PAJES 3.0.21

org.pajes.html
Class Tag

java.lang.Object
  extended by org.pajes.html.Tag
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HTML
Direct Known Subclasses:
Break, Frame, Head.Base, Head.Link, Head.Meta, Head.Title, HorizontalLine, Image, Input, Option, Parameter, Table.Column, TraversableElement

public class Tag
extends java.lang.Object
implements java.lang.Cloneable, HTML, java.io.Serializable

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.

See Also:
Serialized Form

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<TagAttribute> attributes)
          Adds additional 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<TagAttribute> getAttributeSet()
          Returns the attributes defined for this tag.
 Container getContainer()
          Deprecated. Use getParent()
 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.
 Traversable getParent()
          Returns the last parent to which this HTML instance has been added.
 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.
 boolean hasAttribute(java.lang.String name)
          Determines if this tag has an attribute with the specified name.
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 isChildOf(HTML html)
          Determines if the specified item is in the ancestry of this tag.
 boolean isChildOf(java.lang.String id)
          Determines if the specified id is in the ancestry of this tag.
 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<TagAttribute> 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)
          Deprecated. Use setParent(Traversable)
 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.
 void setParent(Traversable parent)
          Sets the container to which this HTML instance has been added.
 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

ON_CLICK_ATTRIBUTE

protected static final java.lang.String ON_CLICK_ATTRIBUTE
The onclick attribute name.

See Also:
Constant Field Values

TAG_CLOSE

protected static final java.lang.String TAG_CLOSE
The / character.

See Also:
Constant Field Values

TAG_LEFT

protected static final java.lang.String TAG_LEFT
The < character.

See Also:
Constant Field Values

TAG_RIGHT

protected static final java.lang.String TAG_RIGHT
The > character.

See Also:
Constant Field Values
Constructor Detail

Tag

public Tag(java.lang.String name)
Creates the base tag instance.

Parameters:
name - the tag name.

Tag

public Tag(java.lang.String name,
           java.lang.String close)
Creates the base tag instance.

Parameters:
name - the tag name.
close - the character that flags the end of a tag.
Method Detail

addAttribute

@Deprecated
public Tag addAttribute(java.lang.String name,
                                   java.lang.String value)
Deprecated. 2.2.0 Use setAttribute(String, String).

Adds a string attribute. e.g. align="center" The value will be trimmed and quoted.

Parameters:
name - The attribute name.
value - The value of the attribute.
Returns:
the modified Tag instance.

addAttributes

public Tag addAttributes(java.util.Collection<TagAttribute> attributes)
Adds additional attributes from an existing collection.

Parameters:
attributes - The Collection of TagAttribute instances.
Returns:
the modified Tag instance.

addAttributes

public Tag addAttributes(java.lang.String[][] attributes)
Adds additional attributes from a String array.

Parameters:
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.
Returns:
the modified Tag instance.
See Also:
PajeParser.getAttributes()

addContent

public void addContent(java.lang.String content)
Adds content to this tag.

Specified by:
addContent in interface HTML
Parameters:
content - the tag content.
See Also:
getContent(), setContent(org.pajes.html.HTML)

clearAttribute

public Tag clearAttribute(java.lang.String name)
Removes the specified attribute.

Parameters:
name - The attribute name.
Returns:
the modified Tag instance.

clearAttributes

public Tag clearAttributes()
Removes all attributes defined for the tag.

Returns:
the modified Tag instance.

clone

public java.lang.Object clone()
Allows a tag to be cloned. Note that this standard clone() is a shallow clone: the Object is cloned, but the objects it contains still reference the ORIGINAL objects.

Specified by:
clone in interface HTML
Overrides:
clone in class java.lang.Object
Returns:
the cloned Tag.
Throws:
TagException - if the clone fails.

destroy

public void destroy()
Sets all the internal variables of this object to null, to assist in garbage collection.

Sub-classes MUST call super.destroy(); if over-riding this method!

Specified by:
destroy in interface HTML

getAttribute

public TagAttribute getAttribute(java.lang.String name)
Returns the specified named TagAttribute.

Parameters:
name - the name of the attribute to be retrieved.
Returns:
the requested TagAttribute, or an empty TagAttribute if no TagAttribute of that name was found.

getAttributes

public java.lang.String getAttributes(Browser browser)
Returns the attributes defined for this tag.

Parameters:
browser - the browser to which the results are to be output.
Returns:
a String of the name/value pairs of the attributes for this tag, or an empty String if no attributes have been defined.

getAttributeSet

public java.util.Set<TagAttribute> getAttributeSet()
Returns the attributes defined for this tag.

Returns:
an unmodifiable Set of the attributes defined for this tag.

getContainer

@Deprecated
public Container getContainer()
Deprecated. Use getParent()

Returns the last container to which this HTML instance has been added.

Specified by:
getContainer in interface HTML
Returns:
the last container to which this HTML instance has been added.

getContent

public HTML getContent()
Returns the content of this tag.

Returns:
the content.
See Also:
addContent(java.lang.String), getContent()

getDocument

public java.lang.String getDocument()
Gets the the unique name of the document containing this tag.

Specified by:
getDocument in interface HTML
Returns:
the name of the document.
See Also:
setWritePermission(org.pajes.security.WritePermission, java.lang.String, java.lang.String)

getId

public java.lang.String getId()
Gets the ID attribute of the current tag.

Specified by:
getId in interface HTML
Returns:
the ID attribute of the current tag.
See Also:
setId(java.lang.String)

getOnClickHandler

public java.lang.String getOnClickHandler(Browser browser)
Returns the JavaScript handler for return this.event.

Parameters:
browser - the Broiwser instance.
Returns:
the JavaScript handler string.

getOnDBLClickHandler

public java.lang.String getOnDBLClickHandler(Browser browser)
Returns the JavaScript handler for return this.event.

Parameters:
browser - the Broiwser instance.
Returns:
the JavaScript handler string.

getOnKeyDownHandler

public java.lang.String getOnKeyDownHandler(Browser browser)
Returns the JavaScript handler for return this.event.

Parameters:
browser - the Broiwser instance.
Returns:
the JavaScript handler string.

getOnKeyPressHandler

public java.lang.String getOnKeyPressHandler(Browser browser)
Returns the JavaScript handler for return this.event.

Parameters:
browser - the Broiwser instance.
Returns:
the JavaScript handler string.

getOnKeyUpHandler

public java.lang.String getOnKeyUpHandler(Browser browser)
Returns the JavaScript handler for return this.event.

Parameters:
browser - the Broiwser instance.
Returns:
the JavaScript handler string.

getOnMouseDownHandler

public java.lang.String getOnMouseDownHandler(Browser browser)
Returns the JavaScript handler for return this.event.

Parameters:
browser - the Broiwser instance.
Returns:
the JavaScript handler string.

getOnMouseOutHandler

public java.lang.String getOnMouseOutHandler(Browser browser)
Returns the JavaScript handler for return this.event.

Parameters:
browser - the Broiwser instance.
Returns:
the JavaScript handler string.

getOnMouseOverHandler

public java.lang.String getOnMouseOverHandler(Browser browser)
Returns the JavaScript handler for return this.event.

Parameters:
browser - the Broiwser instance.
Returns:
the JavaScript handler string.

getOnMouseUpHandler

public java.lang.String getOnMouseUpHandler(Browser browser)
Returns the JavaScript handler for return this.event.

Parameters:
browser - the Broiwser instance.
Returns:
the JavaScript handler string.

getParent

public Traversable getParent()
Returns the last parent to which this HTML instance has been added.

Specified by:
getParent in interface HTML
Returns:
the last parent to which this HTML instance has been added.

getStyle

public java.lang.String getStyle()
Returns the style attribute of the tag.

Returns:
the style attribute of the current tag.
See Also:
setStyle(java.lang.String)

getStyleSheetClass

public java.lang.String getStyleSheetClass()
Gets the CLASS attribute of the current tag.

Returns:
the CLASS attribute of the current tag.
See Also:
setStyleSheetClass(java.lang.String)

getTagName

public java.lang.String getTagName()
Returns the tag name.

Returns:
the tag name.

getTitle

public java.lang.String getTitle()
Returns the global title attribute.

Returns:
the title.

getWritePermission

public WritePermission getWritePermission()
Returns the object which will be used to determine whether this piece of HTML will be returned to the requesting browser.

Specified by:
getWritePermission in interface HTML
Returns:
the implementation of the WritePermission interface which can be used in the write() method to determine if this object should be returned to the browser.

hasAttribute

public boolean hasAttribute(java.lang.String name)
Determines if this tag has an attribute with the specified name.

Parameters:
name - the name of the attribute.
Returns:
true if the named attribute exists.

isChildOf

public boolean isChildOf(HTML html)
Description copied from interface: HTML
Determines if the specified item is in the ancestry of this tag.

Specified by:
isChildOf in interface HTML
Parameters:
html - the parent item
Returns:
true if the specified item is in the ancestry of this tag.
See Also:
HTML.isChildOf(org.pajes.html.HTML)

isChildOf

public boolean isChildOf(java.lang.String id)
Description copied from interface: HTML
Determines if the specified id is in the ancestry of this tag.

Specified by:
isChildOf in interface HTML
Parameters:
id - the parent id.
Returns:
true if the specified id is in the ancestry of this tag.
See Also:
HTML.isChildOf(java.lang.String)

isWritable

public boolean isWritable()
Determines whether this object should be displayed or not.

Returns:
true if this element should be displayed.

setAttribute

public Tag setAttribute(java.lang.String name,
                        boolean required)
Adds a unary attribute.

Parameters:
name - The attribute name.
required - True if the tag is required.
Returns:
the modified Tag instance.

setAttribute

public Tag setAttribute(java.lang.String name,
                        java.lang.Boolean tagRequired)
Adds a unary attribute.

Parameters:
name - The attribute name.
tagRequired - True if the tag is required.
Returns:
the modified Tag instance.

setAttribute

public Tag setAttribute(java.lang.String name,
                        Color value)
Adds a colour attribute.

Parameters:
name - the colour attribute name.
value - the colour value of the attribute.
Returns:
the modified Tag instance.

setAttribute

public Tag setAttribute(java.lang.String name,
                        int value)
Adds an attribute where the value is an integer.

Parameters:
name - The attribute name.
value - TagAttribute int Value
Returns:
the modified Tag instance.

setAttribute

public Tag setAttribute(java.lang.String name,
                        int value,
                        boolean quoted)
Adds an attribute where the value is an integer.

Parameters:
name - The attribute name.
value - TagAttribute int Value
quoted - If true, places quotes around the attribute value.
Returns:
the modified Tag instance.

setAttribute

public Tag setAttribute(java.lang.String name,
                        java.lang.Integer value)
Adds an attribute where the value is an integer.

Parameters:
name - The attribute name.
value - TagAttribute Integer Value
Returns:
the modified Tag instance.

setAttribute

public Tag setAttribute(java.lang.String name,
                        java.lang.Integer value,
                        boolean quoted)
Adds an attribute where the value is an integer.

Parameters:
name - The attribute name.
value - TagAttribute int Value
quoted - If true, places quotes around the attribute value.
Returns:
the modified Tag instance.

setAttribute

public Tag setAttribute(java.lang.String name,
                        java.lang.String value)
Adds a string attribute. The value will be trimmed and quoted.

Parameters:
name - The attribute name.
value - The value of the attribute.
Returns:
the modified Tag instance.

setAttribute

public Tag setAttribute(java.lang.String name,
                        java.lang.String value,
                        boolean quoted)
Adds a string attribute.

Parameters:
name - The attribute name.
value - The value of the attribute.
quoted - If true, places quotes around the attribute value.
Returns:
the modified Tag instance.

setAttribute

