SPT Core API

com.sptci.echo.table
Class Table<D>

java.lang.Object
  extended by nextapp.echo.app.Component
      extended by nextapp.echo.app.Table
          extended by com.sptci.echo.table.Table<D>
Type Parameters:
D - The class of the model object displayed in the table.
All Implemented Interfaces:
Serializable, RenderIdSupport
Direct Known Subclasses:
DirectoryTable, JDOTable

public class Table<D>
extends Table

A genericised Table used to display instances of objects of the type specified.

© Copyright 2007 Sans Pareil Technologies, Inc.

Version:
$Id: Table.java 4859 2009-08-12 20:52:19Z rakesh $
Author:
Rakesh 2007-09-19
See Also:
Serialized Form

Nested Class Summary
protected  class Table.DefaultActionListener
          The default ActionListener for the table.
 
Field Summary
 
Fields inherited from class nextapp.echo.app.Table
ACTION_LISTENERS_CHANGED_PROPERTY, AUTO_CREATE_COLUMNS_FROM_MODEL_CHANGED_PROPERTY, COLUMN_MODEL_CHANGED_PROPERTY, DEFAULT_HEADER_RENDERER_CHANGED_PROPERTY, DEFAULT_RENDERER_CHANGED_PROPERTY, DEFAULT_TABLE_CELL_RENDERER, HEADER_ROW, HEADER_VISIBLE_CHANGED_PROPERTY, INPUT_ACTION, MODEL_CHANGED_PROPERTY, PROPERTY_ACTION_COMMAND, PROPERTY_BORDER, PROPERTY_INSETS, PROPERTY_ROLLOVER_BACKGROUND, PROPERTY_ROLLOVER_BACKGROUND_IMAGE, PROPERTY_ROLLOVER_ENABLED, PROPERTY_ROLLOVER_FONT, PROPERTY_ROLLOVER_FOREGROUND, PROPERTY_SELECTION_BACKGROUND, PROPERTY_SELECTION_BACKGROUND_IMAGE, PROPERTY_SELECTION_ENABLED, PROPERTY_SELECTION_FONT, PROPERTY_SELECTION_FOREGROUND, PROPERTY_WIDTH, SELECTION_CHANGED_PROPERTY, SELECTION_MODEL_CHANGED_PROPERTY
 
Fields inherited from class nextapp.echo.app.Component
CHILD_VISIBLE_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_NEXT_ID_CHANGED_PROPERTY, FOCUS_PREVIOUS_ID_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
protected Table()
          Default constructor.
  Table(TableModel<D> model)
          Create a new table using the specified model for its data.
 
Method Summary
 void addRow(D row)
          Add the specified object to the end of the backing table model.
 void addSelectionListener(SelectionListener<D,? extends Table> listener)
          Adds a selection listener to be notified of row selections.
 void deleteRow(D rowData)
          Delete the row(s) containing the specified object from the model.
 void deleteRow(int row)
          Delete the specified row from the model.
protected  TableNavigation fetchNavigation(Component parent)
          Returns the associated TableNavigation component for this table.
protected  void fireRowSelection()
          Notifies configured SelectionListener of row selections.
 TableModel<D> getModel()
          Over-ridden to return a properly type-cast model.
 void init()
          Life-cyle method invoked when the component is added to the component hierarchy.
 void insertRow(int row, D rowData)
          Insert the specified object at the specified row index into the backing table model.
 void removeSelectionListener(SelectionListener<D,? extends Table> listener)
          Remove a selection listener from being notified of row selections.
 void setModel(TableModel model)
          Over-ridden to only allow instances of TableModel.
protected  void updateNavigation()
          Updates the associated TableNavigation component for this table.
 void updateRow(int row, D rowData)
          Replace the row specified with the object specified.
 
Methods inherited from class nextapp.echo.app.Table
add, addActionListener, createDefaultColumnsFromModel, doRender, getActionCommand, getBorder, getColumnModel, getDefaultHeaderRenderer, getDefaultRenderer, getInsets, getRolloverBackground, getRolloverBackgroundImage, getRolloverFont, getRolloverForeground, getSelectionBackground, getSelectionBackgroundImage, getSelectionFont, getSelectionForeground, getSelectionModel, getWidth, hasActionListeners, invalidate, isAutoCreateColumnsFromModel, isHeaderVisible, isRolloverEnabled, isSelectionEnabled, processInput, remove, removeActionListener, setActionCommand, setAutoCreateColumnsFromModel, setBorder, setColumnModel, setDefaultHeaderRenderer, setDefaultRenderer, setHeaderVisible, setInsets, setRolloverBackground, setRolloverBackgroundImage, setRolloverEnabled, setRolloverFont, setRolloverForeground, setSelectionBackground, setSelectionBackgroundImage, setSelectionEnabled, setSelectionFont, setSelectionForeground, setSelectionModel, setWidth, validate
 
