fr.opensagres.xdocreport.document.preprocessor.sax
Class BufferedElement

java.lang.Object
  extended by fr.opensagres.xdocreport.document.preprocessor.sax.BufferedElement
All Implemented Interfaces:
IBufferedRegion, ISavable
Direct Known Subclasses:
AbstractNoteBufferedRegion, AbstractNoteReferenceBufferedRegion, APBufferedRegion, ARBufferedRegion, BookmarkBufferedRegion, BufferedDocument, HyperlinkBufferedRegion, MergefieldBufferedRegion, PBufferedRegion, RowBufferedRegion, TableBufferedRegion, TxBodyBufferedRegion

public class BufferedElement
extends Object
implements IBufferedRegion

Buffered element which stores start Tag element (ex: ) and end Tag element (ex: ). The start Tag element stores too the BufferedElement children.


Field Summary
protected  BufferedEndTagElement endTagElement
           
protected  BufferedStartTagElement startTagElement
           
 
Constructor Summary
BufferedElement(BufferedElement parent, String uri, String localName, String name, Attributes attributes)
           
 
Method Summary
 void addRegion(ISavable region)
          Add a savable region in the current tag element.
 void append(char c)
          Append content in the current tag element.
 void append(char[] ch, int start, int length)
          Append content in the current tag element.
 void append(String content)
          Append content in the current tag element.
 void end()
          Set the current buffer with end tag element.
 List<BufferedElement> findChildren(BufferedElement element, String name)
          Returns the children element of the given element which match the given name.
 List<BufferedElement> findChildren(String name)
          Returns the children element of this element which match the given name.
 BufferedElement findFirstChild(BufferedElement element, String name)
          Returns the first child element of this element which match the given name and null otherwise.
 BufferedElement findFirstChild(String name)
          Returns the first child element of the given element which match the given name and null otherwise.
 BufferedElement findParent(BufferedElement element, String name)
          Returns the parent element of the given element which match the given name.
 BufferedElement findParent(String name)
          Returns the parent element of this element which match the given name.
 String get(String key)
           
 Attributes getAttributes()
          Returns the static SAX attributes.
 BufferedEndTagElement getEndTagElement()
          Returns the buffer of the end tag element.
 String getEndTagElementName()
          Returns the name of this end tag element (ex : ).
 String getInnerText()
           
 String getName()
           
 BufferedElement getOwnerElement()
          Returns the owner element.
 BufferedElement getParent()
          Returns the parent buffered element of this element.
 BufferedStartTagElement getStartTagElement()
          Returns the buffer of the start tag element.
 String getStartTagElementName()
          Returns the name of this start tag element (ex : ).
 String getTextContent()
          Returns the text content for this element.
 boolean isEnded()
          Returns true if current buffer is end tag element and false otherwise.
 boolean isReseted()
           
 boolean isString()
          Returns false
 boolean match(String name)
          Returns true if the given name match the name of this element and false otherwise.
 void put(String key, String value)
           
 void registerDynamicAttributes()
          Register dynamic attributes if needed.
 void removeAll(Collection<BufferedElement> elements)
          Remove the collection of element.
 void reset()
          Reset the whole content of the element.
 void save(Writer writer)
          Write the content of this element in the given writer.
 BufferedAttribute setAttribute(String name, String value)
          Set dynamic attribute.
 void setContentAfterEndTagElement(String after)
          Set content on the after end tag element.
 void setContentBeforeStartTagElement(String before)
          Set content on the before start tag element.
 void setInnerText(String innerText)
           
 void setTextContent(String content)
          Set text content for this element.
 void start()
          Set the current buffer with start tag element.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

startTagElement

protected final BufferedStartTagElement startTagElement

endTagElement

protected final BufferedEndTagElement endTagElement
Constructor Detail

BufferedElement

public BufferedElement(BufferedElement parent,
                       String uri,
                       String localName,
                       String name,
                       Attributes attributes)
Method Detail

match

public boolean match(String name)
Returns true if the given name match the name of this element and false otherwise.

