org.olat.core.gui.components.form
Class Form

java.lang.Object
  extended by org.olat.core.gui.components.Component
      extended by org.olat.core.gui.components.form.Form
Direct Known Subclasses:
AccessForm, BusinessGroupSendToChooserForm, CalendarImportNameForm, CalendarImportUrlForm, ChangeMessageForm, ChangePasswordForm, ChooseScormRunModeForm, ChooseStepsForm, COConfigForm, ColWithBulkActionForm, ConditionConfigExpertForm, CourseChatSettingsForm, CourseEfficencyStatementForm, DelimChooseForm, DetailsForm, DialogConfigForm, DisplayCourseInfoForm, DisplayInfoForm, DisplayMemberSwitchForm, DropboxForm, EditScoreCalculationEasyForm, EmailSendingForm, FileDetailsForm, GroupNamesForm, GuiDemoForm, IQEditForm, KalendarEntryForm, KeyWithColumnForm, LogFileChooserForm, MailTemplateForm, ModulesForm, OLATAuthentcationForm, OnlineListForm, OptionsChooseForm, PreviewForm, PropertyChangeForm, PropPupForm, PwChangeForm, RegistrationForm2, RosterForm, SearchAllCalendarsForm, SearchForm, SeparatedValueInputForm, ShibbolethMigrationForm, ShibbolethRegistrationForm, ShibbolethRegistrationWithEmailForm, StatusForm, SystemRolesAndRightsForm, TUConfigForm, UserListForm, WikiEditArticleForm

public abstract class Form
extends Component

enclosing_type Description:

Author:
Felix Jost

Field Summary
static java.lang.String CANCEL_IDENTIFICATION
          Comment for CANCEL_IDENTIFICATION
static java.lang.String ELEM_BUTTON_COMMAND_ID
          Comment for ELEM_BUTTON_COMMAND_ID
static Event EVNT_FORM_CANCELLED
          Comment for EVENT_FORM_CANCELLED
static Event EVNT_VALIDATION_NOK
          Comment for EVENT_VALIDATION_NOK
static Event EVNT_VALIDATION_OK
          Comment for EVENT_VALIDATION_OK
static java.lang.String SUBMIT_IDENTIFICATION
          Comment for SUBMIT_IDENTIFICATION
 
Constructor Summary
Form(java.lang.String name, Translator translator)
          A Form must have a valid name and a valid translator.
 
Method Summary
 void addFormElement(java.lang.String name, FormElement formElement)
          adds a formelement
 void addSubmitKey(java.lang.String submitKeyi18n)
          Deprecated. since 19.07.2006 replaced by addSubmitKey(String submitKeyi18n, String identifier).
 void addSubmitKey(java.lang.String submitKeyi18n, java.lang.String identifier)
          Adds a button with i18n key identified by identifier.
 void addVisibilityDependsOnSelectionRule(VisibilityDependsOnSelectionRule rule)
          Set a visibility-of-element-depends-on-a-selection-element rule to the form
 CheckBoxElement getCheckBoxElement(java.lang.String name)
           
 DateElement getDateElement(java.lang.String name)
           
 int getElementCount()
           
 FormElement getFormElement(java.lang.String name)
           
 ComponentRenderer getHTMLRendererSingleton()
           
 IntegerElement getIntegerElement(java.lang.String name)
           
 MultipleSelectionElement getMultipleSelectionElement(java.lang.String name)
           
 java.util.Iterator getNameIterator()
          gives an iterator over the names of the contained formelements
 PasswordElement getPasswordElement(java.lang.String name)
           
 RadioButtonGroupElement getRadioButtonElement(java.lang.String name)
           
 java.lang.String getSelectedSubmitKey()
           
 SingleSelectionElement getSingleSelectionElement(java.lang.String name)
           
 TextAreaElement getTextAreaElement(java.lang.String name)
           
 TextElement getTextElement(java.lang.String name)
           
 java.util.List getVisibilityDependsOnSelectionRules()
          Get a list of all dependecy rules
 WikiMarkupTextAreaElement getWikiMarkupTextAreaElement(java.lang.String name)
           
 boolean hasMandatoryFields()
          Check if this form contains mandatory fields
 boolean hasWikiMarkupFields()
          Check if this form contains mandatory fields
 boolean isDisplayOnly()
          Returns the displayOnly.
 boolean isValid()
          Returns the validated.
 void removeCancelButton()
          Removes the default cancel button.
 void removeFormElements()
          Deprecated. construct a new form if needed
 void setAllFormElements(boolean readOnly)
          disables the form input on all formelements, but keeps the submit/cancel buttons.
 void setCancelButton()
          Sets the default cancel button.
 void setCancelKey(java.lang.String cancelKeyi18n)
          Sets the cancelParamName.
 void setDisplayOnly(boolean displayOnly)
          Sets the displayOnly.
 void setSubmitKey(java.lang.String submitKeyi18n)
          Deprecated. since 22.11.2005 replaced by addSubmitKey(String submitKeyi18n, String identifier).
