svn commit: r15521 - branches/gsoc2008/feature4_5142_bszanto/src/org/argouml: Images application/helpers i18n uml/diagram/static_structure/ui uml/diagram/ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bszanto
Date: 2008-08-08 07:35:32-0700
New Revision: 15521

Added:
   branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/Images/ClassWizard.gif   (contents, props changed)
   branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/ClassCreateWizard.java
   branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CmdCreateNodeWizard.java
   branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CreateWizard.java
Modified:
   branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/application/helpers/ResourceLoaderWrapper.java
   branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/i18n/button.properties
   branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/UMLClassDiagram.java
   branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/UMLDiagram.java

Log:
New elements (classes, interfaces, image) that will be used to create the Build Class Wizard.

Added: branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/Images/ClassWizard.gif
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/Images/ClassWizard.gif?view=auto&rev=15521
==============================================================================
Binary file. No diff available.

Modified: branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/application/helpers/ResourceLoaderWrapper.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/application/helpers/ResourceLoaderWrapper.java?view=diff&rev=15521&p1=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/application/helpers/ResourceLoaderWrapper.java&p2=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/application/helpers/ResourceLoaderWrapper.java&r1=15520&r2=15521
==============================================================================
--- branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/application/helpers/ResourceLoaderWrapper.java	(original)
+++ branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/application/helpers/ResourceLoaderWrapper.java	2008-08-08 07:35:32-0700
@@ -366,6 +366,7 @@
         images.put("button.new-callstate", "CallState");
         images.put("button.new-choice", "Choice");
         images.put("button.new-class", "Class");
+        images.put("button.new-class-wizard", "ClassWizard");
         images.put("button.new-classifierrole", "ClassifierRole");
         images.put("button.new-commentlink", "CommentLink");
         images.put("button.new-component", "Component");

Modified: branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/i18n/button.properties
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/i18n/button.properties?view=diff&rev=15521&p1=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/i18n/button.properties&p2=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/i18n/button.properties&r1=15520&r2=15521
==============================================================================
--- branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/i18n/button.properties	(original)
+++ branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/i18n/button.properties	2008-08-08 07:35:32-0700
@@ -94,6 +94,7 @@
 button.new-changeevent = Change Event
 button.new-choice = New Choice
 button.new-class = New Class
+button.new-class-wizard = New Class Wizard
 button.new-classifierinstate = New ClassifierInState
 button.new-classifierrole = New Classifier Role
 button.new-commentlink = New Comment Link

Added: branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/ClassCreateWizard.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/ClassCreateWizard.java?view=auto&rev=15521
==============================================================================
--- (empty file)
+++ branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/ClassCreateWizard.java	2008-08-08 07:35:32-0700
@@ -0,0 +1,47 @@
+// $Id: svn:keywords $

+// Copyright (c) 2008 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

+// and this paragraph appear in all copies. This software program and

+// documentation are copyrighted by The Regents of the University of

+// California. The software program and documentation are supplied "AS

+// IS", without any accompanying services from The Regents. The Regents

+// does not warrant that the operation of the program will be

+// uninterrupted or error-free. The end-user understands that the program

+// was developed for research purposes and is advised not to rely

+// exclusively on the program for any reason. IN NO EVENT SHALL THE

+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,

+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,

+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF

+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF

+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY

+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF

+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE

+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF

+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,

+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

+

+package org.argouml.uml.diagram.static_structure.ui;

+

+import javax.swing.JOptionPane;

+

+import org.argouml.model.Model;

+import org.argouml.uml.diagram.ui.CreateWizard;

+

+/**

+ * Wizard for creating a new Class.

+ *

+ * @author bszanto

+ */

+public class ClassCreateWizard implements CreateWizard {

+

+    

+    public Object display() {

+        JOptionPane.showMessageDialog(null, "This will be a wizard!", 

+                "Create new class wizard", JOptionPane.PLAIN_MESSAGE);

+        // only creates a new class now

+        return Model.getCoreFactory().createClass();

+    }

+

+}


Modified: branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/UMLClassDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/UMLClassDiagram.java?view=diff&rev=15521&p1=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/UMLClassDiagram.java&p2=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/UMLClassDiagram.java&r1=15520&r2=15521
==============================================================================
--- branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/UMLClassDiagram.java	(original)
+++ branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/UMLClassDiagram.java	2008-08-08 07:35:32-0700
@@ -65,6 +65,7 @@
     // actions for toolbar
     private Action actionAssociationClass;
     private Action actionClass;
+    private Action actionClassWizard;
     private Action actionInterface;
     private Action actionDependency;
     private Action actionPermission;
@@ -165,6 +166,7 @@
         Object[] actions = {
             getActionPackage(),
             getActionClass(),
+            getActionClassWizard(),
             null,
             getAssociationActions(),
             getAggregationActions(),
@@ -321,6 +323,19 @@
 
         return actionClass;
     }