public Tag setAttribute(java.lang.String name,
                        java.lang.String value,
                        boolean quoted,
                        boolean trim)
Adds a string attribute.

Parameters:
name - The attribute name.
value - The value of the attribute.
quoted - If true, places quotes around the attribute value.
trim - Trims the value.
Returns:
the modified Tag instance.

setAttributes

public Tag setAttributes(java.util.Collection<TagAttribute> attributes)
Clears and resets the tag attributes from an existing collection.

Parameters:
attributes - The Collection of TagAttribute instances.
Returns:
the modified Tag instance.

setAttributes

public Tag setAttributes(java.lang.String[][] attributes)
Clears and resets the tag attributes from a String array.

Parameters:
attributes - The array of attributes.
Returns:
the modified Tag instance.
See Also:
PajeParser.getAttributes()

setContainer

@Deprecated
public void setContainer(Container container)
Deprecated. Use setParent(Traversable)

Sets the container to which this HTML instance has been added.

Specified by:
setContainer in interface HTML
Parameters:
container - the container to which this HTML instance has been added.

setContent

public void setContent(HTML content)
Sets the content of this tag, replacing any existing content.

Parameters:
content - the content.
See Also:
getContent(), setContent(org.pajes.html.HTML)

setContent

public void setContent(java.lang.String content)
Sets the content of this tag, replacing any existing content.

Specified by:
setContent in interface HTML
Parameters:
content - the content.
See Also:
getContent(), setContent(org.pajes.html.HTML)

setId

public Tag setId(java.lang.String id)
Sets the ID attribute of the current tag. An ID uniquely indentifies an element within a document.

Parameters:
id - the unique ID of the tag
Returns:
the modified Tag object
See Also:
setWritePermission(org.pajes.security.WritePermission, java.lang.String, java.lang.String)

setOnClickHandler

public Tag setOnClickHandler(java.lang.String onClickHandler)
Sets the JavaScript handler for this event.

Parameters:
onClickHandler - The new onClickHandler value
Returns:
the modified Tag instance.

setOnDBLClickHandler

public Tag setOnDBLClickHandler(java.lang.String onDBLClickHandler)
Sets the JavaScript handler for this event.

Parameters:
onDBLClickHandler - The new onDBLClickHandler value
Returns:
the modified Tag instance.

setOnKeyDownHandler

public Tag setOnKeyDownHandler(java.lang.String onKeyDownHandler)
Sets the JavaScript handler for this event.

Parameters:
onKeyDownHandler - The new onKeyDownHandler value
Returns:
the modified Tag instance.

setOnKeyPressHandler

public Tag setOnKeyPressHandler(java.lang.String onKeyPressHandler)
Sets the JavaScript handler for this event.

Parameters:
onKeyPressHandler - The new onKeyPressHandler value
Returns:
the modified Tag instance.

setOnKeyUpHandler

public Tag setOnKeyUpHandler(java.lang.String onKeyUpHandler)
Sets the JavaScript handler for this event.

Parameters:
onKeyUpHandler - The new onKeyUpHandler value
Returns:
the modified Tag instance.

setOnMouseDownHandler

public Tag setOnMouseDownHandler(java.lang.String onMouseDownHandler)
Sets the JavaScript handler for this event.

Parameters:
onMouseDownHandler - The new onMouseDownHandler value
Returns:
the modified Tag instance.

setOnMouseOutHandler

public Tag setOnMouseOutHandler(java.lang.String onMouseOutHandler)
Sets the JavaScript handler for this event.

Parameters:
onMouseOutHandler - The new onMouseOutHandler value
Returns:
the modified Tag instance.

setOnMouseOverHandler

public Tag setOnMouseOverHandler(java.lang.String onMouseOverHandler)
Sets the JavaScript handler for this event.

Parameters:
onMouseOverHandler - The new onMouseOverHandler value
Returns:
the modified Tag instance.

setOnMouseUpHandler

public Tag setOnMouseUpHandler(java.lang.String onMouseUpHandler)
Sets the JavaScript handler for this event.

