Groovy Documentation

griffon.javafx
[Java] Class WindowManager

java.lang.Object
  griffon.javafx.WindowManager
All Implemented Interfaces:
ShutdownHandler

public final class WindowManager
extends Object

Controls a set of windows that belong to the application.

Windows that are controlled by a WindowManager can be shown/hidden using a custom strategy (WindowDisplayHandler)

Authors:
Andres Almiray
See Also:
WindowDisplayHandler


Nested Class Summary
private class WindowManager.OnWindowHiddenHelper

Listener that triggers application events when a window is hidden.

private class WindowManager.OnWindowHidingHelper

WindowAdapter that invokes hide() when the window is about to be closed.

private class WindowManager.OnWindowShownHelper

Listener that triggers application events when a window is shown.

 
Field Summary
private static org.slf4j.Logger LOG

private JavaFXGriffonApplication app

private WindowManager.OnWindowHiddenHelper onWindowHidden

private WindowManager.OnWindowHidingHelper onWindowHiding

private WindowManager.OnWindowShownHelper onWindowShown

private Map windows

 
Constructor Summary
WindowManager(JavaFXGriffonApplication app)

Creates a new WindowManager tied to an specific application.

 
Method Summary
void attach(String name, javafx.stage.Window window)

Registers a window on this manager if an only if the window is not null and it's not registered already.

boolean canShutdown(GriffonApplication app)

void detach(javafx.stage.Window window)

Removes the window from the list of manages windows if and only if it is registered with this manager.

javafx.stage.Window findWindow(String name)

Finds a Window by name.

String findWindowName(javafx.stage.Window window)

javafx.stage.Window getStartingWindow()

Finds the Window that should be displayed during the Ready phase of an application.

Collection getWindows()

Returns the list of windows managed by this manager.

void handleClose(javafx.stage.Window widget)

void hide(javafx.stage.Window window)

Hides the window.

void onShutdown(GriffonApplication app)

Hides all visible windows

void show(javafx.stage.Window window)

Shows the window.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

LOG

private static final org.slf4j.Logger LOG


app

private final JavaFXGriffonApplication app


onWindowHidden

private final WindowManager.OnWindowHiddenHelper onWindowHidden


onWindowHiding

private final WindowManager.OnWindowHidingHelper onWindowHiding


onWindowShown

private final WindowManager.OnWindowShownHelper onWindowShown


windows

private final Map windows


 
Constructor Detail

WindowManager

public WindowManager(JavaFXGriffonApplication app)
Creates a new WindowManager tied to an specific application.
Parameters:
app - an application


 
Method Detail

attach

public void attach(String name, javafx.stage.Window window)
Registers a window on this manager if an only if the window is not null and it's not registered already.
Parameters:
window - the window to be added to the list of managed windows


canShutdown

public boolean canShutdown(GriffonApplication app)


detach

public void detach(javafx.stage.Window window)
Removes the window from the list of manages windows if and only if it is registered with this manager.
Parameters:
window - the window to be removed


findWindow

public javafx.stage.Window findWindow(String name)
Finds a Window by name.
Parameters:
name - the value of the name: property
Returns:
a Window if a match is found, null otherwise.


findWindowName

public String findWindowName(javafx.stage.Window window)


getStartingWindow

public javafx.stage.Window getStartingWindow()
Finds the Window that should be displayed during the Ready phase of an application.

The WindowManager expects a configuration flag javafx.windowManager.startingWindow to be present in order to determine which Window will be displayed during the Ready phase. If no configuration is found the WindowManmager will pick the first Window found in the list of managed windows.

The configuration flag accepts two value types:

Returns:
a Window that matches the given criteria or null if no match is found.


getWindows

public Collection getWindows()
Returns the list of windows managed by this manager.
Returns:
a List of currently managed windows


handleClose

public void handleClose(javafx.stage.Window widget)


hide

public void hide(javafx.stage.Window window)
Hides the window.

This method is executed SYNCHRONOUSLY in the UI thread.

Parameters:
window - the window to hide


onShutdown

public void onShutdown(GriffonApplication app)
Hides all visible windows


show

public void show(javafx.stage.Window window)
Shows the window.

This method is executed SYNCHRONOUSLY in the UI thread.

Parameters:
window - the window to show


 

Groovy Documentation