Schnittstelle Builder

Alle bekannten Implementierungsklassen:
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 $
Autor:
Oliver Heger
  • Methodendetails

    • 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
      Ungültige Referenz
      BuilderData#getProperty(String)
      method with appropriate keys.
      Parameter:
      script - the script to be executed
      data - the parameter object
      Löst aus:
      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 generic build() method, but directly returns the resulting window object.
      Parameter:
      script - the script to be executed
      data - the parameter object
      Gibt zurück:
      the result window of the builder operation
      Löst aus:
      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.
      Parameter:
      script - the script to be executed
      data - the parameter object
      container - the container to be filled with components
      Löst aus:
      BuilderException - if an error occurs
    • release

      void release(BuilderData data)
      Releases the specified BuilderData object. This will free all resources associated with this data object. Especially the BeanContext created by the Builder will be closed, and on all BeanProvider objects found in the BeanStores that are part of the BeanBuilderResult the shutdown() 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.
      Parameter:
      data - the BuilderData object used for a builder operation (must not be null)
      Löst aus:
      IllegalArgumentException - if the passed in object is null or invalid