Class SessionStorage.WindowProperty
- java.lang.Object
-
- org.jdesktop.application.SessionStorage.WindowProperty
-
- All Implemented Interfaces:
SessionStorage.Property
- Enclosing class:
- SessionStorage
public static class SessionStorage.WindowProperty extends java.lang.Object implements SessionStorage.Property
AsessionState
property for Window.This class defines how the session state for
Windows
issaved
and andrestored
in terms of a property calledsessionState
. The Window'sbounds Rectangle
is saved and restored if the dimensions of the Window's screen have not changed.WindowProperty
is registered forWindow.class
by default, so this class applies to the AWTWindow
,Dialog
, andFrame
class, as well as their Swing counterparts:JWindow
,JDialog
, andJFrame
.
-
-
Constructor Summary
Constructors Constructor Description WindowProperty()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
getSessionState(java.awt.Component c)
Returns aWindowState
object forWindow c
.void
setSessionState(java.awt.Component c, java.lang.Object state)
Restore theWindow's
bounds if the dimensions of its screen (GraphicsConfiguration
) haven't changed, the number of screens hasn't changed, and theisLocationByPlatform
property, which indicates that native Window manager should pick the Window's location, is false.
-
-
-
Method Detail
-
getSessionState
public java.lang.Object getSessionState(java.awt.Component c)
Returns aWindowState
object forWindow c
.Throws an
IllegalArgumentException
ifComponent c
isn't a non-nullWindow
.- Specified by:
getSessionState
in interfaceSessionStorage.Property
- Parameters:
c
- theWindow
whose bounds will be stored in aWindowState
object.- Returns:
- the
WindowState
object - See Also:
setSessionState(java.awt.Component, java.lang.Object)
,SessionStorage.WindowState
-
setSessionState
public void setSessionState(java.awt.Component c, java.lang.Object state)
Restore theWindow's
bounds if the dimensions of its screen (GraphicsConfiguration
) haven't changed, the number of screens hasn't changed, and theisLocationByPlatform
property, which indicates that native Window manager should pick the Window's location, is false. More precisely:If
state
is non-null, and Windowc's
GraphicsConfiguration
bounds
matches theWindowState's value
, and Windowc's
isLocationByPlatform
property is false, then set the Window's to thesaved value
.Throws an
IllegalArgumentException
ifc
is not aWindow
or ifstate
is non-null but not an instance ofSessionStorage.WindowState
.- Specified by:
setSessionState
in interfaceSessionStorage.Property
- Parameters:
c
- the Window whose state is to be restoredstate
- theWindowState
to be restored- See Also:
getSessionState(java.awt.Component)
,SessionStorage.WindowState
-
-