NextApp Echo3
v3.0.b4

nextapp.echo.app
Class Table

java.lang.Object
  extended by nextapp.echo.app.Component
      extended by nextapp.echo.app.Table
All Implemented Interfaces:
java.io.Serializable, RenderIdSupport

public class Table
extends Component

A component used to display data in a tabular format.

See Also:
nextapp.echo.app.table, Serialized Form

Field Summary
static java.lang.String ACTION_LISTENERS_CHANGED_PROPERTY
           
static java.lang.String AUTO_CREATE_COLUMNS_FROM_MODEL_CHANGED_PROPERTY
           
static java.lang.String COLUMN_MODEL_CHANGED_PROPERTY
           
static java.lang.String DEFAULT_HEADER_RENDERER_CHANGED_PROPERTY
           
static java.lang.String DEFAULT_RENDERER_CHANGED_PROPERTY
           
static TableCellRenderer DEFAULT_TABLE_CELL_RENDERER
          The default renderer for table cells.
static int HEADER_ROW
           
static java.lang.String HEADER_VISIBLE_CHANGED_PROPERTY
           
static java.lang.String INPUT_ACTION
           
static java.lang.String MODEL_CHANGED_PROPERTY
           
static java.lang.String PROPERTY_ACTION_COMMAND
           
static java.lang.String PROPERTY_BORDER
           
static java.lang.String PROPERTY_INSETS
           
static java.lang.String PROPERTY_ROLLOVER_BACKGROUND
           
static java.lang.String PROPERTY_ROLLOVER_BACKGROUND_IMAGE
           
static java.lang.String PROPERTY_ROLLOVER_ENABLED
           
static java.lang.String PROPERTY_ROLLOVER_FONT
           
static java.lang.String PROPERTY_ROLLOVER_FOREGROUND
           
static java.lang.String PROPERTY_SELECTION_BACKGROUND
           
static java.lang.String PROPERTY_SELECTION_BACKGROUND_IMAGE
           
static java.lang.String PROPERTY_SELECTION_ENABLED
           
static java.lang.String PROPERTY_SELECTION_FONT
           
static java.lang.String PROPERTY_SELECTION_FOREGROUND
           
static java.lang.String PROPERTY_WIDTH
           
static java.lang.String SELECTION_CHANGED_PROPERTY
           
static java.lang.String SELECTION_MODEL_CHANGED_PROPERTY
           
 
Fields inherited from class nextapp.echo.app.Component
CHILD_VISIBLE_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY, FOCUS_TRAVERSAL_PARTICIPANT_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
Table()
          Creates a new Table with an empty DefaultTableModel.
Table(int columns, int rows)
          Creates a new Table with a new DefaultTableModel with the specified dimensions.
Table(TableModel model)
          Creates a Table using the supplied TableModel.
Table(TableModel model, TableColumnModel columnModel)
          Creates a Table with the supplied TableModel and the specified TableColumnModel.
 
Method Summary
 void addActionListener(ActionListener l)
          Adds an ActionListener to the Table.
 void createDefaultColumnsFromModel()
          Creates a TableColumnModel based on the TableModel.
protected  void doRender()
          Re-renders changed rows.
 java.lang.String getActionCommand()
          Returns the action command which will be provided in ActionEvents fired by this Table.
 Border getBorder()
          Returns the Border.
 TableColumnModel getColumnModel()
          Returns the TableColumnModel describing this table's columns.
 TableCellRenderer getDefaultHeaderRenderer()
          Returns the default TableCellRenderer used to render header cells.
 TableCellRenderer getDefaultRenderer(java.lang.Class columnClass)
          Returns the default TableCellRenderer for the specified column class.
 Insets getInsets()
          Returns the default cell insets.
 TableModel getModel()
          Returns the TableModel being visualized by this Table.
 Color getRolloverBackground()
          Return the rollover background color displayed when the mouse is within the bounds of a row.
 FillImage getRolloverBackgroundImage()
          Return the rollover background image displayed when the mouse is within the bounds of a row.
 Font getRolloverFont()
          Return the rollover font displayed when the mouse is within the bounds of a row.
 Color getRolloverForeground()
          Return the rollover foreground color displayed when the mouse is within the bounds of a row.
 Color getSelectionBackground()
          Returns the row selection background color.
 FillImage getSelectionBackgroundImage()
          Returns the row selection background image.
 Font getSelectionFont()
          Returns the row selection font.
 Color getSelectionForeground()
          Returns the row selection foreground color.
 ListSelectionModel getSelectionModel()
          Returns the row selection model.
 Extent getWidth()
          Returns the overall width of the grid.
 boolean hasActionListeners()
          Determines the any ActionListeners are registered.
