|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.plumtree.xpshared.htmlelements.HTMLElement
public abstract class HTMLElement
All object representing HTML elements should subclass this class.
Defined within this abstract class are methods for getting and setting
attributes common to all HTML elements, such as ID, NAME, CLASS, and
STYLE.
Other methods, such as appendInnerHTML and appendTabs, will help
subclasses display themselves. Most all of the code for displaying HTML
and generating HTML strings is located in this class. For the most part,
subclasses will not need to concern themselves with this functionality, but
only with implementing the abstract methods of this class. Exceptions to this
are those subclasses that need to modify their display in some way, such
as the HTMLElementCollection class. This class displays much like any other
HTMLElement object, except it does not display any HTML itself, but only that
HTML generated by its children. For this reason, the HTMLElementCollection
class needs to override the display methods of this class. Other classes
may not support HTML formatting, such as the HTMLAnchor and HTMLTextArea
class. Formatting of the HTML generated by these classes affects the
display in a bad way, so formatting is not supported, and display methods
need to be overridden.
This class also provides methods and data structures for managing nested
HTML objects, such as addInnerHTMLElement and getInnerHTMLElements.
Nested Class Summary | |
---|---|
static class |
HTMLElement.ValidationLevel
|
Field Summary | |
---|---|
static byte[] |
aNewLine
|
static boolean |
bAllowEvents
Toggle this false to log errors when clients attempt to set values for attributes such as onclick, and onmouseover. |
static boolean |
bAllowSetStyleClassWithString
Set this member variable to specify whether or not the SetStyleClass method throws an HTMLException when called with a String parameter. |
static boolean |
bCheckNestedStringForHTML
Set this boolean true to cause HTMLElements to write warnings to the log file if nested strings contain HTML. |
protected boolean |
bDisplayDidPause
|
static boolean |
bEnforceMaxTableDepth
Set this member variable to specify whether or not a maximum table depth is enforced. |
boolean |
bForceFormattingOff
Set this boolean true to force formatting of for this element as well as nested elements. |
boolean |
bForceFormattingOn
|
protected boolean |
bPauseAfterDisplay
|
static boolean |
bPrintComments
Set this member variable to specify whether or not comments are printed by the display methods. |
protected boolean |
bResumingAndChildFinished
|
protected boolean |
bResumingAndChildInMidRender
|
protected boolean |
bShowLang
|
static int |
iMaxTableDepth
This int member specifies the maximum depth of table nesting. |
protected java.lang.String |
sLangLocal
sLangLocal is used when an element's lang attribute is different from the global lang attribute. |
static java.lang.String |
sNewLine
Set this member to specify the newline character. |
static java.lang.String |
sTab
This member variable to specify the tab character. |
Method Summary | |
---|---|
void |
AddInnerHTMLElement(HTMLElement e)
Call this method to append an additional HTML element to be displayed within this HTML element. |
void |
AddInnerHTMLEncodedString(java.lang.String s)
Call this method to append an additional HTML String to be displayed within this HTML element. |
void |
AddInnerHTMLString(java.lang.String s)
Call this method to append an additional HTML String to be displayed within this HTML element. |
protected abstract void |
AppendBeginningOfOpeningTag(boolean bFormat,
XPStringBuilder sb,
IXPResponse response)
Concrete subclasses must implement this method. |
protected void |
AppendClosingLineBreak(XPStringBuilder sb,
IXPResponse response)
|
protected abstract void |
AppendClosingTag(boolean bFormat,
XPStringBuilder sb,
IXPResponse response)
Concrete subclasses must implement this method. |
void |
CleanupHTMLSubtreeAfterRendering()
This is only called if this element is the root of the display tree. |
void |
ClearInnerHTMLElements()
Call this method to remove all nested html elements from this element. |
protected java.lang.Object |
clone()
Do not call this method. |
void |
Display(IXPResponse response)
Call this method to display the HTML of this object to the IXPResponse object. |
void |
Display(IXPResponse response,
boolean bFormat)
Call this method to display this object's HTML to an IXPResponse object. |
void |
ForceFormattingOff()
Call this method to force formatting off for this HTMLElement object. |
protected HTMLElement |
GetChildInMidRender()
Call this method to obtain a reference to the child that is in mid render. |
java.lang.Object |
GetClone()
Call this method to obtain a clone of this HTMLElement object. |
boolean |
GetDisabled()
Call this method to determine whether or not the disabled attribute is displayed for this HTML element. |
boolean |
GetDisplayDidPause()
Call this method to determine whether or not the most recent call to one of the display methods paused. |
protected DisplayOptions |
GetDisplayOptions()
Helper method to do lazy initialization of display options. |
java.lang.String |
GetDisplayString()
Call this method to obtain a String of HTML markup that represents this HTML element, and all HTML elements nested within. |
protected java.lang.String |
GetDisplayString(boolean bFormat)
This method is the internal String generator for all HTMLElement classes. |
protected void |
GetDisplayString(boolean bFormat,
XPStringBuilder sbLocal)
This method is the internal String generator for all HTMLElement classes. |
boolean |
GetDo508Checking()
This method returns whether or not to do 508 validity checking for HTMLElements. |
boolean |
GetDoFormat()
Call this method to determine whether or not this HTML element generates HTML text formatted for readabilty. |
java.lang.String |
GetElementName()
Call this method to determine the name of this element. |
boolean |
GetForceLineBreaksAfterSafeElements()
This method returns whether or not to use line breaks after elements where it does not affect the HTML output. |
protected boolean |
GetHTMLElementReadOnly()
|
java.lang.String |
GetID()
Call this method to determine the value of the id attribute of this HTML element. |
java.lang.String |
GetImgBaseUrl()
Call this method to obtain the base url used for all HTMLImg objects being displayed |
java.lang.String |
GetInnerHTML()
|
void |
GetInnerHTML(XPStringBuilder sbLocal,
IXPResponse response,
boolean bFormatLocal)
Call this method to obtain the HTML nested within this element. |
java.lang.String |
GetInnerHTMLDisplayString()
|
IXPEnumerator |
GetInnerHTMLElements(boolean bRecursive)
Call this method to obtain an enumeration of the HTMLElement objects nested within this HTMLElement. |
XPArrayList |
GetInnerHTMLElementsAsArrayList(boolean bRecursive)
Call this method to get an XPArrayList containing all nested HTMLElement objects. |
boolean |
GetIsNetscape()
This method returns whether or not the browser is Netscape. |
java.lang.String |
GetLang()
Returns the language for use in the attribute, either the local language if available, or the global language. |
protected HTMLElement |
GetLastChildFullyRendered()
Call this method to obtain a reference to the last child that fully rendered. |
java.lang.String |
GetName()
Call this method to determine the value of the name attribute of this HTML element. |
java.lang.String |
GetOnClick()
Call this method to obtain the value of the setonclick attribute. |
java.lang.String |
GetOnKeyDown()
Call this method to obtain the value of the onkeydown attribute. |
java.lang.String |
GetOnKeyPress()
Call this method to obtain the value of the onkeypress attribute. |
java.lang.String |
GetOnKeyUp()
Call this method to obtain the value of the onkeyup attribute. |
java.lang.String |
GetOnMouseOut()
Call this method to obtain the value of the onmouseout attribute. |
java.lang.String |
GetOnMouseOver()
Call this method to obtain the value of the onmouseover attribute. |
boolean |
GetPauseAfterDisplay()
Call this method to determine whether or not this element pauses after display. |
java.lang.String |
GetPostComment()
Call this method to obtain the comment that is written after the closing tag of this element. |
java.lang.String |
GetPreComment()
Call this method to obtain the comment that is written before the opening tag of this element. |
protected XPStringBuilder |
GetStringBuilder()
This method is used to get a reasonable sized String Builder. |
java.lang.String |
GetStyle()
Call this method to obtain the value of the style attribute of this HTML element. |
java.lang.String |
GetStyleClass()
Call this method to determine the style class assigned to this HTML element. |
java.lang.String |
GetStyleClassPrefix()
This method returns the style class prefix used for all HTMLElement objects being displayed. |
java.lang.String |
GetTitle()
|
static HTMLElement.ValidationLevel |
GetValidationLevel()
Call this method to obtain the ValidationLevel. |
HTMLElement |
InsertInnerHTMLElement(HTMLElement e)
Adds an innerHTMLElement to the specified element, while also returning the element added. |
protected void |
InternalWrite(boolean bFormat,
XPStringBuilder sbLocal,
IXPResponse response)
This method contains the bulk of the logic for writting an HTMLElement. |
protected abstract boolean |
ProvidesClosingTag()
Implement this method to indicate whether a concrete subclass of HTMLElement provides a closing tag. |
java.lang.String |
SaveToTempFile()
This method saves the display string of this object to a temporary file. |
java.lang.String |
SaveToTempFile(java.lang.String sFileName)
This method saves the display string of this object to a temporary file. |
protected void |
SetChildInMidRender(HTMLElement e)
Call this method to set the member reference to the child that is in mid render. |
void |
SetDisabled(boolean b)
Call this method to toggle the "disabled" attribute for this element. |
protected void |
SetDisplayOptions(DisplayOptions options)
Call this method to set the display options for this HTML tree. |
void |
SetDo508Checking(boolean b)
This method sets whether or not to do 508 validity checking for HTMLElements. |
void |
SetDoFormat(boolean b)
Call this method to specify whether or not this HTML element generates HTML text formatted for readabilty. |
void |
SetElementName(java.lang.String s)
Call this method to give this element a name. |
void |
SetFlushAfterDisplay(boolean b)
Call this method to cause the IXPResponse.Flush() method to be called after this element displays itself. |
void |
SetForceLineBreaksAfterSafeElements(boolean b)
This method controls whether or not to use line breaks after elements where it does not affect the HTML output. |
protected void |
SetHTMLElementReadOnly(boolean b)
|
void |
SetID(java.lang.String s)
Call this method to set the ID attribute for this HTML element. |
void |
SetImgBaseUrl(java.lang.String s)
Call this method to set the base url used for all HTMLImg objects being displayed. |
protected void |
SetInner(XPArrayList al)
Call this method to set the internal XPArrayList of nested HTMLElement objects. |
void |
SetIsNetscape(boolean b)
This method sets whether or not the browser is Netscape. |
void |
SetLangGlobal(java.lang.String s)
Set the default language available for all child elements -- not necessarily displayed unless the element is set to display the language attribute. |
void |
SetLangLocal(java.lang.String s)
Sets the value of the language attribute used by this element not the parent or child element(s). |
protected void |
SetLastChildFullyRendered(HTMLElement e)
Call this method to set the member reference to the last child fully rendered. |
void |
SetName(java.lang.String s)
Call this method to set the value of the name attribute of this HTML element. |
void |
SetOnClick(java.lang.String s)
Call this method to set the setonclick attribute |
void |
SetOnKeyDown(java.lang.String s)
Call this method to set the onkeydown attribute |
void |
SetOnKeyPress(java.lang.String s)
Call this method to set the onkeypress attribute |
void |
SetOnKeyUp(java.lang.String s)
Call this method to set the onkeyup attribute |
void |
SetOnMouseOut(java.lang.String s)
Call this method to set the onmouseout attribute |
void |
SetOnMouseOver(java.lang.String s)
Call this method to set the onmouseover attribute |
void |
SetPauseAfterDisplay(boolean b)
Call this method to specify whether or not this element pauses after display. |
void |
SetPostComment(java.lang.String s)
Use this method to set a comment that will be written after the closing tag of this element. |
void |
SetPreComment(java.lang.String s)
Use this method to set a comment that will be written before the opening tag of this element. |
void |
SetStyle(java.lang.String s)
Call this method to set the style attribute for this html element. |
void |
SetStyleClass(java.lang.String s)
Call this method to Set the style class for this HTML element. |
void |
SetStyleClass(StyleClass s)
Call this method to Set the style class for this HTML element. |
void |
SetStyleClassPrefix(java.lang.String s)
Call this method to set the prefix used for all HTMLElement objects being displayed. |
void |
SetTitle(java.lang.String s)
|
static void |
SetValidationLevel(HTMLElement.ValidationLevel l)
Call this method to specify the level at which html validation will occur. |
static byte[] |
ToByteArray(java.lang.String _String)
Convert a String to a byte array using XPStringUtility's default encoding, UTF-8. |
protected void |
VerifyWritability()
This method checks whether or not this tree is read only and throws an exception if it is not. |
protected void |
WriteNugget(byte[] b,
XPStringBuilder sbLocal,
IXPResponse response)
This protected method is used by this class an all subclasses to write the smallest divisible units of HTML. |
protected void |
WriteNugget(java.lang.String s,
XPStringBuilder sbLocal,
IXPResponse response)
This protected method is used by this class an all subclasses to write the smallest divisible units of HTML. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean bShowLang
protected boolean bPauseAfterDisplay
protected boolean bDisplayDidPause
protected boolean bResumingAndChildInMidRender
protected boolean bResumingAndChildFinished
public static final int iMaxTableDepth
public static boolean bEnforceMaxTableDepth
public static boolean bPrintComments
public static boolean bAllowSetStyleClassWithString
public static final java.lang.String sNewLine
public static final byte[] aNewLine
public static boolean bCheckNestedStringForHTML
public boolean bForceFormattingOff
public boolean bForceFormattingOn
public static final java.lang.String sTab
public static boolean bAllowEvents
protected java.lang.String sLangLocal
Method Detail |
---|
protected void SetHTMLElementReadOnly(boolean b)
protected boolean GetHTMLElementReadOnly()
public void SetForceLineBreaksAfterSafeElements(boolean b)
b
- boolean true implies use line breaks.public boolean GetForceLineBreaksAfterSafeElements()
public void SetTitle(java.lang.String s)
public java.lang.String GetTitle()
public void SetLangGlobal(java.lang.String s)
s
- String valuepublic java.lang.String GetLang()
public void SetLangLocal(java.lang.String s)
s
- String valuepublic void SetIsNetscape(boolean b)
b
- boolean true implies the browser is Netscapepublic boolean GetIsNetscape()
public void SetFlushAfterDisplay(boolean b)
b
- booleanpublic void SetPauseAfterDisplay(boolean b)
b
- boolean indicating whether or not this node pauses.public boolean GetPauseAfterDisplay()
protected HTMLElement GetLastChildFullyRendered()
protected void SetLastChildFullyRendered(HTMLElement e)
e
- HTMLElement childprotected HTMLElement GetChildInMidRender()
protected void SetChildInMidRender(HTMLElement e)
e
- HTMLElement childpublic boolean GetDisplayDidPause()
public void SetDo508Checking(boolean b)
b
- boolean true implies enforce 508 validity.public boolean GetDo508Checking()
public java.lang.String GetImgBaseUrl()
public void SetImgBaseUrl(java.lang.String s)
s
- Pass a base url string. It should look something like:
"http://blah/".public java.lang.String GetStyleClassPrefix()
public void SetStyleClassPrefix(java.lang.String s)
s
- Pass a base url string. It should look something like:
"http://blah/".protected void SetDisplayOptions(DisplayOptions options)
options
- DisplayOptions object.protected DisplayOptions GetDisplayOptions()
public void SetElementName(java.lang.String s)
s
- Pass a String.public java.lang.String GetElementName()
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.Object GetClone()
protected void SetInner(XPArrayList al)
HTMLException
- if this element is read only.protected abstract void AppendBeginningOfOpeningTag(boolean bFormat, XPStringBuilder sb, IXPResponse response)
bFormat
- Pass a boolean indicating whether or not to format.sb
- Pass an XPStringBuilder. If this is not null, HTML will
be appended to this string builder.response
- Pass an IXPResponse. If this is not null, HTML will
be written to this response.protected abstract void AppendClosingTag(boolean bFormat, XPStringBuilder sb, IXPResponse response)
bFormat
- Pass a boolean indicating whether or not to format.sb
- Pass an XPStringBuilder. If this is not null, HTML will
be appended to this string builder.response
- Pass an IXPResponse. If this is not null, HTML will
be written to this response.protected abstract boolean ProvidesClosingTag()
public java.lang.String SaveToTempFile()
public java.lang.String SaveToTempFile(java.lang.String sFileName)
sFileName
- Pass the name of the file within which you wish to
save this HTMLPage.
public void SetOnClick(java.lang.String s)
s
- Pass the value of this attribute.public java.lang.String GetOnClick()
public void SetOnMouseOver(java.lang.String s)
s
- Pass the value of this attribute.public java.lang.String GetOnMouseOver()
public void SetOnMouseOut(java.lang.String s)
s
- Pass the value of this attribute.public java.lang.String GetOnMouseOut()
public void SetOnKeyUp(java.lang.String s)
s
- Pass the value of this attribute.public java.lang.String GetOnKeyUp()
public void SetOnKeyDown(java.lang.String s)
s
- Pass the value of this attribute.public java.lang.String GetOnKeyDown()
public void SetOnKeyPress(java.lang.String s)
s
- Pass the value of this attribute.public java.lang.String GetOnKeyPress()
public void SetPreComment(java.lang.String s)
public java.lang.String GetPreComment()
public void SetPostComment(java.lang.String s)
public java.lang.String GetPostComment()
public boolean GetDoFormat()
public void SetDoFormat(boolean b)
public void ForceFormattingOff()
protected void AppendClosingLineBreak(XPStringBuilder sb, IXPResponse response)
protected XPStringBuilder GetStringBuilder()
public java.lang.String GetDisplayString()
HTMLException
public java.lang.String GetInnerHTML()
public java.lang.String GetInnerHTMLDisplayString()
public void Display(IXPResponse response, boolean bFormat)
response
- Pass an IXPResponse object.bFormat
- Pass a boolean indicating whether or not you wish this
element's HTML to be formatted.
HTMLException
- If display fails, an HTMLException will be thrown.public void Display(IXPResponse response)
response
- Pass an IXPResponse object.protected void WriteNugget(java.lang.String s, XPStringBuilder sbLocal, IXPResponse response)
s
- Pass a String you wish appended or written.sb
- Pass an XPStringBuilder to which you wish the
String appended. Pass null if you do not wish the string appended to
an XPStringBuilder.response
- Pass an IXPResponse to which you wish the String
written. Pass null if you do not wish the string written to an
IXPResponse.protected void WriteNugget(byte[] b, XPStringBuilder sbLocal, IXPResponse response)
This method is similar to the WriteNugget method with the String argument,
but different in that it does not require the response to convert the String
argument to a byte array.
s
- Pass a byte array you wish appended or written.sbLocal
- Pass an XPStringBuilder to which you wish the
String appended. Pass null if you do not wish the string appended to
an XPStringBuilder.response
- Pass an IXPResponse to which you wish the String
written. Pass null if you do not wish the string written to an
IXPResponse.protected void InternalWrite(boolean bFormat, XPStringBuilder sbLocal, IXPResponse response)
bFormat
- Pass a boolean indicating whether or not to format
the output.sb
- Pass an XPStringBuilder to which you wish the
String appended. Pass null if you do not wish the string appended to
an XPStringBuilder.response
- Pass an IXPResponse to which you wish the String
written. Pass null if you do not wish the string written to an
IXPResponse.public void CleanupHTMLSubtreeAfterRendering()
protected void GetDisplayString(boolean bFormat, XPStringBuilder sbLocal)
bFormat
- This parameter toggles whether or not all formating
text is included in the display string.protected java.lang.String GetDisplayString(boolean bFormat)
bFormat
- This parameter toggles whether or not all formating
text is included in the display string.public void SetStyleClass(java.lang.String s)
public void SetStyleClass(StyleClass s)
public java.lang.String GetStyleClass()
public void SetStyle(java.lang.String s)
s
- public java.lang.String GetStyle()
public void SetID(java.lang.String s)
s
- Pass the ID you wish to use for this element.public java.lang.String GetID()
public void SetName(java.lang.String s)
public java.lang.String GetName()
public void SetDisabled(boolean b)
b
-
HTMLException
public boolean GetDisabled()
protected void VerifyWritability()
HTMLException
- if this element is read only.public void AddInnerHTMLElement(HTMLElement e)
HTMLException
- if this element is read only.public HTMLElement InsertInnerHTMLElement(HTMLElement e)
HTMLException
- if this element is read only.public void ClearInnerHTMLElements()
HTMLException
- if this element is read only.public XPArrayList GetInnerHTMLElementsAsArrayList(boolean bRecursive)
bRecursive
- Pass a boolean indicating whether or not you wish this
list to be recursive.public IXPEnumerator GetInnerHTMLElements(boolean bRecursive)
bRecursive
- Pass true to obtain an enumeration of all nested
elements. Pass false to obtain an enumeration of only those elements
nested immediately within this element.public void AddInnerHTMLString(java.lang.String s)
s
- Pass a String representation of a valid HTML element.
HTMLException
public void AddInnerHTMLEncodedString(java.lang.String s)
s
- Pass a String representation of a valid HTML element.
HTMLException
- if this element is read onlypublic void GetInnerHTML(XPStringBuilder sbLocal, IXPResponse response, boolean bFormatLocal)
sbLocal
- Pass an XPStringBuilder. Pass null if you do not wish
for the HTML string to be added to a buffer.IXPResponse
- Pass an IXPResponse. Pass null if you do not wish
for the HTML string to be written to the response.bFormat
- Pass a boolean indicating whether or not to format this
HTML.public static void SetValidationLevel(HTMLElement.ValidationLevel l)
public static byte[] ToByteArray(java.lang.String _String)
_String
- String to convert to a byte array.
public static HTMLElement.ValidationLevel GetValidationLevel()
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |