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 TypeMethodDescriptionvoid
setSessionState
(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 aTableState
object forJTable c
or null, if none of the JTable's columns areresizable
. A width of -1 is used to markTableColumns
that are not resizable.Throws an
IllegalArgumentException
ifComponent c
isn't a non-nullJTable
.- Specified by:
getSessionState
in interfaceSessionStorage.Property
- Parameters:
c
- theJTable
whose columnWidths will be saved in aTableState
object.- Returns:
- the
TableState
object or null - See Also:
-
setSessionState
Restore the width of each resizableTableColumn
, if the number of columns haven't changed.Throws an
IllegalArgumentException
ifc
is not aJTable
or ifstate
is not an instance ofSessionStorage.TableState
.- Specified by:
setSessionState
in interfaceSessionStorage.Property
- Parameters:
c
- the JTable whose column widths are to be restoredstate
- theTableState
to be restored- See Also:
-