com.openharbor.xmlj.observer
Class ObservableElement

java.lang.Object
  extended bycom.openharbor.xmlj.Element
      extended bycom.openharbor.xmlj.observer.ObservableElement

public class ObservableElement
extends Element

An element whose changes can be observed by another object. The observer might be a 'wrapper' proxy that provides a more meaningful view of Element information. For example, such a proxy could implement the java.util.Map interface as a proxy for an Element, with Map.Entry objects that are proxies for its subElements. The Map would need to observe changes to the list of subElements, in order to maintain its index (e.g. hash table) and enforce the Map invariant that no two entries have the same key.


Nested Class Summary
protected static class ObservableElement.ObservableList
           
protected static class ObservableElement.ObservableMap
           
static interface ObservableElement.Observer
           
 
Nested classes inherited from class com.openharbor.xmlj.Element
Element.AttributeMap, Element.ElementList
 
Field Summary
 
Fields inherited from class com.openharbor.xmlj.Element
EMPTY_VALUE
 
Constructor Summary
ObservableElement()
           
 
Method Summary
 ObservableElement.Observer getObserver()
           
protected  Element.AttributeMap newAttributeMap(java.util.Map real)
          Override this to customize the implementation of the attributes' Map.
protected  Element.ElementList newElementList()
          Override this to customize the implementation of the subElements' List.
 void setObserver(ObservableElement.Observer observer)
           
 void setValue(java.lang.String value)
          Set the text contained in this element.
 
Methods inherited from class com.openharbor.xmlj.Element
getAttributes, getName, getParent, getSubElements, getValue, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObservableElement

public ObservableElement()
Method Detail

getObserver

public ObservableElement.Observer getObserver()

setObserver

public void setObserver(ObservableElement.Observer observer)

setValue

public void setValue(java.lang.String value)
Description copied from class: Element
Set the text contained in this element. setValue(null) sets the text to EMPTY_VALUE. This prevents the creation of Java structures that can't be represented in XML.

Overrides:
setValue in class Element

newAttributeMap

protected Element.AttributeMap newAttributeMap(java.util.Map real)
Description copied from class: Element
Override this to customize the implementation of the attributes' Map.

Overrides:
newAttributeMap in class Element

newElementList

protected Element.ElementList newElementList()
Description copied from class: Element
Override this to customize the implementation of the subElements' List.

Overrides:
newElementList in class Element