public class Form extends FormElement
FormControl
s that specify the
structure of the dialog as it should be presented to human users. This
implementation organizes the FormControl
s in three standard
Group
s:
SimpleOutput
object that is added as the single child to the ioControls group. The submits
group will be constructed automatically with two buttons based on the
constants ACK_MESSAGE_DELET
resp. ACK_MESSAGE_KEEP
and
LABEL_MESSAGE_DELET
resp. LABEL_MESSAGE_KEEP
. These two
buttons can be used by a user to state either
"ok, I got it, you can delete the message" or "please preserve the message
for later check", respectively. Normally, applications do not need to
subscribe for user decision in this regard, but if they want, then they must
use the value returned by the method getDialogID()
of the created
form object, for subscribing to the UI bus.SubdialogTrigger
for placing
buttons that pop up a subdialog, instead of instances of Submit
that
should be used only for finishing the whole dialog. Submit
instances
must be added to the group returned by Form.getSubmits(), whereas
SubdialogTrigger
instances should be added to appropriate subgroups
of the group returned by Form.getIOControls(). Subdialogs may affect the data
to be used within the main dialog and hence the main dialog must be frozen
until the application requests to continue with it. For this purpose,
applications must call the method
UICaller.resumeDialog(String,org.universAAL.middleware.rdf.Resource)
of their output publisher after the subdialog finishes and they have
processed its data and updated the form data of the main dialog. UI handlers
may decide to render instances of SubdialogTrigger
and Submit
differently. Additionally, they may differentiate between events from these
two types of buttons (and e.g. keep the parent dialog open until the
subdialog loop is closed) or not. In any case, the middleware will
re-dispatch the main dialog by calling
UIHandler.handleUICall(org.universAAL.middleware.ui.UIRequest)
of the output subscriber of the selected UI handler, as soon as the
application requests to resume the dialog. In this way, the freezing and
re-activating the main dialog is forced by the middleware even if the UI
handler does not differentiate between events from instances of
SubdialogTrigger
and Submit
.getIOControls()
and getSubmits()
methods respectively and
construct their dialogs using these two groups as parent for their real form
controls.Modifier and Type | Field and Description |
---|---|
static String |
ACK_MESSAGE_DELET
The submission ID if a user acknowledges that a dialog of type Message
can be deleted.
|
static String |
ACK_MESSAGE_KEEP
The submission ID if a user acknowledges that a dialog of type Message
must be preserved for later check.
|
static Label |
LABEL_MESSAGE_DELET
The label of a button associated with
ACK_MESSAGE_DELET as
submission ID that is automatically added to dialogs of type Message. |
static Label |
LABEL_MESSAGE_KEEP
The label of a button associated with
ACK_MESSAGE_KEEP as
submission ID that is automatically added to dialogs of type Message. |
static String |
MY_URI |
static String |
PROP_DIALOG_CREATED_BY
An optional property of form objects that can be associated with a string
representing the name of the component that created the form.
|
static String |
PROP_DIALOG_CREATION_TIME
The point of time in which a form object is instantiated.
|
static String |
PROP_DIALOG_CURRENT_FOCUSED_CONTROL
An optional property of form objects to indicate which form control
should receive the focus when UI handlers start to present the dialog.
|
static String |
PROP_DIALOG_DATA_ROOT
The
Resource containing the form
data. |
static String |
PROP_DIALOG_TYPE
The type of the dialog represented by a form object as an instance of
DialogType . |
static String |
PROP_PARENT_DIALOG_URI
Applications must set this property for those form objects representing a
dialog of type Subdialog using the value returned by
getDialogID() on the parent form from which the subdialog was
triggered. |
protected static String |
PROP_ROOT_GROUP |
static String |
uAAL_DIALOG_NAMESPACE |
PROP_APPEARANCE
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
Modifier | Constructor and Description |
---|---|
|
Form(String uri)
For usage by de-serializers only.
|
protected |
Form(String uriPrefix,
int numProps) |
Modifier and Type | Method and Description |
---|---|
XMLGregorianCalendar |
getCreationTime()
Returns the time at which the first time the form was created by an
application.
|
FormControl |
getCurrentFocusedControl() |
Resource |
getData() |
String |
getDialogCreator() |
String |
getDialogID()
Returns the URI of this form object as its global unique ID.
|
DialogType |
getDialogType() |
Group |
getIOControls()
Returns the standard group for UI controls in this form.
|
String |
getMessageContent()
Returns the text message originally set if this form was created by
newMessage(String, String) . |
Resource |
getParentDialogResource()
Returns the parent dialog as an empty resource with
PROP_PARENT_DIALOG_URI as its URI. |
String |
getParentDialogURI() |
Output[] |
getSharedOutputs()
Returns all the
Output controls contained in the ioControls group
(see the above documentation of this class concerning the standard groups
within forms) that are likely to be relevant for human users in order to
decide what to do with this dialog. |
Group |
getStandardButtons()
Returns the pre-defined group of standard buttons in this form.
|
String |
getStandardButtonsDialogID()
Reserved for use by a dialog management solution that has access to all
dialogs and adds standard buttons beyond the application logic to reflect
a system-wide behavior.
|
Group |
getSubmits()
Returns the standard group for submit buttons in this form.
|
String |
getTitle()
Returns the form title reflecting the intent of this dialog and
originally set when constructing this form object.
|
boolean |
isMessage()
Answers if this form object is created by
newMessage(String, String) . |
boolean |
isStandardDialog()
Answers if this form object is created by
newDialog(String, Resource) . |
boolean |
isSubdialog()
Answers if this form object is created by
newSubdialog(String, String) . |
boolean |
isSystemMenu()
Answers if this form object is created by
newSystemMenu(String) . |
static Form |
newDialog(String formTitle,
Resource dataRoot)
Constructs and returns a new form object representing an empty dialog of
type
Standard Dialog with proper initial
configuration. |
static Form |
newDialog(String formTitle,
String dataRootType)
An alternative for
newDialog(String, Resource) to be used if no
specific data root is going to be specified but only the URI of its type. |
static Form |
newMessage(String formTitle,
String message)
|
static Form |
newSubdialog(String formTitle,
String parentDialogURI)
Constructs and returns a new form object representing an empty dialog of
type
Subdialog with proper initial
configuration. |
static Form |
newSystemMenu(String formTitle) |
FormControl |
searchFormControl(String formControlURI)
look for a FormControl within the form with the given URI.
|
void |
setCurrentFocusedControl(FormControl fc) |
void |
setDialogCreator(String creator) |
void |
substituteData(Resource pr)
Reserved for usage by the middleware.
|
addAppearanceRecommendation, getAppearanceRecommendations
addType, getLocalName, getNamespace, getProperty, getPropertyURIs, getType, getTypes, getURI, hasQualifiedName, isAnon, numberOfProperties
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, setProperty, setPropertyPath, setPropertyPath, setPropertyPathFromOffset, setResourceComment, setResourceLabel, toString, toStringRecursive, toStringRecursive, unliteral
public static final String uAAL_DIALOG_NAMESPACE
public static final String MY_URI
public static final String ACK_MESSAGE_DELET
public static final String ACK_MESSAGE_KEEP
public static final Label LABEL_MESSAGE_DELET
ACK_MESSAGE_DELET
as
submission ID that is automatically added to dialogs of type Message.public static final Label LABEL_MESSAGE_KEEP
ACK_MESSAGE_KEEP
as
submission ID that is automatically added to dialogs of type Message.public static final String PROP_DIALOG_CREATED_BY
public static final String PROP_DIALOG_CREATION_TIME
TypeMapper.getCurrentDateTime()
.public static final String PROP_DIALOG_CURRENT_FOCUSED_CONTROL
public static final String PROP_DIALOG_DATA_ROOT
Resource
containing the form
data. Form data can be accessed using property paths; UI handlers,
however, do not need to explicitly access this data normally, because
they normally deal only with data associated with form controls that can
be retrieved by calling FormControl.getValue()
or set by calling
Input.storeUserInput(Object)
. Applications may create an instance
of Resource
and set both their
hidden data and initial data associated with the form controls using
Resource.setPropertyPath(String[], Object)
. They can retrieve the form data from ui responses by calling
UIResponse.getUserInput(String[])
.
Note: initial data to be associated with form controls can be set through
their constructors, as well.public static final String PROP_DIALOG_TYPE
DialogType
. See the above documentation of this class regarding
the types of dialogs supported.public static final String PROP_PARENT_DIALOG_URI
getDialogID()
on the parent form from which the subdialog was
triggered.protected static final String PROP_ROOT_GROUP
public Form(String uri)
protected Form(String uriPrefix, int numProps)
uriPrefix
- numProps
- public static Form newDialog(String formTitle, Resource dataRoot)
Standard Dialog
with proper initial
configuration. See also the discussion of dialog types in the above
documentation of this class.formTitle
- The form title giving the intent of the dialog.dataRoot
- The Resource containing the form data. It can be null, if no
hidden data was prepared by the application and any initial
value to be associated with form controls is going to be set
through their constructors. See also
PROP_DIALOG_DATA_ROOT
.Standard Dialog
with proper
initial configuration.public static Form newDialog(String formTitle, String dataRootType)
newDialog(String, Resource)
to be used if no
specific data root is going to be specified but only the URI of its type.public static Form newSubdialog(String formTitle, String parentDialogURI)
Subdialog
with proper initial
configuration. See also the discussion of dialog types in the above
documentation of this class. To set hidden form data, you must first get
the data root using getData()
and then add your data calling its
method
Resource.setPropertyPath(String[], Object)
.formTitle
- The form title giving the intent of the dialog.parentDialogURI
- The ID of the parent dialog. See also
PROP_PARENT_DIALOG_URI
.Subdialog
with proper initial
configuration.public XMLGregorianCalendar getCreationTime()
PROP_DIALOG_CREATION_TIME
public FormControl getCurrentFocusedControl()
PROP_DIALOG_CURRENT_FOCUSED_CONTROL
public Resource getData()
PROP_DIALOG_DATA_ROOT
public String getDialogCreator()
PROP_DIALOG_CREATED_BY
public String getDialogID()
public DialogType getDialogType()
PROP_DIALOG_TYPE
public Group getIOControls()
public String getMessageContent()
newMessage(String, String)
. Otherwise, it returns null.public Resource getParentDialogResource()
PROP_PARENT_DIALOG_URI
as its URI.public String getParentDialogURI()
PROP_PARENT_DIALOG_URI
public Output[] getSharedOutputs()
Output
controls contained in the ioControls group
(see the above documentation of this class concerning the standard groups
within forms) that are likely to be relevant for human users in order to
decide what to do with this dialog. The assumption is that there may be
other Output
controls specific to certain submissions possible
within this dialog, which will be ignored by this method as they do not
represent shared info.public Group getStandardButtons()
public String getStandardButtonsDialogID()
public Group getSubmits()
public String getTitle()
public boolean isStandardDialog()
newDialog(String, Resource)
.PROP_DIALOG_TYPE
public boolean isMessage()
newMessage(String, String)
.PROP_DIALOG_TYPE
public boolean isSubdialog()
newSubdialog(String, String)
.PROP_DIALOG_TYPE
public boolean isSystemMenu()
newSystemMenu(String)
.PROP_DIALOG_TYPE
public void setCurrentFocusedControl(FormControl fc)
PROP_DIALOG_CURRENT_FOCUSED_CONTROL
public void setDialogCreator(String creator)
PROP_DIALOG_CREATED_BY
public void substituteData(Resource pr)
public FormControl searchFormControl(String formControlURI)
formControlURI
- FormControl
or null if not found.Copyright © 2015 universAAL Consortium. All Rights Reserved.