Parameters:
onMouseUpHandler - The new onMouseUpHandler value
Returns:
the modified Tag instance.

setParent

public void setParent(Traversable parent)
Sets the container to which this HTML instance has been added.

Specified by:
setParent in interface HTML
Parameters:
parent - the parent HTML object to which this HTML instance has been added.

setStyle

public Tag setStyle(java.lang.String style)
Sets the Style of the current tag. An individual tag can have a different style by specifying 'style=color:blue; fontsize:12; ' etc.

Parameters:
style - The new style value
Returns:
the modified Tag object

setStyleSheetClass

public Tag setStyleSheetClass(java.lang.String styleSheetClass)
Sets the CLASS attribute of the current tag. The class allows a common style setting to be applied to multiple tags.

Parameters:
styleSheetClass - The new styleSheetClass value
Returns:
the modified Tag object

setTitle

public Tag setTitle(java.lang.String text)
Sets the global title attribute.

Parameters:
text - is the text to be displayed.
Returns:
the modified Tag object.

setWritable

public Tag setWritable(boolean writable)
Determines if this object should be returned to the browser. Note that in the majority of cases, setting this property to 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.

Parameters:
writable - true if this element should be returned to the browser.
Returns:
the modified Tag instance.
See Also:
Traversable.setWritable(boolean, boolean)

setWritePermission

public 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.

Specified by:
setWritePermission in interface HTML
Parameters:
control - 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.
Returns:
the modified Tag object

toString

public java.lang.String toString()
Returns the HTML object as a string.

Overrides:
toString in class java.lang.Object
Returns:
the string of HTML.

write

public void write(Browser browser)
           throws java.io.IOException
Writes the tag to the browser.

Specified by:
write in interface HTML
Parameters:
browser - the browser to which the results are to be output.
Throws:
java.io.IOException - if an I/O error occurs writing to the browser.
See Also:
setWriteEndTag(boolean), writeContent(org.pajes.servlet.Browser)

init

protected void init()
Called by the constructor and the 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.


initAttributes

protected org.pajes.html.Tag.Attributes initAttributes()
Called whenever a new, empty set of tag attributes is required.

Returns:
a new Attributes instance.

isWritable

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.

Parameters:
browser - the browser to which the results are to be output.
Returns:
true if this element should be written to the browser.

setAttribute

protected void setAttribute(TagAttribute attribute)
Adds the specified attribute.

Parameters:
attribute - The attribute.

setTagName

protected Tag setTagName(java.lang.String name)
Returns the tag name.

Parameters:
name - the tag name.
Returns:
the modified Tag object.

setWriteAttributes

protected void setWriteAttributes(boolean attributes)
Determines whether this tag has attributes or not.

Parameters:
attributes - true if attribues should be generated.

setWriteEndTag

protected void setWriteEndTag(boolean endTag)
Determines whether this tag has an end tag or not.

Parameters:
endTag - true if an end tag should be generated.

setWritelnAfter

protected void setWritelnAfter(boolean on)
Determines whether a line feed will be written after the tag end.

Parameters:
on - true if a line feed should be written after the tag end.

setWritelnAfterContent

protected void setWritelnAfterContent(boolean on)
Determines whether a line feed will be written after the content.

Parameters:
on - true if a line feed should be written after the content.

setWritelnBefore

protected void setWritelnBefore(boolean on)
Determines whether a line feed will be written before the tag.

Parameters:
on - true if a line feed should be written before the tag.

setWritelnBeforeContent

protected void setWritelnBeforeContent(boolean on)
Determines whether a line feed will be written before the content.

Parameters:
on - true if a line feed should be written before the content.

writeContent

protected void writeContent(Browser browser)
                     throws java.io.IOException
Called by the 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.

Parameters:
browser - the browser to which the results are to be output.
Throws:
java.io.IOException - if an I/O error occurs writing to the browser.
See Also:
setWriteEndTag(boolean)

PAJES 3.0.21

Copyright 1998-2007 Viridian Pty Limited. All Rights Reserved.