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

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.SingleSelectionImpl
All Implemented Interfaces:
InlineElement, SelectionElement, SingleSelection, FormBaseComponentIdProvider, FormItem

public class SingleSelectionImpl
extends FormItemImpl
implements SingleSelection

Description:
TODO: patrickb Class Description for SingleSelectionContainerImpl

Initial Date: 27.12.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
SingleSelectionImpl(java.lang.String name)
           
SingleSelectionImpl(java.lang.String name, FormLayouter formLayout)
          set your layout
 
Method Summary
static FormLayoutContainer createHorizontalLayout(java.lang.String name)
          radio buttons horizontal
static FormLayoutContainer createSelectboxLayouter(java.lang.String name)
          as selectbox
static FormLayoutContainer createVerticalLayout(java.lang.String name)
          radio buttons vertical
 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
 java.lang.String getFormDispatchId()
          A String containing a unique ID per form element component on the screen.
 java.lang.String getKey(int which)
           
 int getSelected()
           
 java.lang.String getSelectedKey()
           
 int getSize()
           
 java.lang.String getValue(int which)
           
 boolean isMultiselect()
          we are single selection, hence return always false here
 boolean isOneSelected()
           
 boolean isSelected(int which)
           
 void reset()
          reset the data in the field to a initial/predefined value.
 void select(java.lang.String key, boolean select)
           
 void setEnabled(boolean isEnabled)
          item is enabled/disabled, e.g.
 void setKeysAndValues(java.lang.String[] keys, java.lang.String[] values, java.lang.String[] cssClasses)
          Set new keys and values in this selection box.
 void setVisible(boolean isVisible)
          item, label, example, error get not visible
 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, getAction, getActionListenersFor, getComponent, getEmptyDisplayText, getErrorC, getErrorText, getExampleC, getExampleText, getLabelC, getLabelText, getName, getRootForm, getTranslator, getUserObject, hasError, hasExample, hasFocus, hasLabel, isEnabled, isInlineEditingOn, isMandatory, isVisible, setEmptyDisplayText, setErrorComponent, setErrorKey, setExampleKey, setFocus, setLabel, setLabelComponent, setMandatory, setRootForm, setTranslator, setUserObject, 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, getAction, getActionListenersFor, getComponent, getErrorC, getErrorText, getExampleC, getExampleText, getLabelC, getLabelText, getName, getRootForm, getTranslator, getUserObject, hasError, hasExample, hasFocus, hasLabel, isEnabled, isMandatory, isVisible, setErrorComponent, setErrorKey, setExampleKey, setFocus, setLabel, setLabelComponent, setMandatory, setRootForm, setTranslator, setUserObject, showError, showExample, showLabel
 

Constructor Detail

SingleSelectionImpl

public SingleSelectionImpl(java.lang.String name)
Parameters:
name -

SingleSelectionImpl

public SingleSelectionImpl(java.lang.String name,
                           FormLayouter formLayout)
set your layout

Parameters:
name -
presentation -
Method Detail

getSelected

public int getSelected()
Specified by:
getSelected in interface SingleSelection
Returns:
See Also:
org.olat.core.gui.components.form.flexible.elements.SingleSelectionContainer#getSelected()

getSelectedKey

public java.lang.String getSelectedKey()
Specified by:
getSelectedKey in interface SingleSelection
Returns:
See Also:
org.olat.core.gui.components.form.flexible.elements.SingleSelectionContainer#getSelectedKey()

isOneSelected

public boolean isOneSelected()
Specified by:
isOneSelected in interface SingleSelection
Returns:
See Also:
org.olat.core.gui.components.form.flexible.elements.SingleSelectionContainer#isOneSelected()

setKeysAndValues

public void setKeysAndValues(java.lang.String[] keys,
                             java.lang.String[] values,
                             java.lang.String[] cssClasses)
Description copied from interface: SingleSelection
Set new keys and values in this selection box. Be aware that this does reset the selection index and other parameters.
In most cases is is better to create a new SingleSelection Element than set new keys and values for an existing SingleSelection, always check this option.

Specified by:
setKeysAndValues in interface SingleSelection
Parameters:
keys - The new keys to use
values - The new values to use
cssClasses - The CSS classes that should be used in the form element for each key-value pair or NULL not not use special styling
See Also:
SingleSelection.setKeysAndValues(String[], String[], String[])

getKey

public java.lang.String getKey(int which)
Specified by:
getKey in interface SelectionElement
Returns:
String
See Also:
org.olat.core.gui.components.form.flexible.elements.SelectionContainer#getKey(int)

getSize

public int getSize()
Specified by:
getSize in interface SelectionElement
Returns:
integer
See Also:
org.olat.core.gui.components.form.flexible.elements.SelectionContainer#getSize()

getValue

public java.lang.String getValue(int which)
Specified by:
getValue in interface SelectionElement
Returns:
String
See Also:
org.olat.core.gui.components.form.flexible.elements.SelectionContainer#getValue(int)

isSelected

public boolean isSelected(int which)
Specified by:
isSelected in interface SelectionElement
Returns:
boolean
See Also:
org.olat.core.gui.components.form.flexible.elements.SelectionContainer#isSelected(int)

select

public void select(java.lang.String key,
                   boolean select)
Specified by:
select in interface SelectionElement
See Also:
SelectionElement.select(java.lang.String, boolean)

isMultiselect

public boolean isMultiselect()
we are single selection, hence return always false here

Specified by:
isMultiselect in interface SelectionElement
Returns:
See Also:
SelectionElement.isMultiselect()

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
Specified by:
evalFormRequest in class FormItemImpl

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()

setEnabled

public void setEnabled(boolean isEnabled)
Description copied from interface: FormItem
item is enabled/disabled, e.g. editable/read only in contrast to setVisible this does NOT DISABLE label, example, error!

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

setVisible

public void setVisible(boolean isVisible)
Description copied from interface: FormItem
item, label, example, error get not visible

Specified by:
setVisible in interface FormItem
Overrides:
setVisible in class FormItemImpl

getFormDispatchId

public java.lang.String getFormDispatchId()
Description copied from interface: FormBaseComponentIdProvider
A String containing a unique ID per form element component on the screen. This is corresponding to the Component#getDispatchID() and should achieve the same for the form elements.

Specified by:
getFormDispatchId in interface FormBaseComponentIdProvider
Overrides:
getFormDispatchId in class FormItemImpl
Returns:
See Also:
FormBaseComponentIdProvider.getFormDispatchId()

createSelectboxLayouter

public static FormLayoutContainer createSelectboxLayouter(java.lang.String name)
as selectbox

Parameters:
name -
Returns:

createHorizontalLayout

public static FormLayoutContainer createHorizontalLayout(java.lang.String name)
radio buttons horizontal

Parameters:
name -
Returns:

createVerticalLayout

public static FormLayoutContainer createVerticalLayout(java.lang.String name)
radio buttons vertical

Parameters:
name -
Returns: