PAJES 2.3.9

org.pajes.html
Class Anchor

java.lang.Object
  extended byorg.pajes.html.Tag
      extended byorg.pajes.html.TraversableElement
          extended byorg.pajes.html.SingleElementContainer
              extended byorg.pajes.html.Anchor
All Implemented Interfaces:
java.lang.Cloneable, HTML, java.io.Serializable, TextContainer, Traversable
Direct Known Subclasses:
AnchorButton

public class Anchor
extends SingleElementContainer
implements TextContainer

This class builds the HTML ANCHOR tags (<a></a>) for defining hyper links.

See Also:
Serialized Form

Field Summary
protected static java.lang.String AMPERSAND
          The & character
protected  java.util.HashMap parameters
          Map of parameters added with addParameter(java.lang.String, java.lang.String).
protected static java.lang.String QUESTION_MARK
          The ? character
 
Fields inherited from class org.pajes.html.Tag
ON_CLICK_ATTRIBUTE, TAG_CLOSE, TAG_LEFT, TAG_RIGHT
 
Constructor Summary
Anchor()
          Create an empty HTML Anchor tag.
Anchor(HTML text, java.lang.String url)
          Create an HTML Anchor tag.
Anchor(HTML text, java.lang.String url, java.lang.String frameTarget)
          Create an HTML Anchor tag.
Anchor(HTML text, java.lang.String url, java.lang.String frameTarget, java.lang.String name)
          Create an HTML Anchor tag.
Anchor(java.lang.String text, java.lang.String url)
          Create an HTML Anchor tag.
Anchor(java.lang.String text, java.lang.String url, java.lang.String frameTarget)
          Create an HTML Anchor tag.
Anchor(java.lang.String text, java.lang.String url, java.lang.String frameTarget, java.lang.String name)
          Create an HTML Anchor tag.
 
Method Summary
 Anchor addParameter(java.lang.String name, java.lang.String value)
          Add a parameter to the Anchor eg.
 Anchor clearParameters()
          Clears all parameters that have been defined on this anchor.
 java.lang.Object clone()
          Clones the Anchor.
 java.lang.String getContainedText()
          Returns the text that this object contains.
 java.lang.String getHREF(Browser browser)
          Returns the full HREF of the link, including any defined parameters.
 java.lang.String getName()
          Returns the name attribute of this input element.
 int getParameterCount()
          Returns the number of parameters.
protected  java.util.HashMap getParameters()
          Returns the internal parameters HashMap.
 java.lang.String getTarget()
          Returns the target frame for this link.
 HTML getText()
          Returns the text that this anchor or link surrounds.
 java.lang.String getURL()
          Returns the destination URL of the anchor.
protected  void init()
          Called by the constructor and the Tag.destroy() method to correctly clear and initialise internal variables.
protected  void setAttribute(TagAttribute attribute)
          Adds the specified attribute.
 Anchor setName(java.lang.String name)
          Sets the name of this Anchor tag.
 Anchor setStatusDisplay(java.lang.String text)
          Sets the appropriate OnMouseOver and OnMouseOut handlers to change the window status display to the specified text.
 Anchor setTarget(java.lang.String frameTarget)
          Sets the target frame of the anchor.
 Anchor setText(HTML text)
          Sets the text of the anchor.
 Anchor setText(java.lang.String text)
          Sets the text of the anchor.
 Anchor setURL(java.lang.String url)
          Sets the destination URL of the anchor.
 Anchor setURL(URI url)
          Sets the destination URL of the anchor.
protected  void writeContent(Browser browser)
          Called by the Tag.write(org.pajes.servlet.Browser) method to write any content between the start and end tags.
 
Methods inherited from class org.pajes.html.SingleElementContainer
get, set, size
 
Methods inherited from class org.pajes.html.TraversableElement
dump, dump, getAll, getFieldByName, getFirstFieldByName, getFirstTagByAttribute, getFirstTagByClass, getFirstTagByID, getFirstTagByName, getTagByAttribute, getTagByClass, getTagByID, getTagByName, setWritable
 
Methods inherited from class org.pajes.html.Tag
addAttribute, addAttributes, addAttributes, addContent, clearAttribute, clearAttributes, destroy, getAttribute, getAttributes, getAttributeSet, getContainer, getContent, getDocument, getId, getOnClickHandler, getOnDBLClickHandler, getOnKeyDownHandler, getOnKeyPressHandler, getOnKeyUpHandler, getOnMouseDownHandler, getOnMouseOutHandler, getOnMouseOverHandler, getOnMouseUpHandler, getStyle, getStyleSheetClass, getTagName, getTitle, getWritePermission, initAttributes, isWritable, isWritable, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setContainer, setContent, setContent, setId, setOnClickHandler, setOnDBLClickHandler, setOnKeyDownHandler, setOnKeyPressHandler, setOnKeyUpHandler, setOnMouseDownHandler, setOnMouseOutHandler, setOnMouseOverHandler, setOnMouseUpHandler, setStyle, setStyleSheetClass, setTagName, setTitle, setWritable, setWriteAttributes, setWriteEndTag, setWritelnAfter, setWritelnAfterContent, setWritelnBefore, setWritelnBeforeContent, setWritePermission, toString, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AMPERSAND

protected static final java.lang.String AMPERSAND
The & character

See Also:
Constant Field Values

QUESTION_MARK

protected static final java.lang.String QUESTION_MARK
The ? character

See Also:
Constant Field Values

