DimDom v0.8.2

org.alltimeflashdreamer.dimdom
Class AbstractXHTMLDocument

java.lang.Object
  |
  +--org.alltimeflashdreamer.dimdom.AbstractXHTMLDocument
All Implemented Interfaces:
XHTMLDocument
Direct Known Subclasses:
SimpleDocument

public abstract class AbstractXHTMLDocument
extends Object
implements XHTMLDocument

Title: AbstractXHTMLDocument
Description: This class wraps the necessary functionality around the "logic" that is implemented in the DimDom engine, reference implementation.
Each subclass of this class must perform extended, not referencial logic operations using the specified SiteData instance of this class.
The ideal usage of a subclass would be to instantiate the fully filled SiteData object (e.g. as a subclass) and pass it to the DimDom, e.g. from within a servlet:

 //fill every information into the SiteData within a subclass' constructor
 MySiteData mySiteData = new MySiteData();
 //call your own subclass' print method (this class knows which file it shall use)
 response.getWriter().write(DimDom.print(mySiteData));
 


Inner Class Summary
protected  class AbstractXHTMLDocument.RepeatedElement
          This simple class stored the template information on a repeated element, i.e.
 
Field Summary
protected  Hashtable hIDNodeList
          the list of template nodes having an "id" attribute
protected  Hashtable hMicroTemplateNodes
          the list of nodes and their repeated child elements (micro-template structure nodes)
protected  Hashtable hProcessedIDs
          the list of already processed id nodes, to find out whether it's a repeated command on the same node or not, stored together with the number of repetitions; this number is altered on each repetition of the node
protected  AbstractXHTMLSiteData siteData
          pointer to AbstractXHTMLSiteData object which is used to process the dynamic data within the reference implementation
 
Constructor Summary
AbstractXHTMLDocument()
           
 
Method Summary
protected  Hashtable buildListOfIDNodes(Document doc)
          Builds a hashtable containing ID/XHTML element pairs to find the nodes more easily when modifying them during the following update process with the dynamic values.
protected  void buildMicroTemplateNodeList(Hashtable hClonedIDNodeList)
          (Re)Builds the internal list of micro-template nodes, i.e.
protected  Element createAndAddNextDimDomChild(Element element, boolean bIsRepeatedCommand)
          A new child element is created, appended and returned.
Which node is chosen, is up to the specifications of the DimDom.
protected  Node createEmptyTextNode(Document doc)
          Creates an "empty text node", i.e.
protected  Element createSelectedElement(Document doc, String sText)
          Creates a new node of type "b" and appends a text node to it, containing sText.
protected  void findAndAddRepeatedElements(NodeList nodes, Vector vRepeatedElements)
          This method recursively searches the given NodeList for each member of the DOM tree having a defined "dimdom" attribute.
protected  Element findFirstLeafElement(Node node)
          Searches the tree down until he finds a leaf node of type Element.
protected  Node findFirstNodeByName(Node node, String sNodeName)
          Searches the tree recursively, starting with node, for a node having the given name.
protected  Text findFirstText(Node node)
          Finds the first text down the tree, starting with node.
protected  Element getElement(Hashtable hIDNodeList, String sElementIDValue, Document clonedDoc)
          This method can be called be extending classes to directly access an Element specified by the id attribute value within the template.
protected  Text getFirstText(Element element)
          Searches the first text node done the tree, starting with element.
protected abstract  Element getNextRepeatedElement(String sNodeIdentifier, Element element)
          This class doesn't implement the logic that is necessary to find out which node is the next to be processed in micro-template structures.
protected  int getProcessedRepetitionsCount(String sNodeIdentifier)
          Returns the total number of already processed repetitions of the node having the given identifier.
protected  AbstractXHTMLDocument.RepeatedElement[] getRepeatedElements(String sNodeIdentifier)
          Returns the list of RepeatedElement instances that were initialized for the given node or null, if no such nodes exist for the given node in the template.
protected  int getStoredTableDataChildCount(String sNodeIdentifier)
          Returns the stored value for the amount of td/th child nodes, as calculated int getTableDataChildCount.
protected  int getTableDataChildCount(Element element)
          Returns the current amount of td or th (see isTableDataNode method) child elements for the given node identifier.
