org.meshcms.webui
Class FormField

java.lang.Object
  extended byorg.meshcms.webui.FormField
All Implemented Interfaces:
java.io.Serializable

public class FormField
extends java.lang.Object
implements java.io.Serializable

Encapsulates the functionalities of a form field.

See Also:
Serialized Form

Field Summary
static int EMAIL
          Denotes a text field that is supposed to accept e-mail addresses.
static int HIDDEN
          Denotes a hidden field.
static int NUMBER
          Denotes a text field that is supposed to accept numbers.
static int RESET
          Denotes a reset button.
static int SELECT_OPTION
          Denotes a select field.
static int SUBMIT
          Denotes a submit button.
static int TEXT
          Denotes a text field.
 
Constructor Summary
FormField()
           
 
Method Summary
 boolean checkValue()
          Tries to determine if the value of the field is acceptable.
static java.lang.String createCode(java.lang.String s)
          Returns a modified version of the passed string, such as it can be used as a field name.
 java.lang.String getCode()
          Returns the element name of the field.
 java.lang.String getDescription()
          Returns a descriptive name of the field.
 java.lang.String getName()
          Returns the friendly name of the field.
 java.lang.String[] getOptions()
          Returns the options of the field.
 int getRows()
          Returns the number of rows for the editable field.
 int getType()
          Returns the type of the field.
 java.lang.String getValue()
          Returns the value of the field.
 boolean isMessageBody()
          Returns the value of the message body flag.
 boolean isRecipient()
          Returns the value of the recipient flag.
 boolean isRequired()
          Returns the value of the required flag.
 boolean isSender()
          Returns the value of the sender flag.
 boolean isSenderName()
          Returns the value of the sender name flag.
 boolean isSubject()
          Returns the value of the subject flag.
 void setCode(java.lang.String code)
          Sets the element name of the field.
 void setMessageBody(boolean messageBody)
          Sets the message body flag.
 void setName(java.lang.String name)
          Sets the friendly name of the field.
 void setNameAndCode(java.lang.String name)
          Sets both the friendly name and the element name of the field.
 void setOptions(java.lang.String[] options)
          Sets the options of the field. To be used only for fields whose type is SELECT_OPTION.
 void setParameter(java.lang.String value)
          Sets the value of a parameter.
 void setRecipient(boolean recipient)
          Sets the recipient flag.
 void setRequired(boolean required)
          Sets the required flag.
 void setRows(int rows)
          Sets the number of rows for the editable field.
 void setSender(boolean sender)
          Sets the sender flag.
 void setSenderName(boolean senderName)
          Sets the sender name flag.
 void setSubject(boolean subject)
          Sets the subject flag.
 void setType(int type)
          Sets the type of the field.
 void setValue(java.lang.String value)
          Sets the value of the field.
 java.lang.String toString()
          Returns a description of the field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TEXT

public static final int TEXT
Denotes a text field.

See Also:
Constant Field Values

EMAIL

public static final int EMAIL
Denotes a text field that is supposed to accept e-mail addresses.

See Also:
Constant Field Values

SUBMIT

public static final int SUBMIT
Denotes a submit button.

See Also:
Constant Field Values

RESET

public static final int RESET
Denotes a reset button.

See Also:
Constant Field Values

NUMBER

public static final int NUMBER
Denotes a text field that is supposed to accept numbers.

See Also:
Constant Field Values

HIDDEN

public static final int HIDDEN
Denotes a hidden field. Hidden fields are stored in memory and not in the form.

See Also:
Constant Field Values

SELECT_OPTION

public static final int SELECT_OPTION
Denotes a select field.

See Also:
Constant Field Values
Constructor Detail

FormField

public FormField()
Method Detail

setName

public void setName(java.lang.String name)
Sets the friendly name of the field.


getName

public java.lang.String getName()
Returns the friendly name of the field.


setCode

public void setCode(java.lang.String code)
Sets the element name of the field.


getCode

public java.lang.String getCode()
Returns the element name of the field.


setType

public void setType(int type)
Sets the type of the field.


getType

public int getType()
Returns the type of the field.


setValue

public void setValue(java.lang.String value)
Sets the value of the field.


getValue

public java.lang.String getValue()
Returns the value of the field.


setOptions

public void setOptions(java.lang.String[] options)
Sets the options of the field. To be used only for fields whose type is SELECT_OPTION.


getOptions

public java.lang.String[] getOptions()
Returns the options of the field.


setNameAndCode

public void setNameAndCode(java.lang.String name)
Sets both the friendly name and the element name of the field. The value passed as argument is used as friendly name, while the element name will be created using createCode(java.lang.String).


setRequired

public void setRequired(boolean required)
Sets the required flag. A required field is supposed to have a value.


isRequired

public boolean isRequired()
Returns the value of the required flag.


setSender

public void setSender(boolean sender)
Sets the sender flag. This should be set to true for a field that is supposed to contain the e-mail address of the sender.


isSender

public boolean isSender()
Returns the value of the sender flag.


setRecipient

public void setRecipient(boolean recipient)
Sets the recipient flag. This should be set to true for a field that is supposed to contain the e-mail address of the recipient.


isRecipient

public boolean isRecipient()
Returns the value of the recipient flag.


setRows

public void setRows(int rows)
Sets the number of rows for the editable field. In general, an input field is replaced with a textarea when this number is greater than 1.


getRows

public int getRows()
Returns the number of rows for the editable field.


setParameter

public void setParameter(java.lang.String value)
Sets the value of a parameter. The parameter set depends on the passed argument.


checkValue

public boolean checkValue()
Tries to determine if the value of the field is acceptable. The check covers required values, e-mail fields and numeric fields.


createCode

public static java.lang.String createCode(java.lang.String s)
Returns a modified version of the passed string, such as it can be used as a field name.


getDescription

public java.lang.String getDescription()
Returns a descriptive name of the field. This is generally the field name.


toString

public java.lang.String toString()
Returns a description of the field.


isSenderName

public boolean isSenderName()
Returns the value of the sender name flag.


setSenderName

public void setSenderName(boolean senderName)
Sets the sender name flag. This should be set to true for a field that is supposed to contain the (complete) name of the sender.


isSubject

public boolean isSubject()
Returns the value of the subject flag.


setSubject

public void setSubject(boolean subject)
Sets the subject flag. This should be set to true for a field that is supposed to contain the subject of the message.


isMessageBody

public boolean isMessageBody()
Returns the value of the message body flag.


setMessageBody

public void setMessageBody(boolean messageBody)
Sets the message body flag. If true, this filed is considered to be the body of the message and will be written without caption