com.plumtree.xpshared.htmlconstructs
Class PTConstruct

java.lang.Object
  extended by com.plumtree.xpshared.htmlconstructs.PTConstruct

public class PTConstruct
extends java.lang.Object

Author:
beng An objects of this class contains a structure of HTML elements. PTConstruct objects cannot be created by client code, but rather they are generated by the PTConstructFactory class.

A construct contains a nugget of HTML that is commonly used by the various ui components, such as a button, a banner, an image.

The HTMLElements within a PTConstruct can be navigated using various PTConstruct methods, such as GetHTMLElement, GetNestedElement, and GetAllElements.

Various PTConstruct methods allow client code to instert additional HTML elements into the construct, such as ReplaceNestedElementsWithHTMLString, and AddHTMLStringToNestedElement.

Constructor Summary
PTConstruct(PTConstructType type, HTMLElement e)
          Constructor creates a new PTConstruct object.
 
Method Summary
 void AddElementToNestedElement(ElementName enContainer, HTMLElement element)
          Call this method to insert an HTMLElement into an HTMLElement object nested within this construct.
 void AddHTMLEncodedStringToNestedElement(ElementName enContainer, java.lang.String s)
          Call this method to insert an HTML string into an HTMLElement object nested within this construct.
 void AddHTMLStringToNestedElement(ElementName enContainer, java.lang.String s)
          Call this method to insert an HTML string into an HTMLElement object nested within this construct.
 XPArrayList GetAllElements()
          Call this method to obtain an XPArrayList containing all of the HTMLElement objects constituting this construct.
 java.lang.String GetDescription()
          Get the description of this construct.
 HTMLElement GetHTMLElement()
          Call this method to obtain the root HTMLElement of this construct.
 HTMLElement GetNestedElement(ElementName eName)
          Call this method to obtain an HTMLElement nested within this construct.
 XPHashtable GetStringMap()
          Call this method to obtain an XPStringDictionary describing those HTMLElements of this construct containing strings that can be updated.
 PTConstructType GetType()
          Call this method to obtain a PTConstructType specifying the specific type of this construct.
 void ReplaceNestedElementsWithElement(ElementName enContainer, HTMLElement element)
          Call this method to set the inner HTML element of a specific element within this construct.
 void ReplaceNestedElementsWithHTMLEncodedString(ElementName enContainer, java.lang.String s)
          Call this method to set the inner HTML string of a specific element within this construct.
 void ReplaceNestedElementsWithHTMLString(ElementName enContainer, java.lang.String s)
          Call this method to set the inner HTML string of a specific element within this construct.
 void SetElementInnerHTMLElement(ElementName eName, HTMLElement element)
          Deprecated. Use ReplaceNestedElementsWithElement
 void SetElementInnerHTMLEncodedString(ElementName eName, java.lang.String s)
          Deprecated. Use ReplaceNestedElementsWithHTMLString
 void SetElementInnerHTMLString(ElementName eName, java.lang.String s)
          Deprecated. Use ReplaceNestedElementsWithHTMLString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PTConstruct

public PTConstruct(PTConstructType type,
                   HTMLElement e)
Constructor creates a new PTConstruct object. Construct objects are created by the PTConstructFactory object.

Parameters:
type - Pass PTConstructType
e - Pass HTMLElement structure for this construct.
Method Detail

AddElementToNestedElement

public void AddElementToNestedElement(ElementName enContainer,
                                      HTMLElement element)
Call this method to insert an HTMLElement into an HTMLElement object nested within this construct. Any existing HTML nested within the specified container element will be preserved.

Parameters:
enContainer - Pass an ElementName object specifying an HTMLElement object nested within this construct. The HTMLElement passed to this method will be appended to any HTML existing within the container element. If no HTMLElement object having the specified ElementName can be found, an Exception will be thrown.

element - Pass an HTMLElement. This element will be appended to any html existing within the container HTMLElement object specified by the enContainer parameter.
Throws:
java.lang.Exception

AddHTMLStringToNestedElement

public void AddHTMLStringToNestedElement(ElementName enContainer,
                                         java.lang.String s)
Call this method to insert an HTML string into an HTMLElement object nested within this construct. Any existing HTML nested within the specified container element will be preserved.

This will not HTMLEncode the string, and therefore should be used for localized strings, which should be safe.

Parameters:
enContainer - Pass an ElementName object specifying an HTMLElement object nested within this construct. The HTML string passed to this method will be appended to any HTML existing within this element. If no HTMLElement object having the specified ElementName can be found, an Exception will be thrown.

s - Pass an HTML string. This html will be appended to any html existing within the container HTMLElement object specified by the enContainer parameter.
Throws:
java.lang.Exception

AddHTMLEncodedStringToNestedElement

public void AddHTMLEncodedStringToNestedElement(ElementName enContainer,
                                                java.lang.String s)
Call this method to insert an HTML string into an HTMLElement object nested within this construct. Any existing HTML nested within the specified container element will be preserved.

This will HTMLEncode the string, and therefore should not be used for localized strings, which should be safe.

Parameters:
enContainer - Pass an ElementName object specifying an HTMLElement object nested within this construct. The HTML string passed to this method will be appended to any HTML existing within this element. If no HTMLElement object having the specified ElementName can be found, an Exception will be thrown.

s - Pass an HTML string. This html will be appended to any html existing within the container HTMLElement object specified by the enContainer parameter.
Throws:
java.lang.Exception

GetAllElements

public XPArrayList GetAllElements()
Call this method to obtain an XPArrayList containing all of the HTMLElement objects constituting this construct.

This list is recursively genererated, so it is likely that some of the HTMLElements on this list will internally include references to other HTMLElements on this list. For example, if this construct were a table, with a row, with a column, with an image, this method would return an XPArrayList with 4 items: an HTMLTable, an HTMLTableRow, an HTMLTableCell, and an HTMLImg.

Returns:

GetDescription

public java.lang.String GetDescription()
Get the description of this construct.

Returns:
String description

GetHTMLElement

public HTMLElement GetHTMLElement()
Call this method to obtain the root HTMLElement of this construct.

For example, if this construct were a table, with a row, with a cell, with an image, this method would return a reference to an HTMLTable.

Returns:

GetNestedElement

public HTMLElement GetNestedElement(ElementName eName)
Call this method to obtain an HTMLElement nested within this construct. Specify the ElementName identifying the HTMLElement you wish to obtain. ElementName objects can be obtained by calling the PTConstructType.GetElementName( ) method.

Parameters:
eName -
Returns:
Throws:
java.lang.Exception

GetStringMap

public XPHashtable GetStringMap()
Call this method to obtain an XPStringDictionary describing those HTMLElements of this construct containing strings that can be updated.

This XPStringDictionary contains a mapping of element names to string ids. The element name indicates an HTMLElement object nested within this construct. The corresponding string id indicates which localized string is to be nested within.

Returns:

GetType

public PTConstructType GetType()
Call this method to obtain a PTConstructType specifying the specific type of this construct.

Returns:

ReplaceNestedElementsWithElement

public void ReplaceNestedElementsWithElement(ElementName enContainer,
                                             HTMLElement element)
Call this method to set the inner HTML element of a specific element within this construct.

All previous inner html elements and strings will be removed, and replaced with the passed HTMLElement.

Parameters:
enContainer - Pass an ElementName indicating an HTMLElement nested within this construct. All HTMLElements nested within the HTMLElement indicated by this ElementName will be replaced. ElementName objects are available from the specific PTConstructType used to obtain this construct.

element - Pass an HTMLElement. This HTMLElement will be nested within the HTMLElement indicated by the ElementName passed.
Throws:
java.lang.Exception

ReplaceNestedElementsWithHTMLString

public void ReplaceNestedElementsWithHTMLString(ElementName enContainer,
                                                java.lang.String s)
Call this method to set the inner HTML string of a specific element within this construct.

All previous inner html elements and strings will be removed, and replaced with the passed string.

This will not HTMLEncode the string, and therefore should be used for localized strings, which should be safe.

Parameters:
enContainer - Pass an ElementName indicating an HTMLElement nested within this construct. All HTMLElements nested within the HTMLElement indicated by this ElementName will be replaced. ElementName objects are available from the specific PTConstructType used to obtain this construct.

s - Pass an HTML string. This string will be nested within the HTMLElement indicated by the ElementName passed.
Throws:
java.lang.Exception

ReplaceNestedElementsWithHTMLEncodedString

public void ReplaceNestedElementsWithHTMLEncodedString(ElementName enContainer,
                                                       java.lang.String s)
Call this method to set the inner HTML string of a specific element within this construct.

All previous inner html elements and strings will be removed, and replaced with the passed string.

This will HTMLEncode the string, and therefore should not be used with localized strings, which shouldn't need to be encoded.

Parameters:
enContainer - Pass an ElementName indicating an HTMLElement nested within this construct. All HTMLElements nested within the HTMLElement indicated by this ElementName will be replaced. ElementName objects are available from the specific PTConstructType used to obtain this construct.

s - Pass an HTML string. This string will be nested within the HTMLElement indicated by the ElementName passed.
Throws:
java.lang.Exception

SetElementInnerHTMLElement

public void SetElementInnerHTMLElement(ElementName eName,
                                       HTMLElement element)
Deprecated. Use ReplaceNestedElementsWithElement

Call this method to set the inner HTML element of a specific element within this construct.

All previous inner html elements and strings will be removed, and replaced with the passed HTMLElement.

Parameters:
eName -
element -

SetElementInnerHTMLString

public void SetElementInnerHTMLString(ElementName eName,
                                      java.lang.String s)
Deprecated. Use ReplaceNestedElementsWithHTMLString

Call this method to set the inner HTML string of a specific element within this construct.

All previous inner html elements and strings will be removed, and replaced with the passed string. This will not HTMLEncode the string, and therefore should be used for localized strings, which don't need encoding.

Parameters:
eName -
s -
Throws:
java.lang.Exception

SetElementInnerHTMLEncodedString

public void SetElementInnerHTMLEncodedString(ElementName eName,
                                             java.lang.String s)
Deprecated. Use ReplaceNestedElementsWithHTMLString

Call this method to set the inner HTML string of a specific element within this construct.

All previous inner html elements and strings will be removed, and replaced with the passed string. This will HTMLEncode the string, and therefore should not be used for localized strings, which don't need to be encoded.

Parameters:
eName -
s -
Throws:
java.lang.Exception



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.