fi.hut.tml.xsmiles.mlfc.xforms
Class XFormsElementHandler

java.lang.Object
  extended byfi.hut.tml.xsmiles.mlfc.xforms.XFormsElementHandler
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, XFormsConstants, XFormsContext

public class XFormsElementHandler
extends java.lang.Object
implements XFormsContext, XFormsConstants, java.awt.event.ActionListener

The factory for creating DOM event instances it also keeps track of different per page things, such as models, cursors etc.

Author:
Mikko Honkala

Field Summary
protected  java.util.Hashtable cases
          All the case elements in the document
protected  java.util.Hashtable cursors
          All the Repeat elements in the document
static boolean debugXForms
           
protected  ModelElementImpl defaultXForm
          the default XForm element
protected  DialogGUIDebug dialogUI
          the possible dialog UI
protected  ExtendedDocument doc
           
protected  org.apache.xerces.dom.DocumentImpl docImpl
           
protected  MLFC mlfc
          the CSS stylesheet object
protected  java.util.Hashtable models
          All the XForm elements in the document
protected  java.util.Hashtable nodeindexes
          All the Repeat elements in the document
protected  java.util.Vector nodeIndexListeners
          Listeners for nodeindex changes
protected  Action outermostAction
           
protected  RepeatIndexHandler repeatIndexHandler
          the ui index handler for repeats
protected static AdaptiveControlFactory sAdaptiveControlFactory
          factory used to create datatype aware controls
 