protected  void invalidate()
          Marks the table as needing to be re-rendered.
 boolean isAutoCreateColumnsFromModel()
          Determines whether the TableColumnModel will be created automatically from the TableModel.
 boolean isHeaderVisible()
          Determines if the table header is visible.
 boolean isRolloverEnabled()
          Determines if rollover effects are enabled.
 boolean isSelectionEnabled()
          Determines if selection is enabled.
 void processInput(java.lang.String inputName, java.lang.Object inputValue)
          Processes client input specific to the Component received from the UpdateManager.
 void removeActionListener(ActionListener l)
          Removes an ActionListener from the Table.
 void setActionCommand(java.lang.String newValue)
          Sets the action command which will be provided in ActionEvents fired by this Table.
 void setAutoCreateColumnsFromModel(boolean newValue)
          Sets whether the TableColumnModel will be created automatically from the TableModel.
 void setBorder(Border newValue)
          Sets the Border.
 void setColumnModel(TableColumnModel newValue)
          Sets the TableColumnModel describing this table's columns.
 void setDefaultHeaderRenderer(TableCellRenderer newValue)
          Sets the default TableCellRenderer used to render header cells.
 void setDefaultRenderer(java.lang.Class columnClass, TableCellRenderer newValue)
          Sets the default TableCellRenderer for the specified column class.
 void setHeaderVisible(boolean newValue)
          Sets the visibility state of the table header.
 void setInsets(Insets newValue)
          Sets the default cell insets.
 void setModel(TableModel newValue)
          Sets the TableModel being visualized.
 void setRolloverBackground(Color newValue)
          Sets the rollover background color displayed when the mouse is within the bounds of a row.
 void setRolloverBackgroundImage(FillImage newValue)
          Sets the rollover background image displayed when the mouse is within the bounds of a row.
 void setRolloverEnabled(boolean newValue)
          Sets whether rollover effects are enabled when the mouse cursor is within the bounds of a row.
 void setRolloverFont(Font newValue)
          Sets the rollover font displayed when the mouse is within the bounds of a row.
 void setRolloverForeground(Color newValue)
          Sets the rollover foreground color displayed when the mouse is within the bounds of a row.
 void setSelectionBackground(Color newValue)
          Sets the row selection background color.
 void setSelectionBackgroundImage(FillImage newValue)
          Sets the row selection background image.
 void setSelectionEnabled(boolean newValue)
          Sets whether selection is enabled.
 void setSelectionFont(Font newValue)
          Sets the row selection font.
 void setSelectionForeground(Color newValue)
          Sets the row selection foreground color.
 void setSelectionModel(ListSelectionModel newValue)
          Sets the row selection model.
 void setWidth(Extent newValue)
          Sets the overall width of the grid.
 void validate()
          A life-cycle method invoked before the component is rendered to ensure it is in a valid state.
 
Methods inherited from class nextapp.echo.app.Component
add, add, addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, get, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusTraversalIndex, getFont, getForeground, getId, getIndex, getLayoutData, getLayoutDirection, getLocale, getLocalStyle, getParent, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, init, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isValidChild, isValidParent, isVisible, remove, remove, removeAll, removePropertyChangeListener, removePropertyChangeListener, set, setBackground, setComponents, setEnabled, setFocusTraversalIndex, setFocusTraversalParticipant, setFont, setForeground, setId, setIndex, setLayoutData, setLayoutDirection, setLocale, setRenderId, setStyle, setStyleName, setVisible, verifyInput, visibleIndexOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TABLE_CELL_RENDERER

public static final TableCellRenderer DEFAULT_TABLE_CELL_RENDERER
The default renderer for table cells.


PROPERTY_ACTION_COMMAND

public static final java.lang.String PROPERTY_ACTION_COMMAND
See Also:
Constant Field Values

PROPERTY_BORDER

public static final java.lang.String PROPERTY_BORDER
See Also:
Constant Field Values

PROPERTY_INSETS

public static final java.lang.String PROPERTY_INSETS
See Also:
Constant Field Values

