swingx
Version 2005-08-19

org.jdesktop.swingx
Class JXTable.TableAdapter

java.lang.Object
  extended by org.jdesktop.swingx.decorator.ComponentAdapter
      extended by org.jdesktop.swingx.JXTable.TableAdapter
Direct Known Subclasses:
JXTreeTable.TreeTableDataAdapter
Enclosing class:
JXTable

protected static class JXTable.TableAdapter
extends ComponentAdapter


Field Summary
 
Fields inherited from class org.jdesktop.swingx.decorator.ComponentAdapter
column, row, target
 
Constructor Summary
JXTable.TableAdapter(JXTable component)
          Constructs a TableDataAdapter for the specified target component.
 
Method Summary
protected  TableColumn getColumnByModelIndex(int modelColumn)
           
 int getColumnCount()
          Returns the number of columns in the target's data model.
 String getColumnIdentifier(int columnIndex)
          returns the logical name (== identifier) of the column at columnIndex in model coordinates.
 String getColumnName(int columnIndex)
          returns the column's label (= headerValue).
 Object getFilteredValueAt(int row, int column)
          returns the filtered value of the cell identified by the row in view coordinate and the column in model coordinates.
 int getRowCount()
          Returns the number of rows in the target's data model.
 JXTable getTable()
          Typesafe accessor for the target component.
 Object getValueAt(int row, int column)
          Returns the value of the target component's cell identified by the specified row and column in model coordinates.
 boolean hasFocus()
          Returns true if the cell identified by this adapter currently has focus; Otherwise, it returns false.
 boolean isCellEditable(int row, int column)
           
 boolean isSelected()
          Returns true if the cell identified by this adapter is currently selected; Otherwise, it returns false.
 boolean isTestable(int column)
          returns true if the column should be included in testing.
 int modelToView(int columnIndex)
          For target components that support multiple columns in their model, along with column reordering in the view, this method transforms the specified columnIndex from model coordinates to view coordinates.
 void setValueAt(Object aValue, int row, int column)
           
 int viewToModel(int columnIndex)
          For target components that support multiple columns in their model, along with column reordering in the view, this method transforms the specified columnIndex from view coordinates to model coordinates.
 
Methods inherited from class org.jdesktop.swingx.decorator.ComponentAdapter
getComponent, getValue, isExpanded, isHierarchical, isLeaf, refresh
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JXTable.TableAdapter

public JXTable.TableAdapter(JXTable component)
Constructs a TableDataAdapter for the specified target component.

Parameters:
component - the target component
Method Detail

getTable

public JXTable getTable()
Typesafe accessor for the target component.

Returns:
the target component as a JTable

getColumnName

public String getColumnName(int columnIndex)
Description copied from class: ComponentAdapter
returns the column's label (= headerValue). Used f.i. in SearchPanel to fill the field with the column name. Note: it's up to the implementation to decide for which columns it returns a name - most will do so for the subset with isTestable = true.

Specified by:
getColumnName in class ComponentAdapter
Parameters:
columnIndex - in model coordinates
Returns:
column name or null if not found/not testable.

getColumnByModelIndex

protected TableColumn getColumnByModelIndex(int modelColumn)

getColumnIdentifier

public String getColumnIdentifier(int columnIndex)
Description copied from class: ComponentAdapter
returns the logical name (== identifier) of the column at columnIndex in model coordinates. Used f.i. JNTable to store and apply column properties by identifier. Note: it's up to the implementation to decide for which columns it returns a name - most will do so for the subset with isTestable = true.

Specified by:
getColumnIdentifier in class ComponentAdapter
Parameters:
columnIndex - in model coordinates
Returns:
the String value of the column identifier at columnIndex or null if no identifier set

getColumnCount

public int getColumnCount()
Description copied from class: ComponentAdapter
Returns the number of columns in the target's data model.

Overrides:
getColumnCount in class ComponentAdapter
Returns:
the number of columns in the target's data model.

getRowCount

public int getRowCount()
Description copied from class: ComponentAdapter
Returns the number of rows in the target's data model.

Overrides:
getRowCount in class ComponentAdapter
Returns:
the number of rows in the target's data model.

getValueAt

public Object getValueAt(int row,
                         int column)
Returns the value of the target component's cell identified by the specified row and column in model coordinates.

Specified by:
getValueAt in class ComponentAdapter
Parameters:
row - in model coordinates
column - in model coordinates
Returns:
the value of the target component's cell identified by the specified row and column

setValueAt

public void setValueAt(Object aValue,
                       int row,
                       int column)
Specified by:
setValueAt in class ComponentAdapter

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Specified by:
isCellEditable in class ComponentAdapter

isTestable

public boolean isTestable(int column)
Description copied from class: ComponentAdapter
returns true if the column should be included in testing. Here: returns true if visible (that is modelToView gives a valid view column coordinate).

Overrides:
isTestable in class ComponentAdapter
Parameters:
column - in model coordinates
Returns:
true if the column should be included in testing

getFilteredValueAt

public Object getFilteredValueAt(int row,
                                 int column)
Description copied from class: ComponentAdapter
returns the filtered value of the cell identified by the row in view coordinate and the column in model coordinates. Note: the asymetry of the coordinates is intentional - clients like Highlighters are interested in view values but might need to access non-visible columns for testing.

Specified by:
getFilteredValueAt in class ComponentAdapter
Returns:
the filtered value of the cell identified by the row in view coordinate and the column in model coordiantes

isSelected

public boolean isSelected()
Returns true if the cell identified by this adapter is currently selected; Otherwise, it returns false.

Specified by:
isSelected in class ComponentAdapter
Returns:
true if the cell identified by this adapter is currently selected; Otherwise, return false

hasFocus

public boolean hasFocus()
Returns true if the cell identified by this adapter currently has focus; Otherwise, it returns false.

Specified by:
hasFocus in class ComponentAdapter
Returns:
true if the cell identified by this adapter currently has focus; Otherwise, return false

modelToView

public int modelToView(int columnIndex)
For target components that support multiple columns in their model, along with column reordering in the view, this method transforms the specified columnIndex from model coordinates to view coordinates. For all other types of target components, this method returns the columnIndex unchanged.

Overrides:
modelToView in class ComponentAdapter
Parameters:
columnIndex - index of a column in model coordinates
Returns:
index of the specified column in view coordinates

viewToModel

public int viewToModel(int columnIndex)
For target components that support multiple columns in their model, along with column reordering in the view, this method transforms the specified columnIndex from view coordinates to model coordinates. For all other types of target components, this method returns the columnIndex unchanged.

Overrides:
viewToModel in class ComponentAdapter
Parameters:
columnIndex - index of a column in view coordinates
Returns:
index of the specified column in model coordinates

swingx
Version 2005-08-19