org.jvoicexml.interpreter.formitem
Class AbstractFormItem

java.lang.Object
  extended by org.jvoicexml.interpreter.formitem.AbstractFormItem
All Implemented Interfaces:
DialogConstruct, FormItem, FormItemVisitable
Direct Known Subclasses:
ControlItem, InputItem

public abstract class AbstractFormItem
extends Object
implements FormItem

Form items are the elements that can be visited in the main loop of the form interpretation algorithm. Input items direct the FIA to gather a result for a specific element. When the FIA selects a control item, the control item may contain a block of procedural code to execute, or it may tell the FIA to set up the initial prompt-and-collect for a mixed initiative form.

Version:
$Revision: 222 $

Copyright © 2005-2006 JVoiceXML group - http://jvoicexml.sourceforge.net/

Author:
Dirk Schnelle
See Also:
FormInterpretationAlgorithm

Constructor Summary
AbstractFormItem(VoiceXmlInterpreterContext ctx, VoiceXmlNode voiceNode)
          Create a new form item.
 
Method Summary
 Collection<AbstractCatchElement> getCatchElements()
          Get all nested <catch> elements.
protected  VoiceXmlInterpreterContext getContext()
          Selector for the current VoiceXmlInterpreterContext.
 String getExpr()
          Selector for the expr attribute.
 Object getFormItemVariable()
          Retrieves the form item variable.
 String getName()
          Retrieves the name of this FormItem..
 VoiceXmlNode getNode()
          Retrieves the encapsualed VoiceXmlNode.
 boolean isSelectable()
          Guard conditions, which governs whether or not this form item can be selected by the form interpretation algorithm.
 void setFormItemVariable(Object value)
          Sets the form item variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jvoicexml.interpreter.FormItemVisitable
accept
 

Constructor Detail

AbstractFormItem

public AbstractFormItem(VoiceXmlInterpreterContext ctx,
                        VoiceXmlNode voiceNode)
Create a new form item.

Parameters:
ctx - The current VoiceXmlInterpreterContext.
voiceNode - The corresponding XML node in the VoiceXML document.
Method Detail

getFormItemVariable

public final Object getFormItemVariable()
Retrieves the form item variable.

Each form has an associated form item variable. which by default is set to ECMA_SCRIPT_UNDEFINED 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.

Specified by:
getFormItemVariable in interface FormItem
Returns:
Result of interpreting this form item.
See Also:
Context.getUndefinedValue()

setFormItemVariable

public void setFormItemVariable(Object value)
Sets the form item variable.

Specified by:
setFormItemVariable in interface FormItem
Parameters:
value - New value for the form item variable.

getName

public final String getName()
Retrieves the name of this FormItem..

Specified by:
getName in interface FormItem
Returns:
Name of a dialog scoped form item variable.

getExpr

public final String getExpr()
Selector for the expr attribute.

Specified by:
getExpr in interface FormItem
Returns:
Value of the expr attribute.

isSelectable

public boolean isSelectable()
Guard conditions, which governs whether or not this form item can be selected by the form interpretation algorithm.

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.

Specified by:
isSelectable in interface FormItem
Returns:
true if the form item's variable has no value.
See Also:
FormItem.getFormItemVariable(), Context.getUndefinedValue()

getNode

public final VoiceXmlNode getNode()
Retrieves the encapsualed VoiceXmlNode.

Specified by:
getNode in interface FormItem
Returns:
Related VoiceXmlNode.

getContext

protected final VoiceXmlInterpreterContext getContext()
Selector for the current VoiceXmlInterpreterContext.

Returns:
Current VoiceXmlInterpreterContext.

getCatchElements

public Collection<AbstractCatchElement> getCatchElements()
Get all nested <catch> elements.

Specified by:
getCatchElements in interface FormItem
Returns:
Collection of all nested <catch> tags.


Copyright © 2005-2007 JVoiceXML group.