org.nakedobjects.object.value
Class TextString

java.lang.Object
  extended byorg.nakedobjects.object.value.AbstractNakedValue
      extended byorg.nakedobjects.object.value.TextString
All Implemented Interfaces:
Naked, NakedValue, java.io.Serializable
Direct Known Subclasses:
Label, MultilineTextString

public class TextString
extends AbstractNakedValue

Value object representing an unformatted text string of unbounded length.

This object does support value listeners.

See Also:
Serialized Form

Constructor Summary
TextString()
          Creates an empty TextString.
TextString(java.lang.String text)
          Creates a TextString containing the specified text.
TextString(TextString textString)
          Creates a TextString containing a copy of the text in the specified TextString.
 
Method Summary
 void clear()
          clears the value (sets to null) and notifies any listeners.
 boolean contains(java.lang.String text)
          Returns true if the specified text is found withing this object.
 boolean contains(java.lang.String text, Case caseSensitive)
          Returns true if the specified text is found withing this object.
 void copyObject(Naked object)
          Copies the content of the specified object into this object.
 boolean endsWith(java.lang.String text)
          Returns true if the specified text is found at the end of this object's text.
 boolean endsWith(java.lang.String text, Case caseSensitive)
          Returns true if the specified text is found at the end of this object's text.
 boolean equals(java.lang.Object object)
          Deprecated. replaced by isSameAs
protected  org.apache.log4j.Logger getLogger()
          subclasses can override (didn't make abstract so that existing subclasses won't break)
 java.lang.String getObjectHelpText()
          Returns a textual desctiption of the object - its contents and possible uses.
protected  boolean isCharDisallowed(char c)
          disallow CR, LF and TAB
 boolean isEmpty()
          Returns true if this object's text has no characters in it.
 boolean isSameAs(Naked object)
          delegates the comparsion to the isSameAs(TextString) method if specified object is a TextString else returns false.
 boolean isSameAs(java.lang.String text)
          Returns true if the specified text is the same as (for all characters) the object's text.
 boolean isSameAs(java.lang.String text, Case caseSensitive)
          Returns true if the specified text is the same as (for all characters) the object's text.
 boolean isSameAs(TextString text)
          Returns true if the specified text is the same as (for all characters) the object's text.
 boolean isSameAs(TextString text, Case caseSensitive)
          Returns true if the specified text is the same as (for all characters) the object's text.
 void parse(java.lang.String text)
          Takes a user entry string which is parsed to set up the object.
 void reset()
          Reset this string so it set to null (therefore equivalent to clear())
 void restoreString(java.lang.String data)
          Takes a storage string and uses it reinstate this value object to its previous state/
 java.lang.String saveString()
          Returns a basic string representation of this value for storage purposes.
 void setText(java.lang.String text)
          Deprecated. replaced by setValue
 void setText(TextString text)
          Deprecated. replaced by setValue
 void setValue(java.lang.String text)
          Sets this object text to be same as the specified text.
 void setValue(TextString text)
          Sets this object text to be same as the specified text.
 boolean startsWith(java.lang.String text)
          Returns true if the specified text is found at the beginning of this object's text.
 boolean startsWith(java.lang.String text, Case caseSensitive)
          Returns true if the specified text is found at the beginning of this object's text.
 java.lang.String stringValue()
           
 Title title()
          Returns a Title object describing the object.
 
Methods inherited from class org.nakedobjects.object.value.AbstractNakedValue
about, addNakedValueListener, checkCanOperate, contextualTitle, deepCopy, dumpObject, fireValueChanged, fireValueChanged, getClassName, getFullClassName, isNull, isValid, nakedValueListeners, removeNakedValueListener, setAbout, setNull, setValidity, summary, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextString

public TextString()
Creates an empty TextString.


TextString

public TextString(java.lang.String text)
Creates a TextString containing the specified text.


TextString

public TextString(TextString textString)
Creates a TextString containing a copy of the text in the specified TextString.

Method Detail

isEmpty

public boolean isEmpty()
Returns true if this object's text has no characters in it.


getObjectHelpText

