svn commit: r13503 - trunk: src_new/org/argouml/notation src_new/org/argouml/ui/cmd tests/org/argouml/notation tests/org/argouml/notation/providers

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2007-09-07 10:14:07-0700
New Revision: 13503

Modified:
   trunk/src_new/org/argouml/notation/Notation.java
   trunk/src_new/org/argouml/notation/NotationNameImpl.java
   trunk/src_new/org/argouml/ui/cmd/ActionNotation.java
   trunk/tests/org/argouml/notation/TestNotationProvider.java
   trunk/tests/org/argouml/notation/providers/TestNotation.java

Log:
Style.

Modified: trunk/src_new/org/argouml/notation/Notation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/notation/Notation.java?view=diff&rev=13503&p1=trunk/src_new/org/argouml/notation/Notation.java&p2=trunk/src_new/org/argouml/notation/Notation.java&r1=13502&r2=13503
==============================================================================
--- trunk/src_new/org/argouml/notation/Notation.java	(original)
+++ trunk/src_new/org/argouml/notation/Notation.java	2007-09-07 10:14:07-0700
@@ -239,7 +239,7 @@
      *
      * @return list of available notations
      */
-    public static List getAvailableNotations() {
+    public static List<NotationName> getAvailableNotations() {
         return NotationNameImpl.getAvailableNotations();
     }
     

Modified: trunk/src_new/org/argouml/notation/NotationNameImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/notation/NotationNameImpl.java?view=diff&rev=13503&p1=trunk/src_new/org/argouml/notation/NotationNameImpl.java&p2=trunk/src_new/org/argouml/notation/NotationNameImpl.java&r1=13502&r2=13503
==============================================================================
--- trunk/src_new/org/argouml/notation/NotationNameImpl.java	(original)
+++ trunk/src_new/org/argouml/notation/NotationNameImpl.java	2007-09-07 10:14:07-0700
@@ -58,7 +58,8 @@
     private String version;
     private Icon icon;
 
-    private static ArrayList notations = new ArrayList();
+    private static ArrayList<NotationName> notations = 
+        new ArrayList<NotationName>();
 
     /**
      * A notation without a version or icon.
@@ -209,7 +210,7 @@
      *
      * @return a List with all notations
      */
-    static List getAvailableNotations() {
+    static List<NotationName> getAvailableNotations() {
         return Collections.unmodifiableList(notations);
     }
 

Modified: trunk/src_new/org/argouml/ui/cmd/ActionNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/cmd/ActionNotation.java?view=diff&rev=13503&p1=trunk/src_new/org/argouml/ui/cmd/ActionNotation.java&p2=trunk/src_new/org/argouml/ui/cmd/ActionNotation.java&r1=13502&r2=13503
==============================================================================
--- trunk/src_new/org/argouml/ui/cmd/ActionNotation.java	(original)
+++ trunk/src_new/org/argouml/ui/cmd/ActionNotation.java	2007-09-07 10:14:07-0700
@@ -25,8 +25,6 @@
 package org.argouml.ui.cmd;
 
 import java.awt.event.ActionEvent;
-import java.util.List;
-import java.util.ListIterator;
 
 import javax.swing.Action;
 import javax.swing.ButtonGroup;
@@ -82,18 +80,11 @@
     public void actionPerformed(ActionEvent ae) {
     	super.actionPerformed(ae);
         String key = ae.getActionCommand();
-        List list = Notation.getAvailableNotations();
-        ListIterator iterator = list.listIterator();
-        while (iterator.hasNext()) {
-            Object o = iterator.next();
-            if (o instanceof NotationName) {
-                NotationName nn = (NotationName) o;
-                if (key.equals(nn.getTitle())) {
-                    Project p = ProjectManager.getManager()
-                            .getCurrentProject();
-                    p.getProjectSettings().setNotationLanguage(nn);
-                    break;
-                }
+        for (NotationName nn : Notation.getAvailableNotations()) {
+            if (key.equals(nn.getTitle())) {
+                Project p = ProjectManager.getManager().getCurrentProject();
+                p.getProjectSettings().setNotationLanguage(nn);
+                break;
             }
         }
     }
@@ -110,23 +101,17 @@
         Project p = ProjectManager.getManager().getCurrentProject();
         NotationName current = p.getProjectSettings().getNotationName();
         menu.removeAll();
-        List list = Notation.getAvailableNotations();
-        ListIterator iterator = list.listIterator();
         ButtonGroup b = new ButtonGroup();
-        while (iterator.hasNext()) {
-            Object o = iterator.next();
-            if (o instanceof NotationName) {
-                NotationName nn = (NotationName) o;
-                JRadioButtonMenuItem mi =
-                    new JRadioButtonMenuItem(nn.getTitle());
-                if (nn.getIcon() != null) {
-                    mi.setIcon(nn.getIcon());
-                }
-                mi.addActionListener(this);
-                b.add(mi);
-                mi.setSelected(current.sameNotationAs(nn));
-                menu.add(mi);
+        for (NotationName nn : Notation.getAvailableNotations()) {
+            JRadioButtonMenuItem mi =
+                new JRadioButtonMenuItem(nn.getTitle());
+            if (nn.getIcon() != null) {
+                mi.setIcon(nn.getIcon());
             }
+            mi.addActionListener(this);
+            b.add(mi);
+            mi.setSelected(current.sameNotationAs(nn));
+            menu.add(mi);
         }
     }
 

Modified: trunk/tests/org/argouml/notation/TestNotationProvider.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/tests/org/argouml/notation/TestNotationProvider.java?view=diff&rev=13503&p1=trunk/tests/org/argouml/notation/TestNotationProvider.java&p2=trunk/tests/org/argouml/notation/TestNotationProvider.java&r1=13502&r2=13503
==============================================================================
--- trunk/tests/org/argouml/notation/TestNotationProvider.java	(original)
+++ trunk/tests/org/argouml/notation/TestNotationProvider.java	2007-09-07 10:14:07-0700
@@ -26,15 +26,16 @@
 
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 
 import junit.framework.TestCase;
-import org.argouml.model.InitializeModel;
 
 import org.argouml.kernel.Project;
 import org.argouml.kernel.ProjectManager;
+import org.argouml.model.InitializeModel;
 import org.argouml.model.Model;
-import org.argouml.notation.NotationProvider;
 
 /**
  * @author Michiel
@@ -115,8 +116,10 @@
     public void testListener() {
         Object model =
             Model.getModelManagementFactory().createModel();
+        Collection<Object> c = new ArrayList<Object>();
+        c.add(model);
         Project p = ProjectManager.getManager().getCurrentProject();
-        p.setRoot(model);
+        p.setRoots(c);
         aClass = Model.getCoreFactory().buildClass(model);
         
         NotationProvider np = new NPImpl();

Modified: trunk/tests/org/argouml/notation/providers/TestNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/tests/org/argouml/notation/providers/TestNotation.java?view=diff&rev=13503&p1=trunk/tests/org/argouml/notation/providers/TestNotation.java&p2=trunk/tests/org/argouml/notation/providers/TestNotation.java&r1=13502&r2=13503
==============================================================================
--- trunk/tests/org/argouml/notation/providers/TestNotation.java	(original)
+++ trunk/tests/org/argouml/notation/providers/TestNotation.java	2007-09-07 10:14:07-0700
@@ -25,7 +25,6 @@
 package org.argouml.notation.providers;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import javax.swing.ImageIcon;
@@ -69,10 +68,9 @@
     }
     
     public void testNoDefaultNotation() {
-        List nots = new ArrayList(Notation.getAvailableNotations());
-        Iterator i = nots.iterator();
-        while (i.hasNext()) {
-            NotationName nn = (NotationName) i.next();
+        List<NotationName> nots = 
+            new ArrayList<NotationName>(Notation.getAvailableNotations());
+        for (NotationName nn : nots) {
             assertTrue("Not able to remove notation", 
                     Notation.removeNotation(nn));
         }
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.