protected  void hide(Element element, Node replacingNode)
          Hides the Element parameter by replacing it with another node.
If the element is a "tr" element, then the children of type "th" or "td" are searched and their content is hided, and its height attribute is removed.
protected  void hideChildElements(Element element, Node replacingNode)
          Hides each child element (!) of element, i.e.
protected  boolean isDimDomListNode(Node node)
          Returns whether node is a DimDom list node or not, i.e.
protected  boolean isEmpty(String sTestString)
          Returns whether the given test string is null or equals the empty string.
protected  boolean isHTMLListNode(Node node)
          Returns whether node is a HTML list node or not, i.e.
protected  boolean isRepeatedCommand(String sNodeIdentifier, Element element)
          Returns whether the given element is a micro-template node or not.
protected  boolean isTableDataNode(Node node)
          Returns whether node is a table dent node or not, i.e.
protected  boolean isTableRowNode(Node node)
          Returns whether node is a table row node or not, i.e.
protected  void parseFile(File file)
          Parses the parameter file, but only during initialization or if the specified file has a new last modification date.
protected  void parseFile(String sFileName)
          Parses the file specified in sFileName, but only during initialization or if the specified file has a new last modification date.
protected  void parseInputStream(InputStream stream)
          Parses the InputStream specified in stream (parsing is done any time the method is executed).
protected  void parseString(String sInput)
          Parses the InputStream specified in stream (parsing is done any time the method is executed).
 String print()
          Forces the XHTMLDocument instance to print out its dynamically adapted content as a fully qualified XHTML String.
This is done after the cloning of the internal Document pointer and the calling of the processDynamicData method, which updates the DOM.
protected  void processDimDomNode(DimDomNodeImpl dimdomNode, Element element, boolean bIsRepeatedCommand)
          Processes one node of the template having an id attribute value, along the specifications of DimDom.
protected  void removeChildElements(Node node)
          Removes the child nodes that are Element nodess.
protected  void removeChildTextNodes(Node node)
          Removes the child nodes that are Text nodess.
protected  void removeNodes(Vector vNodesToDelete)
          Removes each node in the given list.
protected  void setAttribute(Element element, Attr attribute)
          Sets an attribute name and value to the parameter Element.
protected  void setCommonAttribute(Element element, Attr attribute)
          Sets the attribute and its value to each node found within the document that has the same node name as element.
protected  void setContent(String sNodeIdentifier, Element element, String[] sValues, boolean bIsSelectedRow, int iSelectedColumn, boolean bIsRepeatedCommand)
          Sets the children's content of element using the value list parameter.
protected  void setContent(String sNodeIdentifier, Element element, String sContent, boolean bIsSelected, boolean bIsRepeatedCommand)
          Sets the content of element to sContent.
protected  void setOptionTagSelected(Element option, boolean bIsSelected)
          Sets or unsets the selected attribute of the option tag, depending on the boolean parameter.
protected  void setRepeatedElements(String sNodeIdentifier, AbstractXHTMLDocument.RepeatedElement[] repeatedElements)
          Sets the list of RepeatedElement instances of the given node.
 void setSiteData(XHTMLSiteData siteData)
          This method is (typically) called by the servlet instantiating a specific subclass of this class that needs to be filled with dynamic data.
It is defined within a separate interface to hide the functionality of implementing classes to the servlet programmer, because the updating process is uni-directional (thread safety!).
protected  void setText(Element element, String sText)
          Sets the given string content to the given node by setting the content to the first found text node.
protected  void setText(Element element, String sText, boolean bIsSelected)
          Just calls setText(element, sText), if bIsSelected is false; else a selected element is created and appended to element.
protected  void setTexts(Element element, Vector vNotListValues, int iSelectedIndex)
          Sets a list of string values to a node that is not a list node (see isDimDomListNode method).
protected  void setTexts(Element element, Vector vNotListValues, int iNColumnsPerRow, int iSelectedRow, int iSelectedColumn)
          Sets a 2D field of string values to a node that is not a list node (see isDimDomListNode method).
protected  void wrapWithLink(Element element, DimDomNodeImpl.EmbeddingLink embeddingLink)
          Wraps the parameter Element with a link specified by its target URL and frame.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

