org.jopendocument.dom.template.statements
Class Statement

java.lang.Object
  extended by org.jopendocument.dom.template.statements.Statement
Direct Known Subclasses:
BaseStatement, Include

public abstract class Statement
extends Object

A statement that will be executed to modify the parsed xml.

Author:
Sylvain

Field Summary
static org.jdom.Namespace stmtNS
           
 
Constructor Summary
Statement(String name)
           
 
Method Summary
abstract  void execute(Processor<?> processor, org.jdom.Element elem, DataModel model)
          Should produce valid OpenDocument XML.
protected static org.jdom.Element getAncestorByName(org.jdom.Element element, String name)
           
protected static org.jdom.Element getElement(String name)
           
 String getName()
          The name of this statement.
abstract  boolean matches(org.jdom.Element elem)
          Find representations of this statement.
abstract  void prepare(org.jdom.Element elem)
          Creates an element named getName().
protected static void pullUp(org.jdom.Element elem)
          Replace elem by its content.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

stmtNS

public static final org.jdom.Namespace stmtNS
Constructor Detail

Statement

public Statement(String name)
Method Detail

getName

public final String getName()
The name of this statement. prepare(Element) must create an Element with that name.

Returns:
the name of this statement.

matches

public abstract boolean matches(org.jdom.Element elem)
Find representations of this statement.

Parameters:
elem - the element to test.
Returns:
true if elem should prepared by this statement.

prepare

public abstract void prepare(org.jdom.Element elem)
                      throws TemplateException
Creates an element named getName().

Parameters:
elem - an element that returned true with matches(Element).
Throws:
TemplateException

execute

public abstract void execute(Processor<?> processor,
                             org.jdom.Element elem,
                             DataModel model)
                      throws TemplateException
Should produce valid OpenDocument XML.

Parameters:
processor - the processor.
elem - an element that has been prepared.
model - the data.
Throws:
TemplateException

toString

public String toString()
Overrides:
toString in class Object

getElement

protected static org.jdom.Element getElement(String name)

getAncestorByName

protected static org.jdom.Element getAncestorByName(org.jdom.Element element,
                                                    String name)

pullUp

protected static void pullUp(org.jdom.Element elem)
Replace elem by its content. Ie elem will be detached from the tree and its content will be inserted at this former location.

Parameters:
elem - the element to remove.


Copyright © 2010 jOpenDocument All Rights Reserved.