cleanup
public int cleanup()
Removes all un-displayable compontents from the id map and deletes the components collection (for recreation at the
next request).
A component is made undisplayable either when it is removed from a displayable containment hierarchy or when its
containment hierarchy is made undisplayable. A containment hierarchy is made undisplayable when its ancestor
window
is disposed.
int
number of removed componentes.
find
public Component find(String id)
Returns the UI component with the given name or null.
id
- String
assigned name
Component
- the GUI component with the given name or null if not found.
forget
public void forget(String id)
Removes the id from the internal from the id map, to make the given id available for re-use.
id
- String
assigned name
getAllComponentItertor
public Iterator getAllComponentItertor()
Returns an Iterator for all parsed GUI components.
Iterator
GUI components itearator
getAppFrame
public static Frame getAppFrame()
Frame
a parent for all dialogs.
getClassLoader
public ClassLoader getClassLoader()
ClassLoader
- the Classloader used for all getResourse..() and loadClass()
calls.
getClient
public Object getClient()
Returns the object which instantiated this SwingEngine.
Objecy
SwingEngine client object
Note:
This is the object used through introspection the actions and fileds are set.
getDescendants
public Iterator getDescendants(Component c)
Walks the whole tree to add all components into the components
collection.
c
- Component
recursive start component.
Note:There is another collection available that only tracks
those object that were provided with an idattribute, which hold an unique id
getIdComponentItertor
public Iterator getIdComponentItertor()
Returns an Iterator for id-ed parsed GUI components.
Iterator
GUI components itearator
getIdMap
public Map getIdMap()
Returns the id map, containing all id-ed parsed GUI components.
getLocalizer
public Localizer getLocalizer()
Localizer
- the Localizer, which is used for localization.
getRootComponent
public Container getRootComponent()
Returns the root component of the generated Swing UI.
Component
- the root component of the javax.swing ui
getTaglib
public TagLibrary getTaglib()
TagLibrary
- the Taglibray to insert custom tags.
Note:ConverterLibrary and TagLibray need to be set up before rendering is called.
insert
public void insert(Document jdoc,
Container container)
throws Exception
Inserts swing objects rendered from an XML document into the given container.
Differently to the parse methods, insert does NOT consider the root node of the XML document.
NOTE:
insert() does NOT clear() the idmap before rendering.
Therefore, if this SwingEngine's parser was used before, the idmap still
contains (key/value) pairs (id, JComponent obj. references).
If insert() is NOT
used to insert in a previously (with this very SwingEngine) rendered UI,
it is highly recommended to clear the idmap:
mySwingEngine.getIdMap().clear()
jdoc
- Document
xml-doc path info
insert
public void insert(Reader reader,
Container container)
throws Exception
Inserts swing objects rendered from an XML reader into the given container.
Differently to the render methods, insert does NOT consider the root node of the XML document.
NOTE:
insert() does NOT clear() the idmap before rendering.
Therefore, if this SwingEngine's parser was used before, the idmap still
contains (key/value) pairs (id, JComponent obj. references).
If insert() is NOT
used to insert in a previously (with this very SwingEngine) rendered UI, it is highly
recommended to clear the idmap:
mySwingEngine.getIdMap().clear()
reader
- Reader
xml-file path infocontainer
- Container
target, the swing obj, are added to.
insert
public void insert(String resource,
Container container)
throws Exception
Inserts swing objects rendered from an XML reader into the given container.
Differently to the render methods, insert does NOT consider the root node of the XML document.
NOTE:
insert() does NOT clear() the idmap before rendering.
Therefore, if this SwingEngine's parser was used before, the idmap still
contains (key/value) pairs (id, JComponent obj. references).
If insert() is NOT used to insert in a previously (with this very SwingEngine)
rendered UI, it is highly recommended to clear the idmap:
mySwingEngine.getIdMap().clear()
resource
- String
xml-file path infocontainer
- Container
target, the swing obj, are added to.
insert
public void insert(URL url,
Container container)
throws Exception
Inserts swing object rendered from an XML document into the given container.
Differently to the render methods, insert does NOT consider the root node of the XML document.
NOTE:
insert() does NOT clear() the idmap before rendering.
Therefore, if this SwingEngine's parser was used before, the idmap still
contains (key/value) pairs (id, JComponent obj. references).
If insert() is NOT
used to insert in a previously (with this very SwingEngine) rendered UI,
it is highly recommended to clear the idmap:
mySwingEngine.getIdMap().clear()
url
- URL
url pointing to an XML descriptor *container
- Container
target, the swing obj, are added to.
isMacOSX
public static boolean isMacOSX()
Indicates if currently running on Mac OS X
boolean
- indicating if currently running on a MAC
isMacOSXSupported
public static boolean isMacOSXSupported()
Indicates state of Mac OS X support (default is true = ON).
boolean
- indicating MacOS support is enabled
mapMembers
protected void mapMembers(Object obj)
Introspects the given object's class and initializes its non-transient fields with objects that have been instanced
during parsing. Mappping happens based on type and field name: the fields name has to be equal to the tag id,
psecified in the XML descriptor. The fields class has to be assignable (equals or super class..) from the class
that was used to instance the tag.
obj
- Object
target object to be mapped with instanced tags
render
public Container render(Document jdoc)
throws Exception
Gets the parsing of the XML file started.
jdoc
- Document
xml gui descritptor
Object
- instanced swing object tree root
render
public Container render(File xml_file)
throws Exception
Gets the parsing of the XML file started.
Object
- instanced swing object tree root
render
public Container render(Reader xml_reader)
throws Exception
Gets the parsing of the XML file started.
xml_reader
- Reader
xml-file path info
Object
- instanced swing object tree root
render
public Container render(String resource)
throws Exception
Gets the parsing of the XML file started.
resource
- String
xml-file path info
Object
- instanced swing object tree root
render
public Container render(URL url)
throws Exception
Gets the parsing of the XML started.
url
- URL
url pointing to an XML descriptor
Object
- instanced swing object tree root
setActionListener
public boolean setActionListener(Component c,
ActionListener al)
Recursively Sets an ActionListener
Backtracking algorithm: if al was set for a child component, its not being set for its parent
.
c
- Component
start componental
- ActionListener
setAppFrame
public static void setAppFrame(Frame frame)
Sets the SwingEngine's global application frame variable, to be used as a parent for all child dialogs.
frame
- Object
the parent for all future dialogs.
setClassLoader
public void setClassLoader(ClassLoader cl)
Sets a classloader to be used for all getResourse..() and loadClass() calls. If no class loader is
set, the SwingEngine's loader is used.
ClassLoader.loadClass
, ClassLoader.getResource
setDefaultLocale
public static void setDefaultLocale(Locale locale)
Sets the SwingEngine's global locale, to be used by all SwingEngine instances. This locale can be overwritten
however for a single instance, if a locale
attribute is places in the root tag of an XML descriptor.
setLocale
public void setLocale(Locale l)
Sets the locale to be used during parsing / String conversion
setMacOSXSuport
public static void setMacOSXSuport(boolean osx)
Enables or disables support of Mac OS X GUIs
setResourceBundle
public void setResourceBundle(String bundlename)
Sets the ResourceBundle to be used during parsing / String conversion
setResourceBundleName
public static void setResourceBundleName(String bundlename)
Sets the SwingEngine's global resource bundle name, to be used by all SwingEngine instances. This name can be
overwritten however for a single instance, if a bundle
attribute is places in the root tag of an XML
descriptor.
bundlename
- String
the resource bundle name.
test
public void test()
Displays the GUI during a RAD session. If the root component is neither a JFrame nor a JDialog, the a JFrame is
instantiated and the root is added into the new frames contentpane.
traverse
protected static void traverse(Component c,
Collection collection)
Walks the whole tree to add all components into the components
collection.
c
- Component
recursive start component.
Note:There is another collection available that only tracks
those object that were provided with an idattribute, which hold an unique id