PAJES 3.0.21

org.pajes.html
Class PlainText

java.lang.Object
  extended by org.pajes.html.PlainText
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HTML, TextContainer
Direct Known Subclasses:
Text

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

This class emits the text that is used within containers such as Script and StyleSheet, where no substitution of character entities should be performed.

See Also:
FormattedText, Span, Text, Serialized Form

Constructor Summary
protected PlainText()
          Default constructor does nothing.
  PlainText(java.lang.String text)
          Creates a line of unformatted text.
  PlainText(java.lang.String text, boolean suppressNewLine)
          Creates a line of unformatted text.
 
Method Summary
 PlainText add(java.lang.String text)
          Adds more text to the existing text.
 void addContent(java.lang.String content)
          Adds more text to the existing text.
 java.lang.Object clone()
          Allows the text to be cloned.
 void destroy()
          Sets all the internal variables of this object to null, to assist in garbage collection.
 java.lang.String getContainedText()
          Returns the text that this object contains.
 Container getContainer()
          Deprecated. Use getParent()
 java.lang.String getDocument()
          Gets the the unique name of the document containing the container to which this text was added.
 java.lang.String getId()
          Always returns null for text objects, as they cannot have an ID attribute.
 Traversable getParent()
          Returns the last parent to which this HTML instance has been added.
protected  java.lang.StringBuilder getText()
          Returns the internal string buffer.
 WritePermission getWritePermission()
          Returns the object which will be used to determine whether this container to which this text was added will be returned to the requesting browser.
 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 isNewLineSuppressed()
          Determines whether a new line at the end of the text is suppressed or not.
 boolean isWritable()
          Determines whether this object should be displayed or not.
 void setContainer(Container container)
          Deprecated. Use setParent(Traversable)
 void setContent(java.lang.String content)
          Replaces the text in this object.
 void setParent(Traversable parent)
          Sets the container to which this HTML instance has been added.
 PlainText setText(java.lang.String text)
          Replaces the current text, rather than appending.
 PlainText setWritable(boolean visible)
          Determines if this object should be displayed.
 HTML setWritePermission(WritePermission control, java.lang.String document, java.lang.String id)
          Sets the object which will be used to determine whether this container will be returned to the requesting browser.
 java.lang.String toString()
          Returns the text represented by this object as a string.
 void write(Browser browser)
          Returns the text.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlainText

public PlainText(java.lang.String text)
Creates a line of unformatted text.

Parameters:
text - the line of text.

PlainText

public PlainText(java.lang.String text,
                 boolean suppressNewLine)
Creates a line of unformatted text.

Parameters:
text - the line of text.
suppressNewLine - suppresses a new line after the text.

PlainText

protected PlainText()
Default constructor does nothing.

Method Detail

add

public PlainText add(java.lang.String text)
Adds more text to the existing text. No new lines are automatically inserted.

Parameters:
text - the line of text.
Returns:
the modified Text instance

addContent

public void addContent(java.lang.String content)
Adds more text to the existing text. No new lines are automatically inserted.

Specified by:
addContent in interface HTML
Parameters:
content - the line of content.

clone

public java.lang.Object clone()
Allows the text to be cloned.

Specified by:
clone in interface HTML
Overrides:
clone in class java.lang.Object
Returns:
the cloned text.
Throws:
java.lang.RuntimeException - if a CloneNotSupportedException is thrown, which should never happen.

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

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.

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, or null if it has not been added to a container.

getDocument

public java.lang.String getDocument()
Gets the the unique name of the document containing the container to which this text was added.

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()
Always returns null for text objects, as they cannot have an ID attribute.

Specified by:
getId in interface HTML
Returns:
null

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.

getWritePermission

public WritePermission getWritePermission()
Returns the object which will be used to determine whether this container to which this text was added 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 will be returned to the browser.

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)

isNewLineSuppressed

public boolean isNewLineSuppressed()
Determines whether a new line at the end of the text is suppressed or not.

Returns:
true if the new line has been suppressed.

isWritable

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

Returns:
true if this element should be displayed.

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(java.lang.String content)
Replaces the text in this object.

Specified by:
setContent in interface HTML
Parameters:
content - the line of text.
See Also:
setText(java.lang.String)

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.

setText

public PlainText setText(java.lang.String text)
Replaces the current text, rather than appending.

Parameters:
text - the line of text.
Returns:
the modified Text instance

setWritable

public PlainText setWritable(boolean visible)
Determines if this object should be displayed.

Parameters:
visible - true if this element should be displayed.
Returns:
the modified Tag object

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 container will be returned to the requesting browser.

WARNING! This will modify the WritePermission of the container to which this text was last added.

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 HTML object

toString

public java.lang.String toString()
Returns the text represented by this object as a string.

Overrides:
toString in class java.lang.Object
Returns:
the text.

write

public void write(Browser browser)
           throws java.io.IOException
Returns the text.

Specified by:
write in interface HTML
Parameters:
browser - the browser to which the results are to be output.
Throws:
java.io.IOException - if an error occurs writing the content to the browser.

getText

protected java.lang.StringBuilder getText()
Returns the internal string buffer.

Returns:
the internal string buffer.

PAJES 3.0.21

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