public class WindowBuilderData extends Object implements SimpleBeanStoreImpl.BeanContributor
A data class that stores important information needed during a window builder process.
An instance of this class lives in the Jelly context during execution of a Jelly script that makes use of the window builder library. It contains parameters required by tag handler classes, e.g. the window manager to use. It will also store the results of the builder operation.
In most cases a builder script will define only a single result window (if
any). In this case the result window can be set using the
setResultWindow(Window)
method and queried using
getResultWindow()
. However, scripts are allowed to define multiple
windows (an example use case would be a simple message box window which is
displayed by an action of the main window). This can be achieved by giving
the windows unique names; i.e. the name
attribute of the window tag
must be defined. Then, instead of setResultWindow(Window)
, the
putWindow(String, Window)
method can be called to add the result
window to this data object. putWindow(String, Window)
adds the
window to an internal map so that it can be queried later by its name.
Some objects managed by this class are available to the dependency injection
framework (they can be obtained through the BeanContext
of the
active builder). These are the following:
window:msgBox
returns the window with the name msgBox.Modifier and Type | Field and Description |
---|---|
static String |
KEY_CURRENT_WINDOW
Constant for the key, under which the current result window can be
obtained from the builder's bean context.
|
static String |
KEY_FORM_BEAN
Constant for the key, under which the current form bean can be obtained
from the builder's bean context.
|
static String |
KEY_PARENT_WINDOW
Constant for the key, under which the parent window can be obtained from
the builder's bean context.
|
static String |
KEY_WINDOW_BUILDER_DATA
Constant for the key, under which the instance of this class can be
obtained from the builder's bean context.
|
static String |
WINDOW_PREFIX
Constant for the prefix for window beans.
|
Constructor and Description |
---|
WindowBuilderData()
Creates a new instance of
WindowBuilderData . |
Modifier and Type | Method and Description |
---|---|
void |
beanNames(Set<String> names)
Obtains the names of the supported beans.
|
static WindowBuilderData |
get(org.apache.commons.jelly.JellyContext context)
Returns the instance of this class stored in the specified Jelly context.
|
Object |
getBean(String name)
Returns the bean with the specified name.
|
org.apache.commons.jelly.JellyContext |
getContext()
Returns the current
JellyContext . |
Object |
getFormBean()
Returns the form bean.
|
Window |
getParentWindow()
Returns the parent window of the new window.
|
Window |
getResultWindow()
Returns the result window of the builder process.
|
Window |
getWindow(String name)
Returns the result window with the given name.
|
WindowManager |
getWindowManager()
Returns the window manager.
|
void |
initBeanStore(SimpleBeanStoreImpl store)
Initializes the specified bean store.
|
void |
put(org.apache.commons.jelly.JellyContext ctx)
Stores this instance in the specified Jelly context.
|
void |
putWindow(String name,
Window window)
Adds a result window to this data object.
|
void |
setFormBean(Object formBean)
Sets the form bean.
|
void |
setParentWindow(Window parentWindow)
Sets the parent window.
|
void |
setResultWindow(Window resultWindow)
Sets the result window.
|
void |
setWindowManager(WindowManager windowManager)
Sets the window manager.
|
public static final String KEY_CURRENT_WINDOW
public static final String KEY_PARENT_WINDOW
public static final String KEY_FORM_BEAN
public static final String KEY_WINDOW_BUILDER_DATA
public static final String WINDOW_PREFIX
public WindowBuilderData()
WindowBuilderData
.public Object getFormBean()
public void setFormBean(Object formBean)
formBean
- the form beanpublic Window getParentWindow()
public void setParentWindow(Window parentWindow)
parentWindow
- the parent windowpublic Window getResultWindow()
public void setResultWindow(Window resultWindow)
resultWindow
- the result windowpublic Window getWindow(String name)
name
- the name of the desired windowpublic org.apache.commons.jelly.JellyContext getContext()
JellyContext
. This information can be useful
when access to objects local to the current build operation is needed.
Note that this property is only initialized after this object was stored
in the context. (This is the case while a build operation is executing.)
If this method is called before a context is available, an
IllegalStateException
exception is thrown.JellyContext
IllegalStateException
- if the current context is not yet availablepublic void putWindow(String name, Window window)
getWindow(String)
). This method also invokes
setResultWindow(Window)
, so that the passed in window becomes
the result window. This means that if a script defines multiple windows,
the last one becomes the official result window.name
- the name of the window; can be null, then the window
cannot be queried using getWindow(String)
window
- the window to be addedpublic WindowManager getWindowManager()
public void setWindowManager(WindowManager windowManager)
windowManager
- the window manager to usepublic void beanNames(Set<String> names)
beanNames
in interface SimpleBeanStoreImpl.BeanContributor
names
- a set in which to store the bean namespublic Object getBean(String name)
getBean
in interface SimpleBeanStoreImpl.BeanContributor
name
- the name of the desired beanpublic void initBeanStore(SimpleBeanStoreImpl store)
store
- the store to be initializedpublic void put(org.apache.commons.jelly.JellyContext ctx)
ctx
- the context (must not be null)IllegalArgumentException
- if the context is nullpublic static WindowBuilderData get(org.apache.commons.jelly.JellyContext context)
context
- the Jelly contextCopyright © 2016 The JGUIraffe Team. All rights reserved.