KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > dom > events > MutationEventImpl


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.xerces.dom.events;
18
19 import org.w3c.dom.Node JavaDoc;
20 import org.w3c.dom.events.MutationEvent JavaDoc;
21
22 /**
23  * @xerces.internal
24  *
25  * @version $Id: MutationEventImpl.java,v 1.9 2004/10/06 15:25:33 mrglavas Exp $
26  */

27
28 public class MutationEventImpl
29 extends org.apache.xerces.dom.events.EventImpl
30 implements MutationEvent JavaDoc
31 {
32     Node JavaDoc relatedNode=null;
33     String JavaDoc prevValue=null,newValue=null,attrName=null;
34     // REVISIT: The DOM Level 2 PR has a bug: the init method should let this
35
// attribute be specified. Since it doesn't we have to give write access.
36
public short attrChange;
37     
38     // NON-DOM CONSTANTS: Storage efficiency, avoid risk of typos.
39
public static final String JavaDoc DOM_SUBTREE_MODIFIED = "DOMSubtreeModified";
40     public static final String JavaDoc DOM_NODE_INSERTED = "DOMNodeInserted";
41     public static final String JavaDoc DOM_NODE_REMOVED = "DOMNodeRemoved";
42     public static final String JavaDoc DOM_NODE_REMOVED_FROM_DOCUMENT = "DOMNodeRemovedFromDocument";
43     public static final String JavaDoc DOM_NODE_INSERTED_INTO_DOCUMENT = "DOMNodeInsertedIntoDocument";
44     public static final String JavaDoc DOM_ATTR_MODIFIED = "DOMAttrModified";
45     public static final String JavaDoc DOM_CHARACTER_DATA_MODIFIED = "DOMCharacterDataModified";
46
47     /** @return the name of the Attr which
48         changed, for DOMAttrModified events.
49         Undefined for others.
50         */

51     public String JavaDoc getAttrName()
52     {
53         return attrName;
54     }
55
56     /**
57      * <code>attrChange</code> indicates the type of change which triggered
58      * the DOMAttrModified event. The values can be <code>MODIFICATION</code>
59      * , <code>ADDITION</code>, or <code>REMOVAL</code>.
60      */

61     public short getAttrChange()
62     {
63         return attrChange;
64     }
65
66     /** @return the new string value of the Attr for DOMAttrModified events, or
67         of the CharacterData node for DOMCharDataModifed events.
68         Undefined for others.
69         */

70     public String JavaDoc getNewValue()
71     {
72         return newValue;
73     }
74
75     /** @return the previous string value of the Attr for DOMAttrModified events, or
76         of the CharacterData node for DOMCharDataModifed events.
77         Undefined for others.
78         */

79     public String JavaDoc getPrevValue()
80     {
81         return prevValue;
82     }
83
84     /** @return a Node related to this event, other than the target that the
85         node was dispatched to. For DOMNodeRemoved, it is the node which
86         was removed.
87         No other uses are currently defined.
88         */

89     public Node JavaDoc getRelatedNode()
90     {
91         return relatedNode;
92     }
93
94     /** Initialize a mutation event, or overwrite the event's current
95         settings with new values of the parameters.
96         */

97     public void initMutationEvent(String JavaDoc typeArg, boolean canBubbleArg,
98         boolean cancelableArg, Node JavaDoc relatedNodeArg, String JavaDoc prevValueArg,
99         String JavaDoc newValueArg, String JavaDoc attrNameArg, short attrChangeArg)
100     {
101         relatedNode=relatedNodeArg;
102         prevValue=prevValueArg;
103         newValue=newValueArg;
104         attrName=attrNameArg;
105         attrChange=attrChangeArg;
106         super.initEvent(typeArg,canBubbleArg,cancelableArg);
107     }
108
109 }
110
Popular Tags