fi.hut.tml.xsmiles.mlfc.xforms.dialog
Class DynamicFocusHandler

java.lang.Object
  extended byfi.hut.tml.xsmiles.mlfc.xforms.dialog.DynamicFocusHandler
All Implemented Interfaces:
java.awt.event.ActionListener, org.w3c.dom.events.EventListener, java.util.EventListener, FocusHandler

public class DynamicFocusHandler
extends java.lang.Object
implements FocusHandler, java.awt.event.ActionListener, org.w3c.dom.events.EventListener

Author:
honkkis

Field Summary
protected  SpeechWidget currentFocus
           
protected  XSmilesDialog dialog
           
protected  org.w3c.dom.Document document
           
static java.lang.String DOMFocusInEvent
           
protected  SubmitElement globalSubmit
           
protected  Grammar grammar
           
protected  boolean searchedForGlobalSubmit
           
protected  DialogUI ui
           
 
Constructor Summary
DynamicFocusHandler(org.w3c.dom.Document doc, DialogUI dui, XSmilesDialog dia)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent arg0)
           
protected  void addListeners()
           
 void destroy()
           
protected static SubmitElement findGlobalSubmitElement(org.w3c.dom.Element root)
          searches the Element and it's subtree for single submit element, and returns it .
protected  org.w3c.dom.Element findNextBranchElement(org.w3c.dom.Element root)
           
 org.w3c.dom.Element getCurrentFocus()
           
 java.util.Vector getFocusPoints(org.w3c.dom.Element e)
          returns: vector of focus points Operation: Doa depth first - search and stop at any focus point and add it to the focus point list.
protected  java.util.Vector getFocusPoints(org.w3c.dom.Element e, java.util.Vector v)
           
 java.lang.String getGeneralPrompt()
           
protected  SubmitElement getGlobalSubmit()
          searches the Element and it's subtree for single submit element, and returns it .
 java.lang.String getLastReply()
           
 org.w3c.dom.Element getNextFocus(org.w3c.dom.Element e)
           
 org.w3c.dom.Element getParentFocus(org.w3c.dom.Element e)
           
 org.w3c.dom.Element getPreviousFocus(org.w3c.dom.Element e)
           
 org.w3c.dom.Element getRootFocus()
           
 void handleEvent(org.w3c.dom.events.Event ev)
           
 void installGrammar()
           
protected  boolean isActiveElement(org.w3c.dom.Node el)
           
protected  boolean isDocumentAlive()
           
 boolean isElementVisible(org.w3c.dom.Node n)
           
protected  void removeListeners()
           
 void setFocus(org.w3c.dom.Element elem)
          this is called by the dialog system to explicitly set the focus to some element If the element is an ComponentService, this will also set the GUI focus to that component
 void speak(java.lang.String s)
           
 void speakCurrentFocus()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ui

protected DialogUI ui

dialog

protected XSmilesDialog dialog

document

protected org.w3c.dom.Document document

currentFocus

protected SpeechWidget currentFocus

grammar

protected Grammar grammar

searchedForGlobalSubmit

protected boolean searchedForGlobalSubmit

globalSubmit

protected SubmitElement globalSubmit

DOMFocusInEvent

public static final java.lang.String DOMFocusInEvent
See Also:
Constant Field Values
Constructor Detail

DynamicFocusHandler

public DynamicFocusHandler(org.w3c.dom.Document doc,
                           DialogUI dui,
                           XSmilesDialog dia)
Method Detail

addListeners

protected void addListeners()

removeListeners

protected void removeListeners()

destroy

public void destroy()
Specified by:
destroy in interface FocusHandler

speakCurrentFocus

public void speakCurrentFocus()
Specified by:
speakCurrentFocus in interface FocusHandler

getGeneralPrompt

public java.lang.String getGeneralPrompt()

installGrammar

public void installGrammar()

isDocumentAlive

protected boolean isDocumentAlive()

findGlobalSubmitElement

protected static SubmitElement findGlobalSubmitElement(org.w3c.dom.Element root)
searches the Element and it's subtree for single submit element, and returns it . If there are 0 or more than 1 submit elements, returns null

Parameters:
root -
Returns:

getGlobalSubmit

protected SubmitElement getGlobalSubmit()
searches the Element and it's subtree for single submit element, and returns it . If there are 0 or more than 1 submit elements, returns null

Returns:

setFocus

public void setFocus(org.w3c.dom.Element elem)
this is called by the dialog system to explicitly set the focus to some element If the element is an ComponentService, this will also set the GUI focus to that component

Specified by:
setFocus in interface FocusHandler

isElementVisible

public boolean isElementVisible(org.w3c.dom.Node n)

getNextFocus

public org.w3c.dom.Element getNextFocus(org.w3c.dom.Element e)
Specified by:
getNextFocus in interface FocusHandler

getPreviousFocus

public org.w3c.dom.Element getPreviousFocus(org.w3c.dom.Element e)
Specified by:
getPreviousFocus in interface FocusHandler

getRootFocus

public org.w3c.dom.Element getRootFocus()
Specified by:
getRootFocus in interface FocusHandler

findNextBranchElement

protected org.w3c.dom.Element findNextBranchElement(org.w3c.dom.Element root)

getFocusPoints

public java.util.Vector getFocusPoints(org.w3c.dom.Element e)
returns: vector of focus points Operation: Doa depth first - search and stop at any focus point and add it to the focus point list. Only search ancestors. Ignore items with only one choice. (e.g. a group with only one ancestor focus point)

Specified by:
getFocusPoints in interface FocusHandler

getFocusPoints

protected java.util.Vector getFocusPoints(org.w3c.dom.Element e,
                                          java.util.Vector v)

isActiveElement

protected boolean isActiveElement(org.w3c.dom.Node el)

getCurrentFocus

public org.w3c.dom.Element getCurrentFocus()
Specified by:
getCurrentFocus in interface FocusHandler

getLastReply

public java.lang.String getLastReply()
Specified by:
getLastReply in interface FocusHandler

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent arg0)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

getParentFocus

public org.w3c.dom.Element getParentFocus(org.w3c.dom.Element e)
Specified by:
getParentFocus in interface FocusHandler

speak

public void speak(java.lang.String s)
Specified by:
speak in interface FocusHandler

handleEvent

public void handleEvent(org.w3c.dom.events.Event ev)
Specified by:
handleEvent in interface org.w3c.dom.events.EventListener


X-Smiles 1.2