|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ge.research.html.HTMLTag
Abstract class which represents an HTML 4.0 tag.
Constructs an HTML tag by writing the tag attributes with values within the beggining tag,
writes any tag contents between the open and close tags, and terminates the tag.
Ex. <A HREF="javascript:void(0)" TARGET="_blank">Tag Content</A>
This class provides the common HTML attributes available to all HTML 4.0 tags.
Subclasses need only implement the writeTagSpecificAttributes() method,
to write inline attributes as part of the tag, and the writeTagSpecificData() method,
to write the tag content between the open and closing tags.
The toString() method creates the tag from the attribute and content data.
Once a tag is created, it is flagged to not be recreated unless the content or attribute information is modified.
This is done for efficiency. Each attribute setter method, therefore should intelligently update the value of the
reconstructTag flag.
| Field Summary | |
static java.lang.String |
HORIZONTAL_LINE
HTML horizontal line tag |
static java.lang.String |
LINEBREAK
HTML break tag |
protected boolean |
reconstructTag
Flag indicating whether or not the tag's attributes need to be inspected to construct the HTML tag string for this object. |
protected java.lang.StringBuffer |
tag
The HTML tag StringBuffer for this tag. |
static java.lang.String |
WHITESPACE
HTML whitespace |
| Constructor Summary | |
protected |
HTMLTag(java.lang.String tagName)
Default constructor. |
| Method Summary | |
void |
addAttribute(java.lang.String name)
Adds a user defined attribute to the tag without a value, which will cause the attribute to be handled as a boolean attribute.
|
void |
addAttribute(java.lang.String name,
java.lang.Object value)
Adds a user defined attribute to the tag with the appropriate value Sets the value of the reconstructTag to true. |
java.lang.String |
getId()
Returns the current HTML Tag ID attribute for the tag. |
java.lang.String |
getOnClick()
Returns the current value of the HTML Tag onClick behavior. |
java.lang.String |
getOnContextMenu()
Returns the current value of the HTML Tag onContextMenu behavior. |
java.lang.String |
getOnDblClick()
Returns the current value of the HTML Tag onDblClick behavior. |
java.lang.String |
getOnDrag()
Returns the current value of the HTML Tag onDrag behavior. |
java.lang.String |
getOnDragEnd()
Returns the current value of the HTML Tag onDragEnd behavior. |
java.lang.String |
getOnDragStart()
Returns the current value of the HTML Tag onDragStart behavior. |
java.lang.String |
getOnFocus()
Returns the current value of the HTML Tag onFocus behavior. |
java.lang.String |
getOnFocusOut()
Returns the current value of the HTML Tag onFocusOut behavior. |
java.lang.String |
getOnKeyDown()
Returns the current value of the HTML Tag onKeyDown behavior. |
java.lang.String |
getOnKeyPress()
Returns the current value of the HTML Tag onKeyPress behavior. |
java.lang.String |
getOnKeyUp()
Returns the current value of the HTML Tag onKeyUp behavior. |
java.lang.String |
getOnMouseDown()
Returns the current value of the HTML Tag onMouseDown behavior. |
java.lang.String |
getOnMouseMove()
Returns the current value of the HTML Tag onMouseMove behavior. |
java.lang.String |
getOnMouseOut()
Returns the current value of the HTML Tag onMouseOut behavior. |
java.lang.String |
getOnMouseOver()
Returns the current value of the HTML Tag onMouseOver behavior. |
java.lang.String |
getOnMouseUp()
Returns the current value of the HTML Tag onMouseUp behavior. |
java.lang.String |
getOnMoveEnd()
Returns the current value of the HTML Tag onMoveEnd behavior. |
java.lang.String |
getOnMoveStart()
Returns the current value of the HTML Tag onMoveStart behavior. |
java.lang.String |
getStyle()
Returns the current HTML Tag CSS Style settings for the tag. |
java.lang.String |
getStyleClass()
Returns the current HTML Tag CSS Style Class for the tag |
java.lang.String |
getTitle()
Returns the current value of the HTML Tag TITLE attribute. |
void |
removeAttribute(java.lang.String name)
Removes the user defined attribute specified by the name argument
Sets the value of the reconstructTag to true
if the removal was successful. |
void |
reset()
Sets all attributes to their default values by calling the resetTagSpecificInformation() method. |
protected void |
resetTagSpecificInformation()
Resets the tag attributes and content of the HTML Tag to their default values. |
void |
setId(java.lang.String attribute)
Sets the HTML Tag ID attribute Sets the value of the reconstructTag to true. |
void |
setOnClick(java.lang.String attribute)
Sets the HTML Tag onClick behavior. |
void |
setOnContextMenu(java.lang.String attribute)
Sets the HTML Tag onContextMenu behavior. |
void |
setOnDblClick(java.lang.String attribute)
Sets the HTML Tag onDblClick behavior. |
void |
setOnDrag(java.lang.String attribute)
Sets the HTML Tag onDrag behavior. |
void |
setOnDragEnd(java.lang.String attribute)
Sets the HTML Tag onDragEnd behavior. |
void |
setOnDragStart(java.lang.String attribute)
Sets the HTML Tag onDragStart behavior. |
void |
setOnFocus(java.lang.String attribute)
Sets the HTML Tag onFocus behavior. |
void |
setOnFocusOut(java.lang.String attribute)
Sets the HTML Tag onFocusOut behavior. |
void |
setOnKeyDown(java.lang.String attribute)
Sets the HTML Tag onKeyDown behavior. |
void |
setOnKeyPress(java.lang.String attribute)
Sets the HTML Tag onKeyPress behavior. |
void |
setOnKeyUp(java.lang.String attribute)
Sets the HTML Tag onKeyUp behavior. |
void |
setOnMouseDown(java.lang.String attribute)
Sets the HTML Tag onMouseDown behavior. |
void |
setOnMouseMove(java.lang.String attribute)
Sets the HTML Tag onMouseMove behavior. |
void |
setOnMouseOut(java.lang.String attribute)
Sets the HTML Tag onMouseOut behavior. |
void |
setOnMouseOver(java.lang.String attribute)
Sets the HTML Tag onMouseOver behavior. |
void |
setOnMouseUp(java.lang.String attribute)
Sets the HTML Tag onMouseUp behavior. |
void |
setOnMoveEnd(java.lang.String attribute)
Sets the HTML Tag onMoveEnd behavior. |
void |
setOnMoveStart(java.lang.String attribute)
Sets the HTML Tag onMoveSTart behavior. |
void |
setStyle(java.lang.String attribute)
Sets the HTML Tag CSS Style settings. |
void |
setStyleClass(java.lang.String attribute)
Sets the HTML Tag CSS Style Class attribute. |
void |
setTitle(java.lang.String attribute)
Sets the HTML Tag TITLE attribute. |
java.lang.String |
toString()
Overrides the Object.toString() method and produces the HTML tag represented by this object.
|
protected void |
writeAttribute(java.lang.String value)
Convienence method for adding an attribute string to the HTML Tag. |
protected void |
writeAttribute(java.lang.String attributeName,
boolean value)
Convienence method for adding a boolean attribute to the HTML Tag. |
protected void |
writeAttribute(java.lang.String attributeName,
double value)
Convienence method for adding an attribute and its value to the HTML Tag. |
protected void |
writeAttribute(java.lang.String attributeName,
int value)
Convienence method for adding an attribute and its value to the HTML Tag. |
protected void |
writeAttribute(java.lang.String attributeName,
java.lang.Object value)
Convienence method for adding an Object attribute to the HTML Tag. |
protected void |
writeAttribute(java.lang.String attributeName,
java.lang.String value)
Convienence method for adding an attribute and its value to the HTML Tag. |
protected void |
writeTagSpecificAttributes()
Adds the tag specific attribute information to the HTML Tag. |
protected void |
writeTagSpecificData()
Adds the tag content to the HTML Tag. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String LINEBREAK
public static final java.lang.String HORIZONTAL_LINE
public static final java.lang.String WHITESPACE
protected java.lang.StringBuffer tag
reconstructTag to true.
protected boolean reconstructTag
true.
Each time the tag string is constructed it is set to false.
| Constructor Detail |
protected HTMLTag(java.lang.String tagName)
StringBuffer.
Sets the type of HTML tag, using the tagName argument.
Calls the reset() method.
This constructor is called by subclasses to initialize the HTML tag type correctly.
tagName - the HTML type of this tag| Method Detail |
public final void addAttribute(java.lang.String name)
boolean attribute.
Calls the addAttribute(java.lang.String, java.lang.Object) method
with null as the second argument.
name - the name of the user defined attributeaddAttribute(java.lang.String, java.lang.Object)
public final void addAttribute(java.lang.String name,
java.lang.Object value)
reconstructTag to true.
name - the name of the user defined attributevalue - the value of the user defined attribute. If null the
attribute is assumed to be a boolean attribute, and it's existence will
result in the attribute name written to the inline tag.reconstructTagpublic final java.lang.String getId()
public final java.lang.String getStyle()
public final java.lang.String getStyleClass()
public final java.lang.String getOnClick()
public final java.lang.String getOnContextMenu()
public final java.lang.String getOnDblClick()
public final java.lang.String getOnDrag()
public final java.lang.String getOnDragEnd()
public final java.lang.String getOnDragStart()
public final java.lang.String getOnKeyDown()
public final java.lang.String getOnKeyPress()
public final java.lang.String getOnKeyUp()
public final java.lang.String getOnMouseDown()
public final java.lang.String getOnMouseMove()
public final java.lang.String getOnMouseOut()
public final java.lang.String getOnMouseOver()
public final java.lang.String getOnMouseUp()
public final java.lang.String getOnMoveEnd()
public final java.lang.String getOnMoveStart()
public final java.lang.String getTitle()
public final java.lang.String getOnFocus()
public final java.lang.String getOnFocusOut()
public final void removeAttribute(java.lang.String name)
name argument
Sets the value of the reconstructTag to true
if the removal was successful.
name - the name of the user defined attributereconstructTagpublic final void reset()
resetTagSpecificInformation() method.
resetTagSpecificInformation()public final void setId(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag ID attributereconstructTagpublic final void setOnClick(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML TAG onClick behaviorreconstructTagpublic final void setOnContextMenu(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML TAG onContextMenu behaviorreconstructTagpublic final void setOnDblClick(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onDblClick behaviorreconstructTagpublic final void setOnDrag(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onDrag behaviorreconstructTagpublic final void setOnDragEnd(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onDragEnd behaviorreconstructTagpublic final void setOnDragStart(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onDragStart behaviorreconstructTagpublic final void setOnKeyDown(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onKeyDown behaviorreconstructTagpublic final void setOnKeyPress(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onKeyPress behaviorreconstructTagpublic final void setOnKeyUp(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onKeyUp behaviorreconstructTagpublic final void setOnMouseDown(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onMouseDown behaviorreconstructTagpublic final void setOnMouseMove(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onMouseMove behaviorreconstructTagpublic final void setOnMouseOut(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onMouseOut behaviorreconstructTagpublic final void setOnMouseOver(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onMouseOver behaviorreconstructTagpublic final void setOnMouseUp(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onMouseUp behaviorreconstructTagpublic final void setOnMoveEnd(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onMoveEnd behaviorreconstructTagpublic final void setOnMoveStart(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onMoveStart behaviorreconstructTagpublic final void setStyle(java.lang.String attribute)
reconstructTag to true.
attribute - the new HTML Tag CSS Style settingsreconstructTagpublic final void setStyleClass(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag CSS Style Class attributereconstructTagpublic final void setTitle(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag TITLE attributereconstructTagpublic final void setOnFocus(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onFocus behaviorreconstructTagpublic final void setOnFocusOut(java.lang.String attribute)
reconstructTag to true.
attribute - the new value for the HTML Tag onFocusOut behaviorreconstructTagpublic final java.lang.String toString()
Object.toString() method and produces the HTML tag represented by this object.
If the value of the reconstructTag is false, then the last constructed tag string is returned.
If the value of the reconstructTag is true, then the tag is constructed as follows.
The opening tag is created by calling the writeTagSpecificAttributes() method
which writes the tag attributes inline with the tag name in the opening tag. The tag content (if any) is written by
calling the writeTagSpecificData() method. The tag is then properly closed with a terminating tag sequence.
Sets the value of the reconstructTag to false.
writeTagSpecificAttributes(),
writeTagSpecificData(),
reconstructTagprotected void resetTagSpecificInformation()
reset().
This method is not implemented in HTMLTag.
Subclasses that contain tag content information should implement this method to set their information to their default values.
reset()protected final void writeAttribute(java.lang.String value)
value - the attribue string to add to the HTML Tag
protected final void writeAttribute(java.lang.String attributeName,
boolean value)
value of the attribute is true,
then calls the writeAttribute(java.lang.String) method
with argument attributeName.
attributeName - the attribue that is added to the HTML Tagvalue - true or false value of the attributewriteAttribute(java.lang.String)
protected final void writeAttribute(java.lang.String attributeName,
double value)
attributeName - the name of the attribue whose name value pair is added to the HTML Tagvalue - the value add to the HTML Tag as the value of the attribute
protected final void writeAttribute(java.lang.String attributeName,
int value)
attributeName - the name of the attribue whose name value pair is added to the HTML Tagvalue - the value add to the HTML Tag as the value of the attribute
protected final void writeAttribute(java.lang.String attributeName,
java.lang.Object value)
value attribute is inspected and then converted to a
primirtive format and delegated to the appropriate writeAttribute method.
attributeName - the attribue that is added to the HTML Tagvalue - the attributewriteAttribute(java.lang.String, boolean),
writeAttribute(java.lang.String, int),
writeAttribute(java.lang.String, double),
writeAttribute(java.lang.String, java.lang.String)
protected final void writeAttribute(java.lang.String attributeName,
java.lang.String value)
attributeName - the name of the attribue whose name value pair is added to the HTML Tagvalue - the value add to the HTML Tag as the value of the attributeprotected void writeTagSpecificAttributes()
toString().
This method is not implemented in HTMLTag.
Subclasses that contain additional attribute information should implement this method to write those attributes in the inline tag.
toString()protected void writeTagSpecificData()
toString().
This method is not implemented in HTMLTag.
Subclasses that contain tag content information should implement this method to writeout that content in between the opening and closing tags.
toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||