|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectgriffon.swing.ConfigurableWindowDisplayHandler
public class ConfigurableWindowDisplayHandler extends Object
Implementation of a per window WindowDisplayHandler that can be configured via a DSL.
This is the default WindowDisplayHandler used by SwingApplication. It expects a configuration
entry in griffon-app/conf/Config.groovy that looks like the following one
swing {
windowManager {
myWindowName = [
show: {window, app -> ... },
hide: {window, app -> ... }
]
myOtherWindowName = [
show: {window, app -> ... }
]
}
}
For these settings to work you must specify a name: property on the Window/Frame instance. This
WindowDisplayHandler is smart enough to use the default show/hide behavior should any or both are not specified
or if a window name does not have a matching configuration. The default behavior will also be used if the Window/Frame
does not have a value for its name: property.There's a third option that can be set for each configured window, and that is a delegate WindowDisplayHandler that will be used for that window alone. The following example shows how it can be configured
swing {
windowManager {
myWindowName = [
handler: new MyCustomWindowDisplayHandler()
]
myOtherWindowName = [
show: {window, app -> ... }
]
}
}
Lastly, a global handler can be specified for all windows that have not been configured. If specified, this handler will
override the usage of the default one. It can be configured as follows
swing {
windowManager {
defaultHandler = new MyCustomWindowDisplayHandler()
myOtherWindowName = [
show: {window, app -> ... }
]
}
}
Fine grained control for default show and hide is also possible, by specifying defaultShow
and/or defaultHide properties at the global level. These properties take precedence over defaultHandler .
swing {
windowManager {
defaultHide = {window, app -> ... }
myOtherWindowName = [
show: {window, app -> ... }
]
}
}
Note: the value for show and hide can be either a Closure or a RunnableWithArgs.
| Field Summary | |
|---|---|
private static WindowDisplayHandler |
DEFAULT_WINDOW_DISPLAY_HANDLER
|
| Constructor Summary | |
ConfigurableWindowDisplayHandler()
|
|
| Method Summary | |
|---|---|
private boolean
|
canBeRun(Object obj)
|
private WindowDisplayHandler
|
fetchDefaultWindowDisplayHandler(GriffonApplication application)
|
void
|
hide(Window window, GriffonApplication application)
|
void
|
hide(JInternalFrame window, GriffonApplication application)
|
private void
|
run(Object obj, Window window, GriffonApplication application)
|
private void
|
run(Object obj, JInternalFrame window, GriffonApplication application)
|
void
|
show(Window window, GriffonApplication application)
|
void
|
show(JInternalFrame window, GriffonApplication application)
|
private Map
|
windowBlock(GriffonApplication application, String windowName)
|
private Map
|
windowManagerBlock(GriffonApplication application)
|
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Field Detail |
|---|
private static final WindowDisplayHandler DEFAULT_WINDOW_DISPLAY_HANDLER
| Constructor Detail |
|---|
ConfigurableWindowDisplayHandler()
| Method Detail |
|---|
private boolean canBeRun(Object obj)
private WindowDisplayHandler fetchDefaultWindowDisplayHandler(GriffonApplication application)
public void hide(Window window, GriffonApplication application)
public void hide(JInternalFrame window, GriffonApplication application)
private void run(Object obj, Window window, GriffonApplication application)
private void run(Object obj, JInternalFrame window, GriffonApplication application)
public void show(Window window, GriffonApplication application)
public void show(JInternalFrame window, GriffonApplication application)
private Map windowBlock(GriffonApplication application, String windowName)
private Map windowManagerBlock(GriffonApplication application)
Groovy Documentation