Groovy Documentation

griffon.pivot
[Java] Class WindowManager

java.lang.Object
  griffon.pivot.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.WindowStateHelper

WindowStateAdapter that triggers application events when a window is shown/hidden.

 
Field Summary
private static org.slf4j.Logger LOG

private PivotGriffonApplication app

private boolean hideBeforeHandler

private WindowManager.WindowStateHelper windowStateHelper

private List windows

 
Constructor Summary
WindowManager(PivotGriffonApplication app)

Creates a new WindowManager tied to an specific application.

 
Method Summary
void attach(org.apache.pivot.wtk.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(org.apache.pivot.wtk.Window window)

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

org.apache.pivot.wtk.Window findWindow(String name)

Finds a Window by name.

org.apache.pivot.wtk.Window getAt(int index)

Convenience method to get a managed Window by index.

org.apache.pivot.wtk.Window getStartingWindow()

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

List getWindows()

Returns the list of windows managed by this manager.

void hide(org.apache.pivot.wtk.Window window)

Hides the window.

void hide(String name)

Hides the window.

boolean isHideBeforeHandler()

Should the window be hidden before all ShutdownHandlers be called ?

void onShutdown(GriffonApplication app)

Hides all visible windows

void setHideBeforeHandler(boolean hideBeforeHandler)

Set if the window should be hidden before all ShutdownHandler be called.

void show(org.apache.pivot.wtk.Window window)

Shows the window.

void show(String name)

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 PivotGriffonApplication app


hideBeforeHandler

private boolean hideBeforeHandler


windowStateHelper

private final WindowManager.WindowStateHelper windowStateHelper


windows

private final List windows


 
Constructor Detail

WindowManager

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


 
Method Detail

attach

public void attach(org.apache.pivot.wtk.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(org.apache.pivot.wtk.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 org.apache.pivot.wtk.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.


getAt

public org.apache.pivot.wtk.Window getAt(int index)
Convenience method to get a managed Window by index.

Follows the Groovy conventions for overriding the [] operator.

throws:
ArrayIndexOutOfBoundsException if the index is invalid (below 0 or greater than the size of the managed windows list)
Parameters:
index - the index of the Window to be retrieved
Returns:
the Window found at the specified index


getStartingWindow

public org.apache.pivot.wtk.Window getStartingWindow()
Finds the Window that should be displayed during the Ready phase of an application.

The WindowManager expects a configuration flag pivot.windowManager.startingWindow to be present in order to determine which Window will be displayed during the Ready phase. If no configuration is found the WindowManager 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 List getWindows()
Returns the list of windows managed by this manager.
Returns:
a List of currently managed windows


hide

public void hide(org.apache.pivot.wtk.Window window)
Hides the window.

This method is executed SYNCHRONOUSLY in the UI thread.

Parameters:
window - the window to hide


hide

public void hide(String name)
Hides the window.

This method is executed SYNCHRONOUSLY in the UI thread.

Parameters:
name - the name of window to hide


isHideBeforeHandler

public boolean isHideBeforeHandler()
Should the window be hidden before all ShutdownHandlers be called ?
Returns:
current value


onShutdown

public void onShutdown(GriffonApplication app)
Hides all visible windows


setHideBeforeHandler

public void setHideBeforeHandler(boolean hideBeforeHandler)
Set if the window should be hidden before all ShutdownHandler be called.
Parameters:
hideBeforeHandler - new value


show

public void show(org.apache.pivot.wtk.Window window)
Shows the window.

This method is executed SYNCHRONOUSLY in the UI thread.

Parameters:
window - the window to show


show

public void show(String name)
Shows the window.

This method is executed SYNCHRONOUSLY in the UI thread.

Parameters:
name - the name of window to show


 

Groovy Documentation