Fields inherited from interface fi.hut.tml.xsmiles.mlfc.xforms.XFormsConstants
ACCESSKEY, ACTION_ATTRIBUTE, ACTION_ELEMENT, ACTIVATE_EVENT, ACTIVE_CASE_PSEUDOCLASS, ALERT_ELEMENT, ALERT_EVENT, APPEARANCE_ATTRIBUTE, AT_ATTRIBUTE, BasicDataFactoryClassName, BEFORE_ATTRIBUTE, BIND_ATTRIBUTE, BIND_ELEMENT, BINDING_EXCEPTION, BLUR_EVENT, BUBBLES_ATTRIBUTE, BUTTON_ELEMENT, CALCULATE_ATTRIBUTE, CANCELABLE_ATTRIBUTE, CAPTION_CHANGED, CAPTION_ELEMENT, CASE_ATTRIBUTE, CASE_ELEMENT, CDATA_SECTION_ELEMENTS_ATTRIBUTE, CHOICES_ELEMENT, COMPUTE_EXCEPTION, CONSTRAINT_ATTRIBUTE, CONTROL_ATTRIBUTE, COPY_ELEMENT, DELETE_ELEMENT, DELETE_EVENT, DESELECT_EVENT, DESTROY_ELEMENT, DESTROY_EVENT, DISABLED_EVENT, DISABLED_PSEUDOCLASS, DISPATCH_ELEMENT, DUPLICATE_ELEMENT, DUPLICATE_EVENT, ENABLED_EVENT, ENABLED_PSEUDOCLASS, ENCODING_ATTRIBUTE, END_ATTRIBUTE, EXTENSION, EXTERNAL_LINKING_ATTR, FILENAME, FILENAME_ELEMENT, FOCUS_EVENT, FOCUSIN_NOTIFICATION_EVENT, FOCUSOUT_NOTIFICATION_EVENT, FUNC_INDEX, FUNC_NODEINDEX, FUNCTIONS_ATTRIBUTE, GROUP, GROUP_ELEMENT, HELP, HELP_ELEMENT, HELP_EVENT, HINT, HINT_ELEMENT, HINT_EVENT, INACTIVE_CASE_PSEUDOCLASS, INCLUDENAMESPACEPREFIXES_ATTRIBUTE, INCREMENTAL_ATTRIBUTE, INDENT_ATTRIBUTE, INDEX_ATTRIBUTE, INPUT, INPUT_ELEMENT, INPUTMODE_ATTRIBUTE, INRANGE_EVENT, INRANGE_PSEUDOCLASS, INSERT, INSERT_ELEMENT, INSERT_EVENT, INSTANCE, INSTANCE_ELEMENT, InstanceDocumentClassname, INVALID_DATATYPE_ERROR, INVALID_EVENT, INVALID_PSEUDOCLASS, ISVALID_ATTRIBUTE, ITEM, ITEM_ELEMENT, ITEMSET, ITEMSET_ELEMENT, LABEL, LEVEL_ATTRIBUTE, LINK_ERROR, LINK_EXCEPTION, LOAD, LOADURI_ELEMENT, MAXOCCURS_ATTRIBUTE, MEDIA_TYPE_ELEMENT, MEDIARENDERING_PSEUDOCLASS, MEDIATYPE, MEDIATYPE_ATTRIBUTE, MESSAGE, MESSAGE_ELEMENT, METHOD_ATTRIBUTE, MINOCCURS_ATTRIBUTE, MODEL_ATTRIBUTE, MODEL_CONSTRUCT_DONE_EVENT, MODEL_CONSTRUCT_EVENT, MODEL_DESTRUCT_EVENT, MODEL_ELEMENT, MODEL_ID_ATTRIBUTE, NAME_ATTRIBUTE, NAVINDEX_ATTRIBUTE, NEXT_EVENT, NODESET_ATTRIBUTE, NUMBER_ATTRIBUTE, OMIT_XML_DECLARATION_ATTRIBUTE, OPTIONAL_EVENT, ORIGIN_ATTRIBUTE, OUTOFRANGE_EVENT, OUTOFRANGE_PSEUDOCLASS, OUTPUT_ELEMENT, P3PTYPE_ATTRIBUTE, POSITION_ATTRIBUTE, PREVIOUS_EVENT, PSVIDocumentClassname, PSVISchemaPoolClassName, RANGE, RANGE_ELEMENT, READONLY_ATTRIBUTE, READONLY_EVENT, READONLY_PSEUDOCLASS, READWRITE_EVENT, READWRITE_PSEUDOCLASS, READY_EVENT, REBUILD_ELEMENT, REBUILD_EVENT, RECALCULATE_ELEMENT, RECALCULATE_EVENT, REF_ATTRIBUTE, REFRESH_ELEMENT, REFRESH_EVENT, RELEVANT_ATTRIBUTE, REPEAT, REPEAT_ATTRIBUTE, REPEAT_BIND_ATTRIBUTE, REPEAT_ELEMENT, REPEAT_ID_ATTRIBUTE, REPEAT_MODEL_ATTRIBUTE, REPEAT_NODESET_ATTRIBUTE, REPEAT_NUMBER_ATTRIBUTE, REPEAT_STARTINDEX_ATTRIBUTE, REPLACE_ALL, REPLACE_ATTRIBUTE, REPLACE_INSTANCE, REPLACE_NEW, REPLACE_NONE, REQUIRED_ATTRIBUTE, REQUIRED_EVENT, RESET, RESET_ELEMENT, RESET_EVENT, RESOURCE_ATTRIBUTE, RESOURCE_LINKING_ATTR, REVALIDATE, REVALIDATE_ELEMENT, REVALIDATE_EVENT, SCHEMA_ATTRIBUTE, SCHEMA_CONSTRAINTS_ERROR, SCHEMA_ELEMENT, SCROLL_FIRST_EVENT, SCROLL_LAST_EVENT, SECRET, SECRET_ELEMENT, SELECT, SELECT_BOOLEAN_ELEMENT, SELECT_EVENT, SELECT_MANY_ELEMENT, SELECT_ONE_ELEMENT, SELECT1, SELECTED_ATTRIBUTE, SELECTION_ATTRIBUTE, SEND, SEPARATOR_ATTRIBUTE, SET_FOCUS_ELEMENT, SET_INDEX_ELEMENT, SETFOCUS, SETINDEX, SETVALUE, SETVALUE_ELEMENT, SHOW_ATTR, SHOW_ATTRIBUTE, SHOW_NEW, SHOW_REPLACE, SRC_ATTRIBUTE, STANDALONE_ATTRIBUTE, START_ATTRIBUTE, STARTINDEX_ATTRIBUTE, STEP_ATTRIBUTE, SUBMISSION, SUBMISSION_ATTRIBUTE, SUBMIT, SUBMIT_DONE_EVENT, SUBMIT_ELEMENT, SUBMIT_ERROR, SUBMIT_EVENT, SUBMIT_INFO_ATTRIBUTE, SUBMIT_INFO_ELEMENT, SUBMIT_INSTANCE_ELEMENT, SUBMIT_STARTED_EVENT, SUBTREE_MODIFY_END, SUBTREE_MODIFY_START, SWITCH, SWITCH_ELEMENT, TARGET_ATTRIBUTE, TEXTAREA, TEXTAREA_ELEMENT, TOGGLE, TOGGLE_ELEMENT, TRAVERSAL_ERROR, TREE_ELEMENT, TRIGGER, TYPE_ATTRIBUTE, UI_INITIALIZE_EVENT, UPLOAD, UPLOAD_ELEMENT, VALID_EVENT, VALID_PSEUDOCLASS, VALUE, VALUE_ATTRIBUTE, VALUE_CHANGED_EVENT, VALUE_CHANGING_EVENT, VALUE_ELEMENT, VERSION_ATTRIBUTE, XercesPSVIClassName, XFORMS_NS, XFormsConfigurationPSVI, XHTML_NS, XSMILES_MESSAGE_SHOWN_EVENT
 
