org.universAAL.support.utils.ui.low
Class Message

Package class diagram package Message
java.lang.Object
  extended by org.universAAL.middleware.rdf.Resource
      extended by org.universAAL.middleware.rdf.FinalizedResource
          extended by org.universAAL.middleware.ui.UIRequest
              extended by org.universAAL.support.utils.ui.low.Message
All Implemented Interfaces:
Matchable, Request, Requirement, IContainer

public class Message
extends UIRequest
implements IContainer

A helper class that lets you build UIRequests easily so you can send them with your UICaller class. Just create an instance of this for the addressed user and add Simple Form Controls to it. This one specifically creates a Message, which is a single-time interaction unit between applications and users. Messages take control of a portion of the interaction space (e.g. a pop-up appearing in the screen) until they are dismissed by the application, another Dialog comes in front of them, or are finished with the default commands set by the system (e.g. Cancel). Messages have two groups for Controls: The main Controls group is for any kind of control. The Submits group is only for Submits intended to end the message.

Example: Creating a Message for alerting the user that a light is off.

Message m=new Message(user,"Light interface","Light1 has been turned off");

caller.sendUIRequest(m);

Notice that Simple Form Controls will be rendered in the same order as they are added. Once they are added they can no longer be modified, so set all their properties before adding them to the Dialog. Take into account however that Simple Group controls need to be added to the Dialog BEFORE other controls can be added to those Groups.

This is not necessarily faster nor better than the usual way of doing it with Form and UIRequest. It's just an alternative way that might help those less familiarized with universAAL.

Author:
alfiva

Field Summary
 
Fields inherited from class org.universAAL.middleware.ui.UIRequest
MY_URI, PROP_ADDRESSED_USER, PROP_DIALOG_FORM, PROP_DIALOG_LANGUAGE, PROP_DIALOG_PRIORITY, PROP_DIALOG_PRIVACY_LEVEL, PROP_HAS_ACCESS_IMPAIRMENT, PROP_HAS_PREFERENCE, PROP_PRESENTATION_LOCATION, PROP_PRESENTATION_MODALITY, PROP_PRESENTATION_MODALITY_ALT, uAAL_UI_NAMESPACE
 
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
Message(User user, String title, String message)
          Use this helper class to create a UIRequest that is easy to use.
Message(User user, String title, String message, LevelRating priority, PrivacyLevel privacy)
          Use this helper class to create a UIRequest that is easy to use.
 
Method Summary
 String[] add(Control ctrl)
          Add the given Simple Control UI element to this container.
 void addHidden(String ref, Object hidden)
          Add a hidden object so it is sent within the UI request, but not shown to the user.
 String addSubmit(SubmitCmd ctrl)
          Add a Submit Form Control to the Submit group of the Message.
 
Methods inherited from class org.universAAL.middleware.ui.UIRequest
getAddressedUser, getAltPresentationModality, getDialogForm, getDialogID, getDialogLanguage, getDialogPriority, getDialogPrivacyLevel, getDialogType, getImpairments, getPreferences, getPresentationLocation, getPropSerializationType, matches, setAltPresentationModality, setCollectedInput, setImpairments, setPreferences, setPresentationLocation, setPresentationModality
 
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, getResource, getResourceComment, getResourceLabel, getStaticFieldValue, hashCode, hasProperty, isAnon, isBlockingAddingTypes, isClosedCollection, isQualifiedName, isWellFormed, literal, representsQualifiedURI, serializesAsXMLLiteral, setProperty, setPropertyPath, setPropertyPath, setPropertyPathFromOffset, setResourceComment, setResourceLabel, toString, toStringRecursive, toStringRecursive, unliteral
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Message

public Message(User user,
               String title,
               String message)
Use this helper class to create a UIRequest that is easy to use. This Message extends UIRequest so you can use it with a UICaller. Default values are used for priority (low) and privacy (insensible).

Parameters:
user - The user to which the request is addressed.
title - The title of the Message.
message - The default output message to be shown to the user.

Message

public Message(User user,
               String title,
               String message,
               LevelRating priority,
               PrivacyLevel privacy)
Use this helper class to create a UIRequest that is easy to use. This Message extends UIRequest so you can use it with a UICaller.

Parameters:
user - The user to which the request is addressed.
title - The title of the Message.
message - The default output message to be shown to the user.
priority - Set a custom priority for the Message.
privacy - Set the required privacy level for the Message.
Method Detail

add

public String[] add(Control ctrl)
Description copied from interface: IContainer
Add the given Simple Control UI element to this container. Once the control is added it cannot be modified. Controls are renedered in the same order they are added. Controls that are Containers and can add elements as well, like Group or Repeat, must be added BEFORE other controls can be added to them. Controls that need references, like Inputs (with property paths), or Submits (with IDs) will be given an automatic reference if none was set. This reference will be returned by this method, in the form of an Array of Strings representing the reference: a Path for Inputs, or a single String for Submits IDs.

Specified by:
add in interface IContainer
Parameters:
ctrl - The Simple Control UI element to be added.
Returns:
The Array of Strings representing the reference Property Path for Input Controls, or with a single String for Submits IDs.

addSubmit

public String addSubmit(SubmitCmd ctrl)
Add a Submit Form Control to the Submit group of the Message. Submit group is for Submits that end the message. By default two Submits are added by the system, Delete and Preserve.

Parameters:
ctrl - The Submit to add
Returns:
The String representing the ID to be used to identify the Submit in the response.

addHidden

public void addHidden(String ref,
                      Object hidden)
Add a hidden object so it is sent within the UI request, but not shown to the user. When the UI response is being handled by the UI caller, this hidden input can be retrieved by calling uiresponse.getUserInput(new String[]{ref}); , being ref the one you used in this method.

Parameters:
ref - The reference you will use to access the hidden object later from the response
hidden - The object you want to hide


Copyright © 2014 universAAL Consortium. All Rights Reserved.