PAJES 2.3.9

org.pajes.html
Class Label

java.lang.Object
  extended byorg.pajes.html.Tag
      extended byorg.pajes.html.TraversableElement
          extended byorg.pajes.html.Container
              extended byorg.pajes.html.Label
All Implemented Interfaces:
java.lang.Cloneable, HTML, java.io.Serializable, TextContainer, Traversable

public class Label
extends Container
implements TextContainer

This class builds the HTML LABEL tags (<label></label>) for annotating input tags.

Author:
David Bullock [db@dawnbreaks.net]
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.pajes.html.Tag
ON_CLICK_ATTRIBUTE, TAG_CLOSE, TAG_LEFT, TAG_RIGHT
 
Constructor Summary
Label(HTML text, Input input)
          Create a HTML Label tag.
Label(HTML text, java.lang.String id)
          Create a HTML Label tag.
Label(java.lang.String text, Input input)
          Create a HTML Label tag.
Label(java.lang.String text, java.lang.String id)
          Create a HTML Label tag.
 
Method Summary
 Container add(HTML htmlObject)
          Adds an HTML object to the current container
 java.lang.String getAccessKey(Browser browser)
          Returns the shortcut key for giving focus to this LABEL.
 java.lang.String getContainedText()
          Returns the text that this object contains.
 java.lang.String getFor()
          Returns the ID of the INPUT this label refers to.
 java.lang.String getFor(Browser browser)
          Returns the ID of the INPUT this label refers to.
 Input getInput()
          Returns or locates the input element associated with this tag.
 java.lang.String getOnBlurHandler(Browser browser)
          Returns the JavaScript handler for return this event.
 java.lang.String getOnFocusHandler(Browser browser)
          Returns the JavaScript handler for return this event.
protected  void init()
          Called by the constructor and the Container.destroy() method to correctly clear and initialise internal variables.
 Label setAccessKey(char key)
          Specifies a single Unicode character as a shortcut key for giving focus to this LABEL, which passes the focus on to the associated form control.
 Label setAccessKey(java.lang.String key)
          Specifies a single character String, or a character entity reference (a valid entity that begins with an & and ends with a ;) as a shortcut key for giving focus to this LABEL, which passes the focus on to the associated form control.
 Label setFor(Input input)
          Sets the ID of the HTML INPUT element this label describes.
 Label setFor(java.lang.String id)
          Sets the ID of the HTML INPUT element this label describes.
 Label setOnBlurHandler(java.lang.String onBlurHandler)
          Sets the JavaScript handler for this event.
 Label setOnFocusHandler(java.lang.String onFocusHandler)
          Sets the JavaScript handler for this event.
 Label setText(HTML text)
          Sets the text of the label.
 Label setText(java.lang.String text)
          Sets the text of the label.
 
Methods inherited from class org.pajes.html.Container
add, add, add, addContent, clear, clone, delete, delete, destroy, get, getContent, getContents, getPosition, insert, replace, set, setContent, setContent, size, writeContent
 
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, clearAttribute, clearAttributes, getAttribute, getAttributes, getAttributeSet, getContainer, 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, setAttribute, setAttributes, setAttributes, setContainer, 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
 

Constructor Detail

Label

public Label(java.lang.String text,
             Input input)
Create a HTML Label tag.

Parameters:
text - the text to appear in the label.
input - the INPUT element this label describes.

Label

public Label(HTML text,
             Input input)
Create a HTML Label tag.

Parameters:
text - the text to appear in the label.
input - the INPUT element this label describes.

Label

public Label(java.lang.String text,
             java.lang.String id)
Create a HTML Label tag.

Parameters:
text - the text to appear in the label.
id - the ID of the HTML INPUT element this label describes.

Label

public Label(HTML text,
             java.lang.String id)
Create a HTML Label tag.

Parameters:
text - the text to appear in the label.
id - the ID of the HTML INPUT element this label describes.
Method Detail

setAccessKey

public Label setAccessKey(char key)
Specifies a single Unicode character as a shortcut key for giving focus to this LABEL, which passes the focus on to the associated form control.

Parameters:
key - the shortcut key.
Returns:
the modified Label object.

setAccessKey

public Label setAccessKey(java.lang.String key)
Specifies a single character String, or a character entity reference (a valid entity that begins with an & and ends with a ;) as a shortcut key for giving focus to this LABEL, which passes the focus on to the associated form control.

Parameters:
key - the shortcut key.
Returns:
the modified Label object.
Throws:
TagException - if the key specified is a null value, or a String that is longer than a single character, or a malformed character entity reference.

getAccessKey

public java.lang.String getAccessKey(Browser browser)
Returns the shortcut key for giving focus to this LABEL.

Parameters:
browser - the browser to which the output is being sent.
Returns:
the shortcut key for giving focus to this LABEL.

getContainedText

public java.lang.String getContainedText()
Description copied from interface: TextContainer
Returns the text that this object contains.

Specified by:
getContainedText in interface TextContainer
Returns:
the text that this object contains.
See Also:
TextContainer.getContainedText()

setFor

public Label setFor(java.lang.String id)
Sets the ID of the HTML INPUT element this label describes.

Parameters:
id - the ID of the HTML INPUT element this label describes.
Returns:
the modified Label object.
Throws:
TagException - if the specified ID is null or an empty string.

setFor

public Label setFor(Input input)
Sets the ID of the HTML INPUT element this label describes.

Parameters:
input - the INPUT element this label describes.
Returns:
the modified Label object.

getFor

public java.lang.String getFor(Browser browser)
Returns the ID of the INPUT this label refers to.

Parameters:
browser - the browser object.
Returns:
the ID of the INPUT this label refers to.

getFor

public java.lang.String getFor()
Returns the ID of the INPUT this label refers to.

Returns:
the ID of the INPUT this label refers to.

getInput

public Input getInput()
Returns or locates the input element associated with this tag.

Returns:
the input element associated with this tag, or null if it cannot be located.
Throws:
TagException - if the FOR attribute has not been specified.

setOnBlurHandler

public Label setOnBlurHandler(java.lang.String onBlurHandler)
Sets the JavaScript handler for this event.

Parameters:
onBlurHandler - The new onBlurHandler value
Returns:
the modified Label object.

getOnBlurHandler

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

Parameters:
browser - the browser to which the output is being sent.
Returns:
the JavaScript handler string.

setOnFocusHandler

public Label setOnFocusHandler(java.lang.String onFocusHandler)
Sets the JavaScript handler for this event.

Parameters:
onFocusHandler - The new onFocusHandler value
Returns:
the modified Label object.

getOnFocusHandler

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

Parameters:
browser - the browser to which the output is being sent.
Returns:
the JavaScript handler string.

setText

public Label setText(java.lang.String text)
Sets the text of the label. Any existing text is removed.

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

setText

public Label setText(HTML text)
Sets the text of the label. Any existing text is removed.

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

add

public Container add(HTML htmlObject)
Description copied from class: Container
Adds an HTML object to the current container

Overrides:
add in class Container
Parameters:
htmlObject - - the Object to add (eg. doc.add(new htmlBody);)
Returns:
the modified Container object;
See Also:
Container.add(org.pajes.html.HTML)

init

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

PAJES 2.3.9

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