Class OptionsPageBuilder

java.lang.Object
org.jppf.ui.options.xml.OptionsPageBuilder

public class OptionsPageBuilder extends Object
Instances of this class build options pages from XML descriptors.
Author:
Laurent Cohen
  • Field Details

  • Constructor Details

    • OptionsPageBuilder

      public OptionsPageBuilder()
      Default constructor.
    • OptionsPageBuilder

      public OptionsPageBuilder(boolean enableEvents)
      Initialize this page builder.
      Parameters:
      enableEvents - determines if events triggering should be performed once the page is built.
  • Method Details

    • buildPageFromContent

      public OptionElement buildPageFromContent(String content, String baseName) throws Exception
      Build an option page from the specified XML descriptor.
      Parameters:
      content - the text of the XML document to parse.
      baseName - the base path where the localization resources are located.
      Returns:
      an OptionElement instance, or null if the page could not be build.
      Throws:
      Exception - if an error was raised while parsing the xml document or building the page.
    • buildPageFromURL

      public OptionElement buildPageFromURL(String urlString, String baseName) throws Exception
      Build an option page from an XML descriptor specified as a URL.
      Parameters:
      urlString - the URL of the XML descriptor file.
      baseName - the base path where the localization resources are located.
      Returns:
      an OptionsPage instance, or null if the page could not be build.
      Throws:
      Exception - if an error was raised while parsing the xml document or building the page.
    • buildPage

      public OptionElement buildPage(String xmlPath, String baseName) throws Exception
      Build an option page from the specified XML descriptor.
      Parameters:
      xmlPath - the path to the XML descriptor file.
      baseName - the base path where the localization resources are located.
      Returns:
      an OptionElement instance, or null if the page could not be build.
      Throws:
      Exception - if an error was raised while parsing the xml document or building the page.
    • triggerInitialEvents

      public void triggerInitialEvents(OptionElement elt)
      Trigger all initializers for all options, immediately after the page has been built. This ensures the consistence of the UI's initial state.
      Parameters:
      elt - the root element of the options on which to trigger the events.
    • triggerFinalEvents

      public void triggerFinalEvents(OptionElement elt)
      Trigger all finalizers for all options, before they are disposed. This enables saving some state that can be reloaded upon the next startup.
      Parameters:
      elt - the root element of the options on which to trigger the events.
    • initCommonAttributes

      public void initCommonAttributes(AbstractOptionElement elt, OptionDescriptor desc) throws Exception
      Initialize the attributes common to all option elements from an option descriptor.
      Parameters:
      elt - the element whose attributes are to be initialized.
      desc - the descriptor to get the attribute values from.
      Throws:
      Exception - if an error was raised while building the page.
    • initCommonOptionAttributes

      public void initCommonOptionAttributes(AbstractOption option, OptionDescriptor desc) throws Exception
      Initialize the attributes common to all options from an option descriptor.
      Parameters:
      option - the option whose attributes are to be initialized.
      desc - the descriptor to get the attribute values from.
      Throws:
      Exception - if an error was raised while building the page.
    • createListener

      public ValueChangeListener createListener(OptionDescriptor.ListenerDescriptor listenerDesc) throws Exception
      Create a value change listener from a listener descriptor.
      Parameters:
      listenerDesc - the listener descriptor to get the listener properties from.
      Returns:
      a ValueChangeListener instance.
      Throws:
      Exception - if an error was raised while building the page.
    • createMouseListener

      public MouseListener createMouseListener(AbstractOption option, OptionDescriptor.ListenerDescriptor listenerDesc) throws Exception
      Create a value change listener from a listener descriptor.
      Parameters:
      option - the option whose attributes are to be initialized.
      listenerDesc - the listener descriptor to get the listener properties from.
      Returns:
      a ValueChangeListener instance.
      Throws:
      Exception - if an error was raised while building the page.
    • build

      public List<OptionElement> build(OptionDescriptor desc) throws Exception
      Add all the children elements in a page.
      Parameters:
      desc - the descriptor for the page.
      Returns:
      an OptionElement instance.
      Throws:
      Exception - if an error was raised while building the page.
    • getFactory

      public OptionElementFactory getFactory()
      Get the element factory used by this builder.
      Returns:
      an OptionElementFactory instance.
    • getBaseName

      public String getBaseName()
      Get the base name used to localize labels and tooltips.
      Returns:
      the base name as a string value.
    • setBaseName

      public void setBaseName(String baseName)
      Set the base name used to localize labels and tooltips.
      Parameters:
      baseName - the base name as a string value.
    • isEventEnabled

      public boolean isEventEnabled()
      Determine whether events should be triggered after the component is built.
      Returns:
      true if events should be triggered, false otherwise.