net.sf.swan.xml.input.event
Class EventContext

java.lang.Object
  |
  +--net.sf.swan.xml.input.event.EventContext
Direct Known Subclasses:
DocumentContext, ElementContext

public abstract class EventContext
extends java.lang.Object

Maintains contextual information relevant to the processing of some subset of a document.


Constructor Summary
EventContext()
           
 
Method Summary
 void addContextListener(ContextListener listener)
           
 EventContext connectEvent(ContextEvent event)
          Utility to connect an event to this as it's new source context.
protected  void fireEndElement(EndElementEvent event)
           
protected  void fireProcessingInstruction(ProcessingInstructionEvent event)
           
protected  void fireStartElement(StartElementEvent event)
           
protected  void fireTextEvent(TextEvent event)
           
 java.lang.Object getClientState()
          Gets the associated state, if any.
abstract  java.lang.Object getContextProperty(java.lang.Object key)
          Get the property on this context or the nearest ancestor with a matching property.
abstract  DocumentContext getDocumentContext()
           
protected  ContextListener[] getListeners()
           
 java.lang.Object getProperty(java.lang.Object key)
           
 void putClientState(java.lang.Object value)
          Associate arbitrary state with this ElementContext
abstract  void putContextProperty(java.lang.Object key, java.lang.Object value)
          Add a context property.
 java.lang.Object putProperty(java.lang.Object key, java.lang.Object data)
          Put an annotation on this context identified by the supplied key.
protected  void release()
          Release all associated properties and resources and reset the context to a default state.
 void removeContextListener(ContextListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventContext

public EventContext()
Method Detail

addContextListener

public void addContextListener(ContextListener listener)

removeContextListener

public void removeContextListener(ContextListener listener)

getClientState

public java.lang.Object getClientState()
Gets the associated state, if any. This will be null unless a state object has been previously set with putClientState(java.lang.Object).

putClientState

public void putClientState(java.lang.Object value)
Associate arbitrary state with this ElementContext

putProperty

public java.lang.Object putProperty(java.lang.Object key,
                                    java.lang.Object data)
Put an annotation on this context identified by the supplied key.
Returns:
any previous annotation on this context with the same key

getProperty

public java.lang.Object getProperty(java.lang.Object key)

putContextProperty

public abstract void putContextProperty(java.lang.Object key,
                                        java.lang.Object value)
Add a context property. Context properties (unlike annotations) are inherited by descendant contexts.

getContextProperty

public abstract java.lang.Object getContextProperty(java.lang.Object key)
Get the property on this context or the nearest ancestor with a matching property.

getDocumentContext

public abstract DocumentContext getDocumentContext()

connectEvent

public EventContext connectEvent(ContextEvent event)
Utility to connect an event to this as it's new source context.
Returns:
the previous source context

release

protected void release()
Release all associated properties and resources and reset the context to a default state.

fireStartElement

protected void fireStartElement(StartElementEvent event)
                         throws EventContextException

fireEndElement

protected void fireEndElement(EndElementEvent event)
                       throws EventContextException

fireTextEvent

protected void fireTextEvent(TextEvent event)
                      throws EventContextException

fireProcessingInstruction

protected void fireProcessingInstruction(ProcessingInstructionEvent event)
                                  throws EventContextException

getListeners

protected ContextListener[] getListeners()