siteData

protected AbstractXHTMLSiteData siteData
pointer to AbstractXHTMLSiteData object which is used to process the dynamic data within the reference implementation

hIDNodeList

protected Hashtable hIDNodeList
the list of template nodes having an "id" attribute

hMicroTemplateNodes

protected Hashtable hMicroTemplateNodes
the list of nodes and their repeated child elements (micro-template structure nodes)

hProcessedIDs

protected Hashtable hProcessedIDs
the list of already processed id nodes, to find out whether it's a repeated command on the same node or not, stored together with the number of repetitions; this number is altered on each repetition of the node
Constructor Detail

AbstractXHTMLDocument

public AbstractXHTMLDocument()
Method Detail

print

public String print()
             throws IOException,
                    DimDomException
Forces the XHTMLDocument instance to print out its dynamically adapted content as a fully qualified XHTML String.
This is done after the cloning of the internal Document pointer and the calling of the processDynamicData method, which updates the DOM.
Specified by:
print in interface XHTMLDocument
Returns:
the full XHTML string
Throws:
IOException - thrown by the parser (input source)
DimDomException - thrown by the processor, if something is/went wrong

setSiteData

public void setSiteData(XHTMLSiteData siteData)
                 throws SAXException,
                        IOException,
                        DimDomException
This method is (typically) called by the servlet instantiating a specific subclass of this class that needs to be filled with dynamic data.
It is defined within a separate interface to hide the functionality of implementing classes to the servlet programmer, because the updating process is uni-directional (thread safety!).
Specified by:
setSiteData in interface XHTMLDocument
Parameters:
siteData - an instance of a class implementing org.alltimeflashdreamer.dimdom.XHTMLSiteData interface
Throws:
SAXException - thrown by the parser
IOException - thrown by the parser (input source)
DimDomException - thrown by the processor, if something is/went wrong

getElement

protected Element getElement(Hashtable hIDNodeList,
                             String sElementIDValue,
                             Document clonedDoc)
                      throws DimDomException
This method can be called be extending classes to directly access an Element specified by the id attribute value within the template. The implementation here searches the internal list of id nodes for the one with the given id. If no such node is found, it's assumed that this is a common attribute setting, and a node having the same name is searched and returned, if found, else null is returned.
Parameters:
hIDNodeList - where the found nodes are stored in
sElementIDValue - the id value of the node (or the name, in case of the setting of a common attribute)
clonedDoc - the Document object to search for a common node template, in case
Returns:
the Element from the list or a common node or null
Throws:
DimDomException - thrown if the node to be processed is not a Element node

processDimDomNode

protected void processDimDomNode(DimDomNodeImpl dimdomNode,
                                 Element element,
                                 boolean bIsRepeatedCommand)
                          throws DimDomException
Processes one node of the template having an id attribute value, along the specifications of DimDom. The executed tasks are:
Parameters:
dimdomNode - the object containing the dynamic information; must not be null!
element - the element to which the dynamic information shall be applied
bIsRepeatedCommand - tells the engine about whether this node has already been handled within the "getNextRepeatedElement intelligence" or not; if not, the method has to take care on its own about what to do with repeated data structures (not nodes)
Throws:
DimDomException - if some error occurs while adding the information to the node

getNextRepeatedElement

protected abstract Element getNextRepeatedElement(String sNodeIdentifier,
                                                  Element element)
                                           throws DimDomException
This class doesn't implement the logic that is necessary to find out which node is the next to be processed in micro-template structures. Therefore, this method is to be implemented by extending classes. They will need the getter (and perhaps the setter) method of the repeated elements to get the list of RepeatedElement instances, the wrapper classes for these "special" nodes.
Parameters:
sNodeIdentifier - the id attribute value of the node to be processed
element - the current node to be processed, for deciding how to behave
Returns:
the next repeated element, i.e. a clone that is already appended/inserted correctly
Throws:
DimDomException - wrapper for unexpected errors

setText

protected void setText(Element element,
                       String sText)
                throws DimDomException