Constructor Summary
XFormsElementHandler(ExtendedDocument a_doc, MLFC xmlfc)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
 void addBind(BindElementImpl bind)
           
 void addCase(CaseElementImpl caseElem)
           
 void addModel(ModelElementImpl form)
           
 void addNodeIndexListener(FunctionChangeListener list)
           
 boolean askUserConfirmation(java.lang.String title, java.lang.String prompt)
           
 org.w3c.dom.Attr createAttributeNS(org.apache.xerces.dom.DocumentImpl doc, java.lang.String namespaceURI, java.lang.String qualifiedName)
          Create a DOM attribute.
 org.w3c.dom.Element createElementNS(java.lang.String URI, java.lang.String tagname)
           
 void destroy()
           
 void enterAction(Action action)
          for deferred updates
 void exitAction(Action action)
          when the outermost action exits, go thru all models and run deferred events
 AdaptiveControlFactory getAdaptiveControlFactory()
           
 BindElementImpl getBind(java.lang.String id)
           
 BrowserWindow getBrowser()
           
 CaseElementImpl getCase(java.lang.String id)
           
 ComponentFactory getComponentFactory()
           
 int getCursor(java.lang.String id)
           
 boolean getDebugEvents()
           
 org.apache.xerces.dom.DocumentImpl getDocumentImpl()
           
 ExtendedDocument getExtendedDocument()
           
 boolean getInsideAction()
           
protected  MLFC getMLFC()
          return my mlfc
 ModelElementImpl getModel(java.lang.String xform)
           
 java.util.Hashtable getModels()
           
 org.w3c.dom.Node getNodeIndex(java.lang.String id)
           
 RepeatIndexHandler getRepeatIndexHandler()
          Starts the additional dialog UI for speech
 XSmilesStyleSheet getStyleSheet()
           
 XMLDocument getXMLDocument()
           
 java.net.URL getXResource(java.lang.String id)
           
protected  void listenForHelpKeyPress()
          this method tries to listen to help keypress.
 void nodeIndexChanged(java.lang.String id, org.w3c.dom.Node n)
           
protected  void notifyFunctionChanged()
           
 void openLocation(java.net.URL uri, short show)
           
 XSmilesConnection openURLWithGET(java.net.URL u)
           
 void removeModel(ModelElementImpl form)
           
 void removeNodeIndexListener(FunctionChangeListener list)
           
 void setCursor(java.lang.String id, int value)
           
 void showErrorText(java.lang.String text)
           
 void showMessageDialog(boolean isModal, java.lang.String title, java.lang.String message, boolean errorMessage, long timeToLive)
           
 void showUserError(java.lang.Throwable e)
           
 void start()
          called when MLFC start is called
 boolean understandElement(org.w3c.dom.Element elem)
           
protected  void unlistenForHelpKeyPress()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dialogUI

protected DialogGUIDebug dialogUI
the possible dialog UI


models

protected java.util.Hashtable models
All the XForm elements in the document


defaultXForm

protected ModelElementImpl defaultXForm
the default XForm element


cursors

protected java.util.Hashtable cursors
All the Repeat elements in the document


nodeindexes

protected java.util.Hashtable nodeindexes
All the Repeat elements in the document


nodeIndexListeners

protected java.util.Vector nodeIndexListeners
Listeners for nodeindex changes


cases

protected java.util.Hashtable cases
All the case elements in the document


repeatIndexHandler

protected RepeatIndexHandler repeatIndexHandler
the ui index handler for repeats


doc

protected ExtendedDocument doc

docImpl

protected org.apache.xerces.dom.DocumentImpl docImpl

mlfc

protected MLFC mlfc
the CSS stylesheet object


sAdaptiveControlFactory

protected static AdaptiveControlFactory sAdaptiveControlFactory
factory used to create datatype aware controls


debugXForms

public static boolean debugXForms

outermostAction

protected Action outermostAction
Constructor Detail

XFormsElementHandler

public XFormsElementHandler(ExtendedDocument a_doc,
                            MLFC xmlfc)
Method Detail

start

public void start()
called when MLFC start is called


getRepeatIndexHandler

public RepeatIndexHandler getRepeatIndexHandler()
Starts the additional dialog UI for speech

Specified by:
getRepeatIndexHandler in interface XFormsContext

getDebugEvents

public boolean getDebugEvents()
Specified by:
getDebugEvents in interface XFormsContext

getDocumentImpl

public org.apache.xerces.dom.DocumentImpl getDocumentImpl()

addNodeIndexListener

public void addNodeIndexListener(FunctionChangeListener list)

removeNodeIndexListener

public void removeNodeIndexListener(FunctionChangeListener list)

nodeIndexChanged

public void nodeIndexChanged(java.lang.String id,
                             org.w3c.dom.Node n)

notifyFunctionChanged

protected void notifyFunctionChanged()

getMLFC

protected MLFC getMLFC()
return my mlfc


getComponentFactory

public ComponentFactory getComponentFactory()
Specified by:
getComponentFactory in interface XFormsContext

getAdaptiveControlFactory

public AdaptiveControlFactory getAdaptiveControlFactory()

getExtendedDocument

public ExtendedDocument getExtendedDocument()

createAttributeNS

public org.w3c.dom.Attr createAttributeNS(org.apache.xerces.dom.DocumentImpl doc,
                                          java.lang.String namespaceURI,
                                          java.lang.String qualifiedName)
Create a DOM attribute.


createElementNS

public org.w3c.dom.Element createElementNS(java.lang.String URI,
                                           java.lang.String tagname)

addModel

public void addModel(ModelElementImpl form)

removeModel

public void removeModel(ModelElementImpl form)

addCase

public void addCase(CaseElementImpl caseElem)

getCase

public CaseElementImpl getCase(java.lang.String id)

setCursor

public void setCursor(java.lang.String id,
                      int value)
Specified by:
setCursor in interface XFormsContext

getCursor

public int getCursor(java.lang.String id)
Specified by:
getCursor in interface XFormsContext

getModel

public ModelElementImpl getModel(java.lang.String xform)

getModels

public java.util.Hashtable getModels()
Specified by:
getModels in interface XFormsContext

getBind

public BindElementImpl getBind(java.lang.String id)

addBind

public void addBind(BindElementImpl bind)

getStyleSheet

public XSmilesStyleSheet getStyleSheet()

getXMLDocument

public XMLDocument getXMLDocument()

getBrowser

public BrowserWindow getBrowser()

getXResource

public java.net.URL getXResource(java.lang.String id)
                          throws java.net.MalformedURLException
Returns:
url to a browser resource
Throws:
java.net.MalformedURLException

destroy

public void destroy()

showUserError

public void showUserError(java.lang.Throwable e)

askUserConfirmation

public boolean askUserConfirmation(java.lang.String title,
                                   java.lang.String prompt)

showMessageDialog

public void showMessageDialog(boolean isModal,
                              java.lang.String title,
                              java.lang.String message,
                              boolean errorMessage,
                              long timeToLive)

showErrorText

public void showErrorText(java.lang.String text)

openLocation

public void openLocation(java.net.URL uri,
                         short show)

listenForHelpKeyPress

protected void listenForHelpKeyPress()
this method tries to listen to help keypress. Note, that this works currently only in swing


unlistenForHelpKeyPress

protected void unlistenForHelpKeyPress()

actionPerformed

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

understandElement

public boolean understandElement(org.w3c.dom.Element elem)
Returns:
boolean indicating whether this browser understands a certain element

openURLWithGET

public XSmilesConnection openURLWithGET(java.net.URL u)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

enterAction

public void enterAction(Action action)
for deferred updates


exitAction

public void exitAction(Action action)
when the outermost action exits, go thru all models and run deferred events


getInsideAction

public boolean getInsideAction()

getNodeIndex

public org.w3c.dom.Node getNodeIndex(java.lang.String id)
Specified by:
getNodeIndex in interface XFormsContext


X-Smiles 1.2