Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.chatroomslist
Class ChatRoomTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by net.java.sip.communicator.impl.gui.main.chatroomslist.ChatRoomTableModel
All Implemented Interfaces:
Serializable, EventListener, TableModel, ChatRoomList.ChatRoomProviderWrapperListener, ChatRoomListChangeListener, ProviderPresenceStatusListener

public class ChatRoomTableModel
extends AbstractTableModel
implements ChatRoomListChangeListener, ProviderPresenceStatusListener, ChatRoomList.ChatRoomProviderWrapperListener

The model for the table with saved rooms.

Author:
Damian Minkov
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Fields inherited from interface net.java.sip.communicator.service.protocol.event.ProviderPresenceStatusListener
STATUS_MESSAGE
 
Constructor Summary
ChatRoomTableModel(JTable parentTable)
          Creates new model for the supplied table.
 
Method Summary
 void chatRoomProviderWrapperAdded(ChatRoomProviderWrapper provider)
          When a provider wrapper is added this method is called to inform listeners.
 void chatRoomProviderWrapperRemoved(ChatRoomProviderWrapper provider)
          When a provider wrapper is removed this method is called to inform listeners.
 void contentChanged(ChatRoomListChangeEvent evt)
          Refreshes the chat room's list when a modification in the model has occurred.
 Class<?> getColumnClass(int columnIndex)
          Returns the most specific superclass for all the cell values in the column.
 int getColumnCount()
          Returns the number of columns in the model.
 String getColumnName(int column)
          Returns the name of the column at columnIndex.
 int getRowCount()
          Returns the number of rows in the model.
(package private)  ChatRoomWrapper getValueAt(int rowIndex)
          The room wrapper for the supplied row.
 Object getValueAt(int rowIndex, int columnIndex)
          Returns the value for the cell at columnIndex and rowIndex.
 boolean isCellEditable(int row, int column)
          Returns true if the cell at rowIndex and columnIndex is editable.
 void providerStatusChanged(ProviderPresenceStatusChangeEvent evt)
          Listens for provider status change to change protocol icon.
 void providerStatusMessageChanged(PropertyChangeEvent evt)
          Not used.
 void setValueAt(Object aValue, int rowIndex, int columnIndex)
          Sets the value in the cell at columnIndex and rowIndex to aValue.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChatRoomTableModel

public ChatRoomTableModel(JTable parentTable)
Creates new model for the supplied table.

Parameters:
parentTable - the parent table.
Method Detail

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Returns true if the cell at rowIndex and columnIndex is editable.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Parameters:
row - the row whose value to be queried
column - the column whose value to be queried
Returns:
true if the cell is editable

getRowCount

public int getRowCount()
Returns the number of rows in the model.

Specified by:
getRowCount in interface TableModel
Returns:
the number of rows in the model

getColumnCount

public int getColumnCount()
Returns the number of columns in the model.

Specified by:
getColumnCount in interface TableModel
Returns:
the number of columns in the model

getValueAt

ChatRoomWrapper getValueAt(int rowIndex)
The room wrapper for the supplied row.

Parameters:
rowIndex - the row.
Returns:
the chat room wrapper.

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Returns the value for the cell at columnIndex and rowIndex.

Specified by:
getValueAt in interface TableModel
Parameters:
rowIndex - the row whose value is to be queried
columnIndex - the column whose value is to be queried
Returns:
the value Object at the specified cell

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)
Sets the value in the cell at columnIndex and rowIndex to aValue.

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel
Parameters:
aValue - the new value
rowIndex - the row whose value is to be changed
columnIndex - the column whose value is to be changed

getColumnName

public String getColumnName(int column)
Returns the name of the column at columnIndex.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
column - the index of the column
Returns:
the name of the column

getColumnClass

public Class<?> getColumnClass(int columnIndex)
Returns the most specific superclass for all the cell values in the column.

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
columnIndex - the index of the column
Returns:
the common ancestor class of the object values in the model.

contentChanged

public void contentChanged(ChatRoomListChangeEvent evt)
Refreshes the chat room's list when a modification in the model has occurred.

Specified by:
contentChanged in interface ChatRoomListChangeListener
Parameters:
evt -

providerStatusChanged

public void providerStatusChanged(ProviderPresenceStatusChangeEvent evt)
Listens for provider status change to change protocol icon.

Specified by:
providerStatusChanged in interface ProviderPresenceStatusListener
Parameters:
evt - the event

providerStatusMessageChanged

public void providerStatusMessageChanged(PropertyChangeEvent evt)
Not used.

Specified by:
providerStatusMessageChanged in interface ProviderPresenceStatusListener
Parameters:
evt - the event.

chatRoomProviderWrapperAdded

public void chatRoomProviderWrapperAdded(ChatRoomProviderWrapper provider)
When a provider wrapper is added this method is called to inform listeners.

Specified by:
chatRoomProviderWrapperAdded in interface ChatRoomList.ChatRoomProviderWrapperListener
Parameters:
provider - which was added.

chatRoomProviderWrapperRemoved

public void chatRoomProviderWrapperRemoved(ChatRoomProviderWrapper provider)
When a provider wrapper is removed this method is called to inform listeners.

Specified by:
chatRoomProviderWrapperRemoved in interface ChatRoomList.ChatRoomProviderWrapperListener
Parameters:
provider - which was removed.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.