public interface WindowManager<W> extends ShutdownHandler
Windows that are controlled by a WindowManager can be shown/hidden
using a custom strategy (WindowDisplayHandler
)
Modifier and Type | Method and Description |
---|---|
void |
attach(String name,
W 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)
Asks this handler if the application's shutdown sequence can proceed or not.
|
int |
countVisibleWindows()
Counts how many Windows are visible regardless of their attached status to this WindowManager.
|
void |
detach(String name)
Removes the window from the list of manages windows if and only if it
is registered with this manager.
|
W |
findWindow(String name)
Finds a Window by name.
|
W |
getAt(int index)
Convenience method to get a managed Window by index.
|
W |
getStartingWindow()
Finds the Window that should be displayed during the Ready phase of an application.
|
Collection<W> |
getWindows()
Returns the list of windows managed by this manager.
|
void |
hide(String name)
Hides the window.
|
void |
hide(W window)
Hides the window.
|
boolean |
isAutoShutdown()
Returns the value of the "application.autoShutdown" configuration flag.
|
void |
onShutdown(GriffonApplication app)
Hides all visible windows
|
void |
show(String name)
Shows the window.
|
void |
show(W window)
Shows the window.
|
@Nullable W findWindow(@Nonnull String name)
name
- the value of the of the Window's name@Nullable W getAt(int index)
Follows the Groovy conventions for overriding the [] operator.
index
- the index of the Window to be retrievedArrayIndexOutOfBoundsException
- if the index is invalid (below 0 or greater than the size
of the managed windows list)@Nullable W getStartingWindow()
The WindowManager expects a configuration flag 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:
@Nonnull Collection<W> getWindows()
void attach(@Nonnull String name, @Nonnull W window)
name
- the value of the of the Window's namewindow
- the window to be added to the list of managed windowsvoid detach(@Nonnull String name)
name
- the value of the of the Window's namevoid show(@Nonnull W window)
This method is executed SYNCHRONOUSLY in the UI thread.
window
- the window to showvoid show(@Nonnull String name)
This method is executed SYNCHRONOUSLY in the UI thread.
name
- the name of window to showvoid hide(@Nonnull W window)
This method is executed SYNCHRONOUSLY in the UI thread.
window
- the window to hidevoid hide(@Nonnull String name)
This method is executed SYNCHRONOUSLY in the UI thread.
name
- the name of window to hideboolean canShutdown(@Nonnull GriffonApplication app)
ShutdownHandler
Return false if the shutdown sequence must be aborted.
canShutdown
in interface ShutdownHandler
app
- the current running applicationvoid onShutdown(@Nonnull GriffonApplication app)
onShutdown
in interface ShutdownHandler
app
- the current running applicationint countVisibleWindows()
boolean isAutoShutdown()