jgb.handlers.swing
Class AbstractTagHandler

java.lang.Object
  |
  +--jgb.handlers.swing.AbstractTagHandler
All Implemented Interfaces:
TagHandler
Direct Known Subclasses:
AbstractControlTagHandler, AbstractValueTagHandler, ConstraintsTagHandler, ConstructorTagHandler, ControlsTagHandler, GridbagTagHandler, MethodCallTagHandler, ObjectTagHandler, ParameterTagHandler, RegisterTagHandler, ReturnTagHandler, WindowsTagHandler, WindowTagHandler

public abstract class AbstractTagHandler
extends Object
implements TagHandler

Default implementation for TagHandler. This default implementation does not allow subclasses to override startElement(String, Map, Map) or endElement(String, Map). It provides equivalent methods in the form of enterElement(Map) and exitElement().

This class also provides many helpful methods:

Since:
0.1a
Author:
Francois Beausoleil, fbos@users.sourceforge.net
See Also:
CurrentObjectsStackManager - Manage a stack of objects

Field Summary
protected static String ATTR_CLASS
          The name of the class attribute.
protected static String ATTR_ID
          The name of the id attribute.
protected static String ATTR_REFID
          The name of the refid attribute.
protected  Map tagContext
           
protected  String tagName
           
 
Fields inherited from interface jgb.builder.TagHandler
CALL_RETURN_CLASS_KEY, CALL_RETURN_VALUE_KEY, CONSTANTS_MAP_KEY, CONTROLS_STACK_KEY, CURRENT_CONSTRAINTS_KEY, CURRENT_MODEL_ADAPTER, CURRENT_MODEL_ATTRIBUTE, CURRENT_OBJECT_ID_KEY, CURRENT_OBJECT_KEY, CURRENT_OBJECTS_STACK_KEY, CURRENT_PARM_ACC_KEY, CURRENT_WINDOW_ID_KEY, CURRENT_WINDOW_KEY, DOCUMENT_LOCATOR_KEY, MODEL_ID, OBJECTS_MAP_KEY, PARAMETER_CLASS_KEY, PARAMETER_VALUE_KEY, PROPERTY_NAME_KEY, TAG_HANDLER_FACTORY_STACK_KEY, WINDOW_CONTEXT_KEY, WINDOW_KEY
 
Constructor Summary
AbstractTagHandler()
           
 
Method Summary
 void endElement(String qName, Map tagContext)
          Signals the end of an element in the XML source.
protected abstract  void enterElement(Map atts)
          Actually handle the element's behaviour when the element's start is encountered.
protected abstract  void exitElement()
          Actually handle the element's behaviour when the element's closure is encountered.
protected  Object getCurrentObject()
           
protected  String getCurrentObjectId()
           
protected  Object getObject(String id)
           
protected  boolean isCurrentObjectValid()
           
protected  void popCurrentObject()
           
protected  void pushCurrentObject(Object o)
           
protected  void pushCurrentObject(String id, Object o)
          Pushes the passed object and id to the current objects stack.
protected  void putComponent(String id, Component component)
           
protected  void putObject(String id, Object value)
           
 void startElement(String qName, Map tagContext, Map atts)
          Signals the start of a new element in the XML source.
protected  void throwParsingException(Exception cause)
           
protected  void throwParsingException(String msg)
           
protected  void throwParsingException(String msg, Exception cause)
          Throw a SAXException or a subclass if a locator is available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_ID

protected static final String ATTR_ID
The name of the id attribute.

See Also:
Constant Field Values

ATTR_CLASS

protected static final String ATTR_CLASS
The name of the class attribute.

See Also:
Constant Field Values

ATTR_REFID

protected static final String ATTR_REFID
The name of the refid attribute.

See Also:
Constant Field Values

tagName

protected String tagName

tagContext

protected Map tagContext
Constructor Detail

AbstractTagHandler

public AbstractTagHandler()
Method Detail

startElement

public final void startElement(String qName,
                               Map tagContext,
                               Map atts)
                        throws org.xml.sax.SAXException
Description copied from interface: TagHandler
Signals the start of a new element in the XML source.

The Builder object will call this method whenever it encounters a new element.

Specified by:
startElement in interface TagHandler
Parameters:
qName - The qualified name of the element as it was encountered.
tagContext - A map of context information that is kept accross all calls to TagHandlers.
atts - A map of the attributes that were passed to this element.
org.xml.sax.SAXException

endElement

public final void endElement(String qName,
                             Map tagContext)
                      throws org.xml.sax.SAXException
Description copied from interface: TagHandler
Signals the end of an element in the XML source.

The Builder object will call this method whenever an element ends.

Specified by:
endElement in interface TagHandler
Parameters:
qName - The qualified name of the element as it was encountered.
tagContext - A map of context information that is kept accross all calls to TagHandlers.
org.xml.sax.SAXException

getObject

protected Object getObject(String id)

putComponent

protected void putComponent(String id,
                            Component component)

putObject

protected void putObject(String id,
                         Object value)

pushCurrentObject

protected void pushCurrentObject(Object o)

pushCurrentObject

protected void pushCurrentObject(String id,
                                 Object o)
Pushes the passed object and id to the current objects stack.


popCurrentObject

protected void popCurrentObject()

getCurrentObject

protected Object getCurrentObject()

getCurrentObjectId

protected String getCurrentObjectId()

isCurrentObjectValid

protected boolean isCurrentObjectValid()

throwParsingException

protected void throwParsingException(String msg)
                              throws org.xml.sax.SAXException
org.xml.sax.SAXException

throwParsingException

protected void throwParsingException(Exception cause)
                              throws org.xml.sax.SAXException
org.xml.sax.SAXException

throwParsingException

protected void throwParsingException(String msg,
                                     Exception cause)
                              throws org.xml.sax.SAXException
Throw a SAXException or a subclass if a locator is available.

org.xml.sax.SAXException

enterElement

protected abstract void enterElement(Map atts)
                              throws org.xml.sax.SAXException
Actually handle the element's behaviour when the element's start is encountered.

org.xml.sax.SAXException

exitElement

protected abstract void exitElement()
                             throws org.xml.sax.SAXException
Actually handle the element's behaviour when the element's closure is encountered.

org.xml.sax.SAXException


Copyright 2002-2003, François Beausoleil, All Rights Reserved