org.universAAL.middleware.ui.rdf
Class Select

Package class diagram package Select
java.lang.Object
  extended by org.universAAL.middleware.rdf.Resource
      extended by org.universAAL.middleware.rdf.FinalizedResource
          extended by org.universAAL.middleware.ui.rdf.FormElement
              extended by org.universAAL.middleware.ui.rdf.FormControl
                  extended by org.universAAL.middleware.ui.rdf.Input
                      extended by org.universAAL.middleware.ui.rdf.Select
Direct Known Subclasses:
Select1

public class Select
extends Input

An input control to be used if the user input is restricted to a fixed list of acceptable values. As it allows multiple selections, it can be seen as an abbreviation for a Repeat control having only a Select1 as child.

Author:
mtazari, Carsten Stockloew

Field Summary
static String MY_URI
           
static String PROP_CHOICES
          The list of choices in a select control.
 
Fields inherited from class org.universAAL.middleware.ui.rdf.Input
PROP_INPUT_ALERT, PROP_IS_MANDATORY
 
Fields inherited from class org.universAAL.middleware.ui.rdf.FormControl
PROP_CONTROL_LABEL, PROP_HELP, PROP_HINT, PROP_PARENT_CONTROL, PROP_REFERENCED_PPATH, PROP_VALUE_RESTRICTION
 
Fields inherited from class org.universAAL.middleware.ui.rdf.FormElement
PROP_APPEARANCE
 
Fields inherited from class org.universAAL.middleware.rdf.Resource
ANON_URI_PREFIX, blockAddingTypes, isXMLLiteral, ns_delim_index, PROP_RDF_FIRST, PROP_RDF_REST, PROP_RDF_TYPE, PROP_RDFS_COMMENT, PROP_RDFS_LABEL, PROP_SERIALIZATION_FULL, PROP_SERIALIZATION_OPTIONAL, PROP_SERIALIZATION_REDUCED, PROP_SERIALIZATION_UNDEFINED, PROP_uAAL_INVOLVED_HUMAN_USER, props, RDF_EMPTY_LIST, RDF_NAMESPACE, RDFS_NAMESPACE, TYPE_RDF_LIST, TYPE_RDFS_CLASS, uAAL_NAMESPACE_PREFIX, uAAL_SERVICE_NAMESPACE, uAAL_VOCABULARY_NAMESPACE, uri
 
Constructor Summary
  Select()
          Just for use by de-serializers.
  Select(Group parent, Label label, PropertyPath ref, MergedRestriction valueRestriction, Object initialValue)
          For use by applications.
protected Select(String typeURI, Group parent, Label label, PropertyPath ref, MergedRestriction valueRestriction, Object initialValue)
           
 
Method Summary
 void addChoiceItem(ChoiceItem item)
          Adds the given choice item to the list of choices in this select control.
 void addChoiceList(ChoiceList list)
          Adds the given choice list as a sublist to the list of choices in this select control.
 boolean generateChoices()
          If the restrictions defined or derivable for this select control can be determined and a certain list of allowed values can be derived from those restriction, those values will be passed to generateChoices(Object[]) to construct the list of choices.
 boolean generateChoices(Object[] elems)
          Having the actual values that the user should select from among them, this method automatically generates the list of choices for this select by trying to derive a label for them.
 Label[] getChoices()
          Returns the list of choices in this select control.
 int getMaxCardinality()
          Returns the maximum number of values that can be selected in the context of this select control.
 int getMaxLength()
          Overrides FormControl.getMaxLength() by only considering the labels of the choices currently associated with this select control.
 int getMinCardinality()
          Returns the minimum number of values that must be associated with this select control as selected values.
 boolean isMultilevel()
          Checks if any sublist is contained in the list of choices in this select control.
 boolean setProperty(String propURI, Object value)
          Just for use by de-serializers.
 boolean storeUserInputByLabelString(String selectedLabelString)
          Tries to find the hidden value associated with a choice item whose label has been given as input and then store that value as user input by calling Input.storeUserInput(Object).
 
Methods inherited from class org.universAAL.middleware.ui.rdf.Input
getAlertString, isMandatory, setAlertString, storeUserInput
 
Methods inherited from class org.universAAL.middleware.ui.rdf.FormControl
getAncestorRepeat, getFormObject, getHelpString, getHintString, getLabel, getParentGroup, getParentRepeat, getReferencedPPath, getRestrictions, getSuperGroups, getTypeURI, getValue, hasFocus, hasValue, isOfBooleanType, isOfPrimitiveType, isRepeatable, setHelpString, setHintString, toString
 
