Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.chiba.xml.xforms
Class Container  view Container download Container.java

java.lang.Object
  extended byorg.chiba.xml.xforms.Container

public class Container
extends java.lang.Object

This class represents a complete XForms document. It encapsulates the DOM document.

The XForms document may consist of pure XForms markup or may contain mixed markup from other namespaces (e.g. html, svg, wap). Responsibilities are:
- creation of Model objects found in input

Version:
$Revision: 1.25 $ $Id: Container.java,v 1.25 2003/10/01 21:57:47 joernt Exp $

Field Summary
private  BindingResolver bindingResolver
           
private  org.chiba.xml.xforms.connector.ConnectorFactory connectorFactory
           
private  org.w3c.dom.Document document
           
private  XFormsElementFactory elementFactory
           
private  org.chiba.xml.xforms.events.EventFactory eventFactory
           
private  int idCounter
           
private static org.apache.log4j.Category LOGGER
           
private  boolean modelConstructDone
           
private  java.util.List models
           
private  NamespaceCtx ns
           
private  ChibaBean processor
           
private  org.w3c.dom.Element root
           
private  org.apache.commons.jxpath.JXPathContext rootContext
           
private  java.util.Map xFormsElements
           
 
Constructor Summary
Container(ChibaBean processor)
          associates DocumentContainer with Processor.
Container(ChibaBean processor, org.w3c.dom.Document doc)
          creates a container by setting the document by a external loaded (or created) document.
 
Method Summary
 void addEventListener(java.lang.String targetId, java.lang.String eventType, org.w3c.dom.events.EventListener eventListener, boolean useCapture)
           
 void deregister(XFormsElement element)
          Deregisters the specified XForms element with this container.
 boolean dispatch(org.w3c.dom.events.EventTarget eventTarget, java.lang.String eventType, java.lang.Object info)
           
 boolean dispatch(java.lang.String targetId, java.lang.String eventType)
          Dispatches an eventType of the specified type to the given eventType targetId.
 boolean dispatch(java.lang.String targetId, java.lang.String eventType, java.lang.Object info)
           
 java.lang.String generateId()
          Generates an unique identifier.
 org.chiba.adapter.EnvironmentAdapter getAdapter()
          Returns the Chiba environment adapter.
 BindingResolver getBindingResolver()
          Returns the binding resolver.
 org.chiba.xml.xforms.connector.ConnectorFactory getConnectorFactory()
          Returns the connector factory.
 Model getDefaultModel()
          convenience method to return default model without knowing its id.
 org.w3c.dom.Document getDOM()
          Returns the container as a dom tree representing an (external) XML representation of the xforms container.
 XFormsElementFactory getElementFactory()
          Returns the XForms element factory which is responsible for creating objects for all XForms elements in the input document.
 org.chiba.xml.xforms.events.EventFactory getEventFactory()
          Returns the DOM event factory.
 Model getModel(java.lang.String id)
          return a model object by its id.
 NamespaceCtx getNamespaceCtx()
          returns the NamespaceCtx object
 ChibaBean getProcessor()
          returns the processor for this container
 org.apache.commons.jxpath.JXPathContext getRootContext()
           
 void init()
          stores this container as userobject in document element and triggers model initialization
private  void initModels()
          create Model-objects which simply hold their Model-element node (formerly named XForm-element).
 boolean isModelConstructDone()
           
 XFormsElement lookup(java.lang.String id)
          Returns the specified XForms element.
 void register(XFormsElement element)
          Registers the specified XForms element with this container.
 void removeEventListener(java.lang.String targetId, java.lang.String eventType, org.w3c.dom.events.EventListener eventListener, boolean useCapture)
           
 void setDocument(org.w3c.dom.Document dom)
          passes the XML container document which contains XForms markup.
 void setInstanceURI(java.lang.String id, java.lang.String srcURI)
          Allows to set or overwrite a instance's src URI.
 void setSubmissionURI(java.lang.String id, java.lang.String actionURI)
          Allows to set or overwrite a submission's action URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static org.apache.log4j.Category LOGGER

document

private org.w3c.dom.Document document

root

private org.w3c.dom.Element root

models

private java.util.List models

rootContext

private org.apache.commons.jxpath.JXPathContext rootContext

bindingResolver

private BindingResolver bindingResolver

ns

private NamespaceCtx ns

connectorFactory

private org.chiba.xml.xforms.connector.ConnectorFactory connectorFactory

eventFactory

private org.chiba.xml.xforms.events.EventFactory eventFactory

elementFactory

private XFormsElementFactory elementFactory