Sets the given string content to the given node by setting the content to the first found text node. If no such text node exists, a new one is created, filled and added to element. If sText contains newline characters ("\n"), they are replaced with a "br" node.
Parameters:
element - the element to set the content to
sText - the text to set to element; if null or empty, the node's text is set to ""
Throws:
DimDomException - wrapped DOMException, in case

getFirstText

protected Text getFirstText(Element element)
Searches the first text node done the tree, starting with element. If no such node is found, a newly created, empty Text is returned, which is appended to element.
Parameters:
element - the root node to search
Returns:
a previously existing child Text or a new Text

setTexts

protected void setTexts(Element element,
                        Vector vNotListValues,
                        int iSelectedIndex)
                 throws DimDomException
Sets a list of string values to a node that is not a list node (see isDimDomListNode method). If this situation occurs, the values are added as a comma-separated list, and if the given index is a defined one in the given vector, it's embedded in a "b" tag (HTML bold tag).
Parameters:
element - node to add the list to
vNotListValues - list of values (only String instances)
iSelectedIndex - the selected index; if out of range (e.g. -1), no value is marked as bold
Throws:
DimDomException - in case something went wrong, this is an own or a wrapped DOMException

setTexts

protected void setTexts(Element element,
                        Vector vNotListValues,
                        int iNColumnsPerRow,
                        int iSelectedRow,
                        int iSelectedColumn)
                 throws DimDomException
Sets a 2D field of string values to a node that is not a list node (see isDimDomListNode method). If this situation occurs, the values are added as a comma-separated list, and if the given row/column index is a selected one, the related value is embedded in a "b" tag (HTML bold tag). In case the selected row index is set, but the selected column index is out of range, each entry of the selected row is marked as selected.
Parameters:
element - node to add the list to
vNotListValues - list of values (only String instances)
iNColumnsPerRow - how many columns are there per row?
iSelectedRow - the selected row index; if out of range (e.g. -1), no value is marked as bold
iSelectedColumn - the selected column index; if out of range (e.g. -1), no value is marked as bold
Throws:
DimDomException - in case something went wrong, this is an own or a wrapped DOMException

createSelectedElement

protected Element createSelectedElement(Document doc,
                                        String sText)
                                 throws DimDomException
Creates a new node of type "b" and appends a text node to it, containing sText. This node is then returned.
Parameters:
doc - the Document to create nodes with
sText - the text to show selected; if null, "" is added
Returns:
the selected node
Throws:
DimDomException - a wrapped DOMException, in case

setContent

protected void setContent(String sNodeIdentifier,
                          Element element,
                          String sContent,
                          boolean bIsSelected,
                          boolean bIsRepeatedCommand)
                   throws DimDomException