Methods inherited from class org.universAAL.middleware.ui.rdf.FormElement
addAppearanceRecommendation, getAppearanceRecommendations
 
Methods inherited from class org.universAAL.middleware.rdf.FinalizedResource
addType, getLocalName, getNamespace, getProperty, getPropertyURIs, getType, getTypes, getURI, hasQualifiedName, isAnon, numberOfProperties
 
Methods inherited from class org.universAAL.middleware.rdf.Resource
addMultiLangProp, asList, asList, asRDFList, changeProperty, copy, deepCopy, equals, generateAnonURI, getDefaultLang, getFilename, getMultiLangProp, getOrConstructLabel, getPropSerializationType, getResource, getResourceComment, getResourceLabel, getStaticFieldValue, hashCode, hasProperty, isAnon, isBlockingAddingTypes, isClosedCollection, isQualifiedName, isWellFormed, literal, representsQualifiedURI, serializesAsXMLLiteral, setPropertyPath, setPropertyPath, setPropertyPathFromOffset, setResourceComment, setResourceLabel, toStringRecursive, toStringRecursive, unliteral
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MY_URI

public static final String MY_URI
See Also:
Constant Field Values

PROP_CHOICES

public static final String PROP_CHOICES
The list of choices in a select control. List members must be instances of either ChoiceItem or ChoiceList.

See Also:
Constant Field Values
Constructor Detail

Select

public Select()
Just for use by de-serializers.


Select

public Select(Group parent,
              Label label,
              PropertyPath ref,
              MergedRestriction valueRestriction,
              Object initialValue)
For use by applications.

Parameters:
parent - The group to contain this select object.
label - The label.
ref - mandatory property path within the form data to which this select object refers.
valueRestriction - Optional local restrictions on the value of this select object.
initialValue - Optional initial / default value that will be made available in the form data.

Select

protected Select(String typeURI,
                 Group parent,
                 Label label,
                 PropertyPath ref,
                 MergedRestriction valueRestriction,
                 Object initialValue)
Method Detail

addChoiceItem

public void addChoiceItem(ChoiceItem item)
Adds the given choice item to the list of choices in this select control.


addChoiceList

public void addChoiceList(ChoiceList list)
Adds the given choice list as a sublist to the list of choices in this select control.


generateChoices

public boolean generateChoices(Object[] elems)
Having the actual values that the user should select from among them, this method automatically generates the list of choices for this select by trying to derive a label for them. No sublists can be generated by this method.

Returns:
true if the given parameter is a non empty array without any null element, false otherwise.

generateChoices

public boolean generateChoices()
If the restrictions defined or derivable for this select control can be determined and a certain list of allowed values can be derived from those restriction, those values will be passed to generateChoices(Object[]) to construct the list of choices.


getChoices

public Label[] getChoices()
Returns the list of choices in this select control. Each of the elements in the returned array is supposed to be an instance of either ChoiceItem or ChoiceList.


getMaxCardinality

public int getMaxCardinality()
Returns the maximum number of values that can be selected in the context of this select control. A negative integer is returned if there is no upper limit.


getMaxLength

public int getMaxLength()
Overrides FormControl.getMaxLength() by only considering the labels of the choices currently associated with this select control.

Overrides:
getMaxLength in class FormControl

getMinCardinality

public int getMinCardinality()
Returns the minimum number of values that must be associated with this select control as selected values. A non-positive integer is returned if there is no lower limit.


isMultilevel

public boolean isMultilevel()
Checks if any sublist is contained in the list of choices in this select control.


setProperty

public boolean setProperty(String propURI,
                           Object value)
Just for use by de-serializers.

Overrides:
setProperty in class Input
Returns:
true if the property changed as a result of the call
See Also:
Resource.setProperty(String, Object)

storeUserInputByLabelString

public boolean storeUserInputByLabelString(String selectedLabelString)
Tries to find the hidden value associated with a choice item whose label has been given as input and then store that value as user input by calling Input.storeUserInput(Object). If no hidden value was found, the label itself will be used as user input. Note: for use by UI handlers that can not handle the association between labels and values internally.

Returns:
true, if the storage was successful, false otherwise.


Copyright © 2014 universAAL Consortium. All Rights Reserved.