fi.hut.tml.xsmiles.dom
Class XSmilesElementImpl

java.lang.Object
  extended byorg.apache.xerces.dom.NodeImpl
      extended byorg.apache.xerces.dom.ChildNode
          extended byorg.apache.xerces.dom.ParentNode
              extended byorg.apache.xerces.dom.ElementImpl
                  extended byorg.apache.xerces.dom.ElementNSImpl
                      extended byfi.hut.tml.xsmiles.dom.XSmilesElementImpl
All Implemented Interfaces:
java.lang.Cloneable, org.w3c.dom.Element, org.w3c.dom.events.EventTarget, InitializableElement, org.w3c.dom.Node, org.w3c.dom.NodeList, PseudoClassController, ResourceFetcher, java.io.Serializable, StylableElement, org.w3c.dom.TypeInfo
Direct Known Subclasses:
AreaElementImpl, Audio3DElementImpl, CaptureElementImpl, CommAddressBookElementImpl, CommCommSessionElementImpl, CommElementImpl, COMMElementImpl, CommGroupElementImpl, CommMsgElementImpl, CommSessionElementImpl, CommUserElementImpl, ContentAreaImpl, ControlsAreaImpl, CurrentURIImpl, DataReferenceElementImpl, ElementImpl, EncryptionElementImpl, EnvironmentElementImpl, FramesImpl, GenericElementImpl, GPSDataElementImpl, HeadImpl, ItemElementImpl, JoystickElementImpl, ListenerElementImpl, LoadAGuiImpl, PrintElementImpl, RemoteElementImpl, RemoteImpl, ScriptElementImpl, SignatureElementImpl, SIPCallElementImpl, StatusAreaImpl, StyleImpl, TimedElementImpl, VisualElementImpl, WindowImpl, WorkingImpl, X3DElementImpl

public class XSmilesElementImpl
extends org.apache.xerces.dom.ElementNSImpl
implements StylableElement, ResourceFetcher, PseudoClassController, InitializableElement

XSmiles DOM Elements

See Also:
Serialized Form

Nested Class Summary
 class XSmilesElementImpl.PseudoNodeList
          implementation of a nodelist that contains also pseudoelements
 
Field Summary
static short DESTROYED
           
protected  short elementStatus
          the current status (initialized etc.)
static short INITIALIZED
           
static short INITIALIZING
           
protected  java.util.Hashtable setPseudoClasses
           
protected  org.w3c.dom.css.CSSStyleDeclaration style
          the CSS style declaration for this element, Only updateStyle() is allowed to change this directly to null
static short UNINITIALIZED
           
static java.lang.String xblpropname
           
 
Fields inherited from class org.apache.xerces.dom.ElementNSImpl
localName, namespaceURI
 
Fields inherited from class org.apache.xerces.dom.ElementImpl
attributes, name
 
Fields inherited from class org.apache.xerces.dom.ParentNode
firstChild, fNodeListCache, ownerDocument
 
Fields inherited from class org.apache.xerces.dom.ChildNode
nextSibling, previousSibling
 
Fields inherited from class org.apache.xerces.dom.NodeImpl
DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_PRECEDING, ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, ID, IGNORABLEWS, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE, UNNORMALIZED
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
XSmilesElementImpl(org.apache.xerces.dom.DocumentImpl ownerDocument, java.lang.String value)
           
XSmilesElementImpl(org.apache.xerces.dom.DocumentImpl ownerDocument, java.lang.String namespaceURI, java.lang.String qualifiedName)
           
 
Method Summary
 void addBinding(java.lang.String bindingURI)
           
 boolean addUndistributedChild(org.w3c.dom.Node node)
          Adds a node back to this element's content.
 java.lang.Object clone()
           
 void clonePseudoElements(PseudoElementContainerService from, PseudoElementContainerService to)
           
 void cloneSubtree(org.w3c.dom.Element source)
           
static void debugNode(org.w3c.dom.Node n)
           
