org.jdesktop.application
Class SessionStorage.SplitPaneProperty

java.lang.Object
  extended by org.jdesktop.application.SessionStorage.SplitPaneProperty
All Implemented Interfaces:
SessionStorage.Property
Enclosing class:
SessionStorage

public static class SessionStorage.SplitPaneProperty
extends java.lang.Object
implements SessionStorage.Property

A sessionState property for JSplitPane.

This class defines how the session state for JSplitPanes is saved and and restored in terms of a property called sessionState. The JSplitPane's dividerLocation is saved and restored if its orientation hasn't changed.

SplitPaneProperty is registered for JSplitPane.class by default, so this class applies to JSplitPane and any subclass of JSplitPane. One can override the default with the putProperty method.

See Also:
SessionStorage.SplitPaneState, SessionStorage.save(java.awt.Component, java.lang.String), SessionStorage.restore(java.awt.Component, java.lang.String)

Constructor Summary
SessionStorage.SplitPaneProperty()
           
 
Method Summary
 java.lang.Object getSessionState(java.awt.Component c)
          Returns a SplitPaneState object for JSplitPane c.
 void setSessionState(java.awt.Component c, java.lang.Object state)
          Restore the JSplitPane's dividerLocation property if its orientation has not changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionStorage.SplitPaneProperty

public SessionStorage.SplitPaneProperty()
Method Detail

getSessionState

public java.lang.Object getSessionState(java.awt.Component c)
Returns a SplitPaneState object for JSplitPane c. If the split pane's dividerLocation is -1, indicating that either the divider hasn't been moved, or it's been reset, then return null.

Throws an IllegalArgumentException if Component c isn't a non-null JSplitPane.

Specified by:
getSessionState in interface SessionStorage.Property
Parameters:
c - the JSplitPane whose dividerLocation will recoreded in a SplitPaneState object.
Returns:
the SplitPaneState object
See Also:
setSessionState(java.awt.Component, java.lang.Object), SessionStorage.SplitPaneState

setSessionState

public void setSessionState(java.awt.Component c,
                            java.lang.Object state)
Restore the JSplitPane's dividerLocation property if its orientation has not changed.

Throws an IllegalArgumentException if c is not a JSplitPane or if state is non-null but not an instance of SessionStorage.SplitPaneState.

Specified by:
setSessionState in interface SessionStorage.Property
Parameters:
c - the JSplitPane whose state is to be restored
state - the SplitPaneState to be restored
See Also:
getSessionState(java.awt.Component), SessionStorage.SplitPaneState