svn commit: r18330 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels: model ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2010-04-24 06:23:53-0700
New Revision: 18330

Removed:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLInstanceClassifierListModel.java
Modified:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java

Log:
Replace popup with toolbuttons

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java?view=diff&pathrev=18330&r1=18329&r2=18330
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java	2010-04-24 06:23:53-0700
@@ -30,6 +30,7 @@
 import org.argouml.i18n.Translator;
 import org.argouml.kernel.Command;
 import org.argouml.kernel.NonUndoableCommand;
+import org.argouml.kernel.Project;
 import org.argouml.kernel.ProjectManager;
 import org.argouml.model.Model;
 import org.argouml.ui.targetmanager.TargetManager;
@@ -98,6 +99,7 @@
         addGetterSetter("action", new ActionGetterSetter());
         addGetterSetter("subvertex", new SubvertexGetterSetter());
         addGetterSetter("internalTransition", new InternalTransitionGetterSetter());
+        addGetterSetter("classifier", new ClassifierGetterSetter());
         
         // UML2 only
         addGetterSetter("ownedOperation", new FeatureGetterSetter());
@@ -1772,4 +1774,101 @@
             return Model.getMetaTypes().getTransition();
         }
     }
+    
+
+    private class ClassifierGetterSetter extends ListGetterSetter implements Addable, Removeable {
+        
+        public Collection getOptions(Object modelElement, String type) {
+            return Model.getFacade().getClassifiers(modelElement);
+        }
+      
+        public Object get(Object modelElement, String type) {
+            // not needed
+            return null;
+        }
+      
+        public void set(Object element, Object x) {
+            // not needed
+        }
+
+        public boolean isValidElement(Object element, String type) {
+            return getOptions(element, type).contains(element);
+        }
+        
+        public Object getMetaType() {
+            return Model.getMetaTypes().getClassifier();
+        }
+
+        public Command getAddCommand(Object modelElement) {
+    	return new AddCommand(modelElement);
+    }
+    
+    public Command getRemoveCommand(Object modelElement, Object objectToRemove) {
+    	return new RemoveCommand(modelElement, objectToRemove);
+    }
+    
+    private class AddCommand extends AddModelElementCommand {
+
+        /**
+         * Constructor for ActionAddPackageImport.
+         */
+        public AddCommand(Object target) {
+            super(target);
+        }
+
+
+        protected List getChoices() {
+            List list = new ArrayList();
+            
+            Project p = ProjectManager.getManager().getCurrentProject();
+            Object model = p.getRoot();
+            list.addAll(Model.getModelManagementHelper()
+                    .getAllModelElementsOfKindWithModel(model, Model.getMetaTypes().getClassifier()));
+            
+            return list;
+        }
+
+
+        protected List getSelected() {
+            List list = new ArrayList();
+            list.addAll(Model.getFacade().getClassifiers(getTarget()));
+            return list;
+        }
+
+
+        protected String getDialogTitle() {
+            return Translator.localize("dialog.title.add-specifications");
+        }
+
+
+        @Override
+        protected void doIt(Collection selected) {
+       	    Model.getCommonBehaviorHelper().setClassifiers(getTarget(), selected);
+        }
+    }
+    
+    private class RemoveCommand
+	    extends NonUndoableCommand {
+    	
+    	private final Object target;
+    	private final Object objectToRemove;
+    	
+	    /**
+	     * Constructor for ActionRemovePackageImport.
+	     */
+	    public RemoveCommand(final Object target, final Object objectToRemove) {
+	        this.target = target;
+	        this.objectToRemove = objectToRemove;
+	    }
+	    
+	    /*
+	     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+	     */
+	    public Object execute() {
+	        Model.getCommonBehaviorHelper()
+	            .removeClassifier(target, objectToRemove);
+	        return null;
+	    }
+	}
+    }
 }

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java?view=diff&pathrev=18330&r1=18329&r2=18330
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java	2010-04-24 06:23:53-0700
@@ -73,8 +73,6 @@
             model = new UMLClassifierRoleBaseListModel(modelElement);
         } else if ("baseClass".equals(propName)) {
             model = new UMLStereotypeBaseClassListModel(modelElement);
-        } else if ("classifier".equals(propName)) {
-            model = new UMLInstanceClassifierListModel(modelElement);
         } else if ("classifierInState".equals(propName)) {
             model = new UMLOFSStateListModel(modelElement);
         } else if ("client".equals(propName)) {

Removed: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLInstanceClassifierListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLInstanceClassifierListModel.java?view=markup&pathrev=18329

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2594282

To unsubscribe from this discussion, e-mail: [[email protected]].
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.