static void debugNode(org.w3c.dom.Node n, boolean printPseudoElements)
           
 void destroy()
          Destroy this element and its descendants recursively.
 void dispatchEventInMainThread(org.w3c.dom.events.Event ev)
           
 XSmilesConnection get(java.net.URL dest, short type)
          Retrieve a resource via an URL using authenticated HTTP get and store it as a resource under this contenthandler.
 boolean getApplyBindingSheets()
          Returns value telling if styles included from XBL-tree into whose content-element this node is redistributed are applied to this element and its children.
 boolean getAuthorSheets()
          Returns the value of authorSheets.
 org.w3c.dom.NodeList getChildNodes(boolean includePseudoElements)
          this method includes also pseudoelements
 short getElementStatus()
           
 java.lang.String getId()
          by default return the value of 'id' attribute, any element can override this
 XSmilesElementImpl getOriginalClone()
          Returns the original DOM tree of this element.
 boolean getPseudoClass(java.lang.String pseudoclass)
          query only those set using setPseudoClassMethod
 ResourceReferencer getResourceReferencer()
           
 RuleTreeNode getRuleNode()
           
 org.w3c.dom.css.CSSStyleDeclaration getStyle()
          returns the stored style for this element
 java.lang.String getStyleAttrValue()
          By default return null, so style attribute is not supported, this can be overridden by subclasses
 java.lang.String getText()
           
static java.lang.String getText(org.w3c.dom.Node node)
           
 java.util.Vector getUndistributedChildNodes()
          Method for getting child nodes that aren't yet distributed.
 XBLImplementationList getXblImplementations()
          The xblImplementations attribute on all elements must return an instance of an XBLImplementationList object (the same object for the lifetime of the element), which is a live list of the implementation objects provided by the bindings for that bound element at any particular point in time.
 boolean hasBinding(java.lang.String bindingURI)
           
 boolean hasStyle()
           
 void init()
          Initialize this element.
 boolean initFinalFlattenedTree()
          Clones this element's content so this element can be resetted with resetFinalFlattenedTree() sometime.
 void initStyle(XSmilesStyleSheet styleSheet)
           
 boolean isInitedForReset()
           
 boolean isPseudoClass(java.lang.String pseudoclass)
          ask whether this element belongs to a certain CSS pseudoclass
 void removeBinding(java.lang.String bindingURI)
           
 org.w3c.dom.Node removeUndistributedChild(org.w3c.dom.Node node)
          Removes the the given node from this element, so that the node can be redistributed.
 void replaceNode(XSmilesElementImpl original, XSmilesElementImpl current)
          Replaces original-node with current-node.
 void resetFinalFlattenedTree()
          Changes this node back to its original DOM tree.
 java.net.URL resolveURI(java.lang.String src)
          Resolve an uri to an absolute uri using the base-uri of the current element.
static org.w3c.dom.Element searchElementWithId(org.w3c.dom.Element e, java.lang.String id)
          Searches for element with id from the tree under element e.
static org.w3c.dom.Element searchElementWithId(org.w3c.dom.Element e, java.lang.String id, int n)
          Searches for the n-th element with id from the tree under element e.
 void setApplyBindingSheets(boolean b)
          Sets if styles included from XBL-tree into whose content-element this node is redistributed are applied to this element and its children.
 void setAuthorSheets(boolean value)
          Sets the attribute authorSheets to value.
 void setPseudoClass(java.lang.String pseudoclass, boolean value)
          sets pseudo class on/off
 void setRuleNode(RuleTreeNode rtn)
           
 void setStyle(org.w3c.dom.css.CSSStyleDeclaration a_style)
          set the resolved CSS style for this element
 void updateStyle()
          Update this and child elements' styles
 
Methods inherited from class org.apache.xerces.dom.ElementNSImpl
getBaseURI, getLocalName, getNamespaceURI, getPrefix, getTypeName, getTypeNamespace, setPrefix, setType, setValues
 
Methods inherited from class org.apache.xerces.dom.ElementImpl
cloneNode, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getDefaultAttributes, getElementsByTagName, getElementsByTagNameNS, getNodeName, getNodeType, getSchemaTypeInfo, getTagName, getXercesAttribute, hasAttribute, hasAttributeNS, hasAttributes, isEqualNode, normalize, reconcileDefaultAttributes, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setReadOnly, setupDefaultAttributes, setXercesAttributeNode, synchronizeData
 
Methods inherited from class org.apache.xerces.dom.ParentNode
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, getTextContent, hasChildNodes, insertBefore, item, removeChild, replaceChild, setTextContent, synchronizeChildren
 
Methods inherited from class org.apache.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSibling
 
Methods inherited from class org.apache.xerces.dom.NodeImpl
addEventListener, appendChild, changed, changes, compareDocumentPosition, compareTreePosition, dispatchEvent, getContainer, getFeature, getNodeNumber, getNodeValue, getReadOnly, getUserData, getUserData, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, removeEventListener, setNodeValue, setUserData, setUserData, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Element
getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 

Field Detail

UNINITIALIZED

public static final short UNINITIALIZED
See Also:
Constant Field Values

INITIALIZED

public static final short INITIALIZED
See Also:
Constant Field Values

INITIALIZING

public static final short INITIALIZING
See Also:
Constant Field Values

DESTROYED

public static final short DESTROYED
See Also:
Constant Field Values

style

protected org.w3c.dom.css.CSSStyleDeclaration style
the CSS style declaration for this element, Only updateStyle() is allowed to change this directly to null


elementStatus

protected short elementStatus
the current status (initialized etc.)


setPseudoClasses

protected java.util.Hashtable setPseudoClasses

xblpropname

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

XSmilesElementImpl

public XSmilesElementImpl(org.apache.xerces.dom.DocumentImpl ownerDocument,
                          java.lang.String value)

XSmilesElementImpl

public XSmilesElementImpl(org.apache.xerces.dom.DocumentImpl ownerDocument,
                          java.lang.String namespaceURI,
                          java.lang.String qualifiedName)
Method Detail

init

public void init()
Initialize this element.

Specified by:
init in interface InitializableElement

getElementStatus

public short getElementStatus()

dispatchEventInMainThread

public void dispatchEventInMainThread(org.w3c.dom.events.Event ev)

updateStyle

public void updateStyle()
Update this and child elements' styles


setRuleNode

public void setRuleNode(RuleTreeNode rtn)
Specified by:
setRuleNode in interface StylableElement

getRuleNode

public RuleTreeNode getRuleNode()
Specified by:
getRuleNode in interface StylableElement

initStyle

public void initStyle(XSmilesStyleSheet styleSheet)

destroy

public void destroy()
Destroy this element and its descendants recursively. NOTE: When overriding this method, please be sure to call super.destroy(), otherwise the destroy call will not propagate. NOTE: Actually, the recursion, which destroys the elements should be here, because usually everybody forgets to call super.destroy when overriding, thus causing the destroy sceme to break down.


getStyle

public org.w3c.dom.css.CSSStyleDeclaration getStyle()
returns the stored style for this element

Specified by:
getStyle in interface StylableElement

hasStyle

public boolean hasStyle()
Specified by:
hasStyle in interface StylableElement

setStyle

public void setStyle(org.w3c.dom.css.CSSStyleDeclaration a_style)
set the resolved CSS style for this element

Specified by:
setStyle in interface StylableElement

getId

public java.lang.String getId()
by default return the value of 'id' attribute, any element can override this


getStyleAttrValue

public java.lang.String getStyleAttrValue()
By default return null, so style attribute is not supported, this can be overridden by subclasses

Specified by:
getStyleAttrValue in interface StylableElement

searchElementWithId

public static org.w3c.dom.Element searchElementWithId(org.w3c.dom.Element e,
                                                      java.lang.String id)
Searches for element with id from the tree under element e.

Parameters:
e - start element
id - id to search for
Returns:
the first element with id, or null if not found.

searchElementWithId

public static org.w3c.dom.Element searchElementWithId(org.w3c.dom.Element e,
                                                      java.lang.String id,
                                                      int n)
Searches for the n-th element with id from the tree under element e.

Parameters:
e - start element
id - id to search for
n - which occurence
Returns:
the element with id, or null if not found.

getText

public java.lang.String getText()

getText

public static java.lang.String getText(org.w3c.dom.Node node)

setPseudoClass

public void setPseudoClass(java.lang.String pseudoclass,
                           boolean value)
Description copied from interface: PseudoClassController
sets pseudo class on/off

Specified by:
setPseudoClass in interface PseudoClassController

getPseudoClass

public boolean getPseudoClass(java.lang.String pseudoclass)
Description copied from interface: PseudoClassController
query only those set using setPseudoClassMethod

Specified by:
getPseudoClass in interface PseudoClassController

isPseudoClass

public boolean isPseudoClass(java.lang.String pseudoclass)
ask whether this element belongs to a certain CSS pseudoclass

Specified by:
isPseudoClass in interface StylableElement

resolveURI

public java.net.URL resolveURI(java.lang.String src)
                        throws java.net.MalformedURLException
Resolve an uri to an absolute uri using the base-uri of the current element.

Parameters:
src - the uri to resolve
Throws:
java.net.MalformedURLException - if the resulting URL has an unsupported scheme or a parse error occured

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

clonePseudoElements

public void clonePseudoElements(PseudoElementContainerService from,
                                PseudoElementContainerService to)

cloneSubtree

public void cloneSubtree(org.w3c.dom.Element source)

getChildNodes

public org.w3c.dom.NodeList getChildNodes(boolean includePseudoElements)
this method includes also pseudoelements

Parameters:
includePseudoElements -
Returns:

debugNode

public static void debugNode(org.w3c.dom.Node n)

debugNode

public static void debugNode(org.w3c.dom.Node n,
                             boolean printPseudoElements)

getResourceReferencer

public ResourceReferencer getResourceReferencer()

get

public XSmilesConnection get(java.net.URL dest,
                             short type)
                      throws java.lang.Exception
Description copied from interface: ResourceFetcher
Retrieve a resource via an URL using authenticated HTTP get and store it as a resource under this contenthandler. The XML signature process uses that resource list as the list of resources that are referenced by the document. Use type from the class content.Resource. use RESOURCE_DO_NOT_STORE, for not storing it in the list of loaded resources

Specified by:
get in interface ResourceFetcher
Throws:
java.lang.Exception

replaceNode

public void replaceNode(XSmilesElementImpl original,
                        XSmilesElementImpl current)
Replaces original-node with current-node.

Parameters:
original -
current -

getOriginalClone

public XSmilesElementImpl getOriginalClone()
Returns the original DOM tree of this element.

Returns:
XSmilesElementImpl

resetFinalFlattenedTree

public void resetFinalFlattenedTree()
Changes this node back to its original DOM tree. Changes node's undistributed children to same as in original DOM tree.


isInitedForReset

public boolean isInitedForReset()

initFinalFlattenedTree

public boolean initFinalFlattenedTree()
Clones this element's content so this element can be resetted with resetFinalFlattenedTree() sometime.


getUndistributedChildNodes

public java.util.Vector getUndistributedChildNodes()
Method for getting child nodes that aren't yet distributed.

Returns:
NodeList of undistributed children

removeUndistributedChild

public org.w3c.dom.Node removeUndistributedChild(org.w3c.dom.Node node)
Removes the the given node from this element, so that the node can be redistributed.

Parameters:
node - Node to be removed
Returns:
The element removed.

addUndistributedChild

public boolean addUndistributedChild(org.w3c.dom.Node node)
Adds a node back to this element's content.

Parameters:
node - Element to be added.
Returns:
true if the operation succeed

addBinding

public void addBinding(java.lang.String bindingURI)

removeBinding

public void removeBinding(java.lang.String bindingURI)

hasBinding

public boolean hasBinding(java.lang.String bindingURI)

setApplyBindingSheets

public void setApplyBindingSheets(boolean b)
Sets if styles included from XBL-tree into whose content-element this node is redistributed are applied to this element and its children. If this node is not redistributed in xbl-content element call of this method has no effect.

Parameters:
b - value to be set

getApplyBindingSheets

public boolean getApplyBindingSheets()
Returns value telling if styles included from XBL-tree into whose content-element this node is redistributed are applied to this element and its children.

Returns:
as explained above

setAuthorSheets

public void setAuthorSheets(boolean value)
Sets the attribute authorSheets to value. This is when a binding has been applied to this element and it's templates apply-author-sheets is according to value. Needed in xbl 2.0 apply-author-sheets

Returns:

getAuthorSheets

public boolean getAuthorSheets()
Returns the value of authorSheets.

Returns:
boolean value of authorSheets

getXblImplementations

public XBLImplementationList getXblImplementations()
The xblImplementations attribute on all elements must return an instance of an XBLImplementationList object (the same object for the lifetime of the element), which is a live list of the implementation objects provided by the bindings for that bound element at any particular point in time.

Returns:


X-Smiles 1.2