org.olat.core.gui.components.form.flexible.impl.elements
Class IntegerElementImpl

java.lang.Object
  extended by org.olat.core.gui.components.form.flexible.impl.FormItemImpl
      extended by org.olat.core.gui.components.form.flexible.impl.elements.AbstractTextElement
          extended by org.olat.core.gui.components.form.flexible.impl.elements.TextElementImpl
              extended by org.olat.core.gui.components.form.flexible.impl.elements.IntegerElementImpl
All Implemented Interfaces:
InlineElement, InlineIntegerElement, InlineTextElement, IntegerElement, TextElement, FormBaseComponentIdProvider, FormItem

public class IntegerElementImpl
extends TextElementImpl
implements IntegerElement, InlineIntegerElement

Description:
TODO: patrickb Class Description for IntegerElement

Initial Date: 22.06.2007

Author:
patrickb

Field Summary
 
Fields inherited from class org.olat.core.gui.components.form.flexible.impl.elements.TextElementImpl
HTML_INPUT_TYPE_PASSWORD, HTML_INPUT_TYPE_TEXT
 
Fields inherited from interface org.olat.core.gui.components.form.flexible.FormItem
ERRORC, EXAMPLEC, LABELC
 
Fields inherited from interface org.olat.core.gui.components.form.flexible.FormBaseComponentIdProvider
DISPPREFIX
 
Constructor Summary
IntegerElementImpl(java.lang.String name, int predefinedValue)
           
IntegerElementImpl(java.lang.String name, int predefinedValue, boolean asInline)
           
 
Method Summary
 void evalFormRequest(UserRequest ureq)
          gets called if the implementing component is part of a form which gets partly submitted -> extract data for you and store it temporarly for redisplay without a validation
 int getIntValue()
           
 void reset()
          reset the data in the field to a initial/predefined value.
 void setIntValue(int value)
          set the int value.
 void setIntValueCheck(java.lang.String errorKey)
          Implementors note: an integer element implementation has to provide a generic int value check anyway with a generic "must be a number" error message.
 void setIsEqualCheck(int equalValue, java.lang.String errorKey)
           
 void setIsEqualCheck(java.lang.String otherValue, java.lang.String errorKey)
          compares a text value with another value
 void setMaxValueCheck(int maxValue, java.lang.String errorKey)
          The value must be less or equal to maxValue
 void setMinValueCheck(int minValue, java.lang.String errorKey)
          The value must be bigger or equal minValue.
 void setValue(java.lang.String value)
          set a value by string is not allowed - use setIntValue instead.
 void validate(java.util.List validationResults)
          validate the data in the field, create error messages or update any component.
 
Methods inherited from class org.olat.core.gui.components.form.flexible.impl.elements.TextElementImpl
setTranslator
 
Methods inherited from class org.olat.core.gui.components.form.flexible.impl.elements.AbstractTextElement
getValue, getValue, isEmpty, isEmpty, setDisplaySize, setItemValidatorProvider, setMaxLength, setNewOriginalValue, setNotEmptyCheck, setNotLongerThanCheck, setRegexMatchCheck
 
Methods inherited from class org.olat.core.gui.components.form.flexible.impl.FormItemImpl
addActionListener, clearError, doDispatchFormRequest, getAction, getActionListenersFor, getComponent, getEmptyDisplayText, getErrorC, getErrorText, getExampleC, getExampleText, getFormDispatchId, getLabelC, getLabelText, getName, getRootForm, getTranslator, getUserObject, hasError, hasExample, hasFocus, hasLabel, isEnabled, isInlineEditingOn, isMandatory, isVisible, setEmptyDisplayText, setEnabled, setErrorComponent, setErrorKey, setExampleKey, setFocus, setLabel, setLabelComponent, setMandatory, setRootForm, setUserObject, setVisible, showError, showExample, showLabel, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.olat.core.gui.components.form.flexible.elements.InlineElement
getEmptyDisplayText, isInlineEditingOn, setEmptyDisplayText
 
Methods inherited from interface org.olat.core.gui.components.form.flexible.elements.TextElement
getValue, getValue, isEmpty, isEmpty, setDisplaySize, setItemValidatorProvider, setMaxLength, setNewOriginalValue, setNotEmptyCheck, setNotLongerThanCheck, setRegexMatchCheck
 