Sets the content of element to sContent. There are two scenarios for this method: This is done in case element is not null only.
Notes:
Parameters:
sNodeIdentifier - the name of the currently processed DimDomNode
element - the Element to set the content to
sContent - the content (if null, it's set to "")
bIsSelected - whether to select this element or not
bIsRepeatedCommand - tells the method whether this is a micro-template structure node or not
Throws:
DimDomException - if element is null, or a wrapped DOMException, in case

setContent

protected void setContent(String sNodeIdentifier,
                          Element element,
                          String[] sValues,
                          boolean bIsSelectedRow,
                          int iSelectedColumn,
                          boolean bIsRepeatedCommand)
                   throws DimDomException
Sets the children's content of element using the value list parameter. There are two scenarios for this method: This is done only in case both element and sValues aren't null AND sValues.length is at least 1!
Notes:
Parameters:
sNodeIdentifier - the name of the currently processed DimDomNode
element - the Element to set the content to
sValues - the content (if null, it's set to "")
bIsSelectedRow - whether it's a selected row or not
iSelectedColumn - if it's selected row and the selected column is a valid index, only this column entry will be selected, else the whole row; if it's not the selected row, this parameter is ignored
bIsRepeatedCommand - tells the method whether this is a micro-template structure node or not
Throws:
DimDomException - if element or sValues are null, or a wrapped DOMException, in case

setOptionTagSelected

protected final void setOptionTagSelected(Element option,
                                          boolean bIsSelected)
Sets or unsets the selected attribute of the option tag, depending on the boolean parameter.
Parameters:
option - the HTML option tag to update
bIsSelected - set selected?

setText

protected void setText(Element element,
                       String sText,
                       boolean bIsSelected)
                throws DimDomException
Just calls setText(element, sText), if bIsSelected is false; else a selected element is created and appended to element.
Parameters:
element - the node to set the text to
sText - the text to set to the node
bIsSelected - whether to mark the text as selected or not
Throws:
DimDomException - in case something went wrong, this is an own or a wrapped DOMException

setCommonAttribute

protected void setCommonAttribute(Element element,
                                  Attr attribute)
                           throws DimDomException
Sets the attribute and its value to each node found within the document that has the same node name as element. Be careful using this command, it is designed to e.g. replace each font face attribute within a document.
Because this method needs a template element to know the name of the common attribute node(s), the parameter element must not be null, but an existing template node for the setting of common attributes
Parameters:
element - the element having the common node id (may not be null)
attribute - the Attr instance to add to these nodes
Throws:
DimDomException - wrapped DOMException, in case

parseInputStream

protected void parseInputStream(InputStream stream)
                         throws SAXException,
                                IOException,
                                DimDomException
Parses the InputStream specified in stream (parsing is done any time the method is executed).
Parameters:
stream - the InputStream to parse from
Throws:
SAXException - thrown by the parser
IOException - thrown by the parser (input source)
DimDomException - thrown by the processor, if something is/went wrong

parseString

protected void parseString(String sInput)
                    throws SAXException,
                           IOException,
                           DimDomException
Parses the InputStream specified in stream (parsing is done any time the method is executed).
Parameters:
sInput - the String to parse
Throws:
SAXException - thrown by the parser
IOException - thrown by the parser (input source)
DimDomException - thrown by the processor, if something is/went wrong

parseFile

protected void parseFile(String sFileName)
                  throws SAXException,
                         IOException,
                         DimDomException
Parses the file specified in sFileName, but only during initialization or if the specified file has a new last modification date.
Parameters:
sFileName - the name of the file to be parsed
Throws:
SAXException - thrown by the parser
IOException - thrown by the parser (input source)
DimDomException - thrown by the processor, if something is/went wrong

parseFile

protected void parseFile(File file)
                  throws SAXException,
                         IOException,
                         DimDomException
Parses the parameter file, but only during initialization or if the specified file has a new last modification date.
Parameters:
file - the file to parse
Throws:
SAXException - thrown by the parser
IOException - thrown by the parser (input source)
DimDomException - thrown by the processor, if something is/went wrong

setAttribute

protected void setAttribute(Element element,
                            Attr attribute)
                     throws DimDomException
Sets an attribute name and value to the parameter Element. This method must be used by extending subclasses. If element or attribute is null, an exception is thrown.
Parameters:
element - the Element to set the attribute to
attribute - the Attr to add
Throws:
DimDomException - thrown if element or attribute is null

wrapWithLink

protected void wrapWithLink(Element element,
                            DimDomNodeImpl.EmbeddingLink embeddingLink)
                     throws DimDomException
Wraps the parameter Element with a link specified by its target URL and frame. This method must be used by extending subclasses.
This is done only in case element is not null (if embeddingLink is null, nothing is done).
Parameters:
element - the Element to embed in a link
embeddingLink - the instance of DimDomNodeImpl describing the embedding "a" tag and its attributes
Throws:
DimDomException - if element is null or a wrapped DOMException, in case

hide

protected void hide(Element element,
                    Node replacingNode)
             throws DimDomException
Hides the Element parameter by replacing it with another node.
If the element is a "tr" element, then the children of type "th" or "td" are searched and their content is hided, and its height attribute is removed. If element is a "td" or a "th" itself, then its children are hided. Else the element itself is replaced with the empty text node parameter.
This is done only if both element and replacingNode aren't not null.
Parameters:
element - element to hide or replace with a Text node
replacingNode - the node to replace element with
Throws:
DimDomException - if element or replacingNode is null or a wrapped DOMException, in case

buildListOfIDNodes

protected Hashtable buildListOfIDNodes(Document doc)
                                throws DimDomException
Builds a hashtable containing ID/XHTML element pairs to find the nodes more easily when modifying them during the following update process with the dynamic values.
Parameters:
doc - the org.w3c.dom.Document containing the DOM root node to be searched
Returns:
where the found nodes are stored in after the search
Throws:
DimDomException - thrown if an id attribute value is found more than once in the template

createEmptyTextNode

protected Node createEmptyTextNode(Document doc)
Creates an "empty text node", i.e. a text node having one child node (the " " entity) and no text content.
Parameters:
doc - the owner document which shall created the node
Returns:
the "empty" node, which is actually a nbsp entity within a attributeless div node

findFirstLeafElement

protected Element findFirstLeafElement(Node node)
Searches the tree down until he finds a leaf node of type Element. If such a node is found, it's returned.
Parameters:
node - the starting node for the search
Returns:
the (actually) deepest element

isDimDomListNode

protected boolean isDimDomListNode(Node node)
Returns whether node is a DimDom list node or not, i.e. whether its name is either "ol" or "ul" or "select" or "tr" - or none of them.
Parameters:
node - the node to query
Returns:
whether it's a DimDom list node or not

isHTMLListNode

protected boolean isHTMLListNode(Node node)
Returns whether node is a HTML list node or not, i.e. whether its name is either "ol" or "ul" - or none of them.
Parameters:
node - the node to query
Returns:
whether it's a HTML list node or not

isTableDataNode

protected boolean isTableDataNode(Node node)
Returns whether node is a table dent node or not, i.e. whether its name is either "td" or "th" - or none of them.
Parameters:
node - the node to be checked
Returns:
whether it's a table data node or not

isTableRowNode

protected boolean isTableRowNode(Node node)
Returns whether node is a table row node or not, i.e. whether its name is "tr" or not.
Parameters:
node - the node to be checked
Returns:
whether it's a table row node or not

isRepeatedCommand

protected boolean isRepeatedCommand(String sNodeIdentifier,
                                    Element element)
Returns whether the given element is a micro-template node or not. This is always false if the given node is null, because this means that a common attribute command is to be processed. It's false too in case the internal list of micro-template nodes doesn't contain the given node, else it's true. After this check, the internal list of micro-template nodes is updated with the number of repetitions (starting with 1, to get the correct value).
Parameters:
sNodeIdentifier - the id attribute value of the node
element - the element to check
Returns:
whether this node was processed earlier or not

getProcessedRepetitionsCount

protected int getProcessedRepetitionsCount(String sNodeIdentifier)
Returns the total number of already processed repetitions of the node having the given identifier. If sNodeIdentifier is null or "", 0 is returned. 0 is returned too if the internal list of processed node doesn't contain the given node identifier (yet), else the stored value is returned.
Parameters:
sNodeIdentifier - the value of the node's id attribute, i.e. the node identifier
Returns:
0 or higher, the number of processed repetitions on the given node

findFirstNodeByName

protected Node findFirstNodeByName(Node node,
                                   String sNodeName)
Searches the tree recursively, starting with node, for a node having the given name. If such a node is found, it's returned, else null is returned
Parameters:
node - root node to search
sNodeName - name to search for
Returns:
a node named sNodeName or null

createAndAddNextDimDomChild

protected Element createAndAddNextDimDomChild(Element element,
                                              boolean bIsRepeatedCommand)
                                       throws DimDomException
A new child element is created, appended and returned.
Which node is chosen, is up to the specifications of the DimDom. Supported node names are: form, frameset, select, ol/ul and tr.
This method is used primarily to add child nodes in a "pseudo-repeated" context, i.e. the programmer sent a bundle of values that must be filled in by repeatedly calling this method and then processing the received node. Another common usage is the adding of a hidden input to a form tag.
The second task of this method is to repeat some microtemplate structure, e.g. a node that contains some subnodes needs to be repeated as a whole. If so, the method clones the parameter element deeply and appends it to the same parent node, at the following position. This behaviour becomes active if the parameter element is not a supported node (as listed above).
Parameters:
element - element to which a new child shall be added
bIsRepeatedCommand - tells the method whether this is a micro-template structure node or not
Returns:
the new child, as specified above
Throws:
DimDomException - a wrapped DOMException, in case

findAndAddRepeatedElements

protected final void findAndAddRepeatedElements(NodeList nodes,
                                                Vector vRepeatedElements)
                                         throws DimDomException
This method recursively searches the given NodeList for each member of the DOM tree having a defined "dimdom" attribute. When such a node is found, a new instance of the internal RepeatedElement class is created which stores a pointer to that node and knows how many times the node is allowed to be repeated.
Note: This method is visible for extending classes, because it is very useful for the logic process, but it is declared final because it is essential to work for this class as it is.
Parameters:
nodes - the list of (child) nodes to search repeatedly
vRepeatedElements - the list to add the found repeated elements to
Throws:
DimDomException - thrown by the CommandParser, in case

getRepeatedElements

protected AbstractXHTMLDocument.RepeatedElement[] getRepeatedElements(String sNodeIdentifier)
Returns the list of RepeatedElement instances that were initialized for the given node or null, if no such nodes exist for the given node in the template.
Parameters:
sNodeIdentifier - the id attribute of the node to get the repeated elements for
Returns:
the list of repeated elements or null

setRepeatedElements

protected void setRepeatedElements(String sNodeIdentifier,
                                   AbstractXHTMLDocument.RepeatedElement[] repeatedElements)
Sets the list of RepeatedElement instances of the given node. If this list is null, the element is removed from this list.
Important: Calling this method changes the behaviour on these nodes completely, because they are replaced with new ones!
Parameters:
sNodeIdentifier - the id attribute of the node to get the repeated elements for
repeatedElements - the list of repeated elements or null

getTableDataChildCount

protected int getTableDataChildCount(Element element)
Returns the current amount of td or th (see isTableDataNode method) child elements for the given node identifier. This means that if and only if the underlying node is a tr node (a table row to be repeated as a whole), this method returns the amount of first generation table data child elements of this tr node. In any other case, this method returns 0.
The sense of this method is to allow callers to inform themselves about the situation within the underlying node's table row.
Note: The "current" amount is a value that survives only a single processing of a site. For each further dynamic filling of a site, the value is recalculated.
Parameters:
element - the Element for which the value shall be returned
Returns:
the number of "table data" (td/th) child nodes or 0

getStoredTableDataChildCount

protected int getStoredTableDataChildCount(String sNodeIdentifier)
Returns the stored value for the amount of td/th child nodes, as calculated int getTableDataChildCount.
Parameters:
sNodeIdentifier - the id node for which the value shall be returned
Returns:
the number of "table data" (td/th) child nodes or 0

hideChildElements

protected void hideChildElements(Element element,
                                 Node replacingNode)
Hides each child element (!) of element, i.e. removes all of them and adds the replacing node afterwards.
Parameters:
element - the element to hide
replacingNode - the node to replace element with

findFirstText

protected final Text findFirstText(Node node)
Finds the first text down the tree, starting with node. The algorithm recursively looks more than one level to search for text in font nodes, etc.
Parameters:
node - the starting node for the search
Returns:
the text node or null, if not found

removeNodes

protected final void removeNodes(Vector vNodesToDelete)
Removes each node in the given list. If such a node doesn't have a parent node, it's ignored.
Parameters:
vNodesToDelete -  

removeChildTextNodes

protected void removeChildTextNodes(Node node)
Removes the child nodes that are Text nodess.
Parameters:
node - the node to remove the child Texts of

removeChildElements

protected void removeChildElements(Node node)
Removes the child nodes that are Element nodess.
Parameters:
node - the node to remove the child Elements of

buildMicroTemplateNodeList

protected final void buildMicroTemplateNodeList(Hashtable hClonedIDNodeList)
                                         throws DimDomException
(Re)Builds the internal list of micro-template nodes, i.e. those having a child node with a set dimdom attribute. By DimDom specification, a repeated tag can't be neither the html nor the head nor the body nor a form tag.
Parameters:
hClonedIDNodeList - list of id nodes to check
Throws:
DimDomException - thrown by the command parser

isEmpty

protected final boolean isEmpty(String sTestString)
Returns whether the given test string is null or equals the empty string.
Parameters:
sTestString - the String to be tested
Returns:
whether the test string is empty or not

Copyright (c) 2001/02 by Florian Steinsiepe