/[classpath]/classpath/javax/swing/undo/UndoableEditSupport.java
ViewVC logotype

Diff of /classpath/javax/swing/undo/UndoableEditSupport.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by tromey, Mon Feb 17 01:50:56 2003 UTC revision 1.3 by tromey, Mon Feb 17 02:10:32 2003 UTC
# Line 82  public class UndoableEditSupport Line 82  public class UndoableEditSupport
82     */     */
83    public UndoableEditSupport()    public UndoableEditSupport()
84    {    {
     // TODO  
85    }    }
86    
87    /**    /**
# Line 105  public class UndoableEditSupport Line 104  public class UndoableEditSupport
104     */     */
105    public String toString()    public String toString()
106    {    {
107      return null; // TODO      return (super.toString() + " realSource: " + realSource
108                + " updateLevel: " + updateLevel);
109    }    }
110    
111    /**    /**
112     * addUndoableEditListener     * Add a listener.
113     * @param value0 TODO     * @param val the listener
114     */     */
115    public synchronized void addUndoableEditListener(UndoableEditListener value0)    public synchronized void addUndoableEditListener(UndoableEditListener val)
116    {    {
117      // TODO      listeners.add(val);
118    }    }
119    
120    /**    /**
121     * removeUndoableEditListener     * Remove a listener.
122     * @param value0 TODO     * @param val the listener
123       */
124      public synchronized void removeUndoableEditListener(UndoableEditListener val)
125      {
126        listeners.removeElement(val);
127      }
128    
129      /**
130       * Return an array of all listeners.
131       * @returns all the listeners
132     */     */
133    public synchronized void removeUndoableEditListener(UndoableEditListener value0)    public synchronized UndoableEditListener[] getUndoableEditListeners()
134    {    {
135      // TODO      UndoableEditListener[] result = new UndoableEditListener[listeners.size()];
136        return (UndoableEditListener[]) listeners.toArray(result);
137    }    }
138    
139    /**    /**
140     * _postEdit     * _postEdit
141     * @param value0 TODO     * @param value0 TODO
142     */     */
143    protected void _postEdit(UndoableEdit value0)    protected void _postEdit(UndoableEdit edit)
144    {    {
145      // TODO      UndoableEditEvent event = new UndoableEditEvent(realSource, edit);
146        int max = listeners.size();
147        for (int i = 0; i < max; ++i)
148          {
149            UndoableEditListener l
150              = (UndoableEditListener) (listeners.elementAt(i));
151            l.undoableEditHappened(event);
152          }
153    }    }
154    
155    /**    /**
156     * postEdit     * postEdit
157     * @param value0 TODO     * @param value0 TODO
158     */     */
159    public synchronized void postEdit(UndoableEdit value0)    public synchronized void postEdit(UndoableEdit edit)
160    {    {
161      // TODO      if (compoundEdit == null)
162          compoundEdit.addEdit(edit);
163        else
164          _postEdit(edit);
165    }    }
166    
167    /**    /**
# Line 150  public class UndoableEditSupport Line 170  public class UndoableEditSupport
170     */     */
171    public int getUpdateLevel()    public int getUpdateLevel()
172    {    {
173      return 0; // TODO      return updateLevel;
174    }    }
175    
176    /**    /**
# Line 158  public class UndoableEditSupport Line 178  public class UndoableEditSupport
178     */     */
179    public synchronized void beginUpdate()    public synchronized void beginUpdate()
180    {    {
181      // TODO      if (compoundEdit != null)
182          {
183            // FIXME: what?  We can't push a new one.  This isn't even
184            // documented anyway.
185            endUpdate();
186          }
187    
188        compoundEdit = createCompoundEdit();
189        ++updateLevel;
190    }    }
191    
192    /**    /**
# Line 167  public class UndoableEditSupport Line 195  public class UndoableEditSupport
195     */     */
196    protected CompoundEdit createCompoundEdit()    protected CompoundEdit createCompoundEdit()
197    {    {
198      return null; // TODO      return new CompoundEdit();
199    }    }
200    
201    /**    /**
# Line 175  public class UndoableEditSupport Line 203  public class UndoableEditSupport
203     */     */
204    public synchronized void endUpdate()    public synchronized void endUpdate()
205    {    {
206      // TODO      // FIXME: assert updateLevel == 1;
207        compoundEdit.end();
208        CompoundEdit c = compoundEdit;
209        compoundEdit = null;
210        --updateLevel;
211        _postEdit(c);
212    }    }
213  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26