Methods inherited from interface org.olat.core.gui.components.form.flexible.FormItem
addActionListener, clearError, doDispatchFormRequest, getAction, getActionListenersFor, getComponent, getErrorC, getErrorText, getExampleC, getExampleText, getLabelC, getLabelText, getName, getRootForm, getTranslator, getUserObject, hasError, hasExample, hasFocus, hasLabel, isEnabled, isMandatory, isVisible, setEnabled, setErrorComponent, setErrorKey, setExampleKey, setFocus, setLabel, setLabelComponent, setMandatory, setRootForm, setTranslator, setUserObject, setVisible, showError, showExample, showLabel
 
Methods inherited from interface org.olat.core.gui.components.form.flexible.FormBaseComponentIdProvider
getFormDispatchId
 

Constructor Detail

IntegerElementImpl

public IntegerElementImpl(java.lang.String name,
                          int predefinedValue)
Parameters:
name -
predefinedValue -

IntegerElementImpl

public IntegerElementImpl(java.lang.String name,
                          int predefinedValue,
                          boolean asInline)
Method Detail

getIntValue

public int getIntValue()
Specified by:
getIntValue in interface IntegerElement
Returns:
int value validated by element

setIntValue

public void setIntValue(int value)
Description copied from interface: IntegerElement
set the int value.

Specified by:
setIntValue in interface IntegerElement

setIntValueCheck

public void setIntValueCheck(java.lang.String errorKey)
Description copied from interface: IntegerElement
Implementors note: an integer element implementation has to provide a generic int value check anyway with a generic "must be a number" error message. But the user of an int element can provide its own error key.

Specified by:
setIntValueCheck in interface IntegerElement

evalFormRequest

public void evalFormRequest(UserRequest ureq)
Description copied from class: FormItemImpl
gets called if the implementing component is part of a form which gets partly submitted -> extract data for you and store it temporarly for redisplay without a validation

Specified by:
evalFormRequest in interface FormItem
Overrides:
evalFormRequest in class TextElementImpl
See Also:
org.olat.core.gui.components.form.flexible.FormItemImpl#evalFormRequest(org.olat.core.gui.UserRequest)

reset

public void reset()
Description copied from interface: FormItem
reset the data in the field to a initial/predefined value. This method is called if in a form a reset request is issued. It is the counterpart to the validate call which

Specified by:
reset in interface FormItem
Overrides:
reset in class AbstractTextElement
See Also:
FormItem.reset()

setValue

public void setValue(java.lang.String value)
set a value by string is not allowed - use setIntValue instead.

Specified by:
setValue in interface TextElement
Overrides:
setValue in class AbstractTextElement
Parameters:
value - The value to set
See Also:
AbstractTextElement.setValue(java.lang.String)

validate

public void validate(java.util.List validationResults)
Description copied from interface: FormItem
validate the data in the field, create error messages or update any component.

This method must be implemented by a specialised form item provider.

Specified by:
validate in interface FormItem
Overrides:
validate in class AbstractTextElement
See Also:
org.olat.core.gui.components.form.flexible.FormComponent#validate(java.util.List)

setIsEqualCheck

public void setIsEqualCheck(int equalValue,
                            java.lang.String errorKey)
Specified by:
setIsEqualCheck in interface IntegerElement
See Also:
IntegerElement.setIsEqualCheck(int, java.lang.String)

setIsEqualCheck

public void setIsEqualCheck(java.lang.String otherValue,
                            java.lang.String errorKey)
Description copied from class: AbstractTextElement
compares a text value with another value

Specified by:
setIsEqualCheck in interface TextElement
Overrides:
setIsEqualCheck in class AbstractTextElement

setMaxValueCheck

public void setMaxValueCheck(int maxValue,
                             java.lang.String errorKey)
Description copied from interface: IntegerElement
The value must be less or equal to maxValue

Specified by:
setMaxValueCheck in interface IntegerElement

setMinValueCheck

public void setMinValueCheck(int minValue,
                             java.lang.String errorKey)
Description copied from interface: IntegerElement
The value must be bigger or equal minValue.

Specified by:
setMinValueCheck in interface IntegerElement