SMACS

smacs.tree
Class NodeReferenceAttribute

java.lang.Object
  extended byorg.dom4j.tree.AbstractNode
      extended byorg.dom4j.tree.AbstractAttribute
          extended byorg.dom4j.tree.FlyweightAttribute
              extended byorg.dom4j.tree.DefaultAttribute
                  extended bysmacs.tree.NodeDefaultAttribute
                      extended bysmacs.tree.NodeExtendedAttribute
                          extended bysmacs.tree.NodeReferenceAttribute
All Implemented Interfaces:
Attribute, Cloneable, EventListener, GetSimpleNode, HasNodeHandler, IsaNodeReferenceAttribute, IsaNodeReferenceChildListener, IsaNodeReferenceListener, Node, Serializable
Direct Known Subclasses:
InputNode

public class NodeReferenceAttribute
extends NodeExtendedAttribute
implements IsaNodeReferenceAttribute, HasNodeHandler, IsaNodeReferenceChildListener, IsaNodeReferenceListener

special refer attribute. * It is possible to create a NodeReferenceAttribute that links directly to a NodeReferenceId in the attribute list of another node by means of a java objects refeference. When the name of the id-tag changes in the referenced node than it will be reflected in the xml serialization of the NodeReferenceAttribute as it does pickup the new name automatically via the object reference.

Author:
Copyright (C) 2004, Guido Draheim. All rights reserved. Part of SMACS project.
See Also:
Serialized Form

Field Summary
protected  NodeHandler nodehandler
           
protected  IsaNodeReferenceId referenced
           
 
Fields inherited from class smacs.tree.NodeDefaultAttribute
_qname
 
Fields inherited from class org.dom4j.tree.FlyweightAttribute
value
 
Fields inherited from class org.dom4j.tree.AbstractNode
NODE_TYPE_NAMES
 
Fields inherited from interface org.dom4j.Node
ANY_NODE, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, MAX_NODE_TYPE, NAMESPACE_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE, UNKNOWN_NODE
 
Constructor Summary
NodeReferenceAttribute(String name, IsaNodeReferenceId node)
           
NodeReferenceAttribute(String name, IsaNodeReferenceId node, NodeHandler def)
           
 
Method Summary
 void destroy()
           
 NodeHandler getHandler()
          returns the NodeHandler of the node.
 String getId()
          the Id of the referenced node.
 SimpleNode getSimpleNode()
          return the referenced node.
 String getValue()
          the value is the Id-number.
 void onNodeReferenceChildHasChanged(SimpleNode node)
          per default, tell the referenced node that this attribute points to.
 void onNodeReferenceHasChanged(SimpleNode node)
          per default, tell the parenting node of this reference attribute.
 void setHandler(NodeHandler handler)
          you can set the NodeHandler in the attribute instance. which overrides the one from the referenced node - in other words the original node is not modified.
 String toAttrXML(String prefix)
          currently: nothing
 
Methods inherited from class smacs.tree.NodeDefaultAttribute
getQName, newQName, newQName, setName, setQName
 
Methods inherited from class org.dom4j.tree.DefaultAttribute
getParent, isReadOnly, setParent, setValue, supportsParent
 
Methods inherited from class org.dom4j.tree.AbstractAttribute
accept, asXML, createXPathResult, getData, getName, getNamespace, getNamespacePrefix, getNamespaceURI, getNodeType, getPath, getQualifiedName, getText, getUniquePath, setData, setNamespace, setText, toString, write
 
Methods inherited from class org.dom4j.tree.AbstractNode
asXPathResult, clone, createPattern, createXPath, createXPathFilter, detach, getDocument, getDocumentFactory, getNodeTypeName, getPath, getStringValue, getUniquePath, hasContent, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, valueOf
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.dom4j.Attribute
getData, getNamespace, getNamespacePrefix, getNamespaceURI, getQName, getQualifiedName, setData, setNamespace, setValue
 
Methods inherited from interface org.dom4j.Node
accept, asXML, asXPathResult, clone, createXPath, detach, getDocument, getName, getNodeType, getNodeTypeName, getParent, getPath, getPath, getStringValue, getText, getUniquePath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setName, setParent, setText, supportsParent, valueOf, write
 

Field Detail

referenced

protected IsaNodeReferenceId referenced

nodehandler

protected NodeHandler nodehandler
Constructor Detail

NodeReferenceAttribute

public NodeReferenceAttribute(String name,
                              IsaNodeReferenceId node)

NodeReferenceAttribute

public NodeReferenceAttribute(String name,
                              IsaNodeReferenceId node,
                              NodeHandler def)
Method Detail

setHandler

public void setHandler(NodeHandler handler)
you can set the NodeHandler in the attribute instance. which overrides the one from the referenced node - in other words the original node is not modified.


getHandler

public NodeHandler getHandler()
returns the NodeHandler of the node. This is per default the one from the referenced node unless it is overridden via the local {#setHandler}

Specified by:
getHandler in interface HasNodeHandler

getSimpleNode

public SimpleNode getSimpleNode()
Description copied from interface: IsaNodeReferenceAttribute
return the referenced node.

Specified by:
getSimpleNode in interface IsaNodeReferenceAttribute

getId

public String getId()
the Id of the referenced node.

Specified by:
getId in interface IsaNodeReferenceAttribute

getValue

public String getValue()
the value is the Id-number. overridde attribute.getValue() with attribute.node().getId(). That allows you to change the Id on the referenced Element-node and all ref-ids will change automatically.

Specified by:
getValue in interface Attribute

onNodeReferenceChildHasChanged

public void onNodeReferenceChildHasChanged(SimpleNode node)
per default, tell the referenced node that this attribute points to.

Specified by:
onNodeReferenceChildHasChanged in interface IsaNodeReferenceChildListener

onNodeReferenceHasChanged

public void onNodeReferenceHasChanged(SimpleNode node)
per default, tell the parenting node of this reference attribute.

Specified by:
onNodeReferenceHasChanged in interface IsaNodeReferenceListener

destroy

public void destroy()

toAttrXML

public String toAttrXML(String prefix)
Description copied from class: NodeExtendedAttribute
currently: nothing

Overrides:
toAttrXML in class NodeExtendedAttribute

SMACS