com.taursys.xml
Class Container

java.lang.Object
  extended bycom.taursys.xml.Component
      extended bycom.taursys.xml.Container
All Implemented Interfaces:
MapperComponent
Direct Known Subclasses:
DispatchingContainer

public abstract class Container
extends Component

This class is a foundation container for MapperXML components. This class defines all required properties and methods for a container and provides basic implementation for many of them. The Container provides 3 primary functions:


Constructor Summary
Container()
          Constructs a new container
 
Method Summary
 void add(Component c)
          Add a component to this container.
 void addDispatcher(java.lang.String eventType, Dispatcher d)
          Add the given Dispatcher for the given eventType to this Container.
 boolean contains(Component c)
          Recursively searches for given Component and returns true if found.
 DocumentComponent get(java.lang.String id)
          Recursively searches for a DocumentComponent with the given ID.
 Component[] getComponents()
          Returns an array of all the components for this container.
 Dispatcher getDispatcher(java.lang.String eventType)
          Get the Dispatcher for the given eventType.
protected  java.util.HashMap getDispatchers()
          Get the dispatchers that belong to this container
 DocumentAdapter getDocumentAdapter()
          Returns the DocumentAdapter from the parent else null if no parent.
 Dispatcher getInputDispatcher()
          Deprecated. use getDispatcher(String eventType) instead. This will be removed in the future.
 Dispatcher getParameterDispatcher()
          Deprecated. use getDispatcher(String eventType) instead. This will be removed in the future.
 RecycleDispatcher getRecycleDispatcher()
          Deprecated. use getDispatcher(String eventType) instead. This will be removed in the future.
 RenderDispatcher getRenderDispatcher()
          Deprecated. use getDispatcher(String eventType) instead. This will be removed in the future.
 Dispatcher getTriggerDispatcher()
          Deprecated. use getDispatcher(String eventType) instead. This will be removed in the future.
 void remove(Component c)
          Removes the given component from this container and sets its parent to null.
 void removeDispatcher(java.lang.String eventType)
          Remove the Dispatcher for the given eventType from this Container.
 void setComponents(Component[] newComponents)
          Sets of all the components for this container.
 
Methods inherited from class com.taursys.xml.Component
addEventType, addInputListener, addNotify, addParameterListener, addRecycleListener, addRenderListener, addTriggerListener, dispatchEvent, fireActionPerformed, fireInputReceived, fireParameterReceived, fireRecycle, fireRender, getEventTypeList, getParent, isNotifySet, isVisible, lazyAddNotify, lazyRemoveNotify, processEvent, processInputEvent, processParameterEvent, processRecycleEvent, processRenderEvent, processTriggerEvent, removeEventType, removeInputListener, removeNotify, removeParameterListener, removeRecycleListener, removeRenderListener, removeTriggerListener, setVisible, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Container

public Container()
Constructs a new container

Method Detail

add

public void add(Component c)
Add a component to this container. No action is taken if the component already belongs to this container. If the component belongs to another container as indicated by its parent, it is first removed from the old container before it is added to this container. Finally, it is added to this container and its parent is set to this container. The component's addNotify method is also invoked so it will be notified of events it is interested in.


remove

public void remove(Component c)
Removes the given component from this container and sets its parent to null. Also invokes removeNotify on the given component so it will un-register itself with any dispatchers.


contains

public boolean contains(Component c)
Recursively searches for given Component and returns true if found.

Parameters:
c - Component to look for
Returns:
true if found in this container or a child container

get

public DocumentComponent get(java.lang.String id)
Recursively searches for a DocumentComponent with the given ID. Returns DocumentComponent if found else null. Returns null if given id is null

Parameters:
id - the ID to search for
Returns:
the DocumentComponent if found else null

getComponents

public Component[] getComponents()
Returns an array of all the components for this container.


setComponents

public void setComponents(Component[] newComponents)
Sets of all the components for this container. Old components are first removed, then new components added.

Parameters:
newComponents - array of new Components for this Container

getDocumentAdapter

public DocumentAdapter getDocumentAdapter()
Returns the DocumentAdapter from the parent else null if no parent. The master container should override this method to return the shared DocumentAdapter for all components.


addDispatcher

public void addDispatcher(java.lang.String eventType,
                          Dispatcher d)
Add the given Dispatcher for the given eventType to this Container.

Parameters:
eventType - fully qualified class name of the Event
d - the Dispatcher for this event type

removeDispatcher

public void removeDispatcher(java.lang.String eventType)
Remove the Dispatcher for the given eventType from this Container.

Parameters:
eventType - fully qualified class name of the Event

getDispatcher

public Dispatcher getDispatcher(java.lang.String eventType)
Get the Dispatcher for the given eventType. The eventType is the fully qualified class name of the Event which that Dispatcher dispatches. This method first looks for the Dispatcher in its set of Dispatchers. If not found, it invokes its parent Container's getDispatcher. If this Container's has no parent, it returns null.

Parameters:
eventType - fully qualified class name of the Event
Returns:
the requested Dispatcher or null if not found.

getDispatchers

protected java.util.HashMap getDispatchers()
Get the dispatchers that belong to this container

Returns:
the dispatchers that belong to this container

getParameterDispatcher

public Dispatcher getParameterDispatcher()
Deprecated. use getDispatcher(String eventType) instead. This will be removed in the future.

Returns the Dispatcher for ParameterEvents from the parent else null if no parent. The master container should override this method to return the shared Dispatcher for all components.


getInputDispatcher

public Dispatcher getInputDispatcher()
Deprecated. use getDispatcher(String eventType) instead. This will be removed in the future.

Returns the Dispatcher for InputEvents from the parent else null if no parent. The master container should override this method to return the shared Dispatcher for all components.


getTriggerDispatcher

public Dispatcher getTriggerDispatcher()
Deprecated. use getDispatcher(String eventType) instead. This will be removed in the future.

Returns the Dispatcher for TriggerEvents from the parent else null if no parent. The master container should override this method to return the shared Dispatcher for all components.


getRenderDispatcher

public RenderDispatcher getRenderDispatcher()
Deprecated. use getDispatcher(String eventType) instead. This will be removed in the future.

Returns the Dispatcher for RenderEvents from the parent else null if no parent. The master container should override this method to return the shared Dispatcher for all components.


getRecycleDispatcher

public RecycleDispatcher getRecycleDispatcher()
Deprecated. use getDispatcher(String eventType) instead. This will be removed in the future.

Returns the Dispatcher for RecycleEvents from the parent else null if no parent. The master container should override this method to return the shared Dispatcher for all components.



Copyright © 2007 Martin T Phelan. All Rights Reserved.