org.araneaframework.uilib.form.control
Class FloatControl
java.lang.Object
org.araneaframework.core.BaseComponent
org.araneaframework.core.BaseService
org.araneaframework.core.BaseWidget
org.araneaframework.core.BaseApplicationWidget
org.araneaframework.uilib.form.control.BaseControl
org.araneaframework.uilib.form.control.StringArrayRequestControl
org.araneaframework.uilib.form.control.StringRequestControl
org.araneaframework.uilib.form.control.EmptyStringNullableControl
org.araneaframework.uilib.form.control.FloatControl
- All Implemented Interfaces:
- ApplicationComponent, ApplicationService, ApplicationWidget, Component, Composite, Composite.CompositeComponent, Composite.CompositeService, Composite.CompositeWidget, Control, FilteredInputControl, FormElementAware, Serializable, Service, Viewable, Viewable.ViewableComponent, Viewable.ViewableService, Viewable.ViewableWidget, Widget
- public class FloatControl
- extends EmptyStringNullableControl
- implements FilteredInputControl
This class represents a textbox control that accepts only valid
floating-point numbers.
This class does not support localization. It does not use @link NumberFormat
class to parse and format @link BigDecimal objects because @link NumberFormat
would convert @link BigDecimal objects into doubles.
To customize parsing and formatting one could create a subclass of it and
override @link #createBigDecimal(String) and @link #toString(BigDecimal)
methods. To use the subclass in JSPs also another JSP Tag must be created
to use this implementation and configure validation script.
- Author:
- Jevgeni Kabanov (ekabanov at araneaframework dot org), Rein Raudjärv
- See Also:
- Serialized Form
| Methods inherited from class org.araneaframework.uilib.form.control.BaseControl |
_getWidget, action, addError, convertAndValidate, getFormElementCtx, getLabel, getRawValue, handleEvent, isDisabled, isMandatory, isValid, setFormElementCtx, update |
| Methods inherited from class org.araneaframework.core.BaseApplicationWidget |
_getComposite, _getViewable, addActionListener, addEventListener, addWidget, addWidget, clearActionListeners, clearEventlisteners, clearGlobalEventListener, disableWidget, enableWidget, event, getActionId, getChildEnvironment, getChildren, getChildWidgetEnvironment, getEnvironment, getEventId, getWidget, handleAction, handleUpdate, propagate, putViewData, putViewDataOnce, removeActionListener, removeEventListener, removeViewData, removeWidget, render, setGlobalEventListener |
| Methods inherited from class org.araneaframework.core.BaseComponent |
_addComponent, _addComponent, _checkCall, _disableComponent, _enableComponent, _endCall, _endWaitingCall, _getChildren, _getComponent, _getDisabledChildren, _propagate, _relocateComponent, _removeComponent, _setEnvironment, _setScope, _startCall, _startWaitingCall, _strictCheckCall, _strictStartCall, _waitNoCall, destroy, disable, enable, getScope, handleException, isAlive, isDead, isInitialized |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FloatControl
public FloatControl()
- Empty.
FloatControl
public FloatControl(BigDecimal minValue,
BigDecimal maxValue,
Integer maxScale)
- Makes a float control that has minimum, maximum value and maximum scale.
- Parameters:
minValue - minimum permitted value.maxValue - maximum permitted value.maxScale - maximum permitted scale.
FloatControl
public FloatControl(BigDecimal minValue,
BigDecimal maxValue)
- Makes a float control that has minimum and maximum value.
- Parameters:
minValue - minimum permitted value.maxValue - maximum permitted value.
setMaxValue
public void setMaxValue(BigDecimal maxValue)
- Sets the maximum value.
- Parameters:
maxValue - maximum value.
setMinValue
public void setMinValue(BigDecimal minValue)
- Sets the minimum value.
- Parameters:
minValue - minimum value.
setMaxScale
public void setMaxScale(Integer maxScale)
- Sets the maximum scale.
- Parameters:
maxScale - maximum scale.
getMaxValue
public BigDecimal getMaxValue()
- Returns the maxValue.
- Returns:
- the maxValue.
getMinValue
public BigDecimal getMinValue()
- Returns the minValue.
- Returns:
- the minValue.
getMaxScale
public Integer getMaxScale()
- Returns the maximum scale.
- Returns:
- the maximum scale.
getRawValueType
public String getRawValueType()
- Returns "BigDecimal".
- Specified by:
getRawValueType in interface Control
- Returns:
- "BigDecimal".
getInputFilter
public InputFilter getInputFilter()
- Specified by:
getInputFilter in interface FilteredInputControl
- Since:
- 1.0.11
setInputFilter
public void setInputFilter(InputFilter inputFilter)
- Specified by:
setInputFilter in interface FilteredInputControl
- Since:
- 1.0.11
preprocessRequestParameter
protected String preprocessRequestParameter(String parameterValue)
- Trims request parameter.
- Overrides:
preprocessRequestParameter in class EmptyStringNullableControl
fromRequest
protected Object fromRequest(String parameterValue)
- Checks that the submitted data is a valid floating-point number.
- Specified by:
fromRequest in class StringRequestControl
- See Also:
StringArrayRequestControl.fromRequestParameters(String[])
toResponse
protected String toResponse(Object controlValue)
- Specified by:
toResponse in class StringRequestControl
- See Also:
StringArrayRequestControl.toResponseParameters(Object)
createBigDecimal
protected BigDecimal createBigDecimal(String str)
throws NumberFormatException
- Converts String into BigDecimal. This method can be overrided in subclasses.
- Parameters:
str - String object
- Returns:
- BigDecimal object
- Throws:
NumberFormatException - str is not a valid representation
of a BigDecimal
toString
protected String toString(BigDecimal dec)
- Converts BigDecimal into String. This method can be overrided in subclasses.
- Parameters:
dec - BigDecimal object
- Returns:
- String object
validateNotNull
protected void validateNotNull()
- Checks that the submitted value is in permitted range.
- Overrides:
validateNotNull in class StringArrayRequestControl
getViewModel
public Object getViewModel()
- Returns
FloatControl.ViewModel.
- Overrides:
getViewModel in class StringArrayRequestControl
- Returns:
FloatControl.ViewModel.