Class TextField
- java.lang.Object
-
- org.silverpeas.core.contribution.content.form.AbstractField
-
- org.silverpeas.core.contribution.content.form.field.TextField
-
- All Implemented Interfaces:
Serializable
,Comparable<Field>
,Field
- Direct Known Subclasses:
AccessPathField
,FileField
,JdbcField
,LdapField
,SequenceField
,TextFieldImpl
,TextRoField
public abstract class TextField extends AbstractField
A TextField stores a text value.- See Also:
Field
,FieldDisplayer
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONTENT_TYPE
static String
CONTENT_TYPE_FLOAT
static String
CONTENT_TYPE_INT
static String
PARAM_MAXLENGTH
static String
TYPE
The text field type name.-
Fields inherited from interface org.silverpeas.core.contribution.content.form.Field
FILE_PARAM_NAME_SUFFIX, TYPE_FILE
-
-
Constructor Summary
Constructors Constructor Description TextField()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
acceptObjectValue(Object value)
Returns true if the value is a String and this field isn't read only.boolean
acceptStringValue(String value)
Returns true if the value isn't ill formed and this field isn't read only.boolean
acceptValue(String value)
Returns true if the value isn't ill formed and this field isn't read only.boolean
acceptValue(String value, String language)
Returns true if the value isn't ill formed and this field isn't read only.int
compareTo(Field o)
Compares this field with the specified field.boolean
equals(Object o)
Tests equality between this field and the specified field.Object
getObjectValue()
Returns the value of this field.String
getTypeName()
Returns the type name.String
getValue()
Returns the string value of this field.String
getValue(String language)
Returns the local value of this field.int
hashCode()
boolean
isNull()
Returns true if this field is not set.abstract boolean
isReadOnly()
Returns true if the value is read only.void
setNull()
Set to null this field.void
setObjectValue(Object value)
Set this field value.void
setValue(String value)
Set this field value from a local string value.void
setValue(String value, String language)
Set this field value from a local string value.-
Methods inherited from class org.silverpeas.core.contribution.content.form.AbstractField
getName, getOccurrence, setName, setOccurrence
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.contribution.content.form.Field
getStringValue, setStringValue
-
-
-
-
Field Detail
-
TYPE
public static final String TYPE
The text field type name.- See Also:
- Constant Field Values
-
CONTENT_TYPE
public static final String CONTENT_TYPE
- See Also:
- Constant Field Values
-
CONTENT_TYPE_INT
public static final String CONTENT_TYPE_INT
- See Also:
- Constant Field Values
-
CONTENT_TYPE_FLOAT
public static final String CONTENT_TYPE_FLOAT
- See Also:
- Constant Field Values
-
PARAM_MAXLENGTH
public static final String PARAM_MAXLENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTypeName
public String getTypeName()
Returns the type name.- Returns:
- the name of this field type.
-
isReadOnly
public abstract boolean isReadOnly()
Returns true if the value is read only.
-
getValue
public String getValue()
Returns the string value of this field.- Returns:
- the value of this field.
-
getValue
public String getValue(String language)
Returns the local value of this field. There is no local format for a text field, so the language parameter is unused.- Parameters:
language
- the ISO-631 code of a supported language.- Returns:
- the value in the specified language.
-
setValue
public void setValue(String value) throws FormException
Set this field value from a local string value.- Parameters:
value
- the normalized value to set.- Throws:
FormException
- when the field is readOnly or when the string value is ill formed.
-
setValue
public void setValue(String value, String language) throws FormException
Set this field value from a local string value. There is no local format for a text field, so the language parameter is unused.- Parameters:
value
- a textual value.language
- the ISO-631 code of a supported language.- Throws:
FormException
- when the field is readOnly or when the string value is ill formed.
-
acceptValue
public boolean acceptValue(String value)
Returns true if the value isn't ill formed and this field isn't read only. Here any string value is accepted unless the field is read only.- Returns:
- true if the value format is correct and this field isn't read only. False otherwise.
-
acceptStringValue
public boolean acceptStringValue(String value)
Returns true if the value isn't ill formed and this field isn't read only. Here any string value is accepted unless the field is read only.- Parameters:
value
- aString
value.- Returns:
- true if the value isn't normalized and this field isn't read only.
-
acceptValue
public boolean acceptValue(String value, String language)
Returns true if the value isn't ill formed and this field isn't read only. Here any string value is accepted unless the field is read only.- Parameters:
value
- a textual value.language
- the ISO-631 code of a supported language.- Returns:
- true if the local value isn't ill formed and this field isn't read only.
-
getObjectValue
public Object getObjectValue()
Returns the value of this field.- Returns:
- an object representing the value of this field.
-
setObjectValue
public void setObjectValue(Object value) throws FormException
Set this field value.- Parameters:
value
- anObject
representing the value to set.- Throws:
FormException
- when the field is readOnly or when the value is not a String.
-
acceptObjectValue
public boolean acceptObjectValue(Object value)
Returns true if the value is a String and this field isn't read only.- Parameters:
value
- a value- Returns:
- true if the value hasn't a wrong type and this field isn't read only.
-
isNull
public boolean isNull()
Returns true if this field is not set.- Returns:
- true if this field is not set. False otherwise.
-
setNull
public void setNull() throws FormException
Set to null this field.- Throws:
FormException
- when the field is mandatory or when the field is read only.
-
equals
public boolean equals(Object o)
Tests equality between this field and the specified field.
-
compareTo
public int compareTo(Field o)
Compares this field with the specified field.
-
-