nl.lxtreme.ols.util.export
Class TagElement

java.lang.Object
  extended by nl.lxtreme.ols.util.export.TagElement
All Implemented Interfaces:
Cloneable, ExportUtils.HtmlExporter.Element

public final class TagElement
extends Object
implements ExportUtils.HtmlExporter.Element

Provides a "tag" element, such as <div>-elements.


Constructor Summary
TagElement(String aName)
          Creates a new TagElement instance.
TagElement(String aName, boolean aNeedsCloseTag)
          Creates a new TagElement instance.
 
Method Summary
 ExportUtils.HtmlExporter.Element addAttribute(String aName, String aValue)
          Adds an attribute to this element.
 ExportUtils.HtmlExporter.Element addChild(ExportUtils.HtmlExporter.Element aChild)
          Adds a new child element to this element.
 ExportUtils.HtmlExporter.Element addChild(String aName)
          Adds a new child element to this element.
 ExportUtils.HtmlExporter.Element addContent(String... aValue)
          Adds text content to this element.
 ExportUtils.HtmlExporter.Element clone()
          Creates a deep copy of this element.
 Collection<ExportUtils.HtmlExporter.Attribute> getAttributes()
          Returns the attributes of this element.
 ExportUtils.HtmlExporter.Element getChildByName(String aName)
          Returns the first child with the given name.
 Collection<ExportUtils.HtmlExporter.Element> getChildren()
          Returns the child-elements of this element.
 String getName()
          Returns the name of this element.
 String toString()
          
 String toString(ExportUtils.HtmlExporter.MacroResolver aResolver)
          Returns the string representation of this HTML-element.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TagElement

public TagElement(String aName)
Creates a new TagElement instance.

Parameters:
aName - the name of this tag element, cannot be null.

TagElement

public TagElement(String aName,
                  boolean aNeedsCloseTag)
Creates a new TagElement instance.

Parameters:
aName - the name of this tag element, cannot be null;
aNeedsCloseTag - true if a separate closing tag is needed, false if this tag can be closed in an inline manner.
Method Detail

addAttribute

public ExportUtils.HtmlExporter.Element addAttribute(String aName,
                                                     String aValue)
Adds an attribute to this element.

Specified by:
addAttribute in interface ExportUtils.HtmlExporter.Element
Parameters:
aName - the name of the attribute to add;
aValue - the value of the attribute to add.
Returns:
this element.

addChild

public ExportUtils.HtmlExporter.Element addChild(ExportUtils.HtmlExporter.Element aChild)
Adds a new child element to this element.

Specified by:
addChild in interface ExportUtils.HtmlExporter.Element
Parameters:
aChild - the child element to add, cannot be null.
Returns:
the added child element (which is a clone of the one given!).

addChild

public ExportUtils.HtmlExporter.Element addChild(String aName)
Adds a new child element to this element.

Specified by:
addChild in interface ExportUtils.HtmlExporter.Element
Parameters:
aName - the name of the child element to add, cannot be null.
Returns:
the added child element.

addContent

public ExportUtils.HtmlExporter.Element addContent(String... aValue)
Adds text content to this element.

Specified by:
addContent in interface ExportUtils.HtmlExporter.Element
Parameters:
aValue - the text-values to add, cannot be null.
Returns:
this element.

clone

public ExportUtils.HtmlExporter.Element clone()
Creates a deep copy of this element.

Specified by:
clone in interface ExportUtils.HtmlExporter.Element
Overrides:
clone in class Object
See Also:
Object.clone()

getAttributes

public Collection<ExportUtils.HtmlExporter.Attribute> getAttributes()
Returns the attributes of this element.

Specified by:
getAttributes in interface ExportUtils.HtmlExporter.Element
Returns:
a collection of attributes, never null.

getChildByName

public ExportUtils.HtmlExporter.Element getChildByName(String aName)
Returns the first child with the given name.

Specified by:
getChildByName in interface ExportUtils.HtmlExporter.Element
Parameters:
aName - the name of the child to get, cannot be null.
Returns:
the first child with the given name, or null if no such child was found.

getChildren

public Collection<ExportUtils.HtmlExporter.Element> getChildren()
Returns the child-elements of this element.

Specified by:
getChildren in interface ExportUtils.HtmlExporter.Element
Returns:
a collection of child-elements, never null.

getName

public String getName()
Returns the name of this element.

Specified by:
getName in interface ExportUtils.HtmlExporter.Element
Returns:
the name of this element, never null.

toString

public String toString()

Overrides:
toString in class Object

toString

public String toString(ExportUtils.HtmlExporter.MacroResolver aResolver)
Returns the string representation of this HTML-element.

Specified by:
toString in interface ExportUtils.HtmlExporter.Element
Parameters:
aResolver - the macro resolver to use for any found macros.
Returns:
the string representation of this element, never null.


Copyright © 2012 L'Xtreme IT consultancy. All Rights Reserved.