vnas.sm
Interface ISMaker

All Known Implementing Classes:
SMaker

public interface ISMaker

Interface to SMaker implementations. After an XML file containing the definition of one or more panels has been generated (for example by SEditor), the integration into the application is done by an instance of the ISMaker interface. In a first step the XML file is loaded and all Swing components may be instantiated by ISMaker. Then, the ISMaker provides access to each individual component. The objects (targets, for example Swing components) in the tree are accessed either by their ID or by a path, this is an array of node ids representing a tree path. It may be incomplete, for example to find the node "x", ["root", "a", "b", "x"] the incomplete path ["a", "x"] may be specified. The path must be used instead of the ID, if the ID is not unique within the tree.


Method Summary
 void addSMakerListener(SMakerListener listener)
          Advanced: Sets a lister to get a notification about completion of loading the file, initializing the nodes and creating the components.
 void create()
          Makes the component tree starting at the root node ready for display.
 void create(java.lang.String id)
          Makes the component subtree (starting at the node identified by id) ready for display.
 void create(java.lang.String[] path)
          Makes the component subtree (starting at the node identified by path) ready for display.
 java.lang.Object getRootTarget()
          returns the root target object.
 java.lang.Object getTarget(java.lang.String id)
          searches for a target object (for example a Swing component) of the component tree.
 java.lang.Object getTarget(java.lang.String[] path)
          searches for a target object (for example a Swing component) of the component tree.
 java.lang.Object getTarget(java.lang.String[] path, java.lang.Class cls)
          searches for a target object (for example a Swing component) of the component tree.
 java.lang.Object getTarget(java.lang.String id, java.lang.Class cls)
          searches for a target object (for example a Swing component) of the component tree.
 void getTargets(java.util.Hashtable h, java.lang.String[] path, java.lang.Class cls)
          Searches targets by their class.
 ISMaker newSMaker(java.lang.String id)
          Factory method to construct a new SMaker object that represents a subtree of the original SMaker.
 void removeSMakerListener(SMakerListener listener)
          Advanced: Removes a lister that received SMaker notifications.
 void setExceptionHandler(IExceptionHandler exh)
          Sets an exception handler.
 void setTarget(java.lang.String[] path, java.lang.Object target)
          Sets or replaces a target object (for example a Swing component) of the component tree.
 void setTarget(java.lang.String id, java.lang.Object target)
          Sets or replaces a target object (for example a Swing component) of the component tree.
 

Method Detail

newSMaker

public ISMaker newSMaker(java.lang.String id)
Factory method to construct a new SMaker object that represents a subtree of the original SMaker. The child SMakers are useful if the parent SMaker contains more than one layout (for example the layout for sever dialog boxes and internal frames and the child SMakers contain only one of these layouts. Don't call the create() method of the parent but invoke create() of the childs as soon as needed.
Parameters:
id - identifier of a node. The new SMaker represents a subtree starting at this node.

getTarget

public java.lang.Object getTarget(java.lang.String id)
searches for a target object (for example a Swing component) of the component tree.
Parameters:
id - identifier of the node.
Returns:
the target object or null

getTarget

public java.lang.Object getTarget(java.lang.String[] path)
searches for a target object (for example a Swing component) of the component tree.
Parameters:
path - the path to a node.
Returns:
the target object or null

getTarget

public java.lang.Object getTarget(java.lang.String id,
                                  java.lang.Class cls)
searches for a target object (for example a Swing component) of the component tree.
Parameters:
id - identifier of the node.
cls - target must be of this class or a subclass
Returns:
the target object or null

getRootTarget

public java.lang.Object getRootTarget()
returns the root target object.
Returns:
root target

getTarget

public java.lang.Object getTarget(java.lang.String[] path,
                                  java.lang.Class cls)
searches for a target object (for example a Swing component) of the component tree.
Parameters:
path - array of node ids representing a tree path
cls - target must be of this class or a subclass
Returns:
the target object or null

getTargets

public void getTargets(java.util.Hashtable h,
                       java.lang.String[] path,
                       java.lang.Class cls)
Searches targets by their class. The search result is returned in a hashtable, where the key is the node ID and the value is the target object.
Parameters:
h - is a hashtable for the search results
path - search starts at the node identified by path. If path==null, the search starts at the root.
cls - target class must be equal or be a subclass

setTarget

public void setTarget(java.lang.String id,
                      java.lang.Object target)
Sets or replaces a target object (for example a Swing component) of the component tree. Should be called before calling the create() method.
Parameters:
id - identifier of the node.
Returns:
the target object or null

setTarget

public void setTarget(java.lang.String[] path,
                      java.lang.Object target)
Sets or replaces a target object (for example a Swing component) of the component tree. Should be called before calling the create() method.
Parameters:
path - the path to the node.
Returns:
the target object or null

create

public void create()
Makes the component tree starting at the root node ready for display. Calls constructors, adds child components to their parents, applies layout managers etc. One of the create() methods must be called before retrieving references to GUI components.

create

public void create(java.lang.String id)
Makes the component subtree (starting at the node identified by id) ready for display. Calls constructors, adds child components to their parents, applies layout managers etc. One of the create() methods must be called before retrieving references to GUI components.
Parameters:
id - identifier of the root node of the subtree

create

public void create(java.lang.String[] path)
Makes the component subtree (starting at the node identified by path) ready for display. Calls constructors, adds child components to their parents, applies layout managers etc. One of the create() methods must be called before retrieving references to GUI components.
Parameters:
path - array of node ids to the root node of the subtree.

setExceptionHandler

public void setExceptionHandler(IExceptionHandler exh)
Sets an exception handler. If an exception is catched, the handleException() method of the handler will be called.
Parameters:
exh - exception handler implementation

addSMakerListener

public void addSMakerListener(SMakerListener listener)
Advanced: Sets a lister to get a notification about completion of loading the file, initializing the nodes and creating the components.
Parameters:
listener - the listener gets a notification

removeSMakerListener

public void removeSMakerListener(SMakerListener listener)
Advanced: Removes a lister that received SMaker notifications.
Parameters:
listener - the listener that will be removed