abstract  boolean validate()
           
 void validate(UserRequest ureq, ValidationResult vr)
          called just before the rendering of the -whole tree- takes place, so e.g.
 
Methods inherited from class org.olat.core.gui.components.Component
addListener, debuginfoGetListeners, dispatchRequest, getAndClearLatestFiredEvent, getComponentName, getDispatchID, getExtendedDebugInfo, getLatestDispatchedController, getListenerInfo, getParent, getSpanAsDomReplaceable, getTimestamp, getTranslator, isDirty, isDirtyForUser, isDomReplaceable, isEnabled, isVisible, setDirty, setDomReplaceable, setEnabled, setSpanAsDomReplaceable, setVisible, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CANCEL_IDENTIFICATION

public static final java.lang.String CANCEL_IDENTIFICATION
Comment for CANCEL_IDENTIFICATION

See Also:
Constant Field Values

SUBMIT_IDENTIFICATION

public static final java.lang.String SUBMIT_IDENTIFICATION
Comment for SUBMIT_IDENTIFICATION

See Also:
Constant Field Values

ELEM_BUTTON_COMMAND_ID

public static final java.lang.String ELEM_BUTTON_COMMAND_ID
Comment for ELEM_BUTTON_COMMAND_ID

See Also:
Constant Field Values

EVNT_VALIDATION_OK

public static final Event EVNT_VALIDATION_OK
Comment for EVENT_VALIDATION_OK


EVNT_VALIDATION_NOK

public static final Event EVNT_VALIDATION_NOK
Comment for EVENT_VALIDATION_NOK


EVNT_FORM_CANCELLED

public static final Event EVNT_FORM_CANCELLED
Comment for EVENT_FORM_CANCELLED

Constructor Detail

Form

public Form(java.lang.String name,
            Translator translator)
A Form must have a valid name and a valid translator. Create the translator outside the Form e.g. in a controller or manager.

Parameters:
name, - translator
Method Detail

removeFormElements

public void removeFormElements()
Deprecated. construct a new form if needed


addFormElement

public void addFormElement(java.lang.String name,
                           FormElement formElement)
adds a formelement

Parameters:
name - should not contain anything critical to HTML (no ".", no umlaut, etc.)
formElement -

getFormElement

public FormElement getFormElement(java.lang.String name)
Parameters:
name -
Returns:
The generic form element

getTextElement

public TextElement getTextElement(java.lang.String name)
Parameters:
name -
Returns:
A form element of type text

getIntegerElement

public IntegerElement getIntegerElement(java.lang.String name)
Parameters:
name -
Returns:
A form element of type integer

getDateElement

public DateElement getDateElement(java.lang.String name)
Parameters:
name -
Returns:
A form element of type date

getCheckBoxElement

public CheckBoxElement getCheckBoxElement(java.lang.String name)
Parameters:
name -
Returns:
A form element of type check-box

getSingleSelectionElement

public SingleSelectionElement getSingleSelectionElement(java.lang.String name)
Parameters:
name -
Returns:
A form element of type single selection

getRadioButtonElement

public RadioButtonGroupElement getRadioButtonElement(java.lang.String name)
Parameters:
name -
Returns:
A form element of type radio button

