Plumtree UI Infrastructure API  
 

HTMLElement Members

HTMLElement overview

Public Static Fields

aNewLine 
bAllowEvents Toggle this false to log errors when clients attempt to set values for attributes such as onclick, and onmouseover.
bAllowSetStyleClassWithString Set this member variable to specify whether or not the SetStyleClass method throws an HTMLException when called with a String parameter. If this member is set false, SetStyleClass( String ) will always throw an HTMLException. This is intended to force use of the corresponding method SetStyleClass( StyleClass ), to ensure valid style classes.
bCheckNestedStringForHTML Set this boolean true to cause HTMLElements to write warnings to the log file if nested strings contain HTML.
bEnforceMaxTableDepth Set this member variable to specify whether or not a maximum table depth is enforced. If this member is true, then the display methods will throw exceptions if there are tables nested too deeply. See iMaxTableDepth.
bPrintComments Set this member variable to specify whether or not comments are printed by the display methods.
iMaxTableDepth This int member specifies the maximum depth of table nesting. This is not enforced if bEnforceMaxTableDepth is false.
sNewLine Set this member to specify the newline character. If output is being formatted, this character is appended frequently. If output is not being formatted, this character is not used.
sTab This member variable to specify the tab character. If output is being formatted, this character is appended zero or more times to the beginning of each line.

Public Static Methods

GetValidationLevel Call this method to obtain the ValidationLevel.
SetValidationLevel Call this method to specify the level at which html validation will occur. Each available level will toggle each of the methods of validation that can occur.

Methods of validation currently include:

  • Enforcement of maximum table depth.
  • Validation of HTML on the display of an HTMLPage.


This method is offered as a convenience. Individual validation methods can be toggled individually.

Validation methods are enabled on a package-level-scope. For example, if maximum table depth is being enforced, it's enforced for all HTMLPage objects created. Validation methods cannot be toggled on an object-level-scope.
ToByteArray Convert a String to a byte array using XPStringUtility's default encoding, UTF-8. If the string is null return an array of zero length.

Public Instance Fields

bForceFormattingOff Set this boolean true to force formatting of for this element as well as nested elements.
bForceFormattingOn 

Public Instance Methods

AddInnerHTMLElement Call this method to append an additional HTML element to be displayed within this HTML element. For example, if this is a <body> element, and you append an <img> element, and then you append an <a> element, the body element will display something like: "<body><img><a></body>"

Not all HTML elements allow you to append inner HTML elements. Such elements will throw an exception if you attempt to do this.
AddInnerHTMLEncodedString Call this method to append an additional HTML String to be displayed within this HTML element. For example, if this is a <body> element, and you append the "<img>" String, and then you append the "<a>" String, the body element will display something like: "<body><img><a></body>"

Not all HTML elements allow you to append inner HTML Strings. Such elements will throw an exception if you attempt to do this.

The String appended is not validated. You are free to append garbage. This String will be automatically HTMLEncoded for you. This method will be significantly slower than addInnerHTMLString(), so it should only be used for data that really needs to be HTMLEncoded (things entered by users). This method should not be used for localized strings, which should be safe. If a string contains some text that should be encoded, and some that should not, it should be manually encoded and addInnerHTMLString() should be used.
AddInnerHTMLString Call this method to append an additional HTML String to be displayed within this HTML element. For example, if this is a <body> element, and you append the "<img>" String, and then you append the "<a>" String, the body element will display something like: "<body><img><a></body>"

Not all HTML elements allow you to append inner HTML Strings. Such elements will throw an exception if you attempt to do this.

The String appended is not validated. You are free to append garbage. This String will not be HTMLEncoded, therefore this method will be faster than addInnerHTMLEncodedString(). All localized strings should be safe and should therefore use this method. If a string contains some text that should be encoded, and some that should not, it should be manually encoded and this method should be used instead of addInnerHTMLEncodedString().
CleanupHTMLSubtreeAfterRendering This is only called if this element is the root of the display tree.
ClearInnerHTMLElements Call this method to remove all nested html elements from this element.
Clone Do not call this method. This is implemented only so that internal clone methods can call clone() on HTMLElement objects.
DisplayOverloaded. Call this method to display this object's HTML to an IXPResponse object.
Equals (inherited from Object)Determines whether the specified Object is equal to the current Object.
ForceFormattingOff Call this method to force formatting off for this HTMLElement object.

