Package org.jppf.ui.options.xml
Class OptionsPageBuilder
java.lang.Object
org.jppf.ui.options.xml.OptionsPageBuilder
Instances of this class build options pages from XML descriptors.
- Author:
- Laurent Cohen
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.OptionsPageBuilder(boolean enableEvents) Initialize this page builder. -
Method Summary
Modifier and TypeMethodDescriptionbuild(OptionDescriptor desc) Add all the children elements in a page.Build an option page from the specified XML descriptor.buildPageFromContent(String content, String baseName) Build an option page from the specified XML descriptor.buildPageFromURL(String urlString, String baseName) Build an option page from an XML descriptor specified as a URL.createListener(OptionDescriptor.ListenerDescriptor listenerDesc) Create a value change listener from a listener descriptor.createMouseListener(AbstractOption option, OptionDescriptor.ListenerDescriptor listenerDesc) Create a value change listener from a listener descriptor.Get the base name used to localize labels and tooltips.Get the element factory used by this builder.voidInitialize the attributes common to all option elements from an option descriptor.voidinitCommonOptionAttributes(AbstractOption option, OptionDescriptor desc) Initialize the attributes common to all options from an option descriptor.booleanDetermine whether events should be triggered after the component is built.voidsetBaseName(String baseName) Set the base name used to localize labels and tooltips.voidTrigger all finalizers for all options, before they are disposed.voidTrigger all initializers for all options, immediately after the page has been built.
-
Field Details
-
BASE_NAME
Base name used to localize labels and tooltips.- See Also:
-
-
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
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
OptionElementinstance, 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
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
OptionsPageinstance, 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
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
OptionElementinstance, 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
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
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
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
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
Get the element factory used by this builder.- Returns:
- an
OptionElementFactoryinstance.
-
getBaseName
Get the base name used to localize labels and tooltips.- Returns:
- the base name as a string value.
-
setBaseName
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.
-