JFCML - JFC/Swing
XML Markup Language

com.metasolutions.jfcml
Class TagHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.metasolutions.jfcml.TagHandler
All Implemented Interfaces:
Serializable, ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class TagHandler
extends DefaultHandler
implements Serializable

A SAX Event Handler which is also a JFCML DocumentHandler manager.

Version:
0.9 May 28, 2005
Author:
Shawn Curry, Mathias Henze
See Also:
Serialized Form

Field Summary
protected  AttributeHandler attributeHandler
           
protected  ChildHandler childHandler
           
protected  WindowContext context
           
protected  ElementHandler elementHandler
           
protected  WindowHandler windowHandler
           
 
Constructor Summary
TagHandler()
          Constructs a TagHandler using the configuration stored in the PackageRegistry.
TagHandler(WindowContext ctxt, ElementHandler elem, AttributeHandler attr, WindowHandler window, ChildHandler child)
          Constructs a TagHandler which uses the specified configuration.
 
Method Summary
 void addAttributeHandler(AttributeHandler handler)
           
 void addChildHandler(ChildHandler handler)
           
 void addElementHandler(ElementHandler handler)
           
 void addWindowHandler(WindowHandler handler)
           
 void characters(char[] ch, int start, int length)
           
 void endElement(String namespaceURI, String sName, String qName)
          Part of the DefaultHandler, this method is invoked by the SaxParser when it finds an end tag.
 void endWindow()
           
 void error(SAXParseException e)
          Part of the DefaultHandler, this method is invoked by the SaxParser when an error occurs.
 WindowContext getWindowContext()
           
 void handleAttribute(Element target, Attribute attrib, SimpleStack children)
           
 void handleChildren(Element elem, SimpleStack children)
           
 Object handleElement(Element element, SimpleStack children)
           
 void setWindowContext(WindowContext windowContext)
          Sets the WindowContext for this 'Handler tree.
 void startElement(String namespaceURI, String lName, String qName, Attributes attrs)
          Part of the DefaultHandler, this method is invoked by the SaxParser when it begins an element tag.
 void startWindow(String fileid, Container window)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elementHandler

protected ElementHandler elementHandler

attributeHandler

protected AttributeHandler attributeHandler

windowHandler

protected WindowHandler windowHandler

childHandler

protected ChildHandler childHandler

context

protected WindowContext context
Constructor Detail

TagHandler

public TagHandler()
Constructs a TagHandler using the configuration stored in the PackageRegistry.


TagHandler

public TagHandler(WindowContext ctxt,
                  ElementHandler elem,
                  AttributeHandler attr,
                  WindowHandler window,
                  ChildHandler child)
Constructs a TagHandler which uses the specified configuration.

Parameters:
ctxt - the WindowContext to use
elem - the ElementHandler to use
attr - the AttributeHandler to use
window - the WindowHandler to use
child - the ChildHandler to use
Method Detail

getWindowContext

public WindowContext getWindowContext()
Returns:
Returns the WindowContext.

setWindowContext

public void setWindowContext(WindowContext windowContext)
Sets the WindowContext for this 'Handler tree.

Parameters:
context - The WindowContext to set.

handleElement

public Object handleElement(Element element,
                            SimpleStack children)

addElementHandler

public void addElementHandler(ElementHandler handler)
Parameters:
elementHandler - The elementHandler to set.

handleAttribute

public void handleAttribute(Element target,
                            Attribute attrib,
                            SimpleStack children)

addAttributeHandler

public void addAttributeHandler(AttributeHandler handler)
Parameters:
handler - The AttributeHandler to add to the chain.

handleChildren

public void handleChildren(Element elem,
                           SimpleStack children)
Parameters:
elem -
children -

addChildHandler

public void addChildHandler(ChildHandler handler)
Parameters:
childHandler - The ChildHandler to add to the chain.

startWindow

public void startWindow(String fileid,
                        Container window)

endWindow

public void endWindow()

addWindowHandler

public void addWindowHandler(WindowHandler handler)
Parameters:
windowHandler - The WindowHandler to add to the chain.

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Throws:
SAXException

startElement

public void startElement(String namespaceURI,
                         String lName,
                         String qName,
                         Attributes attrs)
                  throws SAXException
Part of the DefaultHandler, this method is invoked by the SaxParser when it begins an element tag.

In the default implementation, this method will compute a hashCode of the qName parameter, and capture this and the attrs parameter into an Element data structure.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Throws:
SAXException
See Also:
Element, SAXParser, DefaultHandler

endElement

public void endElement(String namespaceURI,
                       String sName,
                       String qName)
                throws SAXException
Part of the DefaultHandler, this method is invoked by the SaxParser when it finds an end tag.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Throws:
SAXException

error

public void error(SAXParseException e)
           throws SAXParseException
Part of the DefaultHandler, this method is invoked by the SaxParser when an error occurs.

In the default implementation, this method simply rethrows the Exception.

Specified by:
error in interface ErrorHandler
Overrides:
error in class DefaultHandler
Throws:
SAXParseException
See Also:
SAXParser, DefaultHandler

SourceForge.net
java.net

Copyright 2004-2005 Shawn Curry, http://jfcml.sourceforge.net
Licensed under the Academic Free License version 2.1