PROPERTY_ROLLOVER_BACKGROUND

public static final java.lang.String PROPERTY_ROLLOVER_BACKGROUND
See Also:
Constant Field Values

PROPERTY_ROLLOVER_BACKGROUND_IMAGE

public static final java.lang.String PROPERTY_ROLLOVER_BACKGROUND_IMAGE
See Also:
Constant Field Values

PROPERTY_ROLLOVER_ENABLED

public static final java.lang.String PROPERTY_ROLLOVER_ENABLED
See Also:
Constant Field Values

PROPERTY_ROLLOVER_FONT

public static final java.lang.String PROPERTY_ROLLOVER_FONT
See Also:
Constant Field Values

PROPERTY_ROLLOVER_FOREGROUND

public static final java.lang.String PROPERTY_ROLLOVER_FOREGROUND
See Also:
Constant Field Values

PROPERTY_SELECTION_BACKGROUND

public static final java.lang.String PROPERTY_SELECTION_BACKGROUND
See Also:
Constant Field Values

PROPERTY_SELECTION_BACKGROUND_IMAGE

public static final java.lang.String PROPERTY_SELECTION_BACKGROUND_IMAGE
See Also:
Constant Field Values

PROPERTY_SELECTION_ENABLED

public static final java.lang.String PROPERTY_SELECTION_ENABLED
See Also:
Constant Field Values

PROPERTY_SELECTION_FONT

public static final java.lang.String PROPERTY_SELECTION_FONT
See Also:
Constant Field Values

PROPERTY_SELECTION_FOREGROUND

public static final java.lang.String PROPERTY_SELECTION_FOREGROUND
See Also:
Constant Field Values

PROPERTY_WIDTH

public static final java.lang.String PROPERTY_WIDTH
See Also:
Constant Field Values

INPUT_ACTION

public static final java.lang.String INPUT_ACTION
See Also:
Constant Field Values

ACTION_LISTENERS_CHANGED_PROPERTY

public static final java.lang.String ACTION_LISTENERS_CHANGED_PROPERTY
See Also:
Constant Field Values

AUTO_CREATE_COLUMNS_FROM_MODEL_CHANGED_PROPERTY

public static final java.lang.String AUTO_CREATE_COLUMNS_FROM_MODEL_CHANGED_PROPERTY
See Also:
Constant Field Values

COLUMN_MODEL_CHANGED_PROPERTY

public static final java.lang.String COLUMN_MODEL_CHANGED_PROPERTY
See Also:
Constant Field Values

DEFAULT_HEADER_RENDERER_CHANGED_PROPERTY

public static final java.lang.String DEFAULT_HEADER_RENDERER_CHANGED_PROPERTY
See Also:
Constant Field Values

DEFAULT_RENDERER_CHANGED_PROPERTY

public static final java.lang.String DEFAULT_RENDERER_CHANGED_PROPERTY
See Also:
Constant Field Values

HEADER_VISIBLE_CHANGED_PROPERTY

public static final java.lang.String HEADER_VISIBLE_CHANGED_PROPERTY
See Also:
Constant Field Values

MODEL_CHANGED_PROPERTY

public static final java.lang.String MODEL_CHANGED_PROPERTY
See Also:
Constant Field Values

SELECTION_CHANGED_PROPERTY

public static final java.lang.String SELECTION_CHANGED_PROPERTY
See Also:
Constant Field Values

SELECTION_MODEL_CHANGED_PROPERTY

public static final java.lang.String SELECTION_MODEL_CHANGED_PROPERTY
See Also:
Constant Field Values

HEADER_ROW

public static final int HEADER_ROW
See Also:
Constant Field Values
Constructor Detail

Table

public Table()
Creates a new Table with an empty DefaultTableModel.


Table

public Table(int columns,
             int rows)
Creates a new Table with a new DefaultTableModel with the specified dimensions.

Parameters:
columns - the initial column count
rows - the initial row count

Table

public Table(TableModel model)
Creates a Table using the supplied TableModel.

Parameters:
model - the initial model

Table

public Table(TableModel model,
             TableColumnModel columnModel)
Creates a Table with the supplied TableModel and the specified TableColumnModel.

Parameters:
model - the initial model
columnModel - the initial column model
Method Detail

getActionCommand

public java.lang.String getActionCommand()
Returns the action command which will be provided in ActionEvents fired by this Table.

