DimDom v0.8.2

org.alltimeflashdreamer.dimdom
Class SimpleDocument

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

public class SimpleDocument
extends AbstractXHTMLDocument

Title: SimpleDocument
Description: This class implements the "simple" logic of the DimDom, extending the very "base" logic from AbstractHTMLDocument, which means that it implements the abstract method getNextRepeatedElement method defined in the superclass. This method is called in case the programmer coded more than one DimDom command on a node having children with a set "dimdom" attribute, telling the DimDom engine that they are ready to be multiplied/cloned on each repeated command (i.e. on the same original template node).


Inner classes inherited from class org.alltimeflashdreamer.dimdom.AbstractXHTMLDocument
AbstractXHTMLDocument.RepeatedElement
 
Fields inherited from class org.alltimeflashdreamer.dimdom.AbstractXHTMLDocument
hIDNodeList, hMicroTemplateNodes, hProcessedIDs, siteData
 
Constructor Summary
(package private) SimpleDocument()
          Constructor is empty and package protected.
  SimpleDocument(XHTMLSiteData siteData)
          Constructor is package protected and proceeds the full job list to be immediately printable.
 
Method Summary
protected  Element getNextRepeatedElement(String sNodeIdentifier, Element element)
          This method is the core of the SimpleDocument's "intelligence".
 
Methods inherited from class org.alltimeflashdreamer.dimdom.AbstractXHTMLDocument
buildListOfIDNodes, buildMicroTemplateNodeList, createAndAddNextDimDomChild, createEmptyTextNode, createSelectedElement, findAndAddRepeatedElements, findFirstLeafElement, findFirstNodeByName, findFirstText, getElement, getFirstText, getProcessedRepetitionsCount, getRepeatedElements, getStoredTableDataChildCount, getTableDataChildCount, hide, hideChildElements, isDimDomListNode, isEmpty, isHTMLListNode, isRepeatedCommand, isTableDataNode, isTableRowNode, parseFile, parseFile, parseInputStream, parseString, print, processDimDomNode, removeChildElements, removeChildTextNodes, removeNodes, setAttribute, setCommonAttribute, setContent, setContent, setOptionTagSelected, setRepeatedElements, setSiteData, setText, setText, setTexts, setTexts, wrapWithLink
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDocument

public SimpleDocument(XHTMLSiteData siteData)
               throws SAXException,
                      IOException,
                      DimDomException
Constructor is package protected and proceeds the full job list to be immediately printable.
Parameters:
siteData - the XHTMLSiteData implementing class
Throws:
SAXException - thrown by the parser
IOException - thrown by the file system
DimDomException - thrown in case something in the template isn't DimDom compliant

SimpleDocument

SimpleDocument()
Constructor is empty and package protected.
Method Detail

getNextRepeatedElement

protected Element getNextRepeatedElement(String sNodeIdentifier,
                                         Element element)
                                  throws DimDomException
This method is the core of the SimpleDocument's "intelligence". Because it is only called in case the designer added a "dimdom=repeat(n)" attribute to at least one subnode of a node having an "id" attribute, its "calling context" is very special in general. Therefore, the method first checks the context and then reacts according to the situation, along the rules listed below.
The returned element is the one that is in turn to be filled according to the "dimdom=repeat(n)" setting(s) in the template. Returned values are: Each child node is repeated "rowwise", i.e. the engine assumes that the designer implemented a "micro-template" structure that shall be repeated as a whole bunch. In case there is a microtemplate within one of the tr element's subnodes (imagine one wants to dynamically change multiple img nodes within a td tag), the engine rowwise adapts the microtemplate's nodes and then clones the whole row, restarting with the first repeated subnode of the new tr element.
The new element, i.e. the current clone of a template node, is appended to the template node (which will later be deleted, during printing of the DOM) immediately.
Important: If the cloned element is an input element (select, input or button), it's asked for its name attribute. If this attribute is defined, its value is modified by the current number of repetitions, but only if this number is greater than 0.
Overrides:
getNextRepeatedElement in class AbstractXHTMLDocument
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

Copyright (c) 2001/02 by Florian Steinsiepe