Groovy Documentation

griffon.lanterna
[Java] Class WindowManager

java.lang.Object
  griffon.lanterna.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.WindowHelper

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

 
Field Summary
private static org.slf4j.Logger LOG

private LanternaGriffonApplication app

private WindowManager.WindowHelper windowHelper

private Map windows

 
Constructor Summary
WindowManager(LanternaGriffonApplication app)

Creates a new WindowManager tied to an specific application.

 
Method Summary
void attach(String name, com.googlecode.lanterna.gui.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(com.googlecode.lanterna.gui.Window window)

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

com.googlecode.lanterna.gui.Window findWindow(String name)

Finds a Window by name.

String findWindowName(com.googlecode.lanterna.gui.Window window)

com.googlecode.lanterna.gui.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 hide(com.googlecode.lanterna.gui.Window window)

Hides the window.

void onShutdown(GriffonApplication app)

Hides all visible windows

void show(com.googlecode.lanterna.gui.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 LanternaGriffonApplication app


windowHelper

private final WindowManager.WindowHelper windowHelper


windows

private final Map windows


 
Constructor Detail

WindowManager

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


 
Method Detail

attach

public void attach(String name, com.googlecode.lanterna.gui.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(com.googlecode.lanterna.gui.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 com.googlecode.lanterna.gui.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(com.googlecode.lanterna.gui.Window window)


getStartingWindow

public com.googlecode.lanterna.gui.Window getStartingWindow()
Finds the Window that should be displayed during the Ready phase of an application.

The WindowManager expects a configuration flag lanterna.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


hide

public void hide(com.googlecode.lanterna.gui.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(com.googlecode.lanterna.gui.Window window)
Shows the window.

This method is executed SYNCHRONOUSLY in the UI thread.

Parameters:
window - the window to show


 

Groovy Documentation