Returns:
the action command

addActionListener

public void addActionListener(ActionListener l)
Adds an ActionListener to the Table. ActionListeners will be invoked when the user selects a row.

Parameters:
l - the ActionListener to add

createDefaultColumnsFromModel

public void createDefaultColumnsFromModel()
Creates a TableColumnModel based on the TableModel. This method is invoked automatically when the TableModel's structure changes if the autoCreateColumnsFromModel flag is set.


doRender

protected void doRender()
Re-renders changed rows.


getBorder

public Border getBorder()
Returns the Border.

Returns:
the border

getColumnModel

public TableColumnModel getColumnModel()
Returns the TableColumnModel describing this table's columns.

Returns:
the column model

getDefaultHeaderRenderer

public TableCellRenderer getDefaultHeaderRenderer()
Returns the default TableCellRenderer used to render header cells. The default header renderer will be used in the event that a TableColumn does not provide a specific header renderer.

Returns:
the TableCellRenderer

getDefaultRenderer

public TableCellRenderer getDefaultRenderer(java.lang.Class columnClass)
Returns the default TableCellRenderer for the specified column class. The default renderer will be used in the event that a TableColumn does not provide a specific renderer.

Parameters:
columnClass - the column Class
Returns:
the TableCellRenderer

getInsets

public Insets getInsets()
Returns the default cell insets.

Returns:
the default cell insets

getModel

public TableModel getModel()
Returns the TableModel being visualized by this Table.

Returns:
the model

getRolloverBackground

public Color getRolloverBackground()
Return the rollover background color displayed when the mouse is within the bounds of a row.

Returns:
the color

getRolloverBackgroundImage

public FillImage getRolloverBackgroundImage()
Return the rollover background image displayed when the mouse is within the bounds of a row.

Returns:
the background image

getRolloverFont

public Font getRolloverFont()
Return the rollover font displayed when the mouse is within the bounds of a row.

Returns:
the font

getRolloverForeground

public Color getRolloverForeground()
Return the rollover foreground color displayed when the mouse is within the bounds of a row.

Returns:
the color

getSelectionBackground

public Color getSelectionBackground()
Returns the row selection background color.

Returns:
the background color

getSelectionBackgroundImage

public FillImage getSelectionBackgroundImage()
Returns the row selection background image.

Returns:
the background image

getSelectionFont

public Font getSelectionFont()
Returns the row selection font.

Returns:
the font

getSelectionForeground

public Color getSelectionForeground()
Returns the row selection foreground color.

Returns:
the foreground color

getSelectionModel

public ListSelectionModel getSelectionModel()
Returns the row selection model.

Returns:
the selection model

getWidth

public Extent getWidth()
Returns the overall width of the grid. This property supports Extents with fixed or percentile units.

Returns:
the width

hasActionListeners

public boolean hasActionListeners()
Determines the any ActionListeners are registered.

Returns:
true if any action listeners are registered

invalidate

protected void invalidate()
Marks the table as needing to be re-rendered.


isAutoCreateColumnsFromModel

public boolean isAutoCreateColumnsFromModel()
Determines whether the TableColumnModel will be created automatically from the TableModel. If this flag is set, changes to the TableModel will automatically cause the TableColumnModel to be re-created. This flag is true by default unless a TableColumnModel is specified in the constructor.

Returns:
true if the TableColumnModel will be created automatically from the TableModel

isHeaderVisible

public boolean isHeaderVisible()
Determines if the table header is visible.

Returns:
the header visibility state

isRolloverEnabled

public boolean isRolloverEnabled()
Determines if rollover effects are enabled.

Returns:
true if rollover effects are enabled
See Also:
setRolloverEnabled(boolean)

isSelectionEnabled

public boolean isSelectionEnabled()
Determines if selection is enabled.

Returns:
true if selection is enabled

processInput

public void processInput(java.lang.String inputName,
                         java.lang.Object inputValue)
Description copied from class: Component
Processes client input specific to the Component received from the UpdateManager. Derivative implementations should take care to invoke super.processInput(). Security note: Because input to this method is likely from a remote client, it should be treated as potentially hostile. All input to this method should be carefully verified. For example, directly invoking set() method with the provided input would constitute a security hole.

Overrides:
processInput in class Component
Parameters:
inputName - the name of the input
inputValue - the value of the input
See Also:
Component.processInput(java.lang.String, java.lang.Object)