Whether or not HTML is formatted generally percolates down through an HTMLElement structure.
GetClone Call this method to obtain a clone of this HTMLElement object.
GetDisabled Call this method to determine whether or not the disabled attribute is displayed for this HTML element.
GetDisplayDidPause Call this method to determine whether or not the most recent call to one of the display methods paused. If this method returns true, a display method must be called again to render a complete HTML page.
GetDisplayStringOverloaded. Call this method to obtain a String of HTML markup that represents this HTML element, and all HTML elements nested within.
GetDo508Checking This method returns whether or not to do 508 validity checking for HTMLElements. If this is true, HTMLElements will try to enforce that the developer does not make HTML that is not 508 compliant.
GetDoFormat Call this method to determine whether or not this HTML element generates HTML text formatted for readabilty.
GetElementName Call this method to determine the name of this element.
GetForceLineBreaksAfterSafeElements This method returns whether or not to use line breaks after elements where it does not affect the HTML output.
GetHashCode (inherited from Object)Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
GetID Call this method to determine the value of the id attribute of this HTML element.
GetImgBaseUrl Call this method to obtain the base url used for all HTMLImg objects being displayed
GetInnerHTMLOverloaded.  
GetInnerHTMLDisplayString 
GetInnerHTMLElements Call this method to obtain an enumeration of the HTMLElement objects nested within this HTMLElement.

GetInnerHTMLElementsAsArrayList Call this method to get an XPArrayList containing all nested HTMLElement objects.
GetIsNetscape This method returns whether or not the browser is Netscape.
GetLang Returns the language for use in the attribute, either the local language if available, or the global language.
GetName Call this method to determine the value of the name attribute of this HTML element.
GetOnClick Call this method to obtain the value of the setonclick attribute.
GetOnKeyDown Call this method to obtain the value of the onkeydown attribute.
GetOnKeyPress Call this method to obtain the value of the onkeypress attribute.
GetOnKeyUp Call this method to obtain the value of the onkeyup attribute.
GetOnMouseOut Call this method to obtain the value of the onmouseout attribute.
GetOnMouseOver Call this method to obtain the value of the onmouseover attribute.
GetPauseAfterDisplay Call this method to determine whether or not this element pauses after display.
GetPostComment Call this method to obtain the comment that is written after the closing tag of this element.
GetPreComment Call this method to obtain the comment that is written before the opening tag of this element.
GetStyle Call this method to obtain the value of the style attribute of this HTML element.
GetStyleClass Call this method to determine the style class assigned to this HTML element. This style class will be rendered as an attribute of this element, like: <a class="styleclass"...
GetStyleClassPrefix This method returns the style class prefix used for all HTMLElement objects being displayed.
GetTitle 
GetType (inherited from Object)Gets the Type of the current instance.
InsertInnerHTMLElement Adds an innerHTMLElement to the specified element, while also returning the element added.
SaveToTempFileOverloaded. This method saves the display string of this object to a temporary file.

SetDisabled Call this method to toggle the "disabled" attribute for this element.
SetDo508Checking This method sets whether or not to do 508 validity checking for HTMLElements. If this is true, HTMLElements will try to enforce that the developer does not make HTML that is not 508 compliant. This can only be used on a top-level HTMLElement (usually an HTMLPage).
SetDoFormat Call this method to specify whether or not this HTML element generates HTML text formatted for readabilty.
SetElementName Call this method to give this element a name. The name does not affect the HTML output of this element, the name is purely for identification puposes.
SetFlushAfterDisplay Call this method to cause the IXPResponse.Flush() method to be called after this element displays itself. This will only cause a flushing of the response buffer if the IXPResponse object is passed to the display method.
SetForceLineBreaksAfterSafeElements This method controls whether or not to use line breaks after elements where it does not affect the HTML output. This can only be used on a top-level HTMLElement (usually an HTMLPage).
SetID Call this method to set the ID attribute for this HTML element.

ID attributes may not contain spaces or dollar signs or anything weird. ID attributes must be unique to each element on a given HTML page. This is currently not enforced by this method.
SetImgBaseUrl Call this method to set the base url used for all HTMLImg objects being displayed.

Call this method only on the root HTMLElement object. If you are building an HTMLPage, for example, call myPage.SetImgBaseUrl( "http://blah/" );. All nested HTMLImg objects may use the base url specified on the HTMLPage object.