xFormsElements

private java.util.Map xFormsElements

idCounter

private int idCounter

processor

private ChibaBean processor

modelConstructDone

private boolean modelConstructDone
Constructor Detail

Container

public Container(ChibaBean processor,
                 org.w3c.dom.Document doc)
creates a container by setting the document by a external loaded (or created) document.


Container

public Container(ChibaBean processor)
associates DocumentContainer with Processor.

Method Detail

isModelConstructDone

public boolean isModelConstructDone()

getRootContext

public org.apache.commons.jxpath.JXPathContext getRootContext()

getProcessor

public ChibaBean getProcessor()
returns the processor for this container


init

public void init()
          throws org.chiba.xml.xforms.exception.XFormsException
stores this container as userobject in document element and triggers model initialization


getAdapter

public org.chiba.adapter.EnvironmentAdapter getAdapter()
Returns the Chiba environment adapter.


getConnectorFactory

public org.chiba.xml.xforms.connector.ConnectorFactory getConnectorFactory()
Returns the connector factory.


getElementFactory

public XFormsElementFactory getElementFactory()
Returns the XForms element factory which is responsible for creating objects for all XForms elements in the input document.


getEventFactory

public org.chiba.xml.xforms.events.EventFactory getEventFactory()
Returns the DOM event factory.


getBindingResolver

public BindingResolver getBindingResolver()
Returns the binding resolver.


dispatch

public boolean dispatch(java.lang.String targetId,
                        java.lang.String eventType)
                 throws org.chiba.xml.xforms.exception.XFormsException
Dispatches an eventType of the specified type to the given eventType targetId.


dispatch

public boolean dispatch(java.lang.String targetId,
                        java.lang.String eventType,
                        java.lang.Object info)
                 throws org.chiba.xml.xforms.exception.XFormsException

dispatch

public boolean dispatch(org.w3c.dom.events.EventTarget eventTarget,
                        java.lang.String eventType,
                        java.lang.Object info)

addEventListener

public void addEventListener(java.lang.String targetId,
                             java.lang.String eventType,
                             org.w3c.dom.events.EventListener eventListener,
                             boolean useCapture)
                      throws org.chiba.xml.xforms.exception.XFormsException

removeEventListener

public void removeEventListener(java.lang.String targetId,
                                java.lang.String eventType,
                                org.w3c.dom.events.EventListener eventListener,
                                boolean useCapture)
                         throws org.chiba.xml.xforms.exception.XFormsException

register

public void register(XFormsElement element)
Registers the specified XForms element with this container.


deregister

public void deregister(XFormsElement element)
Deregisters the specified XForms element with this container.


lookup

public XFormsElement lookup(java.lang.String id)
Returns the specified XForms element.


generateId

public java.lang.String generateId()
Generates an unique identifier.


getDOM

public org.w3c.dom.Document getDOM()
Returns the container as a dom tree representing an (external) XML representation of the xforms container. The return value is live, that means changes to the return tree affects the internal container representation. todo: rename to getDocument


setDocument

public void setDocument(org.w3c.dom.Document dom)
passes the XML container document which contains XForms markup. This method must be called before init() and already builds up the NamespaceCtx and RootContext objects.


getNamespaceCtx

public NamespaceCtx getNamespaceCtx()
returns the NamespaceCtx object


getModel

public Model getModel(java.lang.String id)
               throws org.chiba.xml.xforms.exception.XFormsException
return a model object by its id. If id is null or an empty string, the default model (first found in document order) is returned.


getDefaultModel

public Model getDefaultModel()
convenience method to return default model without knowing its id.


setInstanceURI

public void setInstanceURI(java.lang.String id,
                           java.lang.String srcURI)
                    throws org.chiba.xml.xforms.exception.XFormsException
Allows to set or overwrite a instance's src URI.

This method can be used to provide a parametrized URI to the URI resolver which handles the instance's src URI.


setSubmissionURI

public void setSubmissionURI(java.lang.String id,
                             java.lang.String actionURI)
                      throws org.chiba.xml.xforms.exception.XFormsException
Allows to set or overwrite a submission's action URI.

This method can be used to provide a parametrized URI to the Submission Driver which handles the submission's action URI.


initModels

private void initModels()
create Model-objects which simply hold their Model-element node (formerly named XForm-element). The first Model-element found in the container is the default-model and if it has no model-id it is stored with a key of 'default' in the models hashtable. Otherwise the provided id is used. The subsequent model-elements are stored with their id as the key. If no id exists an exception is thrown (as defined by Spec).