|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectgriffon.pivot.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 PivotGriffonApplication. It expects a configuration entry in
griffon-app/conf/Config.groovy that looks like the following one
pivot {
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
pivot {
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
pivot {
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 .
pivot {
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(org.apache.pivot.wtk.Window window, PivotGriffonApplication application)
|
private void
|
run(Object obj, org.apache.pivot.wtk.Window window, GriffonApplication application)
|
void
|
show(org.apache.pivot.wtk.Window window, PivotGriffonApplication 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(org.apache.pivot.wtk.Window window, PivotGriffonApplication application)
@SuppressWarnings("rawtypes")
private void run(Object obj, org.apache.pivot.wtk.Window window, GriffonApplication application)
public void show(org.apache.pivot.wtk.Window window, PivotGriffonApplication application)
@SuppressWarnings("unchecked")
private Map windowBlock(GriffonApplication application, String windowName)
@SuppressWarnings("unchecked")
private Map windowManagerBlock(GriffonApplication application)
Groovy Documentation