PAJES 3.0.21

org.pajes.html
Class Span

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

public class Span
extends Container
implements TextContainer

Generate the <span> tags.

See Also:
FormattedText, Text, PlainText, Serialized Form

Field Summary
 
Fields inherited from class org.pajes.html.Tag
ON_CLICK_ATTRIBUTE, TAG_CLOSE, TAG_LEFT, TAG_RIGHT
 
Constructor Summary
Span()
          Creates an empty span.
Span(java.lang.String text)
          Creates a string of HTML formatted text.
Span(java.lang.String text, boolean bold)
          Creates a string of HTML formatted text.
Span(java.lang.String text, boolean bold, boolean italic)
          Creates a string of HTML formatted text.
Span(java.lang.String text, boolean bold, boolean italic, boolean underline)
          Creates a string of HTML formatted text.
Span(java.lang.String text, java.lang.String styleSheetClass)
          Creates a string of HTML formatted text.
Span(java.lang.String text, java.lang.String styleSheetClass, java.lang.String styleSheetID)
          Creates a string of HTML formatted text.
 
Method Summary
 Span encodeCharacterEntities(boolean encode)
          Detrmines if any ", &, < or > characters found in the text will be converted to the equivalent HTML named character entity (&quot;, &amp;, &lt; or &gt;).
 java.lang.String getContainedText()
          Returns the text that this object contains.
 java.lang.String getText()
          Retrieves the text that has been assigned to this span.
protected  void init()
          Called by the constructor and the Container.destroy() method to correctly clear and initialise internal variables.
 Span setBold(boolean bold)
          Sets the text to be in bold face.
 Span setFontColor(Color color)
          Sets the font color.
 Span setFontDefaults(Color fontColor, java.lang.String fontFamily, java.lang.String fontSize)
          Sets the font color, family and size.
 Span setFontFamily(java.lang.String family)
          Sets the font family.
 Span setFontSize(java.lang.String size)
          Sets the font size.
 Span setItalics(boolean italics)
          Sets the text to be italicised.
 Span setText(HTML text)
          Sets the text to be displayed.
 Span setText(java.lang.String text)
          Sets the text to be displayed.
 Span setUnderlined(boolean underline)
          Sets the text to be underlined.
 void write(Browser browser)
          Prints the <span> tags and the contained text to the browser.
 
Methods inherited from class org.pajes.html.Container
add, 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, getParent, getStyle, getStyleSheetClass, getTagName, getTitle, getWritePermission, hasAttribute, initAttributes, isChildOf, isChildOf, 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, setParent, setStyle, setStyleSheetClass, setTagName, setTitle, setWritable, setWriteAttributes, setWriteEndTag, setWritelnAfter, setWritelnAfterContent, setWritelnBefore, setWritelnBeforeContent, setWritePermission, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.pajes.html.Traversable
isWritable
 
Methods inherited from interface org.pajes.html.HTML
getContainer, getDocument, getId, getParent, getWritePermission, isChildOf, isChildOf, setContainer, setParent, setWritePermission
 

Constructor Detail

Span

public Span()
Creates an empty span.


Span

public Span(java.lang.String text)
Creates a string of HTML formatted text.

Parameters:
text - the text to display.

Span

public Span(java.lang.String text,
            boolean bold)
Creates a string of HTML formatted text.

Parameters:
text - the text to display.
bold - if true, the text is displayed in bold.

Span

public Span(java.lang.String text,
            boolean bold,
            boolean italic)
Creates a string of HTML formatted text.

Parameters:
text - the text to display.
bold - if true, the text is displayed in bold.
italic - if true, the text is displayed italicised.

Span

public Span(java.lang.String text,
            boolean bold,
            boolean italic,
            boolean underline)
Creates a string of HTML formatted text.

Parameters:
text - the text to display.
bold - if true, the text is displayed in bold.
italic - if true, the text is displayed italicised.
underline - if true, the text is displayed underlined.

Span

public Span(java.lang.String text,
            java.lang.String styleSheetClass)
Creates a string of HTML formatted text.

Parameters:
text - the text to display.
styleSheetClass - applies the specified style sheet class to the text.

Span

public Span(java.lang.String text,
            java.lang.String styleSheetClass,
            java.lang.String styleSheetID)
Creates a string of HTML formatted text.

Parameters:
text - the text to display.
styleSheetClass - applies the specified style sheet class to the text.
styleSheetID - sets the unique identifier of this object within the Document Object Model.
Method Detail

encodeCharacterEntities

public Span encodeCharacterEntities(boolean encode)
Detrmines if any ", &, < or > characters found in the text will be converted to the equivalent HTML named character entity (&quot;, &amp;, &lt; or &gt;).

Parameters:
encode - true if any special HTML characters in the text are to be converted to their equivalent HTML named character entity, or false if no changes are to be made to the text. The default is false.
Returns:
the modified Span object.
See Also:
Text.encodeCharacterEntities(java.lang.String)

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.

getText

public java.lang.String getText()
Retrieves the text that has been assigned to this span.

Returns:
the text assigned to this span.

setBold

public Span setBold(boolean bold)
Sets the text to be in bold face.

Parameters:
bold - if true, the text is displayed in bold.
Returns:
the modified Span object.

setFontColor

public Span setFontColor(Color color)
Sets the font color.

Parameters:
color - specifies the font color.
Returns:
the modified Span object.

setFontDefaults

public Span setFontDefaults(Color fontColor,
                            java.lang.String fontFamily,
                            java.lang.String fontSize)
Sets the font color, family and size.

Parameters:
fontColor - specifies the font color.
fontFamily - specifies the font family.
fontSize - specifies to the font size.
Returns:
the modified Span object.

setFontFamily

public Span setFontFamily(java.lang.String family)
Sets the font family.

Parameters:
family - specifies the font family.
Returns:
the modified Span object.

setFontSize

public Span setFontSize(java.lang.String size)
Sets the font size.

Parameters:
size - specifies to the font size.
Returns:
the modified Span object.

setItalics

public Span setItalics(boolean italics)
Sets the text to be italicised.

Parameters:
italics - if true, the text is displayed in italics.
Returns:
the modified Span object.

setText

public Span setText(HTML text)
Sets the text to be displayed.

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

setText

public Span setText(java.lang.String text)
Sets the text to be displayed.

Parameters:
text - the display text.
Returns:
the modified Span object.

setUnderlined

public Span setUnderlined(boolean underline)
Sets the text to be underlined.

Parameters:
underline - if true, the text is displayed underlined.
Returns:
the modified Span object.

write

public void write(Browser browser)
           throws java.io.IOException
Prints the <span> tags and the contained text to the browser.

Specified by:
write in interface HTML
Overrides:
write in class Tag
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.setWriteEndTag(boolean), Tag.writeContent(org.pajes.servlet.Browser)

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 3.0.21

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