public final class FieldFormItem
extends java.lang.Object
| Constructor and Description |
|---|
FieldFormItem()
Constructs a new object as a template.
|
FieldFormItem(VoiceXmlInterpreterContext context,
org.jvoicexml.xml.VoiceXmlNode voiceNode)
Creates a new field input item.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(FormItemVisitor visitor)
Execute the specific method of the visitor.
|
protected void |
addCustomGrammars(java.util.Collection<org.jvoicexml.xml.srgs.Grammar> grammars)
Adds custom grammars of the grammar container.
|
void |
addGrammar(GrammarDocument document)
Adds the given converted grammar to the list of converted grammars
for this grammar container.
|
boolean |
evaluateCondition()
An expression to evaluate in conjunction with the test of the form item
variable.
|
java.lang.Object |
evaluateExpression(DataModel model)
Retrieves the evaluated
expr attribute. |
java.util.Collection<org.jvoicexml.xml.vxml.AbstractCatchElement> |
getCatchElements()
Retrieves all nested catch elements.
|
protected VoiceXmlInterpreterContext |
getContext()
Retrieves the current
VoiceXmlInterpreterContext. |
int |
getEventCount(java.lang.String type)
Retrieve the counter for the given event type.
|
java.util.Collection<org.jvoicexml.xml.vxml.Filled> |
getFilledElements()
Gets all nested
<filled> elements. |
java.lang.Object |
getFormItemVariable()
Retrieves the form item variable.
|
java.util.Collection<GrammarDocument> |
getGrammarDocuments()
Retrieves the list of converted grammars.
|
java.util.Collection<org.jvoicexml.xml.srgs.Grammar> |
getGrammars()
Get all nested definitions of a
<grammar>. |
java.util.Collection<org.jvoicexml.xml.VoiceXmlNode> |
getLocalExecutableTags()
Retrieves the nested tags that have to be executed locally.
|
java.lang.String |
getName()
Retrieves the name of this
FormItem.. |
org.jvoicexml.xml.VoiceXmlNode |
getNode()
Retrieves the encapsulated
VoiceXmlNode. |
java.lang.String |
getNodeTagName()
Retrieves the tag name of the encapsulated node.
|
int |
getPromptCount()
Retrieves the value of the prompt counter.
|
protected java.lang.String |
getShadowVarContainerName()
Retrieves the name of the corresponding shadow var container name.
|
java.lang.String |
getSlot()
Retrieves the slot of the related field in mixed initiative dialogs.
|
void |
incrementEventCounter(JVoiceXMLEvent event)
Increment counters for all events that have the same name as the given
event or have a name that is a prefix of the given event.
|
void |
incrementPromptCount()
Increments the prompt counter.
|
void |
init(DataModel model)
Initializes this form item.
|
boolean |
isModal()
Checks if this form item is modal.
|
boolean |
isSelectable()
Guard conditions, which governs whether or not this form item can be
selected by the form interpretation algorithm.
|
org.jvoicexml.interpreter.formitem.AbstractFormItem |
newInstance(VoiceXmlInterpreterContext ctx,
org.jvoicexml.xml.VoiceXmlNode voiceNode)
Factory method to create a new instance from a template.
|
void |
resetEventCounter()
Reset the event counter.
|
void |
resetPromptCount()
Resets the prompt counter.
|
int |
setFormItemVariable(java.lang.Object value)
Sets the value of the form item variable.
|
int |
setFormItemVariable(RecognitionResult result)
Sets the form item variable with values from the given recognition
result.
|
int |
setFormItemVariable(java.lang.String utterance)
Sets the form item variable with values from the given utterance.
|
void |
setOptionConverter(OptionConverter optionConverter)
Sets the option converter to use for the conversion of
<option tags into a grammar. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFilledElementsgetCatchElementsevaluateCondition, evaluateExpression, getFormItemVariable, getName, getNode, getNodeTagName, init, isSelectablegetName, getNode, getPromptCount, incrementPromptCount, resetPromptCountgetEventCount, incrementEventCounter, resetEventCounterpublic FieldFormItem()
public FieldFormItem(VoiceXmlInterpreterContext context, org.jvoicexml.xml.VoiceXmlNode voiceNode) throws java.lang.IllegalArgumentException
context - The current VoiceXmlInterpreterContext.voiceNode - The corresponding XML node in the VoiceXML document.java.lang.IllegalArgumentException - if the given node is not a Field.public org.jvoicexml.interpreter.formitem.AbstractFormItem newInstance(VoiceXmlInterpreterContext ctx, org.jvoicexml.xml.VoiceXmlNode voiceNode)
ctx - The current VoiceXmlInterpreterContext.voiceNode - The corresponding XML node in the VoiceXML document.public void setOptionConverter(OptionConverter optionConverter)
<option tags into a grammar.optionConverter - the option converterpublic void accept(FormItemVisitor visitor) throws JVoiceXMLEvent
visitor - The visitor to use.JVoiceXMLEvent - Error or event visiting the form item.public int setFormItemVariable(RecognitionResult result) throws SemanticError
result - the observed recognition result0 if the variable was set successfullySemanticError - error passing the values to the scripting enginepublic int setFormItemVariable(java.lang.String utterance)
throws SemanticError
utterance - the observed utterance0 if the variable was set successfullySemanticError - error passing the values to the scripting enginepublic int setFormItemVariable(java.lang.Object value)
throws SemanticError
setFormItemVariable in interface FormItemvalue - new value for the form item variable.0 if setting the form item variable was successfulSemanticError - error setting the valueprotected void addCustomGrammars(java.util.Collection<org.jvoicexml.xml.srgs.Grammar> grammars)
grammars - already found grammarspublic java.lang.String getSlot()
public boolean isModal()
true if the form item is modal.public java.util.Collection<GrammarDocument> getGrammarDocuments()
getGrammarDocuments in interface GrammarContainerpublic void addGrammar(GrammarDocument document)
addGrammar in interface GrammarContainerdocument - the processed grammar documentpublic final java.util.Collection<org.jvoicexml.xml.srgs.Grammar> getGrammars()
<grammar>.getGrammars in interface GrammarContainer<grammar> tags.public final void incrementEventCounter(JVoiceXMLEvent event)
incrementEventCounter in interface EventCountableevent - Event to increment.public final void resetEventCounter()
resetEventCounter in interface EventCountablepublic final int getPromptCount()
getPromptCount in interface PromptCountablepublic final void incrementPromptCount()
incrementPromptCount in interface PromptCountablepublic final void resetPromptCount()
resetPromptCount in interface PromptCountablepublic final int getEventCount(java.lang.String type)
getEventCount in interface EventCountabletype - Event type.protected final java.lang.String getShadowVarContainerName()
public final java.util.Collection<org.jvoicexml.xml.vxml.Filled> getFilledElements()
<filled> elements.getFilledElements in interface InputItem<filled> tags.public void init(DataModel model) throws SemanticError, BadFetchError
init in interface FormItemmodel - the employed data modelSemanticError - error initializing this form itemBadFetchError - error initializing this form itempublic final java.lang.Object getFormItemVariable()
Each form has an associated form item variable. which by default is set
to null when the form is entered. This form item variable will
contain the result of interpreting the form item. An input item's form
variable can be given a name using the name attribute or left nameless in
which case an internal name is generated.
getFormItemVariable in interface FormItemDataModelpublic final java.lang.String getName()
FormItem..public final java.lang.Object evaluateExpression(DataModel model) throws SemanticError
expr attribute.evaluateExpression in interface FormItemmodel - the data model to use for evaluationexpr attribute.SemanticError - error evaluating the expr attribute.public boolean evaluateCondition()
throws SemanticError
true, or in the case
of <initial>, a test to see if any input item variable
has been filled in.evaluateCondition in interface FormItemtrue if the cond attribute of the form
item evaluates to true.SemanticError - error evaluating the cond attribute.public boolean isSelectable()
throws SemanticError
This default guard condition just tests to see if the form item variable has a value. If it does, this form item will not be visited.
isSelectable in interface FormItemtrue if the form item's variable has no value.SemanticError - error evaluating the cond condition.FormItem.getFormItemVariable()public final org.jvoicexml.xml.VoiceXmlNode getNode()
VoiceXmlNode.public final java.lang.String getNodeTagName()
getNodeTagName in interface FormItemprotected final VoiceXmlInterpreterContext getContext()
VoiceXmlInterpreterContext.VoiceXmlInterpreterContext.public java.util.Collection<org.jvoicexml.xml.vxml.AbstractCatchElement> getCatchElements()
public java.util.Collection<org.jvoicexml.xml.VoiceXmlNode> getLocalExecutableTags()
getLocalExecutableTags in interface FormItemLocalExecutableTagContainer