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

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2010-03-21 13:44:13-0700
New Revision: 18121

Removed:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLOperationMethodsListModel.java
Modified:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels.xml
   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
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SimpleListModel.java

Log:
Allow a Method to be added to an Operation in UML1.4

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels.xml
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels.xml?view=diff&pathrev=18121&r1=18120&r2=18121
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels.xml	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels.xml	2010-03-21 13:44:13-0700
@@ -598,14 +598,14 @@
     <list name="elementImport" type="ModelElement" label="label.element-import" />
     <attribute name="ownerScope" type="ScopeKind" />
     <attribute name="owner" type="Classifier" />
-    <list name="parameter" type="Parameter" />
+    <list name="parameter" type="org.omg.uml.foundation.core.Parameter" />
     <separator />
     <list name="raisedSignal" type="org.omg.uml.behavioralelements.commonbehavior.Signal" label="label.raisedsignals" />
   </panel>
   <panel name="Operation">
     <text name="name" type="Name" />
     <singlerow name="owner" type="Classifier" />
-    <list name="parameter" type="Parameter" />
+    <list name="parameter" type="org.omg.uml.foundation.core.Parameter" />
     <separator />    
     <optionbox name="visibility" type="VisibilityKind" />
     <checkgroup name="modifiers">
@@ -619,7 +619,7 @@
     <optionbox name="concurrency" type="CallConcurrencyKind" />
     <separator />
     <list name="raisedSignal" type="org.omg.uml.behavioralelements.commonbehavior.Signal" label="label.raisedsignals" />
-    <list name="method" type="Operation" />
+    <list name="method" type="org.omg.uml.foundation.core.Method" />
     <textarea name="specification" type="String" />
     
     <debug />
@@ -2067,7 +2067,7 @@
     <!--  list name="elementImport" type="ModelElement" label="label.element-import" / -->
     <attribute name="ownerScope" type="ScopeKind" />
     <attribute name="owner" type="Classifier" />
-    <list name="parameter" type="Parameter" />
+    <list name="parameter" type="org.omg.uml.foundation.core.Parameter" />
     <combo name="signal" type="Signal" />
     <textarea name="specification" type="String" />
     <!-- separator / -->
@@ -2680,7 +2680,7 @@
     <list name="collaborationInstanceSet" type="ModelElement" />
     <list name="partition" type="ModelElement" />
     <list name="elementImport" type="ModelElement" label="label.element-import" />
-    <list name="parameter" type="Parameter" />
+    <list name="parameter" type="org.omg.uml.foundation.core.Parameter" />
     <list name="state" type="Event" />
     <list name="transition" type="Event" />
   </panel>
@@ -2758,7 +2758,7 @@
     <text name="name" type="Name" />
     <combo name="namespace" type="Namespace" />
     <separator />
-    <list name="parameter" type="Parameter" />
+    <list name="parameter" type="org.omg.uml.foundation.core.Parameter" />
     <list name="transition" type="Event" />    
     <separator />
     <textarea name="when" type="TimeExpression" />
@@ -2792,7 +2792,7 @@
     <text name="name" type="Name" />
     <combo name="namespace" type="Namespace" />
     <separator />
-    <list name="parameter" type="Parameter" />
+    <list name="parameter" type="org.omg.uml.foundation.core.Parameter" />
     <list name="transition" type="Event" />
 	<separator />
 	<combo name="operation" type="Operation" />    
@@ -2826,7 +2826,7 @@
     <text name="name" type="Name" />
     <combo name="namespace" type="Namespace" />
     <separator />
-    <list name="parameter" type="Parameter" />
+    <list name="parameter" type="org.omg.uml.foundation.core.Parameter" />
     <list name="transition" type="Event" />    
     <separator />
     <list name="signal" type="Signal" />
@@ -2938,7 +2938,7 @@
     <text name="name" type="Name" />
     <combo name="namespace" type="Namespace" />
     <separator />
-    <list name="parameter" type="Parameter" />
+    <list name="parameter" type="org.omg.uml.foundation.core.Parameter" />
     <list name="transition" type="Event" />
     <separator />    
     <textarea name="changeExpression" type="BooleanExpression" />    
@@ -3726,7 +3726,7 @@
     <separator />
     <list name="outgoing" type="Transition" />
     <list name="incoming" type="Transition" />
-    <list name="parameter" type="Parameter" />
+    <list name="parameter" type="org.omg.uml.foundation.core.Parameter" />
 	
 	<debug />
     <attribute name="visibility" type="VisibilityKind" />

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=18121&r1=18120&r2=18121
==============================================================================
--- 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-03-21 13:44:13-0700
@@ -67,6 +67,7 @@
         addGetterSetter("ownedElement", new OwnedElementGetterSetter());
         addGetterSetter("raisedSignal", new RaisedExceptionGetterSetter());
         addGetterSetter("raisedException", new RaisedExceptionGetterSetter());
