Package org.w3c.dom.events

Examples of org.w3c.dom.events.MutationEvent


    protected void fireDOMCharacterDataModifiedEvent(String oldv,
                                                     String newv) {
        AbstractDocument doc = getCurrentDocument();
        if (doc.getEventsEnabled()) {
            DocumentEvent de = (DocumentEvent)doc;
            MutationEvent ev = (MutationEvent)de.createEvent("MutationEvents");
            ev.initMutationEvent("DOMCharacterDataModified",
                                 true,  // canBubbleArg
                                 false, // cancelableArg
                                 null,  // relatedNodeArg
                                 oldv,  // prevValueArg
                                 newv,  // newValueArg
View Full Code Here


                // Nobody ever asked for the computed style of the
                // element, so it does not require an update...
                return;
            }

            MutationEvent mevt = (MutationEvent)evt;
            Node attr = mevt.getRelatedNode();
            String attrNS = attr.getNamespaceURI();
            if ((attrNS == null && styleNamespaceURI == null) ||
                (attrNS != null && attrNS.equals(styleNamespaceURI))) {
                String name = (attrNS == null)
                    ? attr.getNodeName()
View Full Code Here

     */
    protected void fireDOMSubtreeModifiedEvent() {
  AbstractDocument doc = getCurrentDocument();
  if (doc.getEventsEnabled()) {
      DocumentEvent de = (DocumentEvent)doc;
      MutationEvent ev = (MutationEvent)de.createEvent("MutationEvents");
      ev.initMutationEvent("DOMSubtreeModified",
         true,   // canBubbleArg
         false,  // cancelableArg
         null,   // relatedNodeArg
         null,   // prevValueArg
         null,   // newValueArg
View Full Code Here

     */
    protected void fireDOMNodeInsertedEvent(Node node) {
  AbstractDocument doc = getCurrentDocument();
  if (doc.getEventsEnabled()) {
      DocumentEvent de = (DocumentEvent)doc;
      MutationEvent ev = (MutationEvent)de.createEvent("MutationEvents");
      ev.initMutationEvent("DOMNodeInserted",
         true,   // canBubbleArg
         false,  // cancelableArg
         this,   // relatedNodeArg
         null,   // prevValueArg
         null,   // newValueArg
View Full Code Here

     */
    protected void fireDOMNodeRemovedEvent(Node node) {
  AbstractDocument doc = getCurrentDocument();
  if (doc.getEventsEnabled()) {
      DocumentEvent de = (DocumentEvent)doc;
      MutationEvent ev = (MutationEvent)de.createEvent("MutationEvents");
      ev.initMutationEvent("DOMNodeRemoved",
         true,   // canBubbleArg
         false,  // cancelableArg
         this,   // relatedNodeArg
         null,   // prevValueArg
         null,   // newValueArg
View Full Code Here

        // set of changes.
        // "This event is dispatched after all other events caused by the
        // mutation have been fired."
        LCount lc = LCount.lookup(MutationEventImpl.DOM_SUBTREE_MODIFIED);
        if (lc.captures + lc.bubbles + lc.defaults > 0) {
            MutationEvent me =  new MutationEventImpl();
            me.initMutationEvent(MutationEventImpl.DOM_SUBTREE_MODIFIED,
                                 true, false, null, null,
                                 null, null, (short) 0);

            // If we're within an Attr, DStM gets sent to the Attr
            // and to its owningElement. Otherwise we dispatch it
View Full Code Here

        if (mutationEvents) {
            // MUTATION POST-EVENTS:
            LCount lc =
                LCount.lookup(MutationEventImpl.DOM_CHARACTER_DATA_MODIFIED);
            if (lc.captures + lc.bubbles + lc.defaults > 0) {
                MutationEvent me = new MutationEventImpl();
                me.initMutationEvent(
                                 MutationEventImpl.DOM_CHARACTER_DATA_MODIFIED,
                                     true, false, null,
                                     oldvalue, value, null, (short) 0);
                dispatchEvent(me);
            }
View Full Code Here

            // "Local" events (non-aggregated)
            if ((mutationMask&MUTATION_LOCAL) != 0) {
                // New child is told it was inserted, and where
                LCount lc = LCount.lookup(MutationEventImpl.DOM_NODE_INSERTED);
                if (lc.captures+lc.bubbles+lc.defaults>0) {
                    MutationEvent me= new MutationEventImpl();
                    me.initMutationEvent(MutationEventImpl.DOM_NODE_INSERTED,
                                         true,false,this,null,
                                         null,null,(short)0);
                    newInternal.dispatchEvent(me);
                }

                // If within the Document, tell the subtree it's been added
                // to the Doc.
                lc=LCount.lookup(
                            MutationEventImpl.DOM_NODE_INSERTED_INTO_DOCUMENT);
                if (lc.captures+lc.bubbles+lc.defaults>0) {
                    NodeImpl eventAncestor=this;
                    if (enclosingAttr!=null)
                        eventAncestor=
                            (NodeImpl)(enclosingAttr.node.getOwnerElement());
                    if (eventAncestor!=null) { // Might have been orphan Attr
                        NodeImpl p=eventAncestor;
                        while (p!=null) {
                            eventAncestor=p; // Last non-null ancestor
                            // In this context, ancestry includes
                            // walking back from Attr to Element
                            if (p.getNodeType()==ATTRIBUTE_NODE) {
                                p=(ElementImpl)((AttrImpl)p).getOwnerElement();
                            }
                            else {
                                p=p.parentNode();
                            }
                        }
                        if (eventAncestor.getNodeType()==Node.DOCUMENT_NODE) {
                            MutationEvent me= new MutationEventImpl();
                            me.initMutationEvent(MutationEventImpl
                                              .DOM_NODE_INSERTED_INTO_DOCUMENT,
                                                 false,false,null,null,
                                                 null,null,(short)0);
                            dispatchEventToSubtree(newInternal,me);
                        }
View Full Code Here

            {
                // Child is told that it is about to be removed
                lc=LCount.lookup(MutationEventImpl.DOM_NODE_REMOVED);
                if(lc.captures+lc.bubbles+lc.defaults>0)
                {
                    MutationEvent me= new MutationEventImpl();
                    me.initMutationEvent(MutationEventImpl.DOM_NODE_REMOVED,
                                         true,false,this,null,
                                         null,null,(short)0);
                    oldInternal.dispatchEvent(me);
                }
           
                // If within Document, child's subtree is informed that it's
                // losing that status
                lc=LCount.lookup(
                             MutationEventImpl.DOM_NODE_REMOVED_FROM_DOCUMENT);
                if(lc.captures+lc.bubbles+lc.defaults>0)
                {
                    NodeImpl eventAncestor=this;
                    if(enclosingAttr!=null)
                        eventAncestor=
                            (NodeImpl) enclosingAttr.node.getOwnerElement();
                    if(eventAncestor!=null) // Might have been orphan Attr
                    {
                        for(NodeImpl p=eventAncestor.parentNode();
                            p!=null;
                            p=p.parentNode())
                        {
                            eventAncestor=p; // Last non-null ancestor
                        }
                        if(eventAncestor.getNodeType()==Node.DOCUMENT_NODE)
                        {
                            MutationEvent me= new MutationEventImpl();
                            me.initMutationEvent(MutationEventImpl
                                               .DOM_NODE_REMOVED_FROM_DOCUMENT,
                                                 false,false,
                                                 null,null,null,null,(short)0);
                            dispatchEventToSubtree(oldInternal,me);
                        }
View Full Code Here

    public void handleEvent(Event evt) {
        if (!(evt instanceof MutationEvent))
            return;
        java.lang.System.out.println("[MutationListener] got event:" + evt.toString());
        MutationEvent mutevt = (MutationEvent) evt;
        Node node = mutevt.getRelatedNode();
        if (!(node instanceof Element))
            return;
        Element el = (Element) node;
        switch (mutevt.getAttrChange()) {
            case MutationEvent.MODIFICATION: {
                handleModification(mutevt, el);
                return;
            }
            case MutationEvent.ADDITION: {
View Full Code Here

TOP

Related Classes of org.w3c.dom.events.MutationEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.