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

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2010-03-17 01:41:41-0700
New Revision: 18107

Added:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLReceptionSignalComboBoxModel.java
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLReceptionSpecificationDocument.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/meta/panels2.xml
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java

Log:
Add signal and specification to reception

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=18107&r1=18106&r2=18107
==============================================================================
--- 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-17 01:41:41-0700
@@ -2068,10 +2068,10 @@
     <attribute name="ownerScope" type="ScopeKind" />
     <attribute name="owner" type="Classifier" />
     <list name="parameter" type="Parameter" />
+    <combo name="signal" type="Signal" />
+    <textarea name="specification" type="String" />
     <!-- separator / -->
     <!-- list name="raisedSignal" type="BehavioralFeature" label="label.raisedsignals" / -->
-    <attribute name="specification" type="String" />
-    <attribute name="signal" type="Signal" />
   </panel>
   <panel name="LinkEnd">
     <text name="name" type="Name" />

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels2.xml
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels2.xml?view=diff&pathrev=18107&r1=18106&r2=18107
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels2.xml	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels2.xml	2010-03-17 01:41:41-0700
@@ -2036,6 +2036,7 @@
   </panel>
   <panel name="Reception">
     <text name="name" type="Name" />
+    <singlerow name="owner" type="Classifier" />
     <optionbox name="visibility" type="VisibilityKind" />
     <checkgroup name="modifiers">
       <checkbox name="isSpecification" type="Boolean" />
@@ -2044,13 +2045,12 @@
       <checkbox name="isLeaf" type="Boolean" />
       <checkbox name="isAbstract" type="Boolean" />
     </checkgroup>
-    <combo name="namespace" type="Namespace" />
-    <list name="clientDependency" type="Dependency" label="label.client-dependencies" />
     <list name="targetFlow" type="Flow" label="label.target-flows" />
     <list name="sourceFlow" type="Flow" label="label.source-flows" />
     <list name="comment" type="Comment" />
     <separator />
     <list name="templateParameter" type="TemplateParameter" label="label.template-parameters" />
+    <list name="clientDependency" type="Dependency" label="label.client-dependencies" />
     <list name="supplierDependency" type="ModelElement" label="label.supplier-dependencies" />
     <list name="presentation" type="ModelElement" />
     <list name="defaultedParameter" type="ModelElement" />
@@ -2063,15 +2063,11 @@
     <list name="classifierRole" type="ModelElement" />
     <list name="collaboration" type="ModelElement" />
     <list name="collaborationInstanceSet" type="ModelElement" />
-    <list name="partition" type="ModelElement" />
-    <list name="elementImport" type="ModelElement" label="label.element-import" />
     <attribute name="ownerScope" type="ScopeKind" />
     <attribute name="owner" type="Classifier" />
     <list name="parameter" type="Parameter" />
-    <separator />
-    <list name="raisedSignal" type="BehavioralFeature" label="label.raisedsignals" />
-    <attribute name="specification" type="String" />
-    <attribute name="signal" type="Signal" />
+    <combo name="signal" type="Signal" />
+    <textarea name="specification" type="String" />
   </panel>
   <panel name="LinkEnd">
     <text name="name" type="Name" />

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java?view=diff&pathrev=18107&r1=18106&r2=18107
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java	2010-03-17 01:41:41-0700
@@ -465,6 +465,13 @@
             comp = new UMLComboBoxNavigator(
                     Translator.localize("label.type.navigate.tooltip"),
                     combo);
