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(java.lang.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(java.lang.String name)
Removes the window from the list of manages windows if and only if it
is registered with this manager.
|
W |
findWindow(java.lang.String name)
Finds a Window by name.
|
java.lang.String |
findWindowName(W window)
Lookups a name related to a Window.
|
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.
|
java.util.Set<java.lang.String> |
getWindowNames()
Returns a set of names related to all windows managed by this manager.
|
java.util.Collection<W> |
getWindows()
Returns the collection of windows managed by this manager.
|
void |
hide(java.lang.String name)
Hides the window.
|
void |
hide(W window)
Hides the window.
|
int |
indexOf(W window)
Lookups the index related to a Window.
|
boolean |
isAutoShutdown()
Returns the value of the "application.autoShutdown" configuration flag.
|
void |
onShutdown(GriffonApplication app)
Hides all visible windows
|
void |
show(java.lang.String name)
Shows the window.
|
void |
show(W window)
Shows the window.
|
@Nullable W findWindow(@Nonnull java.lang.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 retrievedjava.lang.ArrayIndexOutOfBoundsException
- 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 java.util.Collection<W> getWindows()
@Nonnull java.util.Set<java.lang.String> getWindowNames()
@Nullable java.lang.String findWindowName(@Nonnull W window)
window
- the window to be looked upint indexOf(@Nonnull W window)
window
- the window to be looked upvoid attach(@Nonnull java.lang.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 java.lang.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 java.lang.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 java.lang.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()