Package net.sf.jguiraffe.gui.builder
Interface Builder
-
- All Known Implementing Classes:
JellyBuilder
public interface Builder
The main builder interface.
A builder is an object that can produce artifacts of the GUI from builder scripts. So the GUI is no longer constructed in the application's code, but can be defined in external resources, which are easier to maintain. This also allows for dynamic GUIs, e.g. when different builder scripts are processed based on some condition or even when builder scripts are generated at runtime.
The builder interface itself is not too complex. There is one very generic
build()
method that can be used to build arbitrary GUI elements. Then there are a few convenience methods that are suitable for specific elements like windows.- Version:
- $Id: Builder.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
build(Locator script, BuilderData data)
A generic builder method.void
buildContainer(Locator script, BuilderData data, Object container)
A convenience method for constructing the GUI of the given passed in container.Window
buildWindow(Locator script, BuilderData data)
A convenience method for building windows like top-level frames or dialogs.void
release(BuilderData data)
Releases the specifiedBuilderData
object.
-
-
-
Method Detail
-
build
void build(Locator script, BuilderData data) throws BuilderException
A generic builder method. This method initializes the builder with the passed in parameter object and then executes the given builder script. Results of the builder operation are stored in the parameter object, from which they can be obtained using the
method with appropriate keys.BuilderData#getProperty(String)
- Parameters:
script
- the script to be executeddata
- the parameter object- Throws:
BuilderException
- if an error occurs
-
buildWindow
Window buildWindow(Locator script, BuilderData data) throws BuilderException
A convenience method for building windows like top-level frames or dialogs. This method behaves similar to the genericbuild()
method, but directly returns the resulting window object.- Parameters:
script
- the script to be executeddata
- the parameter object- Returns:
- the result window of the builder operation
- Throws:
BuilderException
- if an error occurs
-
buildContainer
void buildContainer(Locator script, BuilderData data, Object container) throws BuilderException
A convenience method for constructing the GUI of the given passed in container. This method is useful if an application already has a reference to an (empty) window or panel, which now should be filled. It sets the container as the builder's root container and then invokes the specified script.- Parameters:
script
- the script to be executeddata
- the parameter objectcontainer
- the container to be filled with components- Throws:
BuilderException
- if an error occurs
-
release
void release(BuilderData data)
Releases the specifiedBuilderData
object. This will free all resources associated with this data object. Especially theBeanContext
created by theBuilder
will be closed, and on allBeanProvider
objects found in theBeanStore
s that are part of theBeanBuilderResult
theshutdown()
method is invoked. Clients of the builder should call this method when the results of a builder operation are no more needed, e.g. when closing a window created by a builder.- Parameters:
data
- theBuilderData
object used for a builder operation (must not be null)- Throws:
IllegalArgumentException
- if the passed in object is null or invalid
-
-