svn commit: r13028 - trunk/src_new/org/argouml: application kernel ui ui/explorer/rules uml uml/diagram/ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2007-07-10 11:00:08-0700
New Revision: 13028

Modified:
   trunk/src_new/org/argouml/application/StartCritics.java
   trunk/src_new/org/argouml/kernel/MemberList.java
   trunk/src_new/org/argouml/ui/DetailsPane.java
   trunk/src_new/org/argouml/ui/TabResults.java
   trunk/src_new/org/argouml/ui/explorer/rules/GoBehavioralFeatureToStateDiagram.java
   trunk/src_new/org/argouml/ui/explorer/rules/GoClassifierToSequenceDiagram.java
   trunk/src_new/org/argouml/ui/explorer/rules/GoCollaborationToDiagram.java
   trunk/src_new/org/argouml/ui/explorer/rules/GoModelElementToContainedDiagrams.java
   trunk/src_new/org/argouml/ui/explorer/rules/GoNamespaceToDiagram.java
   trunk/src_new/org/argouml/ui/explorer/rules/GoOperationToCollaborationDiagram.java
   trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToCollaboration.java
   trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToStateMachine.java
   trunk/src_new/org/argouml/ui/explorer/rules/GoStatemachineToDiagram.java
   trunk/src_new/org/argouml/uml/TMResults.java
   trunk/src_new/org/argouml/uml/diagram/ui/ActionAddExistingNodes.java

Log:
Java 5 updates - generics & forall loops

Modified: trunk/src_new/org/argouml/application/StartCritics.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/application/StartCritics.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/application/StartCritics.java&p2=trunk/src_new/org/argouml/application/StartCritics.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/application/StartCritics.java	(original)
+++ trunk/src_new/org/argouml/application/StartCritics.java	2007-07-10 11:00:08-0700
@@ -63,10 +63,8 @@
         Configuration.addListener(Argo.KEY_USER_FULLNAME, dsgr); //MVW
         dsgr.spawnCritiquer(p);
         dsgr.setChildGenerator(new ChildGenUML());
