|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jguiraffe.gui.platform.swing.builder.components.SwingComponentHandler
net.sf.jguiraffe.gui.platform.swing.builder.components.SwingTableComponentHandler
class SwingTableComponentHandler
The Swing-specific implementation of a component handler for a table.
This class wraps a javax.swing.JTable component and implements
the methods required for Swing component handlers in a suitable way. The
following functionality is provided:
getData() and
setData() methods work correspondingly.TableHandler interface.TableHandler interface. They are delegated to the
(Swing) table model implementation.
| Constructor Summary | |
|---|---|
SwingTableComponentHandler(javax.swing.JTable table)
Creates a new instance of SwingTableComponentHandler and
sets the wrapped table. |
|
| Method Summary | |
|---|---|
void |
clearSelection()
Clears any information about selected rows. |
java.lang.Object |
getData()
Returns the data of the underlying component. |
java.lang.Object |
getOuterComponent()
Returns the outer most component. |
int |
getSelectedIndex()
Returns the index of the selected row. |
int[] |
getSelectedIndices()
Returns an array with the indices of the currently selected rows. |
javax.swing.JTable |
getTable()
Returns the table component. |
javax.swing.table.AbstractTableModel |
getTableModel()
Returns the table model. |
java.lang.Class |
getType()
Returns the type of this component handler. |
boolean |
isMultiSelection()
Returns a flag whether the wrapped table supports multi selection. |
protected void |
registerChangeListener()
Registers a change listener at the underlying component. |
void |
rowsDeleted(int startIdx,
int endIdx)
Notifies the table about deleted rows. |
void |
rowsInserted(int startIdx,
int endIdx)
Notifies the table about inserted rows. |
void |
rowsUpdated(int startIdx,
int endIdx)
Notifies the table about updated rows. |
void |
setData(java.lang.Object data)
Sets the data of this component. |
void |
setSelectedIndex(int rowIdx)
Sets the index of the selected row. |
void |
setSelectedIndices(int[] rowIndices)
Selects a number of rows. |
void |
tableDataChanged()
Notifies the table about an unspecific change of the data of its model. |
protected void |
unregisterChangeListener()
Unregisters this handler as change listener from the underlying component. |
void |
valueChanged(javax.swing.event.ListSelectionEvent e)
Reacts on changes of the table's selection. |
| Methods inherited from class net.sf.jguiraffe.gui.platform.swing.builder.components.SwingComponentHandler |
|---|
addActionListener, addChangeListener, addFocusListener, fireChangeEvent, getComponent, getJComponent, isEnabled, removeActionListener, removeChangeListener, removeFocusListener, setEnabled |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.sf.jguiraffe.gui.forms.ComponentHandler |
|---|
getComponent, isEnabled, setEnabled |
| Constructor Detail |
|---|
public SwingTableComponentHandler(javax.swing.JTable table)
SwingTableComponentHandler and
sets the wrapped table.
table - the wrapped table component| Method Detail |
|---|
public javax.swing.JTable getTable()
public javax.swing.table.AbstractTableModel getTableModel()
public boolean isMultiSelection()
public void clearSelection()
clearSelection in interface TableHandlerpublic int getSelectedIndex()
getSelectedIndex in interface TableHandlerpublic int[] getSelectedIndices()
getSelectedIndices in interface TableHandler
public void rowsDeleted(int startIdx,
int endIdx)
rowsDeleted in interface TableHandlerstartIdx - the start index of the affected row intervalendIdx - the end index of the affected row interval
public void rowsInserted(int startIdx,
int endIdx)
rowsInserted in interface TableHandlerstartIdx - the start index of the affected row intervalendIdx - the end index of the affected row intervalTableHandler.tableDataChanged()
public void rowsUpdated(int startIdx,
int endIdx)
rowsUpdated in interface TableHandlerstartIdx - the start index of the affected row intervalendIdx - the end index of the affected row intervalpublic void setSelectedIndex(int rowIdx)
setSelectedIndex in interface TableHandlerrowIdx - the (0-based) index of the row to selectpublic void setSelectedIndices(int[] rowIndices)
setSelectedIndices in interface TableHandlerrowIndices - the indices of the rows to be selectedpublic void tableDataChanged()
tableDataChanged in interface TableHandlerpublic java.lang.Object getData()
getData in interface ComponentHandlerpublic java.lang.Object getOuterComponent()
getOuterComponent in interface ComponentHandlergetOuterComponent in class SwingComponentHandlerpublic java.lang.Class getType()
getType in interface ComponentHandlerpublic void setData(java.lang.Object data)
Number or an array of int values. A value of null
is also accepted, it will reset the selection.
setData in interface ComponentHandlerdata - the new data for the component
java.lang.IllegalArgumentException - if the passed in value is not supportedpublic void valueChanged(javax.swing.event.ListSelectionEvent e)
valueChanged in interface javax.swing.event.ListSelectionListenere - the list selection eventprotected void registerChangeListener()
registerChangeListener in class SwingComponentHandlerprotected void unregisterChangeListener()
unregisterChangeListener in class SwingComponentHandlerSwingComponentHandler.registerChangeListener()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||