Methods inherited from class nextapp.echo.app.Component
add, addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, get, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusNextId, getFocusPreviousId, getFont, getForeground, getId, getIndex, getLayoutData, getLayoutDirection, getLocale, getLocalStyle, getParent, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isValidChild, isValidParent, isVisible, remove, removeAll, removePropertyChangeListener, removePropertyChangeListener, set, setBackground, setComponents, setEnabled, setFocusNextId, setFocusPreviousId, 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
 

Constructor Detail

Table

protected Table()
Default constructor. Cannot be instantiated directly.


Table

public Table(TableModel<D> model)
Create a new table using the specified model for its data.

Parameters:
model - The underlying data model to use for the table.
Method Detail

init

public void init()
Life-cyle method invoked when the component is added to the component hierarchy. Sets default behaviour.

Overrides:
init in class Component

addSelectionListener

public void addSelectionListener(SelectionListener<D,? extends Table> listener)
Adds a selection listener to be notified of row selections.

Parameters:
listener - The listener to add.
See Also:
Component.getEventListenerList()

removeSelectionListener

public void removeSelectionListener(SelectionListener<D,? extends Table> listener)
Remove a selection listener from being notified of row selections.

Parameters:
listener - The listener to remove.

setModel

public void setModel(TableModel model)
Over-ridden to only allow instances of TableModel.

Overrides:
setModel in class Table
Parameters:
model - The table model to use for this component.
Throws:
IllegalArgumentException - If the specified table mode is not an instance of TableModel.

getModel

public TableModel<D> getModel()
Over-ridden to return a properly type-cast model.

Overrides:
getModel in class Table
Returns:
The properly type cast model backing this table.

addRow

public void addRow(D row)
Add the specified object to the end of the backing table model. It is strongly recommended that callers use this method as opposed to directly on the table model, since any standard updates to the backing ListSelectionModel may be affected through this method only.

Parameters:
row - The data object that is to be added to the model.
See Also:
TableModel.addRow(Object), updateNavigation()

insertRow

public void insertRow(int row,
                      D rowData)
Insert the specified object at the specified row index into the backing table model. It is strongly recommended that callers use this method as opposed to directly on the table model, since any standard updates to the backing ListSelectionModel may be affected through this method only.

Parameters:
row - The index at which the object is to be inserted.
rowData - The object that is to be added to the model.
See Also:
TableModel.insertRow(int, D), updateNavigation()

deleteRow

public void deleteRow(int row)
Delete the specified row from the model. It is strongly recommended that callers use this method as opposed to directly on the table model, since any standard updates to the backing ListSelectionModel may be affected through this method only.

Parameters:
row - The index of the row that is to be deleted.
See Also:
TableModel.deleteRow( int ), updateNavigation()

deleteRow

public void deleteRow(D rowData)
Delete the row(s) containing the specified object from the model. It is strongly recommended that callers use this method as opposed to directly on the table model, since any standard updates to the backing ListSelectionModel may be affected through this method only.

Parameters:
rowData - The object that is to be removed.
See Also:
deleteRow( int )

updateRow

public void updateRow(int row,
                      D rowData)
Replace the row specified with the object specified. It is strongly recommended that callers use this method as opposed to directly on the table model, since any standard updates to the backing ListSelectionModel may be affected through this method only.

Parameters:
row - The index at which the object is to be updated.
rowData - The new object that is to be used in the model.
See Also:
TableModel.updateRow(int, D)

fireRowSelection

protected void fireRowSelection()
Notifies configured SelectionListener of row selections.


updateNavigation

protected void updateNavigation()
Updates the associated TableNavigation component for this table.

See Also:
fetchNavigation( Component )

fetchNavigation

protected TableNavigation fetchNavigation(Component parent)
Returns the associated TableNavigation component for this table.

Parameters:
parent - The component whose children are to iterated over.
Returns:
The navigation component if it exists of null.

SPT Core API