jve.generated
Interface ITableBinder

All Superinterfaces:
IBoundObject, IDataObject
All Known Implementing Classes:
SwingTableBinder

public interface ITableBinder
extends IDataObject

A Table binder represets an array of objects (rows) that are the basis for a table model. This model will be bound to a service or another object.

A Table binder also exports an Object (from the IDataObject interface) that represents the selected object (row[selectedIndex]) in the visual table. Because of this, a ITableBinder can only be associated with a single visual table.

If the visual table is setup to allow multiple row selections, the selection object will be the first selected row.


Nested Class Summary
static interface ITableBinder.SelectionChangedEvent
          Notice of a change of selection in the ITableBinder's visual table.
static interface ITableBinder.SelectionChangedListener
          Listen for changes to the ITableBinder's selected object.
 
Field Summary
 
Fields inherited from interface jve.generated.IBoundObject
DELIMITER, PROPERTY_OBJ_CHANGED
 
Method Summary
 void addSelectionChangedListener(ITableBinder.SelectionChangedListener l)
          Add a listener for table selection changes
 int getColumnCount()
          Get the number of columns available for the table.
 java.lang.String getColumnName(int column)
          Get the name of the given column.
 int getDataIndexFromVisualIndex(int index)
          Get the index of the row data associated with this table binder that corresponds to the given index in the visual table.
 IFilterBinder getFilter()
          Get the filter used by this table.
 int getRowCount()
          Get the number of rows in the table.
 int getSelectedIndex()
          This returns the index of the selected row in the visual table.
 java.lang.Object getSelectedObject()
          Get the selected object for the currently selected row in the visual table.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
          Get the value of the given cell in the table.
 java.lang.Object getValueAt(int rowIndex, java.lang.String property)
          Get the value of the given property from the object at the given row (index in the array of objects.)
 int getVisualIndexFromDataIndex(int index)
          Get the index of the visual table row that corresponds to the given index in the row data associated with this table binder.
 void removeSelectionChangedListener(ITableBinder.SelectionChangedListener l)
          Remove an existing table selection listener
 void setFilter(IFilterBinder filter)
          Set a filter to attatch to this table.
 
Methods inherited from interface jve.generated.IDataObject
getValue, isPrimitive, isReadOnly, setValue
 
Methods inherited from interface jve.generated.IBoundObject
actionPerformed, addPropertyChangeListener, getObject, getProperty, getSourceObject, getType, refresh, removePropertyChangeListener, setProperty, setSourceObject, setSourceObject
 

Method Detail

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Get the value of the given cell in the table.

Parameters:
rowIndex - the cell's row
columnIndex - the cell's column
Returns:
the Object in that cell

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   java.lang.String property)
Get the value of the given property from the object at the given row (index in the array of objects.)

Parameters:
rowIndex - the index of the object in the array
property - the property of the object
Returns:
the value of the property on the object in the row

getColumnName

public java.lang.String getColumnName(int column)
Get the name of the given column. This text is usually displayed on a table column header.

Parameters:
column - the column index
Returns:
the name of the column

getRowCount

public int getRowCount()
Get the number of rows in the table. This number reflects the number of rows after filtering, if filtering is enabled.

Returns:
number of rows

getColumnCount

public int getColumnCount()
Get the number of columns available for the table. If the binder is initialized properly, this will reflect the number of properties available on the row object type.

Returns:
the number of available rows.

getSelectedIndex

public int getSelectedIndex()
This returns the index of the selected row in the visual table.

Returns:
the index, or -1 if no selection.

getSelectedObject

public java.lang.Object getSelectedObject()
Get the selected object for the currently selected row in the visual table.

Returns:
the selected object, null if there's no selection.

addSelectionChangedListener

public void addSelectionChangedListener(ITableBinder.SelectionChangedListener l)
Add a listener for table selection changes

Parameters:
l - the SelectionChangedListener

removeSelectionChangedListener

public void removeSelectionChangedListener(ITableBinder.SelectionChangedListener l)
Remove an existing table selection listener

Parameters:
l - the listener to remove

setFilter

public void setFilter(IFilterBinder filter)
Set a filter to attatch to this table. This is optional.

Parameters:
filter - the filter to use with this table.

getFilter

public IFilterBinder getFilter()
Get the filter used by this table.

Returns:
the filter, null if none is set.

getDataIndexFromVisualIndex

public int getDataIndexFromVisualIndex(int index)
Get the index of the row data associated with this table binder that corresponds to the given index in the visual table. These values may not be equal due to filtering and sorting of the rows on the visual table.

Parameters:
index - the row index from the visual table
Returns:
the corresponding row index from the row data

getVisualIndexFromDataIndex

public int getVisualIndexFromDataIndex(int index)
Get the index of the visual table row that corresponds to the given index in the row data associated with this table binder. These values may not be equal due to filtering and sorting of the rows on the visual table.

Parameters:
index - the row index from the row data
Returns:
the corresponding row index from the visual table