Package org.pepstock.charba.client.dom
Class DOMBuilder
- java.lang.Object
-
- org.pepstock.charba.client.dom.DOMBuilder
-
public final class DOMBuilder extends Object
Singleton utility to create and manage DOM element.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Canvas
createCanvasElement()
Creates a <canvas> element.Div
createDivElement()
Creates a <div> element.Heading
createHeadingElement()
Creates a <h3> element.Img
createImageElement()
Creates a <img> element.Img
createImageElement(String src)
Creates a <img> element with the full URL of the image.LineBreak
createLineBreakElement()
Creates a <br> element.Script
createScriptElement()
Creates a <script> element.Span
createSpanElement()
Creates a <span> element.Style
createStyleElement()
Creates a <style> element.TableCell
createTableCellElement()
Creates a <td> element.Table
createTableElement()
Creates a <table> element.TableRow
createTableRowElement()
Creates a <tr> element.TextNode
createTextNode(String data)
Creates a text node.String
createUniqueChartId()
Creates an unique id for CHARBA charts id.static DOMBuilder
get()
Returns the singleton instance of the builder.boolean
isCanvasSupported()
Returnstrue
if the canvas is supported by browser.boolean
isUniqueChartId(String id)
Returnstrue
if the passed id is a CHARBA charts id.
-
-
-
Method Detail
-
get
public static DOMBuilder get()
Returns the singleton instance of the builder.- Returns:
- the singleton instance of the builder
-
createUniqueChartId
public String createUniqueChartId()
Creates an unique id for CHARBA charts id.- Returns:
- an unique id for CHARBA charts id
-
isUniqueChartId
public boolean isUniqueChartId(String id)
Returnstrue
if the passed id is a CHARBA charts id.- Parameters:
id
- an id instance to check- Returns:
true
if the passed id is a CHARBA charts id
-
isCanvasSupported
public boolean isCanvasSupported()
Returnstrue
if the canvas is supported by browser.- Returns:
true
if the canvas is supported by browser
-
createCanvasElement
public Canvas createCanvasElement()
Creates a <canvas> element.- Returns:
- the newly created element
-
createDivElement
public Div createDivElement()
Creates a <div> element.- Returns:
- a <div> element
-
createScriptElement
public Script createScriptElement()
Creates a <script> element.- Returns:
- a <script> element
-
createStyleElement
public Style createStyleElement()
Creates a <style> element.- Returns:
- a <style> element
-
createLineBreakElement
public LineBreak createLineBreakElement()
Creates a <br> element.- Returns:
- a <br> element
-
createSpanElement
public Span createSpanElement()
Creates a <span> element.- Returns:
- a <span> element
-
createImageElement
public Img createImageElement()
Creates a <img> element.- Returns:
- a <img> element
-
createImageElement
public Img createImageElement(String src)
Creates a <img> element with the full URL of the image.- Parameters:
src
- the full URL of the image- Returns:
- a <img> element
-
createTableElement
public Table createTableElement()
Creates a <table> element.- Returns:
- a <table> element
-
createTableRowElement
public TableRow createTableRowElement()
Creates a <tr> element.- Returns:
- a <tr> element
-
createTableCellElement
public TableCell createTableCellElement()
Creates a <td> element.- Returns:
- a <td> element
-
createHeadingElement
public Heading createHeadingElement()
Creates a <h3> element.- Returns:
- a <h3> element
-
-