org.jdesktop.swing.decorator
Class ComponentAdapter

java.lang.Object
  extended byorg.jdesktop.swing.decorator.ComponentAdapter

public abstract class ComponentAdapter
extends Object

Abstract base class for all component data adapter classes. A ComponentAdapter allows a Filter, Sorter, or Highlighter to interact with a target component through a common API.


Field Summary
 int column
           
 int row
           
protected  JComponent target
           
 
Constructor Summary
ComponentAdapter(JComponent component)
          Constructs a ComponentAdapter, setting the specified component as the target component.
 
Method Summary
 int getColumnCount()
          Returns the number of columns in the target component's view.
 String getColumnName(int columnIndex)
           
abstract  Object getFilteredValueAt(int row, int column)
           
 int getRowCount()
          Returns the number of rows in the target component's view.
 Object getValue()
          Returns the value of the cell identified by this adapter by invoking getValueAt(int, int), passing in the row and column values of this adapter.
abstract  Object getValueAt(int row, int column)
          Returns the value of the target component's cell identified by the specified row and column.
abstract  boolean hasFocus()
          Returns true if the cell identified by this adapter currently has focus; Otherwise, it returns false.
abstract  boolean isCellEditable(int row, int column)
           
 boolean isExpanded()
          Returns true if the cell identified by this adapter is currently expanded; Otherwise, it returns false.
 boolean isHierarchical()
          Returns true if the cell identified by this adapter displays the hierarchical node; Otherwise, it returns false.
 boolean isLeaf()
          Returns true if the cell identified by this adapter is a leaf node; Otherwise, it returns false.
abstract  boolean isSelected()
          Returns true if the cell identified by this adapter is currently selected; Otherwise, it returns false.
 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 refresh()
           
abstract  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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

row

public int row

column

public int column

target

protected final JComponent target
Constructor Detail

ComponentAdapter

public ComponentAdapter(JComponent component)
Constructs a ComponentAdapter, setting the specified component as the target component.

Parameters:
component - target component for this adapter
Method Detail

getColumnName

public String getColumnName(int columnIndex)
Parameters:
columnIndex - in view coordinates
Returns:
column name

getColumnCount

public int getColumnCount()
Returns the number of columns in the target component's view.

Returns:
the number of columns in the target component's view

getRowCount

public int getRowCount()
Returns the number of rows in the target component's view.

Returns:
the number of rows in the target component's view

getValue

public Object getValue()
Returns the value of the cell identified by this adapter by invoking getValueAt(int, int), passing in the row and column values of this adapter. For target components that don't support multiple columns, the value of column is always zero.

Returns:
the value of the cell identified by this adapter

getValueAt

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

Parameters:
row -
column -
Returns:
the value of the target component's cell identified by the specified row and column

getFilteredValueAt

public abstract Object getFilteredValueAt(int row,
                                          int column)

setValueAt

public abstract void setValueAt(Object aValue,
                                int row,
                                int column)

isCellEditable

public abstract boolean isCellEditable(int row,
                                       int column)

hasFocus

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

Returns:
true if the cell identified by this adapter currently has focus; Otherwise, return false

isSelected

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

Returns:
true if the cell identified by this adapter is currently selected; Otherwise, return false

isExpanded

public boolean isExpanded()
Returns true if the cell identified by this adapter is currently expanded; Otherwise, it returns false. For components that do not support hierarchical data, this method always returns true because the cells in such components can never be collapsed.

Returns:
true if the cell identified by this adapter is currently expanded; Otherwise, return false

isLeaf

public boolean isLeaf()
Returns true if the cell identified by this adapter is a leaf node; Otherwise, it returns false. For components that do not support hierarchical data, this method always returns true because the cells in such components can never have children.

Returns:
true if the cell identified by this adapter is a leaf node; Otherwise, return false

isHierarchical

public boolean isHierarchical()
Returns true if the cell identified by this adapter displays the hierarchical node; Otherwise, it returns false. For components that do not support hierarchical data, this method always returns false because the cells in such components can never have children.

Returns:
true if the cell identified by this adapter displays the hierarchical node; 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.

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.

Parameters:
columnIndex - index of a column in view coordinates
Returns:
index of the specified column in model coordinates

refresh

public void refresh()


Copyright 2004 by Sun Microsystems, Inc. All Rights Reserved.