Package org.jdesktop.application
Class SessionStorage.TableProperty
- java.lang.Object
-
- org.jdesktop.application.SessionStorage.TableProperty
-
- All Implemented Interfaces:
SessionStorage.Property
- Enclosing class:
- SessionStorage
public static class SessionStorage.TableProperty extends java.lang.Object implements SessionStorage.Property
AsessionState
property for JTableThis class defines how the session state for
JTables
issaved
and andrestored
in terms of a property calledsessionState
. We save and restore the width of each resizableTableColumn
, if the number of columns haven't changed.TableProperty
is registered forJTable.class
by default, so this class applies to JTable and any subclass of JTable. One can override the default with theputProperty
method.
-
-
Constructor Summary
Constructors Constructor Description TableProperty()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
getSessionState(java.awt.Component c)
void
setSessionState(java.awt.Component c, java.lang.Object state)
Restore the width of each resizableTableColumn
, if the number of columns haven't changed.
-
-
-
Method Detail
-
getSessionState
public java.lang.Object getSessionState(java.awt.Component c)
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(java.awt.Component, java.lang.Object)
,SessionStorage.TableState
-
setSessionState
public void setSessionState(java.awt.Component c, java.lang.Object state)
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:
getSessionState(java.awt.Component)
,SessionStorage.TableState
-
-