net.sf.colle.forms
Class Number

java.lang.Object
  extended bynet.sf.colle.forms.Text
      extended bynet.sf.colle.forms.Number
All Implemented Interfaces:
FormElement

public class Number
extends Text

FormElement implementation for numbers. Created: 10 Jul 2001

Version:
$Revision: 1.1 $, $Date: 2003/06/26 18:11:41 $
Author:
Jeremy Miller

Field Summary
static String ERROR_TOO_LARGE
           
static String ERROR_TOO_SMALL
           
 
Fields inherited from class net.sf.colle.forms.Text
ERROR_TOO_LONG, ERROR_TOO_SHORT
 
Fields inherited from interface net.sf.colle.forms.FormElement
ERROR_INVALID, ERROR_REQUIRED, UNKNOWN, VALID
 
Constructor Summary
Number(String psName, Object pxApplicationElement, FormElement pxParent, String psDefaultValue, boolean pbRequired, double pnMinValue, double pnMaxValue)
          Create a new number form element.
 
Method Summary
protected  String getDerivedType()
          Allows derived classes to define the type placed to the out-going XML response document.
 double getDouble()
          Returns the value as a double
 int getInteger()
          Returns the value as a integer
 void setDouble(double pnValue)
          update the value with new double value.
 void setInteger(int pnValue)
          update the value with new integer value.
 int validate(boolean pbRecursive)
          validate the element.
 
Methods inherited from class net.sf.colle.forms.Text
getApplicationElement, getErrorCode, getName, getPath, getRequired, getText, map, service, setErrorCode, setText, setToDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_TOO_SMALL

public static final String ERROR_TOO_SMALL
See Also:
Constant Field Values

ERROR_TOO_LARGE

public static final String ERROR_TOO_LARGE
See Also:
Constant Field Values
Constructor Detail

Number

public Number(String psName,
              Object pxApplicationElement,
              FormElement pxParent,
              String psDefaultValue,
              boolean pbRequired,
              double pnMinValue,
              double pnMaxValue)
Create a new number form element.

Parameters:
psName - name of element
psDefaultValue - initial default value
pbRequired - required element
pxParent - path to the parent in the xml tree
Method Detail

getInteger

public int getInteger()
Returns the value as a integer


setInteger

public void setInteger(int pnValue)
update the value with new integer value.

Parameters:
pnValue - new value

getDouble

public double getDouble()
Returns the value as a double


setDouble

public void setDouble(double pnValue)
update the value with new double value.

Parameters:
pnValue - new value

validate

public int validate(boolean pbRecursive)
validate the element.

Specified by:
validate in interface FormElement
Overrides:
validate in class Text
Parameters:
pbRecursive - on true check child elements
Returns:
error count

getDerivedType

protected String getDerivedType()
Allows derived classes to define the type placed to the out-going XML response document.

Overrides:
getDerivedType in class Text