+        addGetterSetter("method", new MethodGetterSetter());
     }
     
     /**
@@ -693,6 +694,41 @@
         }
     }
     
+    private class MethodGetterSetter extends ListGetterSetter {
+        
+        /**
+         * Get all the method for the operation
+         * @param modelElement
+         * @param type
+         * @return
+         * @see org.argouml.core.propertypanels.model.GetterSetterManager.OptionGetterSetter#getOptions(java.lang.Object, java.lang.String)
+         */
+        public Collection getOptions(
+                final Object modelElement,
+                final String type) {
+            return Model.getFacade().getMethods(modelElement);
+        }
+      
+        public Object get(Object modelElement, String type) {
+            // not needed
+            return null;
+        }
+      
+        public void set(Object element, Object x) {
+            // not needed
+        }
+
+        protected boolean isValidElement(
+                final Object element,
+                final String type) {
+            return getOptions(element, type).contains(element);
+        }
+        
+        public Object getMetaType() {
+            return Model.getMetaTypes().getMethod();
+        }
+    }
+    
     private class ParameterGetterSetter extends ListGetterSetter {
         
         public Collection getOptions(Object modelElement, String type) {

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=18121&r1=18120&r2=18121
==============================================================================
--- 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-03-21 13:44:13-0700
@@ -7,7 +7,7 @@
  * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
- *    bobtarling
+ *    Bob Tarling
  *****************************************************************************
  *
  * Some portions of this file was previously release using the BSD License:
@@ -148,8 +148,6 @@
             model = new UMLEnumerationLiteralsListModel(modelElement);
         } else if ("message".equals(propName)) {
             model = new UMLInteractionMessagesListModel(modelElement);
-        } else if ("method".equals(propName)) {
-            model = new UMLOperationMethodsListModel(modelElement);
         } else if ("outgoing".equals(propName)) {
             model = new UMLStateVertexOutgoingListModel(modelElement);
         } else if ("partition".equals(propName)) {

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java?view=diff&pathrev=18121&r1=18120&r2=18121
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java	2010-03-21 13:44:13-0700
@@ -265,11 +265,12 @@
             metaTypes.add(metaType);
         }
 
-        LOG.info("Creating list for " + target);
-
-        LOG.info("model = " + model.getClass().getName());
-        LOG.info("metatype = " + metaType);
-        LOG.info("target = " + target);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Creating list for " + target);
+            LOG.debug("model = " + model.getClass().getName());
+            LOG.debug("metatype = " + metaType);
+            LOG.debug("target = " + target);
+        }
 
         add((JComponent) scroll);
 
@@ -299,17 +300,19 @@
             moveBottomAction = null;
         } else {
             if (!readonly) {
-        		// TODO: Lets build this into a separate buildToolbar method
+        	// TODO: Lets build this into a separate buildToolbar method
         		
                 // Create actions and expander if we have multiple rows
                 final ArrayList<Action> actions = new ArrayList<Action>(6);
 
                 for (Object meta : metaTypes) {
                     if (Model.getUmlFactory().isContainmentValid(meta, target)) {
+                        final String label =
+                            "button.new-" + Model.getMetaTypes().getName(meta).toLowerCase();
                         final Action createAction = new ActionCreateContainedModelElement(
                                 meta,
                                 target,
-                                "button.new-" + Model.getMetaTypes().getName(meta).toLowerCase());
+                                label);
                         actions.add(createAction);
                     }
                 }
@@ -336,7 +339,7 @@
                 toolbar = tbf.createToolBar();
                 toolbar.setRollover(true);
                 toolbar.setOrientation(ToolBar.VERTICAL);
-        	} else {
+            } else {
                 final ToolBarFactory tbf = new ToolBarFactory(new Object[] {});
                 toolbar = tbf.createToolBar();
                 toolbar.setRollover(true);
@@ -346,7 +349,7 @@
                 moveTopAction = null;
                 moveBottomAction = null;
                 deleteAction = null;
-        	}
+            }
 
             JPanel buttonPanel =
                 new JPanel(new FlexiGridLayout(2, 1, FlexiGridLayout.ROWCOLPREFERRED));
@@ -360,19 +363,19 @@
             }
             add(buttonPanel, BorderLayout.WEST);
 
-        	if (!Model.getModelManagementHelper().isReadOnly(target)) {
-	            getList().addListSelectionListener(deleteAction);
-	            // TODO: We should really test the model instead for this
-	            // but we have no API yet.
-	            // Can we just check if the collection to build the JList
-	            // control implements the List interface?
-	            if (Model.getUmlHelper().isMovable(metaType)) {
-	                getList().addListSelectionListener(moveUpAction);
-	                getList().addListSelectionListener(moveDownAction);
-	                getList().addListSelectionListener(moveTopAction);
-	                getList().addListSelectionListener(moveBottomAction);
-	            }
-        	}
+            if (!Model.getModelManagementHelper().isReadOnly(target)) {
+                getList().addListSelectionListener(deleteAction);
+                // TODO: We should really test the model instead for this
+                // but we have no API yet.
+                // Can we just check if the collection to build the JList
+                // control implements the List interface?
+                if (Model.getUmlHelper().isMovable(metaType)) {
+                    getList().addListSelectionListener(moveUpAction);
+                    getList().addListSelectionListener(moveDownAction);
+                    getList().addListSelectionListener(moveTopAction);
+                    getList().addListSelectionListener(moveBottomAction);
+                }
+            }
             
             getModel().addListDataListener(this);
         }

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SimpleListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SimpleListModel.java?view=diff&pathrev=18121&r1=18120&r2=18121
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SimpleListModel.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SimpleListModel.java	2010-03-21 13:44:13-0700
@@ -71,10 +71,15 @@
         try {
             final StringTokenizer st = new StringTokenizer(type, ",");
             while (st.hasMoreTokens()) {
-                metaTypes.add(Class.forName(st.nextToken()));
+                String className = st.nextToken();
+                if (className.contains(".")) {
+                    metaTypes.add(Class.forName(className));
+                } else {
+                    //LOG.debug(className + " is not recognised as a class name");
+                }
             }
         } catch (ClassNotFoundException e) {
-            LOG.warn("Exception", e);
+            LOG.warn("Exception building model for " + propertyName, e);
         }
         this.propertyName = propertyName;
         this.umlElement = umlElement;

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

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

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.