Top Description Fields Constructors Methods
com.dlsc.gemsfx.util

public Class StageManager

extends Object
Class Inheritance
Imports
javafx.application.Platform, javafx.beans.InvalidationListener, javafx.geometry.Rectangle2D, javafx.stage.Screen, .Stage, java.text.MessageFormat, java.util.logging.Logger, java.util.prefs.Preferences

A manager for storing the location and dimension of a stage across user sessions. Installing this manager on a stage will ensure that a stage will present itself at the same location and in the same size that it had when the user closed it the last time. This manager also works with multiple screens and will ensure that the window becomes visible if the last used screen is no longer available. In that case the stage will be shown centered on the primary screen with the specified min width and min height.

Field Summary

Modifier and TypeField and Description
private final Logger
private double
private double
private final Preferences
private final Stage
private boolean

Constructor Summary

AccessConstructor and Description
private
StageManager(Stage stage, Preferences preferences, double minWidth, double minHeight)

Method Summary

Modifier and TypeMethod and Description
public static StageManager
install(Stage stage, String preferencesPath)

Installs a new manager for the given stage.

public static StageManager
install(Stage stage, Preferences preferences)

Installs a new manager for the given stage.

public static StageManager
install(Stage
the stage to persist and restore
stage
,
String
the java.util preferences path used for storing the information
preferencesPath
,
double
the minimum width that will be used for the stage
minWidth
,
double
the minimum height that will be used for the stage
minHeight
)

Installs a new manager for the given stage.

public static StageManager
install(Stage
the stage to persist and restore
stage
,
Preferences
the java.util preferences used for storing the information
preferences
,
double
the minimum width that will be used for the stage
minWidth
,
double
the minimum height that will be used for the stage
minHeight
)

Installs a new manager for the given stage.

public final boolean
private boolean
private void
private void
private void
public final void
setSupportFullScreenAndMaximized(boolean supportFullScreenAndMaximized)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private final Logger LOG
minHeightback to summary
private double minHeight
minWidthback to summary
private double minWidth
preferencesback to summary
private final Preferences preferences
stageback to summary
private final Stage stage
supportFullScreenAndMaximizedback to summary
private boolean supportFullScreenAndMaximized

Constructor Detail

StageManagerback to summary
private StageManager(Stage stage, Preferences preferences, double minWidth, double minHeight)

Method Detail

installback to summary
public static StageManager install(Stage stage, String preferencesPath)

Installs a new manager for the given stage. The location and dimension information will be stored in the user preferences at the given path. The default values for the minimum width is 850 and for the minimum height is 600.

installback to summary
public static StageManager install(Stage stage, Preferences preferences)

Installs a new manager for the given stage. The location and dimension information will be stored in the given preferences. The default values for the minimum width is 850 and for the minimum height is 600.

installback to summary
public static StageManager install(Stage stage, String preferencesPath, double minWidth, double minHeight)

Installs a new manager for the given stage. The location and dimension information will be stored in the user preferences at the given path.

Parameters
stage:Stage

the stage to persist and restore

preferencesPath:String

the java.util preferences path used for storing the information

minWidth:double

the minimum width that will be used for the stage

minHeight:double

the minimum height that will be used for the stage

installback to summary
public static StageManager install(Stage stage, Preferences preferences, double minWidth, double minHeight)

Installs a new manager for the given stage. The location and dimension information will be stored in the user preferences at the given path.

Parameters
stage:Stage

the stage to persist and restore

preferences:Preferences

the java.util preferences used for storing the information

minWidth:double

the minimum width that will be used for the stage

minHeight:double

the minimum height that will be used for the stage

isSupportFullScreenAndMaximizedback to summary
public final boolean isSupportFullScreenAndMaximized()
isWindowIsOutOfBoundsback to summary
private boolean isWindowIsOutOfBounds()
moveToPrimaryScreenback to summary
private void moveToPrimaryScreen()
restoreStageback to summary
private void restoreStage() throws SecurityException
saveStageback to summary
private void saveStage() throws SecurityException
setSupportFullScreenAndMaximizedback to summary
public final void setSupportFullScreenAndMaximized(boolean supportFullScreenAndMaximized)