KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > xam > ui > undo > FilterUndoManager


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.xml.xam.ui.undo;
21
22 import javax.swing.event.ChangeListener JavaDoc;
23 import javax.swing.event.UndoableEditEvent JavaDoc;
24 import javax.swing.undo.CannotRedoException JavaDoc;
25 import javax.swing.undo.CannotUndoException JavaDoc;
26 import javax.swing.undo.UndoableEdit JavaDoc;
27 import org.openide.awt.UndoRedo;
28
29 /**
30  * A proxy for another UndoRedo.Manager instance. Unless otherwise noted,
31  * all methods delegate to the original manager.
32  *
33  * @author Nathan Fiedler
34  */

35 public class FilterUndoManager extends UndoRedo.Manager {
36     /** silence compiler warnings */
37     private static final long serialVersionUID = 1L;
38     /** The original undo/redo manager. */
39     private UndoRedo.Manager original;
40
41     public FilterUndoManager(UndoRedo.Manager original) {
42         assert original != null;
43         this.original = original;
44     }
45
46     /**
47      * Returns the original UndoRedo.Manager instance.
48      *
49      * @return original manager.
50      */

51     protected UndoRedo.Manager getOriginal() {
52         return original;
53     }
54
55     public void addChangeListener(ChangeListener JavaDoc changeListener) {
56         original.addChangeListener(changeListener);
57     }
58
59     public boolean addEdit(UndoableEdit JavaDoc anEdit) {
60         return original.addEdit(anEdit);
61     }
62
63     public boolean canRedo() {
64         return original.canRedo();
65     }
66
67     public boolean canUndo() {
68         return original.canUndo();
69     }
70
71     public boolean canUndoOrRedo() {
72         return original.canUndoOrRedo();
73     }
74
75     public void die() {
76         original.die();
77     }
78
79     public void discardAllEdits() {
80         original.discardAllEdits();
81     }
82
83     public void end() {
84         original.end();
85     }
86
87     public int getLimit() {
88         return original.getLimit();
89     }
90
91     public String JavaDoc getPresentationName() {
92         return original.getPresentationName();
93     }
94
95     public String JavaDoc getRedoPresentationName() {
96         return original.getRedoPresentationName();
97     }
98
99     public String JavaDoc getUndoOrRedoPresentationName() {
100         return original.getUndoOrRedoPresentationName();
101     }
102
103     public String JavaDoc getUndoPresentationName() {
104         return original.getUndoPresentationName();
105     }
106
107     public boolean isInProgress() {
108         return original.isInProgress();
109     }
110
111     public boolean isSignificant() {
112         return original.isSignificant();
113     }
114
115     public void redo() throws CannotRedoException JavaDoc {
116         original.redo();
117     }
118
119     public void removeChangeListener(ChangeListener JavaDoc changeListener) {
120         original.removeChangeListener(changeListener);
121     }
122
123     public boolean replaceEdit(UndoableEdit JavaDoc anEdit) {
124         return original.replaceEdit(anEdit);
125     }
126
127     public void setLimit(int l) {
128         original.setLimit(l);
129     }
130
131     public void undo() throws CannotUndoException JavaDoc {
132         original.undo();
133     }
134
135     public void undoOrRedo() throws CannotRedoException JavaDoc, CannotUndoException JavaDoc {
136         original.undoOrRedo();
137     }
138
139     public void undoableEditHappened(UndoableEditEvent JavaDoc event) {
140         original.undoableEditHappened(event);
141     }
142 }
143
Popular Tags