+    
+    /**
+     * @return Returns the actionClassWizard.
+     */
+    protected Action getActionClassWizard() {
+        if (actionClassWizard == null) {
+            actionClassWizard = 
+                makeCreateNodeActionWizard(Model.getMetaTypes().getUMLClass(),
+                    "button.new-class-wizard", new ClassCreateWizard());
+        }
+
+        return actionClassWizard;
+    }
 
     /**
     * @return Returns the actionAssociationClass.

Added: branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CmdCreateNodeWizard.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CmdCreateNodeWizard.java?view=auto&rev=15521
==============================================================================
--- (empty file)
+++ branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CmdCreateNodeWizard.java	2008-08-08 07:35:32-0700
@@ -0,0 +1,81 @@
+// $Id: svn:keywords $

+// Copyright (c) 2008 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

+// and this paragraph appear in all copies. This software program and

+// documentation are copyrighted by The Regents of the University of

+// California. The software program and documentation are supplied "AS

+// IS", without any accompanying services from The Regents. The Regents

+// does not warrant that the operation of the program will be

+// uninterrupted or error-free. The end-user understands that the program

+// was developed for research purposes and is advised not to rely

+// exclusively on the program for any reason. IN NO EVENT SHALL THE

+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,

+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,

+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF

+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF

+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY

+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF

+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE

+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF

+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,

+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

+

+package org.argouml.uml.diagram.ui;

+

+import java.awt.event.ActionEvent;

+

+import javax.swing.Action;

+

+import org.argouml.application.helpers.ResourceLoaderWrapper;

+import org.argouml.i18n.Translator;

+import org.tigris.gef.base.CreateNodeAction;

+

+/**

+ * This class creates a new node using a CreateWizard.

+ * 

+ * @author bszanto

+ */

+public class CmdCreateNodeWizard extends CreateNodeAction {

+    

+    /**

+     * Wizard to use

+     */

+    private CreateWizard wizard = null;

+    

+    /**

+     * Object to be created.

+     */

+    private Object node;

+

+    /**

+     * @param modelElement

+     * @param name

+     * @param wiz

+     */

+    public CmdCreateNodeWizard(Object modelElement, String name, CreateWizard wiz) {

+        super(modelElement,

+                name,

+                ResourceLoaderWrapper.lookupIconResource(

+                        ResourceLoaderWrapper.getImageBinding(name)));

+        wizard = wiz;

+        putValue(Action.SHORT_DESCRIPTION, Translator.localize(name));

+        

+        System.out.println("done");

+    }

+    

+    @Override

+    public void actionPerformed(ActionEvent e) {

+        super.actionPerformed(e);

+        

+        // displays the wizard that returns the node to be created

+        node = wizard.display();

+    }

+    

+    @Override

+    public Object makeNode() {

+        return node;

+    }

+

+}


Added: branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CreateWizard.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CreateWizard.java?view=auto&rev=15521
==============================================================================
--- (empty file)
+++ branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CreateWizard.java	2008-08-08 07:35:32-0700
@@ -0,0 +1,42 @@
+// $Id: svn:keywords $

+// Copyright (c) 2008 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

+// and this paragraph appear in all copies. This software program and

+// documentation are copyrighted by The Regents of the University of

+// California. The software program and documentation are supplied "AS

+// IS", without any accompanying services from The Regents. The Regents

+// does not warrant that the operation of the program will be

+// uninterrupted or error-free. The end-user understands that the program

+// was developed for research purposes and is advised not to rely

+// exclusively on the program for any reason. IN NO EVENT SHALL THE

+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,

+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,

+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF

+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF

+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY

+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF

+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE

+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF

+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,

+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

+

+package org.argouml.uml.diagram.ui;

+

+/** 

+ * Interface to be implemented by all Wizards used for creating new elements 

+ * (Classes, Classifiers...). The class implementing this should create a 

+ * JDialog to be displayed using the display() method.

+ * @author bszanto

+ */

+public interface CreateWizard {

+    

+    /**

+     * Displays the wizard.

+     * @return the object to be created, null otherwise (if the object should 

+     * not be created) 

+     */

+    public Object display();

+

+}


Modified: branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/UMLDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/UMLDiagram.java?view=diff&rev=15521&p1=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/UMLDiagram.java&p2=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/UMLDiagram.java&r1=15520&r2=15521
==============================================================================
--- branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/UMLDiagram.java	(original)
+++ branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/UMLDiagram.java	2008-08-08 07:35:32-0700
@@ -420,6 +420,21 @@
     protected Action makeCreateNodeAction(Object modelElement, String descr) {
         return new RadioAction(new CmdCreateNode(modelElement, descr));
     }
+    
+    /**
+     * Factory method to build an Action for creating a node in the
+     * diagram using a CreateWizard.
+     *
+     * @param modelElement identifies the model element type to make
+     * @param descr the description to give this action.
+     * @param wizard the wizard to be used
+     * @return The action to create a new node.
+     */
+    protected Action makeCreateNodeActionWizard(Object modelElement, 
+            String descr, CreateWizard wizard) {
+        return new RadioAction(new CmdCreateNodeWizard(modelElement, descr, 
+                wizard));
+    }
 
     /**
      * Factory method to build an Action for creating an edge in the
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.