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

Quick Search    Search Deep

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

java.lang.Object
  extended bycom.voytechs.html.event.Dispatcher
      extended bycom.voytechs.html.event.HtmlDispatcher
Direct Known Subclasses:
ServletDispatcher

public class HtmlDispatcher
extends Dispatcher


Field Summary
static int EVENT_CHECKED_MASK
           
static int EVENT_DEFAULT_MASK
           
static int EVENT_HIDDEN_MASK
           
static int EVENT_LINK_MASK
           
static int EVENT_LIST_MASK
           
static int EVENT_PASSWORD_MASK
           
static int EVENT_RADIO_MASK
           
static int EVENT_SUBMIT_MASK
           
static int EVENT_TEXTAREA_MASK
           
static int EVENT_TEXTFIELD_MASK
           
private  java.util.Hashtable eventTypeIDs
           
private  java.util.Hashtable eventTypeStrings
           
 
Fields inherited from class com.voytechs.html.event.Dispatcher
 
Constructor Summary
HtmlDispatcher()
           
 
Method Summary
protected  HtmlEvent decodeParam(java.lang.String param, java.lang.String[] value)
          decode an encoded parameter from Properties object.
protected  void dispatchEvent(ListenerIf listener, Event event, java.lang.Object data)
          Dispatches event to a proper listener.
protected  java.lang.String encodeParam(int eventType, int id)
          decode an encoded parameter from Properties object.
 java.lang.String generateUniqName(int eventType, int id)
          Generate a uniq name based on event type and id.
private  void init()
          Initialize the various HTML related event types that we support.
static void main(java.lang.String[] args)
          Test function for HtmlDispatcher
protected  void registerEventType(int eventType, char eventAbr)
          Register/create a new event type so it can be known and encoded.
 void scanEvent(java.lang.Object source)
          Scan source object in form of Properties.
 
Methods inherited from class com.voytechs.html.event.Dispatcher
addListener, addListener, enableEvents, generateUniqId, handleEvent, isEventEnabled, registerEventType, removeListener, removeSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT_SUBMIT_MASK

public static final int EVENT_SUBMIT_MASK
See Also:
Constant Field Values

EVENT_PASSWORD_MASK

public static final int EVENT_PASSWORD_MASK
See Also:
Constant Field Values

EVENT_TEXTAREA_MASK

public static final int EVENT_TEXTAREA_MASK
See Also:
Constant Field Values

EVENT_TEXTFIELD_MASK

public static final int EVENT_TEXTFIELD_MASK
See Also:
Constant Field Values

EVENT_LIST_MASK

public static final int EVENT_LIST_MASK
See Also:
Constant Field Values

EVENT_CHECKED_MASK

public static final int EVENT_CHECKED_MASK
See Also:
Constant Field Values

EVENT_RADIO_MASK

public static final int EVENT_RADIO_MASK
See Also:
Constant Field Values

EVENT_HIDDEN_MASK

public static final int EVENT_HIDDEN_MASK
See Also:
Constant Field Values

EVENT_LINK_MASK

public static final int EVENT_LINK_MASK
See Also:
Constant Field Values

EVENT_DEFAULT_MASK

public static final int EVENT_DEFAULT_MASK
See Also:
Constant Field Values

eventTypeStrings

private java.util.Hashtable eventTypeStrings

eventTypeIDs

private java.util.Hashtable eventTypeIDs
Constructor Detail

HtmlDispatcher

public HtmlDispatcher()
Method Detail

init

private void init()
Initialize the various HTML related event types that we support.
  • Submit button press
  • Reset button press
  • Text area
  • Text field
  • List box
  • Check boxes
  • Radio boxes
  • Hidden input field (way of passing hidden info)
  • Link - Hypertext link
  • Default parameters which are none of the above


registerEventType

protected void registerEventType(int eventType,
                                 char eventAbr)
Register/create a new event type so it can be known and encoded.


scanEvent

public void scanEvent(java.lang.Object source)
               throws EventException
Scan source object in form of Properties.

Specified by:
scanEvent in class Dispatcher

dispatchEvent

protected void dispatchEvent(ListenerIf listener,
                             Event event,
                             java.lang.Object data)
                      throws EventException
Dispatches event to a proper listener.

Specified by:
dispatchEvent in class Dispatcher

decodeParam

protected HtmlEvent decodeParam(java.lang.String param,
                                java.lang.String[] value)
                         throws EventException
decode an encoded parameter from Properties object. In essence a where param is a specially encoded, uniq string which encodes information as to the type of the object. These are mapped a uniq integer ID which the dispatcher uses to hash entries for.
Encoding is as follows: [type]_[id]
where type is a one letter string representing the type of element on the form and id is uniq integer ID associated with that instance of the form element.


encodeParam

protected java.lang.String encodeParam(int eventType,
                                       int id)
                                throws EventException
decode an encoded parameter from Properties object. In essence a where param is a specially encoded, uniq string which encodes information as to the type of the object. These are mapped a uniq integer ID which the dispatcher uses to hash entries for.
Encoding is as follows: [type]_[id]
where type is a one letter string representing the type of element on the form and id is uniq integer ID associated with that instance of the form element.


generateUniqName

public java.lang.String generateUniqName(int eventType,
                                         int id)
                                  throws EventException
Generate a uniq name based on event type and id.


main

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