Class UI
java.lang.Object
org.jpos.ui.UI
- All Implemented Interfaces:
UIFactory, UIObjectFactory
- Direct Known Subclasses:
BSHUI
Central controller for the jPOS Swing-based GUI; manages UI components and their factories.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidConfigures this UI from the stored XML element.protected voidconfigure(org.jdom2.Element ui) Configures the UI from the given XML element.create(org.jdom2.Element e) Creates a Swing component from the given XML element descriptor.UI is itself a UIFactory.voiddispose()dispose this UI objectprotected JComponentdoScript(JComponent component, org.jdom2.Element e) Applies any script element to the component; default implementation is a no-op.Returns the component registered under the given id.getLog()Returns the Log instance, or null if none was set.Returns the application's main frame.UI uses a map to hold references to its components ("id" attribute)booleanReturns true if this UI object has been disposed.newInstance(String clazz) Instantiates an object by class name using the current thread's context class loader.voidreconfigure(String elementName, String panelName) reconfigure can be used in order to re-configure components inside a container (i.e.voidsetConfig(org.jdom2.Element config) Sets the XML configuration element for this UI.voidSets the optional Log instance used for diagnostic output.protected voidsetLookAndFeel(org.jdom2.Element ui) Applies the look-and-feel specified in the UI configuration element.voidsetObjectFactory(UIObjectFactory objFactory) Assigns an object factory use to create new object instances.protected voidLogs a warning.protected voidLogs a warning with an associated exception.
-
Constructor Details
-
UI
public UI()Create a new UI object -
UI
Creates a new UI object- Parameters:
config- configuration element
-
-
Method Details
-
setObjectFactory
Assigns an object factory use to create new object instances. If no object factory is asigned, UI uses the default classloader- Parameters:
objFactory- reference to an Object Factory
-
setConfig
Sets the XML configuration element for this UI.- Parameters:
config- the Configuration element
-
setLog
-
getLog
-
getRegistrar
UI uses a map to hold references to its components ("id" attribute)- Returns:
- UI component registrar
-
get
-
create
UI is itself a UIFactory. This strategy is used to recursively instantiate components inside a container -
newInstance
Instantiates an object by class name using the current thread's context class loader.- Specified by:
newInstancein interfaceUIObjectFactory- Parameters:
clazz- fully qualified class name- Returns:
- new instance
- Throws:
Exception- if the class cannot be found or instantiated
-
configure
Configures this UI from the stored XML element.- Throws:
org.jdom2.JDOMException- on XML processing error
-
reconfigure
reconfigure can be used in order to re-configure components inside a container (i.e. changing a panel in response to an event).- Parameters:
elementName- the element name used as new configurationpanelName- panel ID (see "id" attribute)- See Also:
-
dispose
dispose this UI object -
isDestroyed
Returns true if this UI object has been disposed.- Returns:
- true if this UI object has been disposed and is no longer valid
-
configure
Configures the UI from the given XML element.- Parameters:
ui- the root UI configuration element- Throws:
org.jdom2.JDOMException- on XML processing error
-
setLookAndFeel
Applies the look-and-feel specified in the UI configuration element.- Parameters:
ui- the UI configuration element
-
doScript
Applies any script element to the component; default implementation is a no-op.- Parameters:
component- the target componente- the script XML element- Returns:
- the component after script application
-
create
Creates a Swing component from the given XML element descriptor.- Parameters:
e- the XML element describing the component- Returns:
- the created JComponent, or
nullif none was produced
-
getMainFrame
-
warn
-
warn
-