harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r440359 - in /incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo: CompoundEdit.java StateEdit.java StateEditable.java UndoManager.java UndoableEditSupport.java
Date Tue, 05 Sep 2006 14:49:07 GMT
Author: mloenko
Date: Tue Sep  5 07:49:06 2006
New Revision: 440359

URL: http://svn.apache.org/viewvc?view=rev&rev=440359
Log:
applied patch for HARMONY-1378
[classlib][swing] Generalization of javax.swing.undo package

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/CompoundEdit.java
    incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEdit.java
    incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEditable.java
    incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/UndoManager.java
    incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/UndoableEditSupport.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/CompoundEdit.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/CompoundEdit.java?view=diff&rev=440359&r1=440358&r2=440359
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/CompoundEdit.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/CompoundEdit.java
Tue Sep  5 07:49:06 2006
@@ -25,18 +25,13 @@
 
 public class CompoundEdit extends AbstractUndoableEdit {
 
-    protected Vector edits;
+    protected Vector<UndoableEdit> edits = new Vector<UndoableEdit>();
 
     /**
      * This is flag that indicates edits are still being added to it.
      * The method end() sets inProgress to false.
      */
-    boolean inProgress;
-
-    public CompoundEdit() {
-        edits = new Vector();
-        inProgress = true;
-    }
+    boolean inProgress = true;
 
     public boolean addEdit(final UndoableEdit anEdit) {
        if (!inProgress) {
@@ -55,7 +50,7 @@
     protected UndoableEdit lastEdit() {
         UndoableEdit last = null;
         try {
-            last = (UndoableEdit)edits.lastElement();
+            last = edits.lastElement();
         } catch (final NoSuchElementException e) {
         }
 
@@ -169,4 +164,3 @@
     }
 
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEdit.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEdit.java?view=diff&rev=440359&r1=440358&r2=440359
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEdit.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEdit.java
Tue Sep  5 07:49:06 2006
@@ -29,9 +29,9 @@
 
     protected StateEditable object;
 
-    protected Hashtable preState;
+    protected Hashtable<Object, Object> preState;
 
-    protected Hashtable postState;
+    protected Hashtable<Object, Object> postState;
 
     protected String undoRedoName;
 
@@ -58,9 +58,11 @@
         return undoRedoName;
     }
 
-    private Hashtable initHashtable(final Hashtable ht) {
+    private Hashtable<Object, Object>
+                    initHashtable(final Hashtable<Object, Object> ht) {
+
         if (ht == null) {
-            return new Hashtable();
+            return new Hashtable<Object, Object>();
         }
         ht.clear();
         return ht;
@@ -109,4 +111,3 @@
     }
 
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEditable.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEditable.java?view=diff&rev=440359&r1=440358&r2=440359
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEditable.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/StateEditable.java
Tue Sep  5 07:49:06 2006
@@ -28,10 +28,9 @@
         + "/08 19:39:08 marklin Exp $";
 
 
-    void restoreState(final Hashtable ht);
+    void restoreState(final Hashtable<?, ?> ht);
 
 
-    void storeState(final Hashtable ht);
+    void storeState(final Hashtable<Object, Object> ht);
 
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/UndoManager.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/UndoManager.java?view=diff&rev=440359&r1=440358&r2=440359
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/UndoManager.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/UndoManager.java
Tue Sep  5 07:49:06 2006
@@ -64,7 +64,7 @@
     protected void undoTo(final UndoableEdit edit) {
         int index = edits.indexOf(edit);
         for (int i = indexOfNextAdd - 1; i >= index; i--) {
-            UndoableEdit e = (UndoableEdit)edits.get(i);
+            UndoableEdit e = edits.get(i);
             e.undo();
         }
         indexOfNextAdd = index;
@@ -73,7 +73,7 @@
     protected void redoTo(final UndoableEdit edit) {
         int index = edits.indexOf(edit);
         for (int i = indexOfNextAdd; i <= index; i++) {
-            UndoableEdit e = (UndoableEdit)edits.get(i);
+            UndoableEdit e = edits.get(i);
             e.redo();
         }
         indexOfNextAdd = index + 1;
@@ -82,7 +82,7 @@
     protected UndoableEdit editToBeUndone() {
         // find first significant edit starting from indexOfNextAdd - 1 -> start
         for (int i = indexOfNextAdd - 1; i >= 0; i--) {
-            UndoableEdit edit = (UndoableEdit)edits.get(i);
+            UndoableEdit edit = edits.get(i);
             if (edit.isSignificant()) {
                 return edit;
             }
@@ -93,7 +93,7 @@
     protected UndoableEdit editToBeRedone() {
         // find first significant edit starting from indexOfNextAdd -> end
         for (int i = indexOfNextAdd; i < edits.size(); i++) {
-            UndoableEdit edit = (UndoableEdit)edits.get(i);
+            UndoableEdit edit = edits.get(i);
             if (edit.isSignificant()) {
                 return edit;
             }
@@ -102,8 +102,6 @@
     }
 
     public void undoableEditHappened(final UndoableEditEvent e) {
-        // implements just described behaviour
-        // XXX to be additionally tested
         addEdit(e.getEdit());
     }
 
@@ -160,7 +158,7 @@
         // and remove all edits in the given range (inclusive) from edits
         // we must go from end to start (to -> from)
         for (int i = to; i >= from; i--) {
-            ((UndoableEdit)edits.get(i)).die();
+            edits.get(i).die();
             edits.remove(i);
         }
     }
@@ -272,7 +270,7 @@
     public synchronized void discardAllEdits() {
         indexOfNextAdd = 0;
         for (int i = 0; i < edits.size(); i++) {
-            ((UndoableEdit)edits.get(i)).die();
+            edits.get(i).die();
         }
         edits.removeAllElements();
         return;
@@ -283,4 +281,3 @@
     }
 
 }
-

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/UndoableEditSupport.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/UndoableEditSupport.java?view=diff&rev=440359&r1=440358&r2=440359
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/UndoableEditSupport.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/undo/UndoableEditSupport.java
Tue Sep  5 07:49:06 2006
@@ -34,7 +34,7 @@
 
     protected CompoundEdit compoundEdit;
 
-    protected Vector       listeners;
+    protected Vector<UndoableEditListener> listeners;
 
     /**
      * Source for UndoableEditEvent
@@ -54,7 +54,7 @@
      */
     public UndoableEditSupport(final Object source) {
         realSource = (source == null) ? this : source;
-        listeners = new Vector();
+        listeners = new Vector<UndoableEditListener>();
         updateLevel = 0;
     }
 
@@ -145,8 +145,7 @@
     }
 
     public synchronized UndoableEditListener[] getUndoableEditListeners() {
-        return (UndoableEditListener[])listeners
-                .toArray(new UndoableEditListener[listeners.size()]);
+        return listeners.toArray(new UndoableEditListener[listeners.size()]);
     }
 
-}
\ No newline at end of file
+}



Mime
View raw message