org.universAAL.support.utils.ui
Class SelectMulti

Package class diagram package SelectMulti
java.lang.Object
  extended by org.universAAL.support.utils.ui.Control
      extended by org.universAAL.support.utils.ui.InputControl
          extended by org.universAAL.support.utils.ui.SelectMulti
Direct Known Subclasses:
SelectOne

public class SelectMulti
extends InputControl

Class representing a Multi-selection Input UI element. Multi-selection Inputs get one or many Object values from a list, whether it's a list of checkboxes, sorted column or any other way, depending on the UI renderer. The input is represented as the same type of Object stored in the list.

Example render:

 Label |  val1  |
       |[ val2 ]|
       |[ val3 ]|
       |  val4  |
       |  val5  |
 

The Objects in the list are displayed in a textual form by trying to convert them to a readable String, by using their .toString() method or their URI if they are Resources. When retrieving the input, remember to cast to the appropriate original type of Object.

Author:
alfiva

Field Summary
protected  Integer initialValue
          Initial selected index.
 
Fields inherited from class org.universAAL.support.utils.ui.InputControl
model
 
Fields inherited from class org.universAAL.support.utils.ui.Control
help, hint, label, MY_NAMESPACE, ref
 
Constructor Summary
SelectMulti()
          Generic empty constructor.
SelectMulti(String ref)
          Constructor with the reference of the input to be used in request and response.
SelectMulti(String ref, String label)
          Constructor with the reference of the input to be used in request and response.
SelectMulti(String ref, String label, Object[] initialOptions)
          Constructor with the reference of the input to be used in request and response.
 
Method Summary
 void addOption(Object option)
          Add an option to the list of possible options.
 String[] create(Group group)
          This method is for internal use of utils only.
 Integer getInitialIndex()
          Get the initial value of the selection as an index in the array of options.
 Object[] getOptions()
          Get the possible options to select.
 void setInitialIndex(Integer initialIndex)
          Set the initial value of the selection as the index in the array of options.
 void setOptions(Object[] options)
          Get the possible options to select.
 
Methods inherited from class org.universAAL.support.utils.ui.InputControl
getModel
 
Methods inherited from class org.universAAL.support.utils.ui.Control
getHelp, getHint, getLabel, getReference, setHelp, setHint, setLabel, setReference, setReference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialValue

protected Integer initialValue
Initial selected index.

Constructor Detail

SelectMulti

public SelectMulti()
Generic empty constructor. The Input will be generated with default values (first).


SelectMulti

public SelectMulti(String ref)
Constructor with the reference of the input to be used in request and response. The reference is a property path, but in this constructor it is simplified as a single String (a single-property path). All other properties of the input are set to defaults (first). Use method setReference(String[] path) to set a path through several properties.

Parameters:
ref - The simple reference identifying the input. Set to null to auto-generate.

SelectMulti

public SelectMulti(String ref,
                   String label)
Constructor with the reference of the input to be used in request and response. The reference is a property path, but in this constructor it is simplified as a single String (a single-property path). Use method setReference(String[] path) to set a path through several properties.

Parameters:
ref - The simple reference identifying the input. Set to null to auto-generate.
label - The label text that identifies the input to the user.

SelectMulti

public SelectMulti(String ref,
                   String label,
                   Object[] initialOptions)
Constructor with the reference of the input to be used in request and response. The reference is a property path, but in this constructor it is simplified as a single String (a single-property path). All other properties of the input are set to defaults (first). Use method setReference(String[] path) to set a path through several properties.

Parameters:
ref - The simple reference identifying the input. Set to null to auto-generate.
label - The label text that identifies the input to the user.
initialOptions - An array of Objects that represent the different possible options to select.
Method Detail

create

public String[] create(Group group)
Description copied from class: Control
This method is for internal use of utils only. It creates the actual official uaal control configured with the properties defined by this class. Once it is created it cannot be modified.

Specified by:
create in class Control
Parameters:
group - The UI group to which the control is being added.
Returns:
An array of Strings representing the property path used to identify the control in the response. This is only of interest for Input Controls. Submits and Triggers have only one String value. If the path has not been set manually by the time this method is called, an automatic one must be generated.

getInitialIndex

public Integer getInitialIndex()
Get the initial value of the selection as an index in the array of options.

Returns:
The index of the initial value

setInitialIndex

public void setInitialIndex(Integer initialIndex)
Set the initial value of the selection as the index in the array of options.

Parameters:
initialIndex - The index of the initial value

getOptions

public Object[] getOptions()
Get the possible options to select.

Returns:
An array of Strings representing the different options to select, or null if none were set.

addOption

public void addOption(Object option)
Add an option to the list of possible options. It will be added in the last place.

Parameters:
option - The option to add

setOptions

public void setOptions(Object[] options)
Get the possible options to select. Overrides any previous values.

Parameters:
options - The array of Strings representing the different options to select


Copyright © 2014 universAAL Consortium. All Rights Reserved.