+        } else if ("signal".equals(prop.getName())) {
+            final UMLComboBoxModel model =
+                new UMLReceptionSignalComboBoxModel(propertyName, target);
+            final JComboBox combo = new UMLComboBox(model);
+            comp = new UMLComboBoxNavigator(
+                    Translator.localize("label.type.navigate.tooltip"),
+                    combo);
         } else if ("specification".equals(prop.getName())) {
             final UMLComboBoxModel model =
                 new UMLMethodSpecificationComboBoxModel(propertyName, target);

Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLReceptionSignalComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLReceptionSignalComboBoxModel.java?view=markup&pathrev=18107
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLReceptionSignalComboBoxModel.java	2010-03-17 01:41:41-0700
@@ -0,0 +1,168 @@
+/* $Id: UMLReceptionSignalComboBoxModel.java 17890 2010-01-12 21:21:00Z linus $
+ *****************************************************************************
+ * Copyright (c) 2009 Contributors - see below
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    bobtarling
+ *****************************************************************************
+ *
+ * Some portions of this file was previously release using the BSD License:
+ */
+
+// Copyright (c) 1996-2006 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.core.propertypanels.ui;
+
+import java.awt.event.ActionEvent;
+import java.util.Collection;
+
+import javax.swing.Action;
+
+import org.argouml.kernel.Project;
+import org.argouml.kernel.ProjectManager;
+import org.argouml.model.Model;
+import org.argouml.model.RemoveAssociationEvent;
+import org.argouml.model.UmlChangeEvent;
+import org.argouml.ui.UndoableAction;
+
+
+/**
+ * The model for the signal combobox on the reception proppanel.
+ */
+public class UMLReceptionSignalComboBoxModel extends UMLComboBoxModel {
+
+    /**
+     * Constructor for UMLReceptionSignalComboBoxModel.
+     */
+    public UMLReceptionSignalComboBoxModel(
+        final String propertyName,
+        final Object target) {
+        super(propertyName, false);
+        Model.getPump().addClassModelEventListener(this,
+                Model.getMetaTypes().getNamespace(), "ownedElement");
+        setTarget(target);
+    }
+
+    /*
+     * @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList()
+     */
+    protected void buildModelList() {
+        Object target = getTarget();
+        if (Model.getFacade().isAReception(target)) {
+            Object rec = /*(MReception)*/ target;
+            removeAllElements();
+            Project p = ProjectManager.getManager().getCurrentProject();
+            Object model = p.getRoot();
+            setElements(Model.getModelManagementHelper()
+                    .getAllModelElementsOfKindWithModel(
+                            model,
+                            Model.getMetaTypes().getSignal()));
+            setSelectedItem(Model.getFacade().getSignal(rec));
+        }
+
+    }
+
+    /*
+     * @see org.argouml.uml.ui.UMLComboBoxModel2#isValidElement(Object)
+     */
+    protected boolean isValidElement(Object m) {
+        return Model.getFacade().isASignal(m);
+    }
+
+    /*
+     * @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
+     */
+    protected Object getSelectedModelElement() {
+        if (getTarget() != null) {
+            return Model.getFacade().getSignal(getTarget());
+        }
+        return null;
+    }
+
+    /**
+     * Override UMLComboBoxModel2's default handling of RemoveAssociation. We
+     * get this from MDR for the previous signal when a different signal is
+     * selected. Don't let that remove it from the combo box. Only remove it if
+     * the signal was removed from the namespace.
+     * <p>
+     * @param evt the event describing the property change
+     */
+    public void modelChanged(UmlChangeEvent evt) {
+        if (evt instanceof RemoveAssociationEvent) {
+            if ("ownedElement".equals(evt.getPropertyName())) {
+                Object o = getChangedElement(evt);
+                if (contains(o)) {
+                    if (o instanceof Collection) {
+                        removeAll((Collection) o);
+                    } else {
+                        removeElement(o);
+                    }
+                }
+            }
+        } else {
+            super.propertyChange(evt);
+        }
+    }
+    
+    public Action getAction() {
+        
+        return new SetAction();
+    }
+    
+    class SetAction extends UndoableAction {
+        
+        /**
+         * The class uid
+         */
+        private static final long serialVersionUID = 6281434994800778660L;
+
+        /**
+         * Constructor for ActionSetModelElementNamespace.
+         */
+        public SetAction() {
+            super();
+        }
+
+        /*
+         * @see java.awt.event.ActionListener#actionPerformed(
+         * java.awt.event.ActionEvent)
+         */
+        public void actionPerformed(ActionEvent e) {
+            Object source = e.getSource();
+            UMLComboBox box = (UMLComboBox) source;
+            Object o = getTarget();
+            o = box.getSelectedItem();
+            Object signal = o;
+            Object reception = getTarget();
+            if (signal != Model.getFacade().getSignal(reception)) {
+                super.actionPerformed(e);
+                Model.getCommonBehaviorHelper().setSignal(reception, signal);
+            }
+        }
+    }
+}

Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLReceptionSpecificationDocument.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLReceptionSpecificationDocument.java?view=markup&pathrev=18107
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLReceptionSpecificationDocument.java	2010-03-17 01:41:41-0700
@@ -0,0 +1,78 @@
+/* $Id: UMLReceptionSpecificationDocument.java 17890 2010-01-12 21:21:00Z linus $
+ *****************************************************************************
+ * Copyright (c) 2009 Contributors - see below
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    tfmorris
+ *****************************************************************************
+ *
+ * Some portions of this file was previously release using the BSD License:
+ */
+
+// Copyright (c) 2003-2006 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.core.propertypanels.ui;
+
+import org.argouml.model.Model;
+import org.argouml.uml.ui.UMLPlainTextDocument;
+
+/**
+ *
+ * @author mkl
+ *
+ */
+public class UMLReceptionSpecificationDocument extends UMLPlainTextDocument {
+
+    /**
+     * Constructor.
+     */
+    public UMLReceptionSpecificationDocument() {
+        super("specification");
+    }
+
+    /*
+     * @see org.argouml.uml.ui.UMLPlainTextDocument#setProperty(java.lang.String)
+     */
+    protected void setProperty(String text) {
+        if (Model.getFacade().isAReception(getTarget())) {
+            Model.getCommonBehaviorHelper().setSpecification(getTarget(), text);
+        }
+
+    }
+
+    /*
+     * @see org.argouml.uml.ui.UMLPlainTextDocument#getProperty()
+     */
+    protected String getProperty() {
+        if (Model.getFacade().isAReception(getTarget())) {
+            return Model.getFacade().getSpecification(getTarget());
+        }
+        return null;
+    }
+
+}

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

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.