Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.voytechs.html.event
Class DispatcherBroker  view DispatcherBroker download DispatcherBroker.java

java.lang.Object
  extended bycom.voytechs.html.event.DispatcherBroker
Direct Known Subclasses:
HtmlDispatcherBroker

public abstract class DispatcherBroker
extends java.lang.Object

Specialized container object for holding dispatcher listeners. Because of dynamic binding of HTML components and the dispatcher, addtion of listeners has to be delayed until the dispatcher bound and initlizated otherwise the binding can't occur. This object adapts to the HTML component special requirements such as generating a URL acceptable parameters or HTML Form tags.


Field Summary
private  Dispatcher dispatcher
           
private  int eventType
           
private  int id
           
private  java.util.Vector listenerRequests
           
 
Constructor Summary
DispatcherBroker(int eventType)
          Initialized the broker.
 
Method Summary
protected  void addDelayedListeners()
          Since event listeners are added in the constructor of the element, the dispatcher isn't bound to the component at the time.
 void addListener(ListenerRequest request)
          Add listener.
 int getEventType()
          Get eventType.
 int getId()
          Get event ID
protected  boolean hasListenerRequests()
           
static void main(java.lang.String[] args)
          Test function for DispatcherBroker
protected  void setDispatcher(Dispatcher dispatcher)
          Sets the global dispatcher.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private int id

eventType

private int eventType

listenerRequests

private java.util.Vector listenerRequests

dispatcher

private Dispatcher dispatcher
Constructor Detail

DispatcherBroker

public DispatcherBroker(int eventType)
Initialized the broker.

Method Detail

setDispatcher

protected void setDispatcher(Dispatcher dispatcher)
                      throws EventException
Sets the global dispatcher. Late bindings, adding delayed listeners, etc. Called after the full component tree is built.


addListener

public void addListener(ListenerRequest request)
                 throws EventException
Add listener. Can add listeners only after the init method is called which means that all of the bindings to the dispatcher have already occured and we can safely register our listener.


hasListenerRequests

protected boolean hasListenerRequests()

addDelayedListeners

protected void addDelayedListeners()
                            throws EventException
Since event listeners are added in the constructor of the element, the dispatcher isn't bound to the component at the time. The listeners are added to a queue instead and only registered with the dispatcher from the init() method which is called after the dispatcher is bound.


getId

public int getId()
          throws EventException
Get event ID


getEventType

public int getEventType()
Get eventType.


main

public static void main(java.lang.String[] args)
Test function for DispatcherBroker