-        java.util.Enumeration models = (p.getUserDefinedModels()).elements();
-        while (models.hasMoreElements()) {
-            Object o = models.nextElement();
-            Model.getPump().addModelEventListener(dsgr, o);
+        for (Object model : p.getUserDefinedModelList()) {
+            Model.getPump().addModelEventListener(dsgr, model);
         }
         LOG.info("spawned critiquing thread");
         dsgr.getDecisionModel().startConsidering(UMLDecision.CLASS_SELECTION);

Modified: trunk/src_new/org/argouml/kernel/MemberList.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/kernel/MemberList.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/kernel/MemberList.java&p2=trunk/src_new/org/argouml/kernel/MemberList.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/kernel/MemberList.java	(original)
+++ trunk/src_new/org/argouml/kernel/MemberList.java	2007-07-10 11:00:08-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 2004-2006 The Regents of the University of California. All
+// Copyright (c) 2004-2007 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -47,7 +47,8 @@
     private static final Logger LOG = Logger.getLogger(MemberList.class);
 
     private AbstractProjectMember model;
-    private List diagramMembers = new ArrayList(10);
+    private List<ProjectMemberDiagram> diagramMembers = 
+        new ArrayList<ProjectMemberDiagram>(10);
     private AbstractProjectMember todoList;
 
     /**
@@ -69,7 +70,7 @@
             return true;
         } else if (member instanceof ProjectMemberDiagram) {
             // otherwise add the diagram at the start
-            return diagramMembers.add(member);
+            return diagramMembers.add((ProjectMemberDiagram) member);
         }
         return false;
     }

Modified: trunk/src_new/org/argouml/ui/DetailsPane.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/DetailsPane.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/ui/DetailsPane.java&p2=trunk/src_new/org/argouml/ui/DetailsPane.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/ui/DetailsPane.java	(original)
+++ trunk/src_new/org/argouml/ui/DetailsPane.java	2007-07-10 11:00:08-0700
@@ -95,7 +95,7 @@
     /**
      * a list of all the tabs, which are JPanels, in the JTabbedPane tabs.
      */
-    private List tabPanelList = new ArrayList();
+    private List<JPanel> tabPanelList = new ArrayList<JPanel>();
 
     /**
      * index of the selected tab in the JTabbedPane.
@@ -146,9 +146,8 @@
         setFont(new Font("Dialog", Font.PLAIN, 10));
         add(topLevelTabbedPane, BorderLayout.CENTER);
 
-        for (int i = 0; i < tabPanelList.size(); i++) {
+        for (JPanel t : tabPanelList) {
             String titleKey = "tab";
-            JPanel t = (JPanel) tabPanelList.get(i);
             if (t instanceof AbstractArgoJPanel) {
                 titleKey = ((AbstractArgoJPanel) t).getTitle();
             }
@@ -203,8 +202,7 @@
      */
     public boolean setToDoItem(Object item) {
         enableTabs(item);
-        for (int i = 0; i < tabPanelList.size(); i++) {
-            JPanel t = (JPanel) tabPanelList.get(i);
+        for (JPanel t : tabPanelList) {
             if (t instanceof TabToDoTarget) {
                 ((TabToDoTarget) t).setTarget(item);
                 topLevelTabbedPane.setSelectedComponent(t);
@@ -282,7 +280,7 @@
             }
             // default tab todo
             if (!tabSelected) {
-                JPanel tab = (JPanel) tabPanelList.get(0);
+                JPanel tab = tabPanelList.get(0);
                 if (!(tab instanceof TabToDoTarget)) {
                     Iterator it = tabPanelList.iterator();
                     while (it.hasNext()) {
@@ -390,9 +388,9 @@
      * @param p the given property panel
      */
     public void addToPropTab(Class c, PropPanel p) {
-        for (int i = 0; i < tabPanelList.size(); i++) {
-            if (tabPanelList.get(i) instanceof TabProps) {
-                ((TabProps) tabPanelList.get(i)).addPanel(c, p);
+        for (JPanel panel : tabPanelList) {
+            if (panel instanceof TabProps) {
+                ((TabProps) panel).addPanel(c, p);
             }
         }
     }
@@ -572,13 +570,12 @@
      * @see org.tigris.swidgets.Orientable#setOrientation(org.tigris.swidgets.Orientation)
      */
     public void setOrientation(Orientation orientation) {
-        for (int i = 0; i < tabPanelList.size(); i++) {
-            JPanel t = (JPanel) tabPanelList.get(i);
+        for (JPanel t : tabPanelList) {
             if (t instanceof Orientable) {
                 Orientable o = (Orientable) t;
                 o.setOrientation(orientation);
             }
-        } /* end for */
+        }
     }
 
     /*
@@ -616,7 +613,7 @@
         // iterate through the tabbed panels to determine wether they
         // should be enabled.
         for (int i = 0; i < tabPanelList.size(); i++) {
-            JPanel tab = (JPanel) tabPanelList.get(i);
+            JPanel tab = tabPanelList.get(i);
             boolean shouldEnable = false;
             if (tab instanceof TargetListener) {
                 if (tab instanceof TabTarget) {
@@ -671,4 +668,4 @@
         }
     }
 
-} /* end class DetailsPane */
+}

Modified: trunk/src_new/org/argouml/ui/TabResults.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/TabResults.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/ui/TabResults.java&p2=trunk/src_new/org/argouml/ui/TabResults.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/ui/TabResults.java	(original)
+++ trunk/src_new/org/argouml/ui/TabResults.java	2007-07-10 11:00:08-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2007 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -25,7 +25,6 @@
 package org.argouml.ui;
 
 import java.awt.BorderLayout;
-
 import java.awt.Dimension;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -33,7 +32,9 @@
 import java.awt.event.KeyListener;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
+import java.util.ArrayList;
 import java.util.Enumeration;
+import java.util.List;
 import java.util.Vector;
 
 import javax.swing.BorderFactory;
@@ -79,15 +80,14 @@
      */
     private static final int INSET_PX = 3;
 
-    ////////////////////////////////////////////////////////////////
-    // instance variables
     private PredicateFind pred;
     private ChildGenerator cg;
     private Object root;
     private JSplitPane mainPane;
-    private Vector results = new Vector();
-    private Vector related = new Vector();
-    private Vector diagrams = new Vector();
+    private List results = new ArrayList();
+    private List related = new ArrayList();
+    // TODO: This should be some non-GEF type such as ArgoDiagram.
+    private List<Diagram> diagrams = new ArrayList<Diagram>();
     private boolean relatedShown;
 
     private JLabel resultsLabel = new JLabel();
@@ -160,9 +160,6 @@
 
     }
 
-    ////////////////////////////////////////////////////////////////
-    // accessors
-
     /**
      * @param p the predicate for the search
      */
@@ -187,19 +184,29 @@
     /**
      * @param res the results
      * @param dia the diagrams
+     * @deprecated for 0.25.4 by tfmorris. Use {@link #setResults(List, List)}.
      */
+    @Deprecated
     public void setResults(Vector res, Vector dia) {
-	results = res;
-	diagrams = dia;
-	Object[] msgArgs = {new Integer(results.size()) };
-	resultsLabel.setText(Translator.messageFormat(
+        setResults((List) res, (List) dia);
+    }
+
+    /**
+     * @param res the results
+     * @param dia the diagrams
+     */
+    public void setResults(List res, List dia) {
+        results = res;
+        diagrams = dia;
+        Object[] msgArgs = {new Integer(results.size()) };
+        resultsLabel.setText(Translator.messageFormat(
             "dialog.tabresults.results-items", msgArgs));
-	resultsModel.setTarget(results, diagrams);
-	relatedModel.setTarget(null, null);
-	relatedLabel.setText(
+        resultsModel.setTarget(results, diagrams);
+        relatedModel.setTarget((List) null, (List) null);
+        relatedLabel.setText(
             Translator.localize("dialog.tabresults.related-items"));
     }
-
+    
     /*
      * @see org.argouml.ui.AbstractArgoJPanel#spawn()
      */
@@ -288,15 +295,15 @@
 	    if (row < 0) {
                 return;
             }
-	    sel = results.elementAt(row);
-	    d = (Diagram) diagrams.elementAt(row);
+	    sel = results.get(row);
+	    d = (Diagram) diagrams.get(row);
 	} else if (src == relatedTable) {
 	    int row = relatedTable.getSelectionModel().getMinSelectionIndex();
 	    if (row < 0) {
                 return;
             }
 	    numJumpToRelated++;
-	    sel = related.elementAt(row);
+	    sel = related.get(row);
 	}
 
 	if (d != null) {
@@ -345,14 +352,14 @@
 	}
 	if (relatedShown) {
 	    int row = lse.getFirstIndex();
-	    Object sel = results.elementAt(row);
+	    Object sel = results.get(row);
 	    LOG.debug("selected " + sel);
-	    related.removeAllElements();
+	    related.clear();
 	    Enumeration elems =
 		ChildGenRelated.getSingleton().gen(sel);
 	    if (elems != null) {
 		while (elems.hasMoreElements()) {
-		    related.addElement(elems.nextElement());
+		    related.add(elems.nextElement());
 		}
 	    }
 	    relatedModel.setTarget(related, null);
@@ -362,15 +369,12 @@
 	}
     }
 
-    ////////////////////////////////////////////////////////////////
-    // actions
-
     /*
      * @see java.lang.Runnable#run()
      */
     public void run() {
 	resultsLabel.setText(Translator.localize("dialog.find.searching"));
-	results.removeAllElements();
+	results.clear();
 	depthFirst(root, null);
 	setResults(results, diagrams);
     }
@@ -403,8 +407,8 @@
 	    Object c = elems.nextElement();
 	    if (pred.predicate(c)
                     && (lastDiagram != null || pred.matchDiagram(""))) {
-		results.addElement(c);
-		diagrams.addElement(lastDiagram);
+		results.add(c);
+		diagrams.add(lastDiagram);
 	    }
 	    depthFirst(c, lastDiagram);
 	}
@@ -414,4 +418,4 @@
      * The UID.
      */
     private static final long serialVersionUID = 4980167466628873068L;
-} /* end class TabResults */
+}

Modified: trunk/src_new/org/argouml/ui/explorer/rules/GoBehavioralFeatureToStateDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoBehavioralFeatureToStateDiagram.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/ui/explorer/rules/GoBehavioralFeatureToStateDiagram.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoBehavioralFeatureToStateDiagram.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/rules/GoBehavioralFeatureToStateDiagram.java	(original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoBehavioralFeatureToStateDiagram.java	2007-07-10 11:00:08-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2007 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -25,9 +25,8 @@
 package org.argouml.ui.explorer.rules;
 
 import java.util.Collection;
-import java.util.Iterator;
+import java.util.HashSet;
 import java.util.Set;
-import java.util.Vector;
 
 import org.argouml.i18n.Translator;
 import org.argouml.kernel.Project;
@@ -51,12 +50,9 @@
 
         if (Model.getFacade().isABehavioralFeature(parent)) {
             Collection col = Model.getFacade().getBehaviors(parent);
-            Vector ret = new Vector();
+            Set<ArgoDiagram> ret = new HashSet<ArgoDiagram>();
             Project p = ProjectManager.getManager().getCurrentProject();
-            Vector diagrams = p.getDiagrams();
-            Iterator it = diagrams.iterator();
-            while (it.hasNext()) {
-                ArgoDiagram diagram = (ArgoDiagram) it.next();
+            for (ArgoDiagram diagram : p.getDiagramList()) {
                 if (diagram instanceof UMLStateDiagram
                     && col.contains(((UMLStateDiagram) diagram)
                             .getStateMachine())) {

Modified: trunk/src_new/org/argouml/ui/explorer/rules/GoClassifierToSequenceDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoClassifierToSequenceDiagram.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/ui/explorer/rules/GoClassifierToSequenceDiagram.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoClassifierToSequenceDiagram.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/rules/GoClassifierToSequenceDiagram.java	(original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoClassifierToSequenceDiagram.java	2007-07-10 11:00:08-0700
@@ -24,10 +24,8 @@
 
 package org.argouml.ui.explorer.rules;
 
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
+import java.util.HashSet;
 import java.util.Set;
 
 import org.argouml.i18n.Translator;
@@ -58,12 +56,10 @@
     public Collection getChildren(Object parent) {
 	if (Model.getFacade().isAClassifier(parent)) {
 	    Collection col = Model.getFacade().getCollaborations(parent);
-	    List ret = new ArrayList();
+	    Set<ArgoDiagram> ret = new HashSet<ArgoDiagram>();
 	    Project p = ProjectManager.getManager().getCurrentProject();
-	    Iterator it = p.getDiagrams().iterator();
-
-	    while (it.hasNext()) {
-		ArgoDiagram diagram = (ArgoDiagram) it.next();
+            
+            for (ArgoDiagram diagram : p.getDiagramList()) {
 		if (diagram instanceof UMLSequenceDiagram
 		    && col.contains(((SequenceDiagramGraphModel)
 		            ((UMLSequenceDiagram) diagram).getGraphModel())

Modified: trunk/src_new/org/argouml/ui/explorer/rules/GoCollaborationToDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoCollaborationToDiagram.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/ui/explorer/rules/GoCollaborationToDiagram.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoCollaborationToDiagram.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/rules/GoCollaborationToDiagram.java	(original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoCollaborationToDiagram.java	2007-07-10 11:00:08-0700
@@ -25,13 +25,14 @@
 package org.argouml.ui.explorer.rules;
 
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.Set;
-import java.util.Vector;
 
 import org.argouml.i18n.Translator;
 import org.argouml.kernel.Project;
 import org.argouml.kernel.ProjectManager;
 import org.argouml.model.Model;
+import org.argouml.uml.diagram.ArgoDiagram;
 import org.argouml.uml.diagram.collaboration.ui.UMLCollaborationDiagram;
 import org.argouml.uml.diagram.sequence.ui.UMLSequenceDiagram;
 
@@ -59,23 +60,18 @@
         if (p == null)
             return null;
 
-        Vector res = new Vector();
-        Vector diagrams = p.getDiagrams();
-        if (diagrams == null)
-            return null;
-        java.util.Enumeration elems = diagrams.elements();
-        while (elems.hasMoreElements()) {
-            Object d = elems.nextElement();
+        Set<ArgoDiagram> res = new HashSet<ArgoDiagram>();
+        for (ArgoDiagram d : p.getDiagramList()) {
             if (d instanceof UMLCollaborationDiagram
                 && ((UMLCollaborationDiagram) d).getNamespace() == parent) {
-                res.addElement(d);
+                res.add(d);
             }
             /* Also show unattached sequence diagrams: */
             if ((d instanceof UMLSequenceDiagram)
                 && (Model.getFacade().getRepresentedClassifier(parent) == null)
                 &&  (Model.getFacade().getRepresentedOperation(parent) == null)
                 && (parent == ((UMLSequenceDiagram) d).getNamespace())) {
-                res.addElement(d);
+                res.add(d);
             }
         }
         return res;

Modified: trunk/src_new/org/argouml/ui/explorer/rules/GoModelElementToContainedDiagrams.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoModelElementToContainedDiagrams.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/ui/explorer/rules/GoModelElementToContainedDiagrams.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoModelElementToContainedDiagrams.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/rules/GoModelElementToContainedDiagrams.java	(original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoModelElementToContainedDiagrams.java	2007-07-10 11:00:08-0700
@@ -24,10 +24,8 @@
 
 package org.argouml.ui.explorer.rules;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 import org.argouml.i18n.Translator;
@@ -59,11 +57,8 @@
     public Collection getChildren(Object parent) {
         if (Model.getFacade().isAModelElement(parent)) {
             Project p = ProjectManager.getManager().getCurrentProject();
-            Collection ret = new ArrayList();
-            Collection diagrams = p.getDiagrams();
-            Iterator it = diagrams.iterator();
-            while (it.hasNext()) {
-                ArgoDiagram diagram = (ArgoDiagram) it.next();
+            Set<ArgoDiagram> ret = new HashSet<ArgoDiagram>();
+            for (ArgoDiagram diagram : p.getDiagramList()) {
                 if (diagram.getNamespace() == parent) {
                     ret.add(diagram);
                 }

Modified: trunk/src_new/org/argouml/ui/explorer/rules/GoNamespaceToDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoNamespaceToDiagram.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/ui/explorer/rules/GoNamespaceToDiagram.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoNamespaceToDiagram.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/rules/GoNamespaceToDiagram.java	(original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoNamespaceToDiagram.java	2007-07-10 11:00:08-0700
@@ -26,7 +26,6 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -62,9 +61,7 @@
         if (Model.getFacade().isANamespace(namespace)) {
             List returnList = new ArrayList();
             Project proj = ProjectManager.getManager().getCurrentProject();
-            Iterator it = proj.getDiagrams().iterator();
-            while (it.hasNext()) {
-                ArgoDiagram diagram = (ArgoDiagram) it.next();
+            for (ArgoDiagram diagram : proj.getDiagramList()) {
                 // Sequence diagrams are not shown as children of the
                 // collaboration that they show but as children of the
                 // classifier/operation the collaboration represents.

Modified: trunk/src_new/org/argouml/ui/explorer/rules/GoOperationToCollaborationDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoOperationToCollaborationDiagram.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/ui/explorer/rules/GoOperationToCollaborationDiagram.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoOperationToCollaborationDiagram.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/rules/GoOperationToCollaborationDiagram.java	(original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoOperationToCollaborationDiagram.java	2007-07-10 11:00:08-0700
@@ -26,9 +26,8 @@
 package org.argouml.ui.explorer.rules;
 
 import java.util.Collection;
-import java.util.Iterator;
+import java.util.HashSet;
 import java.util.Set;
-import java.util.Vector;
 
 import org.argouml.i18n.Translator;
 import org.argouml.kernel.Project;
@@ -50,14 +49,11 @@
      */
     public Collection getChildren(Object parent) {
         if (Model.getFacade().isAOperation(parent)) {
-            Object operation = parent; //MOperation
+            Object operation = parent;
             Collection col = Model.getFacade().getCollaborations(operation);
-            Vector ret = new Vector();
+            Set<ArgoDiagram> ret = new HashSet<ArgoDiagram>();
             Project p = ProjectManager.getManager().getCurrentProject();
-            Vector diagrams = p.getDiagrams();
-            Iterator it = diagrams.iterator();
-            while (it.hasNext()) {
-                ArgoDiagram diagram = (ArgoDiagram) it.next();
+            for (ArgoDiagram diagram : p.getDiagramList()) {
                 if (diagram instanceof UMLCollaborationDiagram
 		    && col.contains(((UMLCollaborationDiagram) diagram)
 				    .getNamespace())) {

Modified: trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToCollaboration.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToCollaboration.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToCollaboration.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToCollaboration.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToCollaboration.java	(original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToCollaboration.java	2007-07-10 11:00:08-0700
@@ -27,7 +27,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 import org.argouml.i18n.Translator;
@@ -52,14 +51,13 @@
      */
     public Collection getChildren(Object parent) {
 	Collection col = new ArrayList();
-	if (parent instanceof Project) {
-	    Iterator it = ((Project) parent).getUserDefinedModels().iterator();
-	    while (it.hasNext()) {
-		col.addAll(Model.getModelManagementHelper()
-			   .getAllModelElementsOfKind(it.next(),
-				Model.getMetaTypes().getCollaboration()));
-	    }
-	}
+        if (parent instanceof Project) {
+            for (Object model : ((Project) parent).getUserDefinedModelList()) {
+                col.addAll(Model.getModelManagementHelper()
+                        .getAllModelElementsOfKind(model,
+                                Model.getMetaTypes().getCollaboration()));
+            }
+        }
 	return col;
     }
 

Modified: trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToStateMachine.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToStateMachine.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToStateMachine.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToStateMachine.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToStateMachine.java	(original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToStateMachine.java	2007-07-10 11:00:08-0700
@@ -26,7 +26,6 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Set;
 
 import org.argouml.i18n.Translator;
@@ -52,10 +51,9 @@
     public Collection getChildren(Object parent) {
 	Collection col = new ArrayList();
 	if (parent instanceof Project) {
-	    Iterator it = ((Project) parent).getUserDefinedModels().iterator();
-	    while (it.hasNext()) {
+            for (Object model : ((Project) parent).getUserDefinedModelList()) {
 		col.addAll(Model.getModelManagementHelper()
-			   .getAllModelElementsOfKind(it.next(),
+			   .getAllModelElementsOfKind(model,
 			           Model.getMetaTypes().getStateMachine()));
 	    }
 	}

Modified: trunk/src_new/org/argouml/ui/explorer/rules/GoStatemachineToDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoStatemachineToDiagram.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/ui/explorer/rules/GoStatemachineToDiagram.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoStatemachineToDiagram.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/rules/GoStatemachineToDiagram.java	(original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoStatemachineToDiagram.java	2007-07-10 11:00:08-0700
@@ -24,16 +24,15 @@
 
 package org.argouml.ui.explorer.rules;
 
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
+import java.util.HashSet;
 import java.util.Set;
 
 import org.argouml.i18n.Translator;
 import org.argouml.kernel.Project;
 import org.argouml.kernel.ProjectManager;
 import org.argouml.model.Model;
+import org.argouml.uml.diagram.ArgoDiagram;
 import org.argouml.uml.diagram.activity.ui.UMLActivityDiagram;
 import org.argouml.uml.diagram.state.ui.UMLStateDiagram;
 
@@ -51,11 +50,9 @@
      */
     public Collection getChildren(Object parent) {
         if (Model.getFacade().isAStateMachine(parent)) {
-            List returnList = new ArrayList();
+            Set<ArgoDiagram> returnList = new HashSet<ArgoDiagram>();
             Project proj = ProjectManager.getManager().getCurrentProject();
-            Iterator it = proj.getDiagrams().iterator();
-            while (it.hasNext()) {
-                Object diagram = it.next();
+            for (ArgoDiagram diagram : proj.getDiagramList()) {
                 if (diagram instanceof UMLActivityDiagram) {
                     UMLActivityDiagram activityDiagram =
                         (UMLActivityDiagram) diagram;

Modified: trunk/src_new/org/argouml/uml/TMResults.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/TMResults.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/uml/TMResults.java&p2=trunk/src_new/org/argouml/uml/TMResults.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/uml/TMResults.java	(original)
+++ trunk/src_new/org/argouml/uml/TMResults.java	2007-07-10 11:00:08-0700
@@ -24,6 +24,7 @@
 
 package org.argouml.uml;
 
+import java.util.List;
 import java.util.Vector;
 
 import javax.swing.table.AbstractTableModel;
@@ -41,8 +42,8 @@
  */
 public class TMResults extends AbstractTableModel {
 
-    private Vector rowObjects;
-    private Vector diagrams;
+    private List rowObjects;
+    private List<UMLDiagram> diagrams;
     private boolean showInDiagramColumn;
 
     /**
@@ -63,19 +64,25 @@
         showInDiagramColumn = showTheInDiagramColumn;
     }
 
-    ////////////////
-    // accessors
-
     /**
      * @param results the row objects
      * @param theDiagrams the diagrams
+     * @deprecated for 0.25.4 by tfmorris.  Use {@link #setTarget(List, List)}.
      */
     public void setTarget(Vector results, Vector theDiagrams) {
+        setTarget((List) results, (List) theDiagrams);
+    }
+
+    /**
+     * @param results the row objects
+     * @param theDiagrams the diagrams
+     */
+    public void setTarget(List results, List theDiagrams) {
         rowObjects = results;
         diagrams = theDiagrams;
         fireTableStructureChanged();
     }
-
+    
     ////////////////
     // TableModel implementation
 
@@ -141,7 +148,7 @@
         if (col < 0 || col >= (showInDiagramColumn ? 4 : 3)) {
             return "bad col!";
         }
-        Object rowObj = rowObjects.elementAt(row);
+        Object rowObj = rowObjects.get(row);
         if (rowObj instanceof Diagram) {
             Diagram d = (Diagram) rowObj;
             switch (col) {
@@ -164,7 +171,7 @@
         if (Model.getFacade().isAModelElement(rowObj)) {
             Diagram d = null;
             if (diagrams != null) {
-                d = (Diagram) diagrams.elementAt(row);
+                d = (Diagram) diagrams.get(row);
             }
             switch (col) {
 	    case 0 : // the name of this type of ModelElement
@@ -215,6 +222,7 @@
     /*
      * @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int)
      */
+    @Override
     public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
     }
 
@@ -222,4 +230,4 @@
      * The UID.
      */
     private static final long serialVersionUID = -1444599676429024575L;
-} /* end class TMResults */
+}

Modified: trunk/src_new/org/argouml/uml/diagram/ui/ActionAddExistingNodes.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/ActionAddExistingNodes.java?view=diff&rev=13028&p1=trunk/src_new/org/argouml/uml/diagram/ui/ActionAddExistingNodes.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/ActionAddExistingNodes.java&r1=13027&r2=13028
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/ActionAddExistingNodes.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/ActionAddExistingNodes.java	2007-07-10 11:00:08-0700
@@ -63,14 +63,15 @@
     /*

      * @see javax.swing.Action#isEnabled()

      */

+    @Override

     public boolean isEnabled() {

-        ArgoDiagram dia = ProjectManager.getManager().

-            getCurrentProject().getActiveDiagram();

-        if (dia == null) return false;

+        ArgoDiagram dia = ProjectManager.getManager().getCurrentProject()

+                .getActiveDiagram();

+        if (dia == null) {

+            return false;

+        }

         MutableGraphModel gm = (MutableGraphModel) dia.getGraphModel();

-        Iterator iter = objects.iterator();

-        while (iter.hasNext()) {

-            Object o = iter.next();

+        for (Object o : objects) {

             if (gm.canAddNode(o)) {

                 return true;

             }

@@ -81,19 +82,18 @@
     /*

      * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)

      */

+    @Override

     public void actionPerformed(ActionEvent ae) {

         super.actionPerformed(ae);

         if (!objects.isEmpty()) {

             // Use DiagramInterface to add classes to diagram

-            ArgoDiagram dia = ProjectManager.getManager().

-                getCurrentProject().getActiveDiagram();

+            ArgoDiagram dia = ProjectManager.getManager().getCurrentProject()

+                    .getActiveDiagram();

             if (dia != null) {

                 DiagramInterface diagram =

                     new DiagramInterface(Globals.curEditor());

                 diagram.setCurrentDiagram(dia);

-                Iterator iter = objects.iterator();

-                while (iter.hasNext()) {

-                    Object o = iter.next();

+                for (Object o : objects) {

                     if (Model.getFacade().isAClass(o)) {

                         diagram.addClass(o, false);

                     } else if (Model.getFacade().isAInterface(o)) {

@@ -103,4 +103,4 @@
             }

         }

     }

-} /* end class ActionAddExistingNodes */

+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.