HTMLImg objects may or may not use this base url specified. This can only be used on a top-level HTMLElement (usually an HTMLPage).
SetIsNetscape This method sets whether or not the browser is Netscape. Certain HTMLElements will display differently on Netscape versus other browsers. This can only be used on a top-level HTMLElement (usually an HTMLPage).
SetLangGlobal Set the default language available for all child elements -- not necessarily displayed unless the element is set to display the language attribute.
SetLangLocal Sets the value of the language attribute used by this element not the parent or child element(s).
SetName Call this method to set the value of the name attribute of this HTML element.
SetOnClick Call this method to set the setonclick attribute
SetOnKeyDown Call this method to set the onkeydown attribute
SetOnKeyPress Call this method to set the onkeypress attribute
SetOnKeyUp Call this method to set the onkeyup attribute
SetOnMouseOut Call this method to set the onmouseout attribute
SetOnMouseOver Call this method to set the onmouseover attribute
SetPauseAfterDisplay Call this method to specify whether or not this element pauses after display. If you pass true, after this html element fully renders, display will stop. The resulting HTML will not be complete. One of the display methods must be called again, and rendering will resume with the html immediately after this element. Call GetDisplayPaused() to determine whether or not the previous call to one of the display methods resulted in a pause.
SetPostComment Use this method to set a comment that will be written after the closing tag of this element.
SetPreComment Use this method to set a comment that will be written before the opening tag of this element.
SetStyle Call this method to set the style attribute for this html element. Calling this method with the parameter "text-decoration:none" for example, will cause this element to display something like: <a style="text-decoration:none"...
SetStyleClassOverloaded. Call this method to Set the style class for this HTML element. Calling this method with the parameter "gContentSection", for example, will cause this element to display something like: <td class="gContentSection"...
SetStyleClassPrefix Call this method to set the prefix used for all HTMLElement objects being displayed.

Call this method only on the root HTMLElement object. If you are building an HTMLPage, for example, call myPage.SetStyleClassPrefix( "PREFIX" );. All nested objects may use the prefix specified on the HTMLPage object.

This can only be used on a top-level HTMLElement (usually an HTMLPage).
SetTitle 
ToString (inherited from Object)Returns a String that represents the current Object.

Protected Instance Fields

bDisplayDidPause 
bPauseAfterDisplay 
bResumingAndChildFinished 
bResumingAndChildInMidRender 
bShowLang 
sLangLocal sLangLocal is used when an element's lang attribute is different from the global lang attribute. For example a search result page may display results in languages different from the page itself.

Protected Instance Methods

AppendBeginningOfOpeningTag Concrete subclasses must implement this method. This method is responsible for appending the begining of the opening tag, for example: <tagname attribute="blah"

Common attributes will be automatically appended to the begninning of the opening tag.
AppendClosingLineBreak 
AppendClosingTag Concrete subclasses must implement this method. This method is responsible for appending the closing tag.
Finalize (inherited from Object)Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
GetChildInMidRender Call this method to obtain a reference to the child that is in mid render.
GetDisplayOptions Helper method to do lazy initialization of display options. Call this method to get the display options for display of this HTML tree. This method will only return a meaningful value during the execution of the display methods. This value will be cleared when display is finished.
GetDisplayStringOverloaded. This method is the internal String generator for all HTMLElement classes. This method may be overridden by subclasses, but this shouldn't be necessary.

GetHTMLElementReadOnly 
GetLastChildFullyRendered Call this method to obtain a reference to the last child that fully rendered.
GetStringBuilder This method is used to get a reasonable sized String Builder. It should be overridden by larger HTMLElements such as HTMLPage.
InternalWrite This method contains the bulk of the logic for writting an HTMLElement. For subclasses needing to modify their display behavior, this is the primary method to override.
MemberwiseClone (inherited from Object)Creates a shallow copy of the current Object.
ProvidesClosingTag Implement this method to indicate whether a concrete subclass of HTMLElement provides a closing tag. Elements such as BR do not provide closing tags, they are self-closing.
SetChildInMidRender Call this method to set the member reference to the child that is in mid render.
SetDisplayOptions Call this method to set the display options for this HTML tree.

This method is called internally during the execution of display methods.
SetHTMLElementReadOnly 
SetInner Call this method to set the internal XPArrayList of nested HTMLElement objects. Warning: This will erase all elements previously added to this element through calls to AddInnerHTMLElement.
SetLastChildFullyRendered Call this method to set the member reference to the last child fully rendered.
VerifyWritability This method checks whether or not this tree is read only and throws an exception if it is not.
WriteNuggetOverloaded. This protected method is used by this class an all subclasses to write the smallest divisible units of HTML. These nuggets of HTML are either appended to an XPStringBuilder, written to the IXPResponse, both, or neither.

See Also

HTMLElement Class | com.plumtree.xpshared.htmlelements Namespace