Parameters:
name -
Returns:

getStartTagElement

public BufferedStartTagElement getStartTagElement()
Returns the buffer of the start tag element.

Returns:

getEndTagElement

public BufferedEndTagElement getEndTagElement()
Returns the buffer of the end tag element.

Returns:

setContentBeforeStartTagElement

public void setContentBeforeStartTagElement(String before)
Set content on the before start tag element.

Parameters:
before -

setContentAfterEndTagElement

public void setContentAfterEndTagElement(String after)
Set content on the after end tag element.

Parameters:
before -

getParent

public BufferedElement getParent()
Returns the parent buffered element of this element.

Specified by:
getParent in interface IBufferedRegion
Returns:

save

public void save(Writer writer)
          throws IOException
Write the content of this element in the given writer.

Specified by:
save in interface ISavable
Throws:
IOException

addRegion

public void addRegion(ISavable region)
Add a savable region in the current tag element.

Specified by:
addRegion in interface IBufferedRegion

isString

public boolean isString()
Returns false

Specified by:
isString in interface IBufferedRegion
Returns:

append

public void append(String content)
Append content in the current tag element.

Specified by:
append in interface IBufferedRegion

append

public void append(char[] ch,
                   int start,
                   int length)
Append content in the current tag element.

Specified by:
append in interface IBufferedRegion

append

public void append(char c)
Append content in the current tag element.

Specified by:
append in interface IBufferedRegion

reset

public void reset()
Reset the whole content of the element.


isReseted

public boolean isReseted()

removeAll

public void removeAll(Collection<BufferedElement> elements)
Remove the collection of element.

Parameters:
elements -

toString

public String toString()
Overrides:
toString in class Object

getOwnerElement

public BufferedElement getOwnerElement()
Returns the owner element.

Specified by:
getOwnerElement in interface ISavable
Returns:

findParent

public BufferedElement findParent(String name)
Returns the parent element of this element which match the given name.

Parameters:
element -
name -
Returns:

findParent

public BufferedElement findParent(BufferedElement element,
                                  String name)
Returns the parent element of the given element which match the given name.

Parameters:
element -
name -
Returns:

findChildren

public List<BufferedElement> findChildren(String name)
Returns the children element of this element which match the given name.

Parameters:
name -
Returns:

findChildren

public List<BufferedElement> findChildren(BufferedElement element,
                                          String name)
Returns the children element of the given element which match the given name.

Parameters:
element -
name -
Returns:

findFirstChild

public BufferedElement findFirstChild(String name)
Returns the first child element of the given element which match the given name and null otherwise.

Parameters:
name -
Returns:

findFirstChild

public BufferedElement findFirstChild(BufferedElement element,
                                      String name)
Returns the first child element of this element which match the given name and null otherwise.

Parameters:
name -
Returns:

start

public void start()
Set the current buffer with start tag element.


end

public void end()
Set the current buffer with end tag element.


isEnded

public boolean isEnded()
Returns true if current buffer is end tag element and false otherwise.

Returns:

getStartTagElementName

public String getStartTagElementName()
Returns the name of this start tag element (ex : ).

Returns:

getEndTagElementName

public String getEndTagElementName()
Returns the name of this end tag element (ex : ).

Returns:

setTextContent

public void setTextContent(String content)
Set text content for this element.

Parameters:
content -

getTextContent

public String getTextContent()
Returns the text content for this element.

Returns:

getAttributes

public Attributes getAttributes()
Returns the static SAX attributes.

Returns:

registerDynamicAttributes

public void registerDynamicAttributes()
Register dynamic attributes if needed.


setAttribute

public BufferedAttribute setAttribute(String name,
                                      String value)
Set dynamic attribute.

Parameters:
name -
value -
Returns:

getName

public String getName()

getInnerText

public String getInnerText()

setInnerText

public void setInnerText(String innerText)

get

public String get(String key)

put

public void put(String key,
                String value)


Copyright © 2013. All rights reserved.