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).
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. |
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 |
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 parserIOException
- thrown by the file systemDimDomException
- thrown in case something in the template
isn't DimDom compliant
SimpleDocument
SimpleDocument()
- Constructor is empty and package protected.
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:
- If the list of RepeatedElements is empty, null is returned
- If the internal list of RepeatedElements contains only one element
related to (i.e. a child node of the given element) element and the
repeat mode is * (= -1), a clone of this single repeated element is
returned
- If the internal list of RepeatedElements contains multiple
elements, the returned node is evaluated based on the following rules:
- Whether the current number of repetition on the same node,
compared to the maximum allowed repetition value defined in the
template (node), is still smaller or equal; if not, the next repeated
element is asked, and so on
- Whether it's a tr tag or not
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
processedelement
- 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