|
PAJES 2.3.9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.pajes.html.Tag
Base Class for all HTML generation classes. The HTML classes are a series of classes that allow the programmer to treat HTML in an OO way instead of having embeded HTML tags throughout their code.
| Field Summary | |
protected static java.lang.String |
ON_CLICK_ATTRIBUTE
The onclick attribute name. |
protected static java.lang.String |
TAG_CLOSE
The / character. |
protected static java.lang.String |
TAG_LEFT
The < character. |
protected static java.lang.String |
TAG_RIGHT
The > character. |
| Constructor Summary | |
Tag(java.lang.String name)
Creates the base tag instance. |
|
Tag(java.lang.String name,
java.lang.String close)
Creates the base tag instance. |
|
| Method Summary | |
Tag |
addAttribute(java.lang.String name,
java.lang.String value)
Deprecated. 2.2.0 Use setAttribute(String, String). |
Tag |
addAttributes(java.util.Collection attributes)
Adds additonal attributes from an existing collection. |
Tag |
addAttributes(java.lang.String[][] attributes)
Adds additional attributes from a String array. |
void |
addContent(java.lang.String content)
Adds content to this tag. |
Tag |
clearAttribute(java.lang.String name)
Removes the specified attribute. |
Tag |
clearAttributes()
Removes all attributes defined for the tag. |
java.lang.Object |
clone()
Allows a tag to be cloned. |
void |
destroy()
Sets all the internal variables of this object to null, to assist in garbage collection. |
TagAttribute |
getAttribute(java.lang.String name)
Returns the specified named TagAttribute. |
java.lang.String |
getAttributes(Browser browser)
Returns the attributes defined for this tag. |
java.util.Set |
getAttributeSet()
Returns the attributes defined for this tag. |
Container |
getContainer()
Returns the last container to which this HTML instance has been added. |
HTML |
getContent()
Returns the content of this tag. |
java.lang.String |
getDocument()
Gets the the unique name of the document containing this tag. |
java.lang.String |
getId()
Gets the ID attribute of the current tag. |
java.lang.String |
getOnClickHandler(Browser browser)
Returns the JavaScript handler for return this.event. |
java.lang.String |
getOnDBLClickHandler(Browser browser)
Returns the JavaScript handler for return this.event. |
java.lang.String |
getOnKeyDownHandler(Browser browser)
Returns the JavaScript handler for return this.event. |
java.lang.String |
getOnKeyPressHandler(Browser browser)
Returns the JavaScript handler for return this.event. |
java.lang.String |
getOnKeyUpHandler(Browser browser)
Returns the JavaScript handler for return this.event. |
java.lang.String |
getOnMouseDownHandler(Browser browser)
Returns the JavaScript handler for return this.event. |
java.lang.String |
getOnMouseOutHandler(Browser browser)
Returns the JavaScript handler for return this.event. |
java.lang.String |
getOnMouseOverHandler(Browser browser)
Returns the JavaScript handler for return this.event. |
java.lang.String |
getOnMouseUpHandler(Browser browser)
Returns the JavaScript handler for return this.event. |
java.lang.String |
getStyle()
Returns the style attribute of the tag. |
java.lang.String |
getStyleSheetClass()
Gets the CLASS attribute of the current tag. |
java.lang.String |
getTagName()
Returns the tag name. |
java.lang.String |
getTitle()
Returns the global title attribute. |
WritePermission |
getWritePermission()
Returns the object which will be used to determine whether this piece of HTML will be returned to the requesting browser. |
protected void |
init()
Called by the constructor and the destroy() method to correctly
clear and initialise internal variables. |
protected org.pajes.html.Tag.Attributes |
initAttributes()
Called whenever a new, empty set of tag attributes is required. |
boolean |
isWritable()
Determines whether this object should be displayed or not. |
protected boolean |
isWritable(Browser browser)
Called by write(org.pajes.servlet.Browser) implementations to see if the tag is both
writable and permitted to be written. |
Tag |
setAttribute(java.lang.String name,
boolean required)
Adds a unary attribute. |
Tag |
setAttribute(java.lang.String name,
java.lang.Boolean tagRequired)
Adds a unary attribute. |
Tag |
setAttribute(java.lang.String name,
Color value)
Adds a colour attribute. |
Tag |
setAttribute(java.lang.String name,
int value)
Adds an attribute where the value is an integer. |
Tag |
setAttribute(java.lang.String name,
int value,
boolean quoted)
Adds an attribute where the value is an integer. |
Tag |
setAttribute(java.lang.String name,
java.lang.Integer value)
Adds an attribute where the value is an integer. |
Tag |
setAttribute(java.lang.String name,
java.lang.Integer value,
boolean quoted)
Adds an attribute where the value is an integer. |
Tag |
setAttribute(java.lang.String name,
java.lang.String value)
Adds a string attribute. |
Tag |
setAttribute(java.lang.String name,
java.lang.String value,
boolean quoted)
Adds a string attribute. |
Tag |
setAttribute(java.lang.String name,
java.lang.String value,
boolean quoted,
boolean trim)
Adds a string attribute. |
protected void |
setAttribute(TagAttribute attribute)
Adds the specified attribute. |
Tag |
setAttributes(java.util.Collection attributes)
Clears and resets the tag attributes from an existing collection. |
Tag |
setAttributes(java.lang.String[][] attributes)
Clears and resets the tag attributes from a String array. |
void |
setContainer(Container container)
Sets the container to which this HTML instance has been added. |
void |
setContent(HTML content)
Sets the content of this tag, replacing any existing content. |
void |
setContent(java.lang.String content)
Sets the content of this tag, replacing any existing content. |
Tag |
setId(java.lang.String id)
Sets the ID attribute of the current tag. |
Tag |
setOnClickHandler(java.lang.String onClickHandler)
Sets the JavaScript handler for this event. |
Tag |
setOnDBLClickHandler(java.lang.String onDBLClickHandler)
Sets the JavaScript handler for this event. |
Tag |
setOnKeyDownHandler(java.lang.String onKeyDownHandler)
Sets the JavaScript handler for this event. |
Tag |
setOnKeyPressHandler(java.lang.String onKeyPressHandler)
Sets the JavaScript handler for this event. |
Tag |
setOnKeyUpHandler(java.lang.String onKeyUpHandler)
Sets the JavaScript handler for this event. |
Tag |
setOnMouseDownHandler(java.lang.String onMouseDownHandler)
Sets the JavaScript handler for this event. |
Tag |
setOnMouseOutHandler(java.lang.String onMouseOutHandler)
Sets the JavaScript handler for this event. |
Tag |
setOnMouseOverHandler(java.lang.String onMouseOverHandler)
Sets the JavaScript handler for this event. |
Tag |
setOnMouseUpHandler(java.lang.String onMouseUpHandler)
Sets the JavaScript handler for this event. |
Tag |
setStyle(java.lang.String style)
Sets the Style of the current tag. |
Tag |
setStyleSheetClass(java.lang.String styleSheetClass)
Sets the CLASS attribute of the current tag. |
protected Tag |
setTagName(java.lang.String name)
Returns the tag name. |
Tag |
setTitle(java.lang.String text)
Sets the global title attribute. |
Tag |
setWritable(boolean writable)
Determines if this object should be returned to the browser. |
protected void |
setWriteAttributes(boolean attributes)
Determines whether this tag has attributes or not. |
protected void |
setWriteEndTag(boolean endTag)
Determines whether this tag has an end tag or not. |
protected void |
setWritelnAfter(boolean on)
Determines whether a line feed will be written after the tag end. |
protected void |
setWritelnAfterContent(boolean on)
Determines whether a line feed will be written after the content. |
protected void |
setWritelnBefore(boolean on)
Determines whether a line feed will be written before the tag. |
protected void |
setWritelnBeforeContent(boolean on)
Determines whether a line feed will be written before the content. |
HTML |
setWritePermission(WritePermission control,
java.lang.String document,
java.lang.String id)
Sets the object which will be used to determine whether this piece of HTML will be returned to the requesting browser. |
java.lang.String |
toString()
Returns the HTML object as a string. |
void |
write(Browser browser)
Writes the tag to the browser. |
protected void |
writeContent(Browser browser)
Called by the write(org.pajes.servlet.Browser) method to write any content between the
start and end tags. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected static final java.lang.String ON_CLICK_ATTRIBUTE
onclick attribute name.
protected static final java.lang.String TAG_CLOSE
/ character.
protected static final java.lang.String TAG_LEFT
< character.
protected static final java.lang.String TAG_RIGHT
The > character.
| Constructor Detail |
public Tag(java.lang.String name)
name - the tag name.
public Tag(java.lang.String name,
java.lang.String close)
name - the tag name.close - the character that flags the end of a tag.| Method Detail |
public Tag setAttribute(java.lang.String name,
Color value)
name - the colour attribute name.value - the colour value of the attribute.
public Tag setAttribute(java.lang.String name,
java.lang.String value)
name - The attribute name.value - The value of the attribute.
public Tag setAttribute(java.lang.String name,
java.lang.String value,
boolean quoted)
name - The attribute name.value - The value of the attribute.quoted - If true, places quotes around the attribute value.
public Tag setAttribute(java.lang.String name,
java.lang.String value,
boolean quoted,
boolean trim)
name - The attribute name.value - The value of the attribute.quoted - If true, places quotes around the attribute value.trim - Trims the value.
public Tag setAttribute(java.lang.String name,
java.lang.Boolean tagRequired)
name - The attribute name.tagRequired - True if the tag is required.
public Tag setAttribute(java.lang.String name,
boolean required)
name - The attribute name.required - True if the tag is required.
public Tag setAttribute(java.lang.String name,
java.lang.Integer value)
name - The attribute name.value - TagAttribute Integer Value
public Tag setAttribute(java.lang.String name,
int value)
name - The attribute name.value - TagAttribute int Value
public Tag setAttribute(java.lang.String name,
java.lang.Integer value,
boolean quoted)
name - The attribute name.value - TagAttribute int Valuequoted - If true, places quotes around the attribute value.
public Tag setAttribute(java.lang.String name,
int value,
boolean quoted)
name - The attribute name.value - TagAttribute int Valuequoted - If true, places quotes around the attribute value.
public TagAttribute getAttribute(java.lang.String name)
name - the name of the attribute to be retrieved.
public java.util.Set getAttributeSet()
public Tag setAttributes(java.util.Collection attributes)
attributes - The Collection of TagAttribute instances.
public Tag setAttributes(java.lang.String[][] attributes)
attributes - The array of attributes.
PajeParser.getAttributes()public java.lang.String getAttributes(Browser browser)
browser - the browser to which the results are to be output.
public void setContainer(Container container)
setContainer in interface HTMLcontainer - the container to which this HTML instance has been
added.public Container getContainer()
getContainer in interface HTMLpublic void setContent(HTML content)
content - the content.getContent(),
setContent(org.pajes.html.HTML)public void setContent(java.lang.String content)
setContent in interface HTMLcontent - the content.getContent(),
setContent(org.pajes.html.HTML)public HTML getContent()
addContent(java.lang.String),
getContent()public java.lang.String getDocument()
getDocument in interface HTMLsetWritePermission(org.pajes.security.WritePermission, java.lang.String, java.lang.String)public Tag setId(java.lang.String id)
id - the unique ID of the tag
setWritePermission(org.pajes.security.WritePermission, java.lang.String, java.lang.String)public java.lang.String getId()
getId in interface HTMLsetId(java.lang.String)public Tag setOnClickHandler(java.lang.String onClickHandler)
onClickHandler - The new onClickHandler value
public java.lang.String getOnClickHandler(Browser browser)
browser - the Broiwser instance.
public Tag setOnDBLClickHandler(java.lang.String onDBLClickHandler)
onDBLClickHandler - The new onDBLClickHandler value
public java.lang.String getOnDBLClickHandler(Browser browser)
browser - the Broiwser instance.
public Tag setOnKeyDownHandler(java.lang.String onKeyDownHandler)
onKeyDownHandler - The new onKeyDownHandler value
public java.lang.String getOnKeyDownHandler(Browser browser)
browser - the Broiwser instance.
public Tag setOnKeyPressHandler(java.lang.String onKeyPressHandler)
onKeyPressHandler - The new onKeyPressHandler value
public java.lang.String getOnKeyPressHandler(Browser browser)
browser - the Broiwser instance.
public Tag setOnKeyUpHandler(java.lang.String onKeyUpHandler)
onKeyUpHandler - The new onKeyUpHandler value
public java.lang.String getOnKeyUpHandler(Browser browser)
browser - the Broiwser instance.
public Tag setOnMouseDownHandler(java.lang.String onMouseDownHandler)
onMouseDownHandler - The new onMouseDownHandler value
public java.lang.String getOnMouseDownHandler(Browser browser)
browser - the Broiwser instance.
public Tag setOnMouseOutHandler(java.lang.String onMouseOutHandler)
onMouseOutHandler - The new onMouseOutHandler value
public java.lang.String getOnMouseOutHandler(Browser browser)
browser - the Broiwser instance.
public Tag setOnMouseOverHandler(java.lang.String onMouseOverHandler)
onMouseOverHandler - The new onMouseOverHandler value
public java.lang.String getOnMouseOverHandler(Browser browser)
browser - the Broiwser instance.
public Tag setOnMouseUpHandler(java.lang.String onMouseUpHandler)
onMouseUpHandler - The new onMouseUpHandler value
public java.lang.String getOnMouseUpHandler(Browser browser)
browser - the Broiwser instance.
public Tag setStyle(java.lang.String style)
style - The new style value
public java.lang.String getStyle()
setStyle(java.lang.String)public Tag setStyleSheetClass(java.lang.String styleSheetClass)
styleSheetClass - The new styleSheetClass value
public java.lang.String getStyleSheetClass()
setStyleSheetClass(java.lang.String)public java.lang.String getTagName()
public Tag setTitle(java.lang.String text)
text - is the text to be displayed.
public java.lang.String getTitle()
public Tag setWritable(boolean writable)
false
only affects this tag, not any tags this tag may contain.
The main exception to this are the Table tags setting the
writable property of a table row or table cell does suppress the
row or cell contents from being returned to the browser.
writable - true if this element should be returned to
the browser.
Traversable.setWritable(boolean, boolean)public boolean isWritable()
public HTML setWritePermission(WritePermission control,
java.lang.String document,
java.lang.String id)
setWritePermission in interface HTMLcontrol - the instance of the WritePermission interface which can
be used in the write() method to determine if this object should
be returned to the browser.document - the unique name of the page containing this tag.id - the unique ID of the tag.
public WritePermission getWritePermission()
getWritePermission in interface HTML
public Tag addAttribute(java.lang.String name,
java.lang.String value)
setAttribute(String, String).
name - The attribute name.value - The value of the attribute.
public Tag addAttributes(java.util.Collection attributes)
attributes - The Collection of TagAttribute instances.
public Tag addAttributes(java.lang.String[][] attributes)
attributes - The array of attributes. If the value of index [0][0]
in the array is the same as the case-insensitive name of the
tag, the first element will be ignored.
PajeParser.getAttributes()public void addContent(java.lang.String content)
addContent in interface HTMLcontent - the tag content.getContent(),
setContent(org.pajes.html.HTML)public Tag clearAttribute(java.lang.String name)
name - The attribute name.
public Tag clearAttributes()
public java.lang.Object clone()
clone in interface HTMLTagException - if the clone fails.public void destroy()
Sub-classes MUST call super.destroy(); if
over-riding this method!
destroy in interface HTMLpublic java.lang.String toString()
public void write(Browser browser)
throws java.io.IOException
write in interface HTMLbrowser - the browser to which the results are to be output.
java.io.IOException - if an I/O error occurs writing to the browser.setWriteEndTag(boolean),
writeContent(org.pajes.servlet.Browser)protected void setAttribute(TagAttribute attribute)
attribute - The attribute.protected Tag setTagName(java.lang.String name)
name - the tag name.
protected boolean isWritable(Browser browser)
write(org.pajes.servlet.Browser) implementations to see if the tag is both
writable and permitted to be written.
browser - the browser to which the results are to be output.
protected void setWriteAttributes(boolean attributes)
attributes - true if attribues should be generated.protected void setWriteEndTag(boolean endTag)
endTag - true if an end tag should be generated.protected void setWritelnAfter(boolean on)
on - true if a line feed should be written after the tag end.protected void setWritelnAfterContent(boolean on)
on - true if a line feed should be written after the content.protected void setWritelnBefore(boolean on)
on - true if a line feed should be written before the tag.protected void setWritelnBeforeContent(boolean on)
on - true if a line feed should be written before the content.protected void init()
destroy() method to correctly
clear and initialise internal variables.
Sub-classes must call super.init() before doing
anything else to ensure the Tag is initialised correctly.
protected org.pajes.html.Tag.Attributes initAttributes()
protected void writeContent(Browser browser)
throws java.io.IOException
write(org.pajes.servlet.Browser) method to write any content between the
start and end tags. Note that this method will be called even if the
tag is NOTwritable, as long as setWriteEndTag(boolean) has been called with a true argument.
browser - the browser to which the results are to be output.
java.io.IOException - if an I/O error occurs writing to the browser.setWriteEndTag(boolean)
|
PAJES 2.3.9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||