DimDom v0.8.2

org.alltimeflashdreamer.dimdom
Class DimDomNodeImpl

java.lang.Object
  |
  +--org.alltimeflashdreamer.dimdom.DimDomNodeImpl
All Implemented Interfaces:
DimDomNode

public class DimDomNodeImpl
extends Object
implements DimDomNode

Title: DimDomNodeImpl
Description: This class represents one node that is processed by the DimDom engine. Its constructor stores the identifier which must exist in the template file. If the template lacks this String (case-insensitive comparison), a DimDomException will be thrown on accessing that node.


Inner Class Summary
(package private)  class DimDomNodeImpl.AttributeObject
          Description of the Class
(package private)  class DimDomNodeImpl.EmbeddingLink
          Simple object to stored the set values of an embedding link ("a" element).
(package private)  class DimDomNodeImpl.ValueObject
          The ValueObject class is abled to store data in the supported formats of DimDom, i.e.
 
Constructor Summary
DimDomNodeImpl(Document testDocument, String sNodeIdentifier)
           
 
Method Summary
 void addData(String sValue)
          Stores a single String value, without selection.
 void addData(String[] sValues)
          Stores a list of String values, without selection.
 void addData(String[][] sValues2D)
          Stores a field (i.e.
 void addData(String[][] sValues2D, int iSelectedRow)
          Stores a field (i.e.
 void addData(String[][] sValues2D, int iSelectedRow, int iSelectedColumn)
          Stores a field (i.e.
 void addData(String[] sValues, int iSelectedIndex)
          Stores a list of String values, with selection.
 void addData(String[] sValues, String sSelectedEntry)
          Stores a list of String values, with selected string.
 void addData(String sValue, boolean bIsSelected)
          Stores a single String value, with selection.
 void addData(Vector vValues)
          Stores a list of String values, without selection.
 void addData(Vector vValues, int iSelectedIndex)
          Stores a list of String values, without selection.
 void addData(Vector vValues, String sSelectedEntry)
          Stores a list of String values, with selected string.
(package private)  DimDomNodeImpl.EmbeddingLink getEmbeddingLink()
          Returns this class EmbeddingLink instance, if defined
(package private)  DimDomNodeImpl.AttributeObject getNextAttributeObject()
          Returns an AttributeObject instance to be appended to the underlying node by the DimDom engine.
(package private)  DimDomNodeImpl.ValueObject getNextValueObject()
          Returns an instance of ValueObject, to allow the DimDom engine to process the next cycle on this class' underlying element/node.
(package private)  String getNodeIdentifier()
          Returns the value of the id attribute of the underlying (DimDom) node.
(package private)  String getReplacingText()
          Returns the replacing text of this node.
(package private)  boolean hasEmbeddingLink()
          Returns whether this node was set to be embedded in a link.
(package private)  boolean hasMoreAttributeObjects()
          Returns whether there are more instances of Attr in the pipeline or not.
(package private)  boolean hasMoreValueObjects()
          Returns whether there are more instances of ValueObject in the pipeline or not.
(package private)  boolean isVisible()
          Returns the visibility of the node.
 void setAttribute(String sKey, String sValue)
          Sets an attribute key/value pair to the node.
 void setAttribute(String sKey, String sValue, boolean bIsCommon)
          Sets an attribute key/value pair to the node.
 void setChildAttribute(String sKey, String sValue)
          Sets an attribute key/value pair to DimDom-specific child of node.
 void setEmbeddingLink(String sTargetURL)
          Embeds the underlying DOM node with a "a" element and sets the parameter String to the element's "href" attribute.
 void setEmbeddingLink(String sTargetURL, String sTargetFrame)
          Embeds the underlying DOM node with a "a" element and sets the parameter String to the element's "href" attribute.
 void setReplacingText(String sReplacingText)
          Sets the visibility of the DimDomNode to false and updates the replacement value.
 void setVisible(boolean bIsVisible)
          Sets the visibility of the DimDomNode.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DimDomNodeImpl

public DimDomNodeImpl(Document testDocument,
                      String sNodeIdentifier)
Parameters:
sNodeIdentifier - as defined in the template
testDocument - a valid XHTML Document object which is used to run tests while setting data/attributes
Method Detail

setAttribute

public void setAttribute(String sKey,
                         String sValue,
                         boolean bIsCommon)
                  throws DimDomException
Sets an attribute key/value pair to the node. If this attribute is already defined for the underlying node, it is replaced during the processing of the template. If the key or the value parameter is not XHTML compliant, a DimDomException is thrown If the boolean is true, this attribute is added to each node of the same kind as the underlying node.
Specified by:
setAttribute in interface DimDomNode
Parameters:
sKey - the name of the attribute
sValue - the value of the attribute
bIsCommon - whether to set this attribute to each node having the same node name as the template node having this class' node identifier
Throws:
DimDomException - if one of the parameters is not XHTML compliant (see org.w3c.dom.Attr class)

setAttribute

public void setAttribute(String sKey,
                         String sValue)
                  throws DimDomException
Sets an attribute key/value pair to the node. If this attribute is already defined for the underlying node, it is replaced during the processing of the template. If the key or the value parameter is not XHTML compliant, a DimDomException is thrown. This method is designed for individual nodes only.
Specified by:
setAttribute in interface DimDomNode
Parameters:
sKey - the name of the attribute
sValue - the value of the attribute
Throws:
DimDomException - if one of the parameters is not XHTML compliant (see org.w3c.dom.Attr class)

setChildAttribute

public void setChildAttribute(String sKey,
                              String sValue)
                       throws DimDomException
Sets an attribute key/value pair to DimDom-specific child of node. If this attribute is already defined for the child node, it is replaced during the processing of the template. If the key or the value parameter is not XHTML compliant, a DimDomException is thrown. This method is designed for individual nodes only, because DimDom doesn't append children to common nodes.
Specified by:
setChildAttribute in interface DimDomNode
Parameters:
sKey - the name of the attribute
sValue - the value of the attribute
Throws:
DimDomException - if one of the parameters is not XHTML compliant (see org.w3c.dom.Attr class)

addData

public void addData(String sValue)
Stores a single String value, without selection.
Specified by:
addData in interface DimDomNode
Parameters:
sValue - just a value

addData

public void addData(String sValue,
                    boolean bIsSelected)
Stores a single String value, with selection.
Specified by:
addData in interface DimDomNode
Parameters:
sValue - just a value
bIsSelected - whether to select the value or not

addData

public void addData(String[] sValues)
Stores a list of String values, without selection.
Specified by:
addData in interface DimDomNode
Parameters:
sValues - a value list

addData

public void addData(Vector vValues)
Stores a list of String values, without selection.
Specified by:
addData in interface DimDomNode
Parameters:
vValues - a value list

addData

public void addData(String[] sValues,
                    int iSelectedIndex)
Stores a list of String values, with selection.
Specified by:
addData in interface DimDomNode
Parameters:
sValues - a value list
iSelectedIndex - an existing index, else nothing is selected

addData

public void addData(String[] sValues,
                    String sSelectedEntry)
Stores a list of String values, with selected string.
Specified by:
addData in interface DimDomNode
Parameters:
sValues - a value list
sSelectedEntry - an existing string of the list, else nothing is selected

addData

public void addData(Vector vValues,
                    int iSelectedIndex)
Stores a list of String values, without selection.
Specified by:
addData in interface DimDomNode
Parameters:
vValues - a value list
iSelectedIndex - an existing index, else nothing is selected

addData

public void addData(Vector vValues,
                    String sSelectedEntry)
Stores a list of String values, with selected string.
Specified by:
addData in interface DimDomNode
Parameters:
vValues - a value list
sSelectedEntry - an existing string of the list, else nothing is selected

addData

public void addData(String[][] sValues2D)
Stores a field (i.e. a 2-dimensional list) of String values, without selection.
Specified by:
addData in interface DimDomNode
Parameters:
sValues2D - a value field

addData

public void addData(String[][] sValues2D,
                    int iSelectedRow)
Stores a field (i.e. a 2-dimensional list) of String values, with selected row.
Specified by:
addData in interface DimDomNode
Parameters:
sValues2D - a value field
iSelectedRow - each value of this row (starting with 0) will be selected in the output

addData

public void addData(String[][] sValues2D,
                    int iSelectedRow,
                    int iSelectedColumn)
Stores a field (i.e. a 2-dimensional list) of String values, with selected row and column.
Specified by:
addData in interface DimDomNode
Parameters:
sValues2D - a value field
iSelectedRow - the row index (starting with 0) of the selected element
iSelectedColumn - the column index (starting with 0) of the selected element

setVisible

public void setVisible(boolean bIsVisible)
Sets the visibility of the DimDomNode. If hidden, its underlying node is removed from the DOM tree during processing to make it invisible.
Specified by:
setVisible in interface DimDomNode
Parameters:
bIsVisible - true for visible, false for invisible

setReplacingText

public void setReplacingText(String sReplacingText)
Sets the visibility of the DimDomNode to false and updates the replacement value. If the node is still hidden during processing, its underlying node is replaced with a Text node having the given replacement as text.
Specified by:
setReplacingText in interface DimDomNode
Parameters:
sReplacingText - e.g. a simple "-" to demonstrate there is no more of what has been there before

setEmbeddingLink

public void setEmbeddingLink(String sTargetURL)
                      throws DimDomException
Embeds the underlying DOM node with a "a" element and sets the parameter String to the element's "href" attribute. The given string may of course be a JavaScript command or something else.
Specified by:
setEmbeddingLink in interface DimDomNode
Parameters:
sTargetURL - the URL string to set to the link's href attribute
Throws:
DimDomException - if the target URL string is not XHTML compliant (see org.w3c.dom.Attr class)

setEmbeddingLink

public void setEmbeddingLink(String sTargetURL,
                             String sTargetFrame)
                      throws DimDomException
Embeds the underlying DOM node with a "a" element and sets the parameter String to the element's "href" attribute. The given string may of course be a JavaScript command or something else.
Specified by:
setEmbeddingLink in interface DimDomNode
Parameters:
sTargetURL - the URL string to set to the link's href attribute
sTargetFrame - the browser frame name where the link shall point to
Throws:
DimDomException - if the target URL string is not XHTML compliant (see org.w3c.dom.Attr class)

hasMoreValueObjects

boolean hasMoreValueObjects()
Returns whether there are more instances of ValueObject in the pipeline or not.
Returns:
more ValueObject instances?

getNextValueObject

DimDomNodeImpl.ValueObject getNextValueObject()
Returns an instance of ValueObject, to allow the DimDom engine to process the next cycle on this class' underlying element/node.
Returns:
the next stored instance of ValueObject or null

hasMoreAttributeObjects

boolean hasMoreAttributeObjects()
Returns whether there are more instances of Attr in the pipeline or not.
Returns:
more AttributeObject instances?

getNextAttributeObject

DimDomNodeImpl.AttributeObject getNextAttributeObject()
Returns an AttributeObject instance to be appended to the underlying node by the DimDom engine.
Returns:
the next stored Attr or null

isVisible

boolean isVisible()
Returns the visibility of the node.
Returns:
true if visible, else false

getReplacingText

String getReplacingText()
Returns the replacing text of this node. The returned value is null if the node is set visible, "" if no replacement was defined and else the replacing text.
Returns:
null, "" or a text string

hasEmbeddingLink

boolean hasEmbeddingLink()
Returns whether this node was set to be embedded in a link.
Returns:
is EmbeddedLink object defined?

getEmbeddingLink

DimDomNodeImpl.EmbeddingLink getEmbeddingLink()
Returns this class EmbeddingLink instance, if defined
Returns:
the EmbeddingLink instance or null

getNodeIdentifier

String getNodeIdentifier()
Returns the value of the id attribute of the underlying (DimDom) node.
Returns:
the identifying string, which is unique in the template

Copyright (c) 2001/02 by Florian Steinsiepe