echopointng.ui.util
Class TriCellTable

java.lang.Object
  extended by echopointng.ui.util.TriCellTable

public class TriCellTable
extends java.lang.Object

Renders an HTML table that has two or three "container" cells and independently settable margins between them. These tables are useful for rendering buttons that have two or three elements (images, text labels, and state indicators). This class supports all possible permutations for placement of each of the two or three contained components.


Field Summary
static int BOTTOM_TOP
           
static int LEFT_RIGHT
           
static int RIGHT_LEFT
           
static int TOP_BOTTOM
           
 
Constructor Summary
TriCellTable(org.w3c.dom.Document document, java.lang.String id, int orientation0_1, Extent margin0_1)
          Creates a two-celled TriCellTable.
TriCellTable(org.w3c.dom.Document document, java.lang.String id, int orientation0_1, Extent margin0_1, int orientation01_2, Extent margin01_2)
          Creates a three-celled TriCellTable.
 
Method Summary
 void addGlobalAttribute(java.lang.String name, java.lang.String value)
          Adds an attribute to every table cell in the rendered table.
 org.w3c.dom.Element getMarginTdElement(int index)
          Returns the specified margin element.
 org.w3c.dom.Element getTableElement()
          Returns the created table element.
 org.w3c.dom.Element getTdElement(int index)
          Returns the specified container element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT_RIGHT

public static final int LEFT_RIGHT
See Also:
Constant Field Values

RIGHT_LEFT

public static final int RIGHT_LEFT
See Also:
Constant Field Values

TOP_BOTTOM

public static final int TOP_BOTTOM
See Also:
Constant Field Values

BOTTOM_TOP

public static final int BOTTOM_TOP
See Also:
Constant Field Values
Constructor Detail

TriCellTable

public TriCellTable(org.w3c.dom.Document document,
                    java.lang.String id,
                    int orientation0_1,
                    Extent margin0_1)
Creates a two-celled TriCellTable.

Parameters:
document - the outgoing XML document
id - the id of the root element
orientation0_1 - The orientation of Element 0 with respect to Element 1, one of the following values:
  • LEFT_RIGHT (element 0 is to the left of element 1)
  • RIGHT_LEFT (element 1 is to the left of element 0)
  • TOP_BOTTOM (element 0 is above element 1)
  • BOTTOM_TOP (element 1 is above element 0)
margin0_1 - The margin size between element 0 and element 1.

TriCellTable

public TriCellTable(org.w3c.dom.Document document,
                    java.lang.String id,
                    int orientation0_1,
                    Extent margin0_1,
                    int orientation01_2,
                    Extent margin01_2)
Creates a three-celled TriCellTable.

Parameters:
document - the outgoing XML document
id - the id of the root element
orientation0_1 - The orientation of Element 0 with respect to Element 1, one of the following values:
  • LEFT_RIGHT (element 0 is to the left of element 1)
  • RIGHT_LEFT (element 1 is to the left of element 0)
  • TOP_BOTTOM (element 0 is above element 1)
  • BOTTOM_TOP (element 1 is above element 0)
margin0_1 - The margin size between element 0 and element 1.
orientation01_2 - The orientation of Elements 0 and 1 with respect to Element 2, one of the following values:
  • LEFT_RIGHT (elements 0 and 1 are to the left of element 1)
  • RIGHT_LEFT (element 2 is to the left of elements 0 and 1)
  • TOP_BOTTOM (elements 0 and 1 are above element 2)
  • BOTTOM_TOP (element 2 is above elements 0 and 1)
margin01_2 - The margin size between the combination of elements 0 and 1 and element 2.
Method Detail

addGlobalAttribute

public void addGlobalAttribute(java.lang.String name,
                               java.lang.String value)
Adds an attribute to every table cell in the rendered table.

Parameters:
name - The name of the attribute.
value - The value of the attribute.

getTableElement

public org.w3c.dom.Element getTableElement()
Returns the created table element.

Returns:
the table element

getTdElement

public org.w3c.dom.Element getTdElement(int index)
Returns the specified container element.

Parameters:
index - The index of the table element to return. For two-celled tables, legitimate values are 0 and 1. For three-celled tables, legitimate values are 0, 1, and 2.
Returns:
The specified container element.

getMarginTdElement

public org.w3c.dom.Element getMarginTdElement(int index)
Returns the specified margin element.

Parameters:
index - The index of the table element to return. Index 0 is the margin element between container cells 0 and 1. Index 1 is the margin element between container cells 0/1 and 2.
Returns:
The specified margin element. Returns null if the margin is zero pixels.