getMultipleSelectionElement

public MultipleSelectionElement getMultipleSelectionElement(java.lang.String name)
Parameters:
name -
Returns:
A form element of type multiple selection

getTextAreaElement

public TextAreaElement getTextAreaElement(java.lang.String name)
Parameters:
name -
Returns:
A form element of type text area

getWikiMarkupTextAreaElement

public WikiMarkupTextAreaElement getWikiMarkupTextAreaElement(java.lang.String name)
Parameters:
name -
Returns:
A form element of type wiki markup

getPasswordElement

public PasswordElement getPasswordElement(java.lang.String name)
Parameters:
name -
Returns:
A form element of type password

getElementCount

public int getElementCount()
Returns:
integer: the form element counter

getNameIterator

public java.util.Iterator getNameIterator()
gives an iterator over the names of the contained formelements

Returns:
Iterator

setAllFormElements

public void setAllFormElements(boolean readOnly)
disables the form input on all formelements, but keeps the submit/cancel buttons. convenience method, useful for e.g. after a form has been successfully submitted.

Parameters:
readOnly -

validate

public abstract boolean validate()
Returns:
true: form validates, false: form contains invalid data

validate

public void validate(UserRequest ureq,
                     ValidationResult vr)
Description copied from class: Component
called just before the rendering of the -whole tree- takes place, so e.g. lazy fetching can be implemented, or issueing a request for a new moduleUri (e.g. for CPComponent, so that the browser loads images correctly). only called when the component is visible

Overrides:
validate in class Component

setSubmitKey

public void setSubmitKey(java.lang.String submitKeyi18n)
Deprecated. since 22.11.2005 replaced by addSubmitKey(String submitKeyi18n, String identifier).

Sets the submitKey.

Parameters:
submitKeyi18n - The submitKey to set

addSubmitKey

public void addSubmitKey(java.lang.String submitKeyi18n)
Deprecated. since 19.07.2006 replaced by addSubmitKey(String submitKeyi18n, String identifier).

Sets the submitKey.

Parameters:
submitKeyi18n - The submitKey to set

addSubmitKey

public void addSubmitKey(java.lang.String submitKeyi18n,
                         java.lang.String identifier)
Adds a button with i18n key identified by identifier.

Parameters:
submitKeyi18n -
identifier -

isValid

public boolean isValid()
Returns the validated.

Returns:
boolean

setCancelButton

public void setCancelButton()
Sets the default cancel button. behaves like setCancelKey("cancel")


removeCancelButton

public void removeCancelButton()
Removes the default cancel button. This is only needed if you want to toggle the visibility of the button. behaves like setCancelKey(null)


setCancelKey

public void setCancelKey(java.lang.String cancelKeyi18n)
Sets the cancelParamName.

Parameters:
cancelKey -

isDisplayOnly

public boolean isDisplayOnly()
Returns the displayOnly.

Returns:
boolean

setDisplayOnly

public void setDisplayOnly(boolean displayOnly)
Sets the displayOnly.

Parameters:
displayOnly - The displayOnly to set

hasMandatoryFields

public boolean hasMandatoryFields()
Check if this form contains mandatory fields

Returns:
True if form has at least one mandatory field, false otherwhise

hasWikiMarkupFields

public boolean hasWikiMarkupFields()
Check if this form contains mandatory fields

Returns:
True if form has at least one mandatory field, false otherwhise

addVisibilityDependsOnSelectionRule

public void addVisibilityDependsOnSelectionRule(VisibilityDependsOnSelectionRule rule)
Set a visibility-of-element-depends-on-a-selection-element rule to the form

Parameters:
rule -

getVisibilityDependsOnSelectionRules

public java.util.List getVisibilityDependsOnSelectionRules()
Get a list of all dependecy rules

Returns:
List of VisibilityDependsOnSelectionRule objects

getHTMLRendererSingleton

public ComponentRenderer getHTMLRendererSingleton()
Specified by:
getHTMLRendererSingleton in class Component

getSelectedSubmitKey

public java.lang.String getSelectedSubmitKey()
Returns:
Returns the selectedSubmitKey.