parameters

protected java.util.HashMap parameters
Map of parameters added with addParameter(java.lang.String, java.lang.String).

Constructor Detail

Anchor

public Anchor()
Create an empty HTML Anchor tag.


Anchor

public Anchor(java.lang.String text,
              java.lang.String url)
Create an HTML Anchor tag.

Parameters:
text - the text to appear in the anchor.
url - the destination URL to goto when the anchor is selected

Anchor

public Anchor(java.lang.String text,
              java.lang.String url,
              java.lang.String frameTarget)
Create an HTML Anchor tag.

Parameters:
text - the text to appear in the anchor
url - the destination URL to goto when the anchor is selected
frameTarget - the frame in which the page will appear

Anchor

public Anchor(java.lang.String text,
              java.lang.String url,
              java.lang.String frameTarget,
              java.lang.String name)
Create an HTML Anchor tag.

Parameters:
text - the text to appear in the anchor
url - the destination URL to goto when the anchor is selected
frameTarget - the frame in which the page will appear
name - the name of the anchor (used by JavaScript)

Anchor

public Anchor(HTML text,
              java.lang.String url)
Create an HTML Anchor tag.

Parameters:
text - the text to appear in the anchor
url - the destination URL to goto when the anchor is selected

Anchor

public Anchor(HTML text,
              java.lang.String url,
              java.lang.String frameTarget)
Create an HTML Anchor tag.

Parameters:
text - the text to appear in the anchor
url - the destination URL to goto when the anchor is selected
frameTarget - the frame in which the page will appear

Anchor

public Anchor(HTML text,
              java.lang.String url,
              java.lang.String frameTarget,
              java.lang.String name)
Create an HTML Anchor tag.

Parameters:
text - the text to appear in the anchor
url - the destination URL to goto when the anchor is selected
frameTarget - the frame in which the page will appear
name - the name of the anchor (used by JavaScript)
Method Detail

getContainedText

public java.lang.String getContainedText()
Returns the text that this object contains.

Specified by:
getContainedText in interface TextContainer
Returns:
the text that this object contains.

getHREF

public java.lang.String getHREF(Browser browser)
Returns the full HREF of the link, including any defined parameters.

Parameters:
browser - the browser object.
Returns:
the HREF of the link.

setName

public Anchor setName(java.lang.String name)
Sets the name of this Anchor tag.

Parameters:
name - the name to apply to the input object.
Returns:
the modified Anchor object.

getName

public java.lang.String getName()
Returns the name attribute of this input element.

Returns:
the name attribute of this input element.

getParameterCount

public int getParameterCount()
Returns the number of parameters.

Returns:
the number of parameters.

setStatusDisplay

public Anchor setStatusDisplay(java.lang.String text)
Sets the appropriate OnMouseOver and OnMouseOut handlers to change the window status display to the specified text.

Parameters:
text - is the text to be displayed in the status bar. If null, the OnMouseOver and OnMouseOut handlers are cleared.
Returns:
the modified Anchor object.

setTarget

public Anchor setTarget(java.lang.String frameTarget)
Sets the target frame of the anchor.

Parameters:
frameTarget - the name of the target frame.
Returns:
the modified Anchor object.

getTarget

public java.lang.String getTarget()
Returns the target frame for this link.

Returns:
the target frame name.

setText

public Anchor setText(java.lang.String text)
Sets the text of the anchor.

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

setText

public Anchor setText(HTML text)
Sets the text of the anchor.

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

getText

public HTML getText()
Returns the text that this anchor or link surrounds.

Returns:
the HTML object representing the displayed contents of this anchor or link.

setURL

public Anchor setURL(java.lang.String url)
Sets the destination URL of the anchor.

Parameters:
url - the destination URL.
Returns:
the modified Anchor object.

setURL

public Anchor setURL(URI url)
Sets the destination URL of the anchor.

Parameters:
url - the destination URL.
Returns:
the modified Anchor object.

getURL

public java.lang.String getURL()
Returns the destination URL of the anchor.

Returns:
the destination URL.

addParameter

public Anchor addParameter(java.lang.String name,
                           java.lang.String value)
Add a parameter to the Anchor eg. myPage.html?action=save&clientId=abc123& where the text after the '?' are the parameter name/value pairs separated by the ampersand.

Parameters:
name - the name of the parameter
value - the value of the parameter
Returns:
the modified Anchor instance.

clearParameters

public Anchor clearParameters()
Clears all parameters that have been defined on this anchor.

Returns:
the modified Anchor instance.

clone

public java.lang.Object clone()
Clones the Anchor.

Specified by:
clone in interface HTML
Overrides:
clone in class Tag
Returns:
a clone of this Anchor

setAttribute

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

Overrides:
setAttribute in class Tag
Parameters:
attribute - The attribute.

getParameters

protected java.util.HashMap getParameters()
Returns the internal parameters HashMap.

Returns:
the HashMap of parameters.
See Also:
addParameter(java.lang.String, java.lang.String)

init

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

Overrides:
init in class Tag

writeContent

protected void writeContent(Browser browser)
                     throws java.io.IOException
Description copied from class: SingleElementContainer
Called by the Tag.write(org.pajes.servlet.Browser) method to write any content between the start and end tags.

Overrides:
writeContent in class SingleElementContainer
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:
Tag.writeContent(Browser)

PAJES 2.3.9

Copyright © 2002-2003 Viridian Pty Limited. All Rights Reserved.