public java.lang.String getObjectHelpText()
Description copied from interface: Naked
Returns a textual desctiption of the object - its contents and possible uses.

Specified by:
getObjectHelpText in interface Naked
Overrides:
getObjectHelpText in class AbstractNakedValue

isSameAs

public boolean isSameAs(Naked object)
delegates the comparsion to the isSameAs(TextString) method if specified object is a TextString else returns false.

Parameters:
object - the object to compare
Returns:
boolean returns true if the objects have the same content, and false if the objects are of different types or their contents are deemed to be different.
See Also:
Naked.isSameAs(Naked)

isSameAs

public boolean isSameAs(java.lang.String text)
Returns true if the specified text is the same as (for all characters) the object's text.


isSameAs

public boolean isSameAs(java.lang.String text,
                        Case caseSensitive)
Returns true if the specified text is the same as (for all characters) the object's text. If caseSensitive is false then differences in case are ignored.


isSameAs

public boolean isSameAs(TextString text)
Returns true if the specified text is the same as (for all characters) the object's text.


isSameAs

public boolean isSameAs(TextString text,
                        Case caseSensitive)
Returns true if the specified text is the same as (for all characters) the object's text. If caseSensitive is false then differences in case are ignored.


setText

public void setText(java.lang.String text)
Deprecated. replaced by setValue

Sets this object text to be same as the specified text.


setText

public void setText(TextString text)
Deprecated. replaced by setValue

Sets this object text to be same as the specified text.


setValue

public void setValue(java.lang.String text)
Sets this object text to be same as the specified text.


setValue

public void setValue(TextString text)
Sets this object text to be same as the specified text.


clear

public void clear()
clears the value (sets to null) and notifies any listeners.


contains

public boolean contains(java.lang.String text)
Returns true if the specified text is found withing this object.


contains

public boolean contains(java.lang.String text,
                        Case caseSensitive)
Returns true if the specified text is found withing this object. If caseSensitive is false then differences in case are ignored.


copyObject

public void copyObject(Naked object)
Description copied from interface: Naked
Copies the content of the specified object into this object.


endsWith

public boolean endsWith(java.lang.String text)
Returns true if the specified text is found at the end of this object's text.


endsWith

public boolean endsWith(java.lang.String text,
                        Case caseSensitive)
Returns true if the specified text is found at the end of this object's text. If caseSensitive is false then differences in case are ignored.


equals

public boolean equals(java.lang.Object object)
Deprecated. replaced by isSameAs

See Also:
isSameAs(org.nakedobjects.object.Naked)

parse

public void parse(java.lang.String text)
           throws ValueParseException
Description copied from interface: NakedValue
Takes a user entry string which is parsed to set up the object. This needs to accomodate punctuation and adornments such as currency signs.

Throws:
ValueParseException
See Also:
NakedValue.restoreString(String)

reset

public void reset()
Reset this string so it set to null (therefore equivalent to clear())

See Also:
NakedValue.reset(), clear()

restoreString

public void restoreString(java.lang.String data)
Description copied from interface: NakedValue
Takes a storage string and uses it reinstate this value object to its previous state/

Parameters:
data -
See Also:
NakedValue.parse(String)

saveString

public java.lang.String saveString()
Description copied from interface: NakedValue
Returns a basic string representation of this value for storage purposes.


startsWith

public boolean startsWith(java.lang.String text)
Returns true if the specified text is found at the beginning of this object's text.


startsWith

public boolean startsWith(java.lang.String text,
                          Case caseSensitive)
Returns true if the specified text is found at the beginning of this object's text. If caseSensitive is false then differences in case are ignored.


stringValue

public java.lang.String stringValue()

title

public Title title()
Description copied from interface: Naked
Returns a Title object describing the object.


isCharDisallowed

protected boolean isCharDisallowed(char c)
disallow CR, LF and TAB

Parameters:
c -
Returns:
boolean

getLogger

protected org.apache.log4j.Logger getLogger()
Description copied from class: AbstractNakedValue
subclasses can override (didn't make abstract so that existing subclasses won't break)

Overrides:
getLogger in class AbstractNakedValue