removeActionListener

public void removeActionListener(ActionListener l)
Removes an ActionListener from the Table. ActionListeners will be invoked when the user selects a row.

Parameters:
l - the ActionListener to remove

setActionCommand

public void setActionCommand(java.lang.String newValue)
Sets the action command which will be provided in ActionEvents fired by this Table.

Parameters:
newValue - the new action command

setAutoCreateColumnsFromModel

public void setAutoCreateColumnsFromModel(boolean newValue)
Sets whether the TableColumnModel will be created automatically from the TableModel.

Parameters:
newValue - true if the TableColumnModel should be created automatically from the TableModel
See Also:
isAutoCreateColumnsFromModel()

setBorder

public void setBorder(Border newValue)
Sets the Border.

Parameters:
newValue - the new border

setColumnModel

public void setColumnModel(TableColumnModel newValue)
Sets the TableColumnModel describing this table's columns.

Parameters:
newValue - the new column model

setDefaultHeaderRenderer

public void setDefaultHeaderRenderer(TableCellRenderer newValue)
Sets the default TableCellRenderer used to render header cells. The default header renderer will be used in the event that a TableColumn does not provide a specific header renderer.

Parameters:
newValue - the TableCellRenderer

setDefaultRenderer

public void setDefaultRenderer(java.lang.Class columnClass,
                               TableCellRenderer newValue)
Sets the default TableCellRenderer for the specified column class. The default renderer will be used in the event that a TableColumn does not provide a specific renderer.

Parameters:
columnClass - the column Class
newValue - the TableCellRenderer

setHeaderVisible

public void setHeaderVisible(boolean newValue)
Sets the visibility state of the table header.

Parameters:
newValue - true if the header should be displayed

setInsets

public void setInsets(Insets newValue)
Sets the default cell insets.

Parameters:
newValue - the new default cell insets

setModel

public void setModel(TableModel newValue)
Sets the TableModel being visualized.

Parameters:
newValue - the new model (may not be null)

setRolloverBackground

public void setRolloverBackground(Color newValue)
Sets the rollover background color displayed when the mouse is within the bounds of a row.

Parameters:
newValue - the new Color

setRolloverBackgroundImage

public void setRolloverBackgroundImage(FillImage newValue)
Sets the rollover background image displayed when the mouse is within the bounds of a row.

Parameters:
newValue - the new background image

setRolloverEnabled

public void setRolloverEnabled(boolean newValue)
Sets whether rollover effects are enabled when the mouse cursor is within the bounds of a row. Rollover properties have no effect unless this property is set to true. The default value is false.

Parameters:
newValue - true if rollover effects should be enabled

setRolloverFont

public void setRolloverFont(Font newValue)
Sets the rollover font displayed when the mouse is within the bounds of a row.

Parameters:
newValue - the new Font

setRolloverForeground

public void setRolloverForeground(Color newValue)
Sets the rollover foreground color displayed when the mouse is within the bounds of a row.

Parameters:
newValue - the new Color

setSelectionBackground

public void setSelectionBackground(Color newValue)
Sets the row selection background color.

Parameters:
newValue - the new background color

setSelectionBackgroundImage

public void setSelectionBackgroundImage(FillImage newValue)
Sets the row selection background image.

Parameters:
newValue - the new background image

setSelectionEnabled

public void setSelectionEnabled(boolean newValue)
Sets whether selection is enabled.

Parameters:
newValue - true to enable selection

setSelectionForeground

public void setSelectionForeground(Color newValue)
Sets the row selection foreground color.

Parameters:
newValue - the new foreground color

setSelectionFont

public void setSelectionFont(Font newValue)
Sets the row selection font.

Parameters:
newValue - the new font

setSelectionModel

public void setSelectionModel(ListSelectionModel newValue)
Sets the row selection model. The selection model may not be null.

Parameters:
newValue - the new selection model

setWidth

public void setWidth(Extent newValue)
Sets the overall width of the grid. This property supports Extents with fixed or percentile units.

Parameters:
newValue - the new width

validate

public void validate()
Description copied from class: Component
A life-cycle method invoked before the component is rendered to ensure it is in a valid state. Default implementation is empty. Overriding implementations should ensure to invoke super.validate() out of convention.

Overrides:
validate in class Component
See Also:
Component.validate()

NextApp Echo3
v3.0.b4