com.taursys.xml
Class DispatchingContainer

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

public class DispatchingContainer
extends Container

DispatchingContainer is a Container which can function as a top or intermediate level Container and has its own set of event Dispatchers for its children. It responds to ParameterEvents, InputEvents and TriggerEvents by simply propagating the event to its children.

In response to a RenderEvent, it simply shows or hides the Document Element and, if visible, dispatches a RenderEvent to the children of the DocumentElement.

In response to a RecycleEvent, it simply makes the Document Element visible, and dispatches a RecycleEvent to the children of the DocumentElement.

Version:
1.0
Author:
Marty Phelan

Constructor Summary
DispatchingContainer()
          Constructs a new DispatchingContainer
 
Method Summary
 void add(Component c)
          Add a component to this container.
protected  InputDispatcher createInputDispatcher()
          Create the InputDispatcher for this Container.
protected  ParameterDispatcher createParameterDispatcher()
          Create the ParameterDispatcher for this Container.
protected  RecycleDispatcher createRecycleDispatcher()
          Create the RecycleDispatcher for this Container.
protected  RenderDispatcher createRenderDispatcher()
          Create the RenderDispatcher for this Container.
protected  TriggerDispatcher createTriggerDispatcher()
          Create the TriggerDispatcher for this Container.
protected  void dispatchActions()
          Initiate the dispatch of the TriggerEvent to registered components using the current parameterMap.
protected  void dispatchInput()
          Initiate the dispatch of the InputEvent to registered components using the current parameterMap.
protected  void dispatchParameters()
          Initiate the dispatch of the ParameterEvent to registered components using the current parameterMap.
protected  void dispatchRecycle()
          Initiate the dispatch of the RecycleEvent to registered components.
protected  void dispatchRender()
          Initiate the dispatch of the RenderEvent to registered components.
 java.util.Map getParameterMap()
          Get the Map of parameters contained in the request.
protected  void processInputEvent(InputEvent e)
          Dispatches given InputEvent to children then notifies all InputListeners of event.
protected  void processParameterEvent(ParameterEvent e)
          Dispatches given ParameterEvent to children then notifies all ParameterListeners of event.
 void processRecycleEvent(RecycleEvent e)
          Dispatches given RecycleEvent to children then notifies all RecycleListeners of event.
 void processRenderEvent(RenderEvent e)
          Notifies all RenderListeners of given RenderEvent then dispatches event to children.
protected  void processTriggerEvent(TriggerEvent e)
          Dispatches given TriggerEvent to children then notifies all TriggerListeners of event.
 void setParameterMap(java.util.Map map)
          Set the Map of parameters contained in the request.
 
Methods inherited from class com.taursys.xml.Container
addDispatcher, contains, get, getComponents, getDispatcher, getDispatchers, getDocumentAdapter, getInputDispatcher, getParameterDispatcher, getRecycleDispatcher, getRenderDispatcher, getTriggerDispatcher, remove, removeDispatcher, setComponents
 
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, 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

DispatchingContainer

public DispatchingContainer()
Constructs a new DispatchingContainer

Method Detail

createParameterDispatcher

protected ParameterDispatcher createParameterDispatcher()
Create the ParameterDispatcher for this Container.

Returns:
the ParameterDispatcher for this Container.

createInputDispatcher

protected InputDispatcher createInputDispatcher()
Create the InputDispatcher for this Container.

Returns:
the InputDispatcher for this Container.

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.

Overrides:
add in class Container

createTriggerDispatcher

protected TriggerDispatcher createTriggerDispatcher()
Create the TriggerDispatcher for this Container.

Returns:
the TriggerDispatcher for this Container.

createRenderDispatcher

protected RenderDispatcher createRenderDispatcher()
Create the RenderDispatcher for this Container.

Returns:
the RenderDispatcher for this Container.

createRecycleDispatcher

protected RecycleDispatcher createRecycleDispatcher()
Create the RecycleDispatcher for this Container.

Returns:
the RecycleDispatcher for this Container.

getParameterMap

public java.util.Map getParameterMap()
Get the Map of parameters contained in the request. The Map must contain String keys for each parameter and String[] arrays for each parameter value.

Returns:
a Map of parameters contained in the request.

setParameterMap

public void setParameterMap(java.util.Map map)
Set the Map of parameters contained in the request. The Map must contain String keys for each parameter and String[] arrays for each parameter value.

Parameters:
map - a Map of parameters contained in the request.

dispatchParameters

protected void dispatchParameters()
                           throws java.lang.Exception
Initiate the dispatch of the ParameterEvent to registered components using the current parameterMap.

Throws:
java.lang.Exception

dispatchInput

protected void dispatchInput()
                      throws java.lang.Exception
Initiate the dispatch of the InputEvent to registered components using the current parameterMap.

Throws:
java.lang.Exception

dispatchActions

protected void dispatchActions()
                        throws java.lang.Exception
Initiate the dispatch of the TriggerEvent to registered components using the current parameterMap.

Throws:
java.lang.Exception

dispatchRender

protected void dispatchRender()
                       throws java.lang.Exception
Initiate the dispatch of the RenderEvent to registered components.

Throws:
java.lang.Exception

dispatchRecycle

protected void dispatchRecycle()
                        throws java.lang.Exception
Initiate the dispatch of the RecycleEvent to registered components.

Throws:
java.lang.Exception

processParameterEvent

protected void processParameterEvent(ParameterEvent e)
                              throws java.lang.Exception
Dispatches given ParameterEvent to children then notifies all ParameterListeners of event.

Overrides:
processParameterEvent in class Component
Parameters:
e - the ParameterEvent
Throws:
java.lang.Exception - from child or listener in response to event

processInputEvent

protected void processInputEvent(InputEvent e)
                          throws java.lang.Exception
Dispatches given InputEvent to children then notifies all InputListeners of event.

Overrides:
processInputEvent in class Component
Parameters:
e - the InputEvent
Throws:
java.lang.Exception - from child or listener in response to event

processTriggerEvent

protected void processTriggerEvent(TriggerEvent e)
                            throws java.lang.Exception
Dispatches given TriggerEvent to children then notifies all TriggerListeners of event.

Overrides:
processTriggerEvent in class Component
Parameters:
e - the TriggerEvent
Throws:
java.lang.Exception - from child or listener in response to event

processRenderEvent

public void processRenderEvent(RenderEvent e)
                        throws RenderException
Notifies all RenderListeners of given RenderEvent then dispatches event to children.

Overrides:
processRenderEvent in class Component
Parameters:
e - the RenderEvent
Throws:
RenderException - from child or listener in response to event

processRecycleEvent

public void processRecycleEvent(RecycleEvent e)
                         throws RecycleException
Dispatches given RecycleEvent to children then notifies all RecycleListeners of event.

Overrides:
processRecycleEvent in class Component
Parameters:
e - the RecycleEvent
Throws:
RecycleException - from child or listener in response to event


Copyright © 2007 Martin T Phelan. All Rights Reserved.