Package org.jdesktop.application
Class SessionStorage.TableProperty
java.lang.Object
org.jdesktop.application.SessionStorage.TableProperty
- All Implemented Interfaces:
SessionStorage.Property
- Enclosing class:
SessionStorage
A
sessionState property for JTable
This class defines how the session state for JTables
is saved and
and restored in
terms of a property called sessionState.
We save and restore the width of each resizable
TableColumn, if the number of columns haven't
changed.
TableProperty is registered for
JTable.class by default, so this class applies to
JTable and any subclass of JTable. One can
override the default with the putProperty
method.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetSessionState(Component c, Object state) Restore the width of each resizableTableColumn, if the number of columns haven't changed.
-
Constructor Details
-
TableProperty
public TableProperty()
-
-
Method Details
-
getSessionState
Returns aTableStateobject forJTable cor null, if none of the JTable's columns areresizable. A width of -1 is used to markTableColumnsthat are not resizable.Throws an
IllegalArgumentExceptionifComponent cisn't a non-nullJTable.- Specified by:
getSessionStatein interfaceSessionStorage.Property- Parameters:
c- theJTablewhose columnWidths will be saved in aTableStateobject.- Returns:
- the
TableStateobject or null - See Also:
-
setSessionState
Restore the width of each resizableTableColumn, if the number of columns haven't changed.Throws an
IllegalArgumentExceptionifcis not aJTableor ifstateis not an instance ofSessionStorage.TableState.- Specified by:
setSessionStatein interfaceSessionStorage.Property- Parameters:
c- the JTable whose column widths are to be restoredstate- theTableStateto be restored- See Also:
-