com.togethersoft.openapi.ide.inspector.util.table
Class RwiElementsTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--com.togethersoft.openapi.ide.inspector.util.table.PropertyTableModelBase
              |
              +--com.togethersoft.openapi.ide.inspector.util.table.RwiElementsTableModel

public class RwiElementsTableModel
extends PropertyTableModelBase
implements PropertyChangeListener

This model can be used for creation of more or less complicated tables dealing with RwiElements. Usually the developer would like to work with a table where properties for each RwiElement is grouped into single row (for example, row might contain "name", "type", "containing package" fields). For that purpose the RwiElementsComponent is used as internal storage of this model. In RwiElementsComponent for each RwiElement there is a set (represented by IdeInspectorPropertySetComponent instance) of IdeInspectorProperties. The method getInspectorProperty(int row, int col) first gets corresponing IdeInspectorPropertySetComponent for the specified row, and then determines which IdeInspectorProperty from this IdeInspectorPropertySetComponent should be treated as standing on the specified column. By default it simply returns IdeInspectorProperty at the position specified by column parameter. Note that since IdeInspectorPropertySetComponent can contain any set of IdeInspectorProperties, you can overrite this method to implement your own mechanism of finding target IdeInspectorProperty. You must extend RwiElementsComponent and provide a method called createIdePropertySetForRwiElement(RwiElement rwiElement) in which you actually fills each row with IdeInspectorProperties.

Author:
TogetherSoft

Field Summary
 protected RwiElementsComponentmyRwiElementsComponent
           

Fields inherited from class javax.swing.table.AbstractTableModel
listenerList

Constructor Summary
RwiElementsTableModel(RwiElementsComponent rwiElementsComponent)
           Constructs this model for the specified RwiElementsComponent.

Method Summary
 intgetColumnCount()
           Returns count of columns.
 IdeInspectorPropertygetInspectorProperty(int row, int col)
           Returns IdeInspectorProperty related to certain cell of this table model.
 intgetRowCount()
           Returns count of rows.
 ObjectgetValueAt(int row, int column)
           Returns value of the cetain cell.
 booleanisCellEditable(int row, int column)
           Checks whether it is posssible to edit certain cell.
 voidpropertyChange(PropertyChangeEvent e)
           Called by property change listener when property is changed.
 voidsetValueAt(Object obj, int row, int column)
           Sets value to the cetain cell.
 protected voidsynchronizeProperties()
           Synchronise table cells with RwiElementsPropertySets.

Methods inherited from class com.togethersoft.openapi.ide.inspector.util.table.PropertyTableModelBase
getPropertyEditor, getPropertyType

Methods inherited from class javax.swing.table.AbstractTableModel
getColumnName, findColumn, getColumnClass, addTableModelListener, removeTableModelListener, fireTableDataChanged, fireTableStructureChanged, fireTableRowsInserted, fireTableRowsUpdated, fireTableRowsDeleted, fireTableCellUpdated, fireTableChanged, getListeners

Methods inherited from class java.lang.Object
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize

Field Detail

myRwiElementsComponent

protected RwiElementsComponent myRwiElementsComponent
label Treats each IdeInspectorPropertySetComponent as a row, and extracts cells from them
Constructor Detail

RwiElementsTableModel

public RwiElementsTableModel(RwiElementsComponent rwiElementsComponent)
Constructs this model for the specified RwiElementsComponent.
Parameters:
rwiElementsComponent - RwiElementsComponent for which this model will be constructed
Method Detail

getColumnCount

public int getColumnCount()
Returns count of columns.
Returns: count of columns, zero if table is empty

getInspectorProperty

public IdeInspectorProperty getInspectorProperty(int row, int col)
Returns IdeInspectorProperty related to certain cell of this table model.
Parameters:
row - Row numer of this cell
col - Column number of this cell
Returns: IdeInspectorProperty related to certain cell of this table model
Throws:
IllegalArgumentException - if specified row or col is illegal

getRowCount

public int getRowCount()
Returns count of rows.
Returns: count of rows

getValueAt

public Object getValueAt(int row, int column)
Returns value of the cetain cell.
Parameters:
row - Row number of this cell
column - Column number of this cell
Returns: value of this cell

isCellEditable

public boolean isCellEditable(int row, int column)
Checks whether it is posssible to edit certain cell.
Parameters:
row - Row number of this cell
column - Column number of this cell
Returns: true if so, false otherwise

propertyChange

public void propertyChange(PropertyChangeEvent e)
Called by property change listener when property is changed.
Parameters:
e - Property change event

setValueAt

public void setValueAt(Object obj, int row, int column)
Sets value to the cetain cell.
Parameters:
obj - New value
row - Row number of this cell
column - Column number of this cell

synchronizeProperties

protected void synchronizeProperties()
Synchronise table cells with RwiElementsPropertySets.

Association Links

to Class com.togethersoft.openapi.ide.inspector.util.table.RwiElementsComponent

Label Treats each IdeInspectorPropertySetComponent as a row, and extracts cells from them

to Class java.util.Vector