001    /*
002     * Copyright (c) 2000 World Wide Web Consortium,
003     * (Massachusetts Institute of Technology, Institut National de
004     * Recherche en Informatique et en Automatique, Keio University). All
005     * Rights Reserved. This program is distributed under the W3C's Software
006     * Intellectual Property License. This program is distributed in the
007     * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
008     * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
009     * PURPOSE.
010     * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
011     */
012    
013    package org.w3c.dom.events;
014    
015    import org.w3c.dom.Node;
016    
017    /**
018     * The <code>MutationEvent</code> interface provides specific contextual
019     * information associated with Mutation events.
020     * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113'>Document Object Model (DOM) Level 2 Events Specification</a>.
021     * @since DOM Level 2
022     */
023    public interface MutationEvent extends Event {
024        // attrChangeType
025        /**
026         * The <code>Attr</code> was modified in place.
027         */
028        public static final short MODIFICATION              = 1;
029        /**
030         * The <code>Attr</code> was just added.
031         */
032        public static final short ADDITION                  = 2;
033        /**
034         * The <code>Attr</code> was just removed.
035         */
036        public static final short REMOVAL                   = 3;
037    
038        /**
039         *  <code>relatedNode</code> is used to identify a secondary node related
040         * to a mutation event. For example, if a mutation event is dispatched
041         * to a node indicating that its parent has changed, the
042         * <code>relatedNode</code> is the changed parent. If an event is
043         * instead dispatched to a subtree indicating a node was changed within
044         * it, the <code>relatedNode</code> is the changed node. In the case of
045         * the DOMAttrModified event it indicates the <code>Attr</code> node
046         * which was modified, added, or removed.
047         */
048        public Node getRelatedNode();
049    
050        /**
051         *  <code>prevValue</code> indicates the previous value of the
052         * <code>Attr</code> node in DOMAttrModified events, and of the
053         * <code>CharacterData</code> node in DOMCharacterDataModified events.
054         */
055        public String getPrevValue();
056    
057        /**
058         *  <code>newValue</code> indicates the new value of the <code>Attr</code>
059         * node in DOMAttrModified events, and of the <code>CharacterData</code>
060         * node in DOMCharacterDataModified events.
061         */
062        public String getNewValue();
063    
064        /**
065         *  <code>attrName</code> indicates the name of the changed
066         * <code>Attr</code> node in a DOMAttrModified event.
067         */
068        public String getAttrName();
069    
070        /**
071         *  <code>attrChange</code> indicates the type of change which triggered
072         * the DOMAttrModified event. The values can be <code>MODIFICATION</code>
073         * , <code>ADDITION</code>, or <code>REMOVAL</code>.
074         */
075        public short getAttrChange();
076    
077        /**
078         * The <code>initMutationEvent</code> method is used to initialize the
079         * value of a <code>MutationEvent</code> created through the
080         * <code>DocumentEvent</code> interface. This method may only be called
081         * before the <code>MutationEvent</code> has been dispatched via the
082         * <code>dispatchEvent</code> method, though it may be called multiple
083         * times during that phase if necessary. If called multiple times, the
084         * final invocation takes precedence.
085         * @param typeArg Specifies the event type.
086         * @param canBubbleArg Specifies whether or not the event can bubble.
087         * @param cancelableArg Specifies whether or not the event's default
088         *   action can be prevented.
089         * @param relatedNodeArg Specifies the <code>Event</code>'s related Node.
090         * @param prevValueArg Specifies the <code>Event</code>'s
091         *   <code>prevValue</code> attribute. This value may be null.
092         * @param newValueArg Specifies the <code>Event</code>'s
093         *   <code>newValue</code> attribute. This value may be null.
094         * @param attrNameArg Specifies the <code>Event</code>'s
095         *   <code>attrName</code> attribute. This value may be null.
096         * @param attrChangeArg Specifies the <code>Event</code>'s
097         *   <code>attrChange</code> attribute
098         */
099        public void initMutationEvent(String typeArg,
100                                      boolean canBubbleArg,
101                                      boolean cancelableArg,
102                                      Node relatedNodeArg,
103                                      String prevValueArg,
104                                      String newValueArg,
105                                      String attrNameArg,
106                                      short attrChangeArg);
107    
108    }