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

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
All Implemented Interfaces:
InlineElement, TextElement, FormBaseComponentIdProvider, FormItem
Direct Known Subclasses:
RichTextElementImpl, TextAreaElementImpl, TextElementImpl

public abstract class AbstractTextElement
extends FormItemImpl
implements TextElement

Description:
TODO: patrickb Class Description for AbstractTextElement

Initial Date: 27.11.2006

Author:
patrickb

Field Summary
 
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
AbstractTextElement(java.lang.String name)
           
 
Method Summary
 java.lang.String getValue()
          Get the value of the text element.
 java.lang.String getValue(Filter filter)
          Get the value and filter it using the given filter.
 boolean isEmpty()
          Check if the text element is empty
 boolean isEmpty(java.lang.String errorKey)
          Check if the text element is empty
 void reset()
          reset the data in the field to a initial/predefined value.
 void setDisplaySize(int displaySize)
          defines the desired display size of the element
 void setIsEqualCheck(java.lang.String otherValue, java.lang.String errorKey)
          compares a text value with another value
 void setItemValidatorProvider(ItemValidatorProvider itemValidatorProvider)
          to be set if TextElement should be validated with its validate() method
 void setMaxLength(int maxLength)
           
 void setNewOriginalValue(java.lang.String value)
          Set a new value as the original value that is used when resetting the form.
 void setNotEmptyCheck(java.lang.String errorKey)
           
 void setNotLongerThanCheck(int maxLength, java.lang.String errorKey)
           
 void setRegexMatchCheck(java.lang.String regExp, java.lang.String errorKey)
           
 void setValue(java.lang.String value)
          Sets the value.
 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.FormItemImpl
addActionListener, clearError, doDispatchFormRequest, evalFormRequest, 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, setTranslator, 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.FormItem
addActionListener, clearError, doDispatchFormRequest, evalFormRequest, 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

AbstractTextElement

public AbstractTextElement(java.lang.String name)
Method Detail

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
Specified by:
validate in class FormItemImpl
See Also:
org.olat.core.gui.components.form.flexible.FormComponent#validate(java.util.List)

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
Specified by:
reset in class FormItemImpl
See Also:
FormItem.reset()

getValue

public java.lang.String getValue()
Description copied from interface: TextElement
Get the value of the text element.

Specified by:
getValue in interface TextElement
Returns:
String
See Also:
TextElement.getValue()

getValue

public java.lang.String getValue(Filter filter)
Description copied from interface: TextElement
Get the value and filter it using the given filter. To use multiple filters, use the ChainedFilter instead of a single filter.

Specified by:
getValue in interface TextElement
Returns:
See Also:
TextElement.getValue(org.olat.core.util.filter.Filter)

setValue

public void setValue(java.lang.String value)
Sets the value. if null is given, an empty string is assumed.

Specified by:
setValue in interface TextElement
Parameters:
value - The value to set

setNewOriginalValue

public void setNewOriginalValue(java.lang.String value)
Set a new value as the original value that is used when resetting the form. This can be used when a form is saved and in a later form should be resetted to the intermediate save state.

Does not change the value of the element, just the reset-value!

Specified by:
setNewOriginalValue in interface TextElement
Parameters:
value - The new original value

setDisplaySize

public void setDisplaySize(int displaySize)
Description copied from interface: TextElement
defines the desired display size of the element

Specified by:
setDisplaySize in interface TextElement
See Also:
TextElement.setDisplaySize(int)

setMaxLength

public void setMaxLength(int maxLength)
Specified by:
setMaxLength in interface TextElement
Parameters:
maxLength - The maximum numbe of characters allowed in this field. Set -1 for no limit
See Also:
TextElement.setMaxLength(int)

setNotEmptyCheck

public void setNotEmptyCheck(java.lang.String errorKey)
Specified by:
setNotEmptyCheck in interface TextElement
Parameters:
errorKey -

setNotLongerThanCheck

public void setNotLongerThanCheck(int maxLength,
                                  java.lang.String errorKey)
Specified by:
setNotLongerThanCheck in interface TextElement
Parameters:
maxLength - if value is -1 maxlength will not be checked
errorKey -
See Also:
TextElement.setNotLongerThanCheck(int, java.lang.String)

setIsEqualCheck

public void setIsEqualCheck(java.lang.String otherValue,
                            java.lang.String errorKey)
compares a text value with another value

Specified by:
setIsEqualCheck in interface TextElement
Parameters:
otherValue -
errorKey -

isEmpty

public boolean isEmpty()
Check if the text element is empty

Specified by:
isEmpty in interface TextElement
Returns:
boolean true if is empty, false otherwhise

isEmpty

public boolean isEmpty(java.lang.String errorKey)
Check if the text element is empty

Specified by:
isEmpty in interface TextElement
Parameters:
errorKey -
Returns:
boolean true if is empty, false otherwise

setRegexMatchCheck

public void setRegexMatchCheck(java.lang.String regExp,
                               java.lang.String errorKey)
Specified by:
setRegexMatchCheck in interface TextElement
Parameters:
regExp -
errorKey -

setItemValidatorProvider

public void setItemValidatorProvider(ItemValidatorProvider itemValidatorProvider)
Description copied from interface: TextElement
to be set if TextElement should be validated with its validate() method

Specified by:
setItemValidatorProvider in interface TextElement