View Javadoc

1   /*
2    * Copyright 1999-2006 Faculty of Mathematics, Physics and Informatics, Comenius
3    * University, Bratislava. This file is protected by the Mozilla Public License
4    * version 1.1 (the License); you may not use this file except in compliance
5    * with the License. You may obtain a copy of the License at
6    * http://euromath2.sourceforge.net/license.html Unless required by applicable
7    * law or agreed to in writing, software distributed under the License is
8    * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9    * KIND, either express or implied. See the License for the specific language
10   * governing permissions and limitations under the License.
11   */
12  package sk.uniba.euromath.document;
13  import org.w3c.dom.Node;
14  /***
15   * <p>
16   * Informs about the document modification operations.
17   * </p>
18   * <p>
19   * In case the listener modifies the document it should make sure not to cause
20   * an endless loop, for example by modifying current node in the
21   * {@link #nodeModified(ChangeTracer, boolean)} method etc.
22   * </p>
23   * @author Martin Vysny
24   * @deprecated use DOM 2 Events
25   */
26  @Deprecated
27  public interface IModifierListener {
28  	/***
29  	 * Informs the class that this node is about to be deleted from document.
30  	 * The node is still present in the document.
31  	 * @param node node from document that is about to be deleted.
32  	 * @param changesIdLevel if <code>false</code> then the change itself
33  	 * changes the ID level however it is part of a bigger change that does not
34  	 * affect the ID level (for example splitting the text node consists of
35  	 * modification and creation, they both affect ID level however together
36  	 * they does not).
37  	 */
38  	public void nodeDelete(Node node, boolean changesIdLevel);
39  	/***
40  	 * <p>
41  	 * Informs this splitted document that this node has been added to original
42  	 * document. Node complies to these rules:
43  	 * </p>
44  	 * <ul>
45  	 * <li>Node must be already inserted in original document,</li>
46  	 * <li>There is no brother node before this node, that had been inserted to
47  	 * original document and not yet reported to this method. (This rule does
48  	 * not apply when the node is an attribute)</li>
49  	 * </ul>
50  	 * <p>
51  	 * <code>emp:id</code> attributes are also reflected into splitted
52  	 * document so the node and its descendants must already have this
53  	 * attribute.
54  	 * </p>
55  	 * <p>
56  	 * If multiple nodes are added to the document then only 'topmost' nodes are
57  	 * reported. In other words, if we report node n then its descendants must
58  	 * not be reported.
59  	 * </p>
60  	 * @param node node that has been added.
61  	 * @param changesIdLevel if <code>false</code> then the change itself
62  	 * changes the ID level however it is part of a bigger change that does not
63  	 * affect the ID level (for example splitting the text node consists of
64  	 * modification and creation, they both affect ID level however together
65  	 * they does not).
66  	 */
67  	public void nodeAdded(Node node, boolean changesIdLevel);
68  	/***
69  	 * <p>
70  	 * Informs splitted document, that node has been modified (for example, Text
71  	 * had changed its text value to a non-empty value). Element can be reported
72  	 * to this method only if its local name was changed - if its children have
73  	 * been modified then appropriate methods must be called for each
74  	 * added/removed/modified child instead. Attribute node must be reported to
75  	 * this function only if its text value had changed.
76  	 * </p>
77  	 * <p>
78  	 * If element contents had been changed (child added/removed/etc.), then
79  	 * this method must not be called. Instead, for every modified child an
80  	 * appropriate method must be called. If node changes completely, then it
81  	 * should be reported as follows:
82  	 * </p>
83  	 * <ol>
84  	 * <li>First, call <code>nodeDelete()</code> on this node.</li>
85  	 * <li>Then, modify the node, or even replace it with another one.</li>
86  	 * <li>Then call <code>nodeAdded()</code> with this new node.</li>
87  	 * </ol>
88  	 * <p>
89  	 * If an attribute node had changed its namespace and/or qname, it must be
90  	 * reported by a call to <code>nodeDeleted()</code> and
91  	 * <code>nodeAdded()</code> functions.
92  	 * </p>
93  	 * <p>
94  	 * Entity reference nodes must not be passed to this function.
95  	 * </p>
96  	 * @param tracer traces the changes that had been done to the node.
97  	 * @param changesIdLevel if <code>false</code> then the change itself
98  	 * changes the ID level however it is part of a bigger change that does not
99  	 * affect the ID level (for example splitting the text node consists of
100 	 * modification and creation, they both affect ID level however together
101 	 * they does not).
102 	 */
103 	public void nodeModified(ChangeTracer tracer, boolean changesIdLevel);
104 }