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

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.MultipleSelectionElementImpl
All Implemented Interfaces:
InlineElement, MultipleSelectionElement, SelectionElement, FormBaseComponentIdProvider, FormItem
Direct Known Subclasses:
MultiSelectionTree

public class MultipleSelectionElementImpl
extends FormItemImpl
implements MultipleSelectionElement

Description:
TODO: patrickb Class Description for MultipleSelectionElementImpl

Initial Date: 04.01.2007

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
MultipleSelectionElementImpl(java.lang.String name)
           
MultipleSelectionElementImpl(java.lang.String name, FormLayouter formLayout)
           
 
Method Summary
static FormLayouter createHorizontalLayout(java.lang.String name)
          radio buttons horizontal
static FormLayouter createSelectboxLayouter(java.lang.String name)
          as selectbox
static FormLayouter createVerticalLayout(java.lang.String name, int columns)
          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)
           
 java.util.Set<java.lang.String> getKeys()
          Returns the keys of the checkboxes in this MultipleSelectionElement.
 java.util.Set<java.lang.String> getSelectedKeys()
           
 int getSize()
           
 java.lang.String getValue(int which)
           
 boolean isAtLeastSelected(int howmany)
           
 boolean isMultiselect()
          selection element supports multiple select
 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 selectAll()
          Select all selection elements.
 void setEnabled(boolean isEnabled)
          item is enabled/disabled, e.g.
 void setEnabled(java.util.Set<java.lang.String> keys, boolean isEnabled)
          Enables or disables several checkboxes at once by applying MultipleSelectionElement.setEnabled(String, boolean) to the checkboxes with the keys given in keys.
 void setEnabled(java.lang.String key, boolean isEnabled)
          Enables or disables a checkbox.
 void setKeysAndValues(java.lang.String[] keys, java.lang.String[] values, java.lang.String[] cssClasses)
           
 void setSelectedValues(java.lang.String[] values)
          array of values which are selected
 void setVisible(boolean isVisible)
          item, label, example, error get not visible
 void setVisible(java.util.Set<java.lang.String> keys, boolean isEnabled)
          Shows or hides several checkboxes at once by applying MultipleSelectionElement.setVisible(String, boolean) to the checkboxes with the keys given in keys.
 void setVisible(java.lang.String key, boolean isVisible)
          Shows or hides a checkbox.
 void uncheckAll()
          Uncheck all selection elements.
 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

MultipleSelectionElementImpl

public MultipleSelectionElementImpl(java.lang.String name)

MultipleSelectionElementImpl

public MultipleSelectionElementImpl(java.lang.String name,
                                    FormLayouter formLayout)
Method Detail

getSelectedKeys

public java.util.Set<java.lang.String> getSelectedKeys()
Specified by:
getSelectedKeys in interface MultipleSelectionElement
Returns:
a Set of Strings

setKeysAndValues

public void setKeysAndValues(java.lang.String[] keys,
                             java.lang.String[] values,
                             java.lang.String[] cssClasses)
Specified by:
setKeysAndValues in interface MultipleSelectionElement
cssClasses - The CSS classes that should be used in the form element for each key-value pair or NULL not not use special styling

isAtLeastSelected

public boolean isAtLeastSelected(int howmany)
Specified by:
isAtLeastSelected in interface MultipleSelectionElement
Returns:
See Also:
org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement#isAtLeastSelected(int, java.lang.String)

getKey

public java.lang.String getKey(int which)
Specified by:
getKey in interface SelectionElement
Returns:
String

getSize

public int getSize()
Specified by:
getSize in interface SelectionElement
Returns:
integer

getValue

public java.lang.String getValue(int which)
Specified by:
getValue in interface SelectionElement
Returns:
String

isMultiselect

public boolean isMultiselect()
selection element supports multiple select

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

isSelected

public boolean isSelected(int which)
Specified by:
isSelected in interface SelectionElement
Returns:
boolean

select

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

setSelectedValues

public void setSelectedValues(java.lang.String[] values)
array of values which are selected

Parameters:
values -

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)

setEnabled

public void setEnabled(java.lang.String key,
                       boolean isEnabled)
Description copied from interface: MultipleSelectionElement
Enables or disables a checkbox. Note that this is not the same as org.olat.core.gui.components.form.flexible.FormItem#setesetEnabled(boolean) which enables or disables all checkboxes of this form element.

Specified by:
setEnabled in interface MultipleSelectionElement
Parameters:
key - The key of the checkbox.
isEnabled - true means enabled.
See Also:
MultipleSelectionElement.setEnabled(java.lang.String, boolean)

setEnabled

public void setEnabled(java.util.Set<java.lang.String> keys,
                       boolean isEnabled)
Description copied from interface: MultipleSelectionElement
Enables or disables several checkboxes at once by applying MultipleSelectionElement.setEnabled(String, boolean) to the checkboxes with the keys given in keys.

Specified by:
setEnabled in interface MultipleSelectionElement
Parameters:
keys - Keys of the checkboxes.
isEnabled - Whether the checkboxes given in keys are to be enabled (true) or disabled (false).
See Also:
MultipleSelectionElement.setEnabled(java.util.Set, 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

setVisible

public void setVisible(java.lang.String key,
                       boolean isVisible)
Description copied from interface: MultipleSelectionElement
Shows or hides a checkbox. Note that this is not the same as FormItem.setVisible(boolean) which shows or hides all checkboxes of this form element.

Specified by:
setVisible in interface MultipleSelectionElement
Parameters:
key - The key of the checkbox.
See Also:
MultipleSelectionElement.setVisible(java.lang.String, boolean)

setVisible

public void setVisible(java.util.Set<java.lang.String> keys,
                       boolean isEnabled)
Description copied from interface: MultipleSelectionElement
Shows or hides several checkboxes at once by applying MultipleSelectionElement.setVisible(String, boolean) to the checkboxes with the keys given in keys.

Specified by:
setVisible in interface MultipleSelectionElement
Parameters:
keys - Keys of the checkboxes.
isEnabled - Whether the checkboxes given in keys are to be shown (true) or hidden (false).
See Also:
MultipleSelectionElement.setVisible(java.util.Set, boolean)

getKeys

public java.util.Set<java.lang.String> getKeys()
Returns the keys of the checkboxes in this MultipleSelectionElement.

Returns:
Keys of the checkboxes

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 FormLayouter createSelectboxLayouter(java.lang.String name)
as selectbox

Parameters:
name -
Returns:

createHorizontalLayout

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

Parameters:
name -
Returns:

createVerticalLayout

public static FormLayouter createVerticalLayout(java.lang.String name,
                                                int columns)
radio buttons vertical

Parameters:
name -
Returns:

selectAll

public void selectAll()
Select all selection elements.

Specified by:
selectAll in interface MultipleSelectionElement

uncheckAll

public void uncheckAll()
Uncheck all selection elements.

Specified by:
uncheckAll in interface MultipleSelectionElement