1/*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.  Oracle designates this
7 * particular file as subject to the "Classpath" exception as provided
8 * by Oracle in the LICENSE file that accompanied this code.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24
25/*
26 * This file is available under and governed by the GNU General Public
27 * License version 2 only, as published by the Free Software Foundation.
28 * However, the following notice accompanied the original version of this
29 * file and, per its terms, should not be removed:
30 *
31 * Copyright (c) 2000 World Wide Web Consortium,
32 * (Massachusetts Institute of Technology, Institut National de
33 * Recherche en Informatique et en Automatique, Keio University). All
34 * Rights Reserved. This program is distributed under the W3C's Software
35 * Intellectual Property License. This program is distributed in the
36 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
37 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
38 * PURPOSE.
39 * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
40 */
41
42package org.w3c.dom.events;
43
44import org.w3c.dom.Node;
45
46/**
47 * The <code>MutationEvent</code> interface provides specific contextual
48 * information associated with Mutation events.
49 * <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>.
50 * @since 1.5, DOM Level 2
51 */
52public interface MutationEvent extends Event {
53    // attrChangeType
54    /**
55     * The <code>Attr</code> was modified in place.
56     */
57    public static final short MODIFICATION              = 1;
58    /**
59     * The <code>Attr</code> was just added.
60     */
61    public static final short ADDITION                  = 2;
62    /**
63     * The <code>Attr</code> was just removed.
64     */
65    public static final short REMOVAL                   = 3;
66
67    /**
68     *  <code>relatedNode</code> is used to identify a secondary node related
69     * to a mutation event. For example, if a mutation event is dispatched
70     * to a node indicating that its parent has changed, the
71     * <code>relatedNode</code> is the changed parent. If an event is
72     * instead dispatched to a subtree indicating a node was changed within
73     * it, the <code>relatedNode</code> is the changed node. In the case of
74     * the DOMAttrModified event it indicates the <code>Attr</code> node
75     * which was modified, added, or removed.
76     */
77    public Node getRelatedNode();
78
79    /**
80     *  <code>prevValue</code> indicates the previous value of the
81     * <code>Attr</code> node in DOMAttrModified events, and of the
82     * <code>CharacterData</code> node in DOMCharacterDataModified events.
83     */
84    public String getPrevValue();
85
86    /**
87     *  <code>newValue</code> indicates the new value of the <code>Attr</code>
88     * node in DOMAttrModified events, and of the <code>CharacterData</code>
89     * node in DOMCharacterDataModified events.
90     */
91    public String getNewValue();
92
93    /**
94     *  <code>attrName</code> indicates the name of the changed
95     * <code>Attr</code> node in a DOMAttrModified event.
96     */
97    public String getAttrName();
98
99    /**
100     *  <code>attrChange</code> indicates the type of change which triggered
101     * the DOMAttrModified event. The values can be <code>MODIFICATION</code>
102     * , <code>ADDITION</code>, or <code>REMOVAL</code>.
103     */
104    public short getAttrChange();
105
106    /**
107     * The <code>initMutationEvent</code> method is used to initialize the
108     * value of a <code>MutationEvent</code> created through the
109     * <code>DocumentEvent</code> interface. This method may only be called
110     * before the <code>MutationEvent</code> has been dispatched via the
111     * <code>dispatchEvent</code> method, though it may be called multiple
112     * times during that phase if necessary. If called multiple times, the
113     * final invocation takes precedence.
114     * @param typeArg Specifies the event type.
115     * @param canBubbleArg Specifies whether or not the event can bubble.
116     * @param cancelableArg Specifies whether or not the event's default
117     *   action can be prevented.
118     * @param relatedNodeArg Specifies the <code>Event</code>'s related Node.
119     * @param prevValueArg Specifies the <code>Event</code>'s
120     *   <code>prevValue</code> attribute. This value may be null.
121     * @param newValueArg Specifies the <code>Event</code>'s
122     *   <code>newValue</code> attribute. This value may be null.
123     * @param attrNameArg Specifies the <code>Event</code>'s
124     *   <code>attrName</code> attribute. This value may be null.
125     * @param attrChangeArg Specifies the <code>Event</code>'s
126     *   <code>attrChange</code> attribute
127     */
128    public void initMutationEvent(String typeArg,
129                                  boolean canBubbleArg,
130                                  boolean cancelableArg,
131                                  Node relatedNodeArg,
132                                  String prevValueArg,
133                                  String newValueArg,
134                                  String attrNameArg,
135                                  short attrChangeArg);
136
137}
138