public class Table extends Component
add()/remove() directly on this component is not allowed.nextapp.echo.app.table,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
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 |
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 and Description |
|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Component c,
int n)
Adds the specified
Component as the nth
child of this component. |
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 |
remove(Component c)
Removes the specified child
Component from this
Component. |
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.
|
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, init, 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, visibleIndexOfpublic static final TableCellRenderer DEFAULT_TABLE_CELL_RENDERER
public static final java.lang.String PROPERTY_ACTION_COMMAND
public static final java.lang.String PROPERTY_BORDER
public static final java.lang.String PROPERTY_INSETS
public static final java.lang.String PROPERTY_ROLLOVER_BACKGROUND
public static final java.lang.String PROPERTY_ROLLOVER_BACKGROUND_IMAGE
public static final java.lang.String PROPERTY_ROLLOVER_ENABLED
public static final java.lang.String PROPERTY_ROLLOVER_FONT
public static final java.lang.String PROPERTY_ROLLOVER_FOREGROUND
public static final java.lang.String PROPERTY_SELECTION_BACKGROUND
public static final java.lang.String PROPERTY_SELECTION_BACKGROUND_IMAGE
public static final java.lang.String PROPERTY_SELECTION_ENABLED
public static final java.lang.String PROPERTY_SELECTION_FONT
public static final java.lang.String PROPERTY_SELECTION_FOREGROUND
public static final java.lang.String PROPERTY_WIDTH
public static final java.lang.String INPUT_ACTION
public static final java.lang.String ACTION_LISTENERS_CHANGED_PROPERTY
public static final java.lang.String AUTO_CREATE_COLUMNS_FROM_MODEL_CHANGED_PROPERTY
public static final java.lang.String COLUMN_MODEL_CHANGED_PROPERTY
public static final java.lang.String DEFAULT_HEADER_RENDERER_CHANGED_PROPERTY
public static final java.lang.String DEFAULT_RENDERER_CHANGED_PROPERTY
public static final java.lang.String HEADER_VISIBLE_CHANGED_PROPERTY
public static final java.lang.String MODEL_CHANGED_PROPERTY
public static final java.lang.String SELECTION_CHANGED_PROPERTY
public static final java.lang.String SELECTION_MODEL_CHANGED_PROPERTY
public static final int HEADER_ROW
public Table()
Table with an empty
DefaultTableModel.public Table(int columns,
int rows)
Table with a new
DefaultTableModel with the specified dimensions.columns - the initial column countrows - the initial row countpublic Table(TableModel model)
Table using the supplied
TableModel.model - the initial modelpublic Table(TableModel model, TableColumnModel columnModel)
Table with the supplied
TableModel and the specified TableColumnModel.model - the initial modelcolumnModel - the initial column modelpublic java.lang.String getActionCommand()
ActionEvents fired by this
Table.public void add(Component c, int n) throws IllegalChildException
ComponentComponent as the nth
child of this component.
All component-add operations use this method to add components.
Components that require notification of all child additions
should override this method (making sure to call the superclass'
implementation).
If the child component currently has a parent in another hierarchy, it
will automatically be removed from that hierarchy before being added
to this component. This behavior will also occur if the child component
is currently a child of this component.add in class Componentc - the child component to addn - the index at which to add the child component, or -1 to add the
component at the endIllegalChildException - if the child is not allowed to be added
to this component, because it is either not valid for the
component's state or is of an invalid typeComponent.add(nextapp.echo.app.Component, int)public void addActionListener(ActionListener l)
ActionListener to the Table.
ActionListeners will be invoked when the user
selects a row.l - the ActionListener to addpublic void createDefaultColumnsFromModel()
TableColumnModel based on the
TableModel. This method is invoked automatically when the
TableModel's structure changes if the
autoCreateColumnsFromModel flag is set.protected void doRender()
public Border getBorder()
Border.public TableColumnModel getColumnModel()
TableColumnModel describing this table's
columns.public TableCellRenderer getDefaultHeaderRenderer()
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.TableCellRendererpublic TableCellRenderer getDefaultRenderer(java.lang.Class columnClass)
TableCellRenderer for the specified
column class. The default renderer will be used in the event that
a TableColumn does not provide a specific renderer.columnClass - the column ClassTableCellRendererpublic Insets getInsets()
public TableModel getModel()
TableModel being visualized by this
Table.public Color getRolloverBackground()
public FillImage getRolloverBackgroundImage()
public Font getRolloverFont()
public Color getRolloverForeground()
public Color getSelectionBackground()
public FillImage getSelectionBackgroundImage()
public Font getSelectionFont()
public Color getSelectionForeground()
public ListSelectionModel getSelectionModel()
public Extent getWidth()
Extents with
fixed or percentile units.public boolean hasActionListeners()
ActionListeners are registered.protected void invalidate()
public boolean isAutoCreateColumnsFromModel()
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.TableColumnModel will be created
automatically from the TableModelpublic boolean isHeaderVisible()
public boolean isRolloverEnabled()
setRolloverEnabled(boolean)public boolean isSelectionEnabled()
public void processInput(java.lang.String inputName,
java.lang.Object inputValue)
ComponentComponent
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.processInput in class ComponentinputName - the name of the inputinputValue - the value of the inputComponent.processInput(java.lang.String, java.lang.Object)public void remove(Component c)
ComponentComponent from this
Component.
All Component remove operations use this method to
remove Components. Components that require
notification of all child removals should
override this method (while ensuring to call the superclass'
implementation).
remove in class Componentc - the child Component to removeComponent.remove(nextapp.echo.app.Component)public void removeActionListener(ActionListener l)
ActionListener from the Table.
ActionListeners will be invoked when the user
selects a row.l - the ActionListener to removepublic void setActionCommand(java.lang.String newValue)
ActionEvents fired by this
Table.newValue - the new action commandpublic void setAutoCreateColumnsFromModel(boolean newValue)
TableColumnModel will be created
automatically from the TableModel.newValue - true if the TableColumnModel should be
created automatically from the TableModelisAutoCreateColumnsFromModel()public void setBorder(Border newValue)
Border.newValue - the new borderpublic void setColumnModel(TableColumnModel newValue)
TableColumnModel describing this table's
columns.newValue - the new column modelpublic void setDefaultHeaderRenderer(TableCellRenderer newValue)
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.newValue - the TableCellRendererpublic void setDefaultRenderer(java.lang.Class columnClass,
TableCellRenderer newValue)
TableCellRenderer for the specified
column class. The default renderer will be used in the event that
a TableColumn does not provide a specific renderer.columnClass - the column ClassnewValue - the TableCellRendererpublic void setHeaderVisible(boolean newValue)
newValue - true if the header should be displayedpublic void setInsets(Insets newValue)
newValue - the new default cell insetspublic void setModel(TableModel newValue)
TableModel being visualized.newValue - the new model (may not be null)public void setRolloverBackground(Color newValue)
newValue - the new Colorpublic void setRolloverBackgroundImage(FillImage newValue)
newValue - the new background imagepublic void setRolloverEnabled(boolean newValue)
newValue - true if rollover effects should be enabledpublic void setRolloverFont(Font newValue)
newValue - the new Fontpublic void setRolloverForeground(Color newValue)
newValue - the new Colorpublic void setSelectionBackground(Color newValue)
newValue - the new background colorpublic void setSelectionBackgroundImage(FillImage newValue)
newValue - the new background imagepublic void setSelectionEnabled(boolean newValue)
newValue - true to enable selectionpublic void setSelectionForeground(Color newValue)
newValue - the new foreground colorpublic void setSelectionFont(Font newValue)
newValue - the new fontpublic void setSelectionModel(ListSelectionModel newValue)
newValue - the new selection modelpublic void setWidth(Extent newValue)
Extents with
fixed or percentile units.newValue - the new widthpublic void validate()
Componentsuper.validate()
out of convention.validate in class ComponentComponent.validate()