svn commit: r17540 - trunk/src/argouml-app/src/org/argouml: ui/explorer ui/explorer/rules uml/ui uml/ui/foundation/core

Christian López Espínola <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: penyaskito
Date: 2009-11-24 15:45:54-0800
New Revision: 17540

Added:
   trunk/src/argouml-app/src/org/argouml/ui/explorer/rules/GoModelElementToTemplateParameter.java
   trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelTemplateParameter.java
Modified:
   trunk/src/argouml-app/src/org/argouml/ui/explorer/PerspectiveManager.java
   trunk/src/argouml-app/src/org/argouml/uml/ui/ElementPropPanelFactory.java
   trunk/src/argouml-app/src/org/argouml/uml/ui/UmlObjectPropPanelFactory.java

Log:
Revert r17464, where Alexander Lepekhine removed an initial implementation of Template Parameter support.

Modified: trunk/src/argouml-app/src/org/argouml/ui/explorer/PerspectiveManager.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/explorer/PerspectiveManager.java?view=diff&pathrev=17540&r1=17539&r2=17540
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/ui/explorer/PerspectiveManager.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/ui/explorer/PerspectiveManager.java	2009-11-24 15:45:54-0800
@@ -63,6 +63,7 @@
 import org.argouml.ui.explorer.rules.GoModelElementToContainedDiagrams;
 import org.argouml.ui.explorer.rules.GoModelElementToContainedLostElements;
 import org.argouml.ui.explorer.rules.GoModelElementToContents;
+import org.argouml.ui.explorer.rules.GoModelElementToTemplateParameter;
 import org.argouml.ui.explorer.rules.GoModelToBaseElements;
 import org.argouml.ui.explorer.rules.GoModelToCollaboration;
 import org.argouml.ui.explorer.rules.GoModelToDiagrams;
@@ -346,6 +347,7 @@
         classPerspective.addRule(new GoSummaryToInheritance());
         classPerspective.addRule(new GoSummaryToIncomingDependency());
         classPerspective.addRule(new GoSummaryToOutgoingDependency());
+        classPerspective.addRule(new GoModelElementToTemplateParameter());
 
         ExplorerPerspective packagePerspective =
             new ExplorerPerspective(
@@ -374,6 +376,7 @@
         packagePerspective.addRule(new GoOperationToCollaboration());
         packagePerspective.addRule(new GoModelElementToComment());
         packagePerspective.addRule(new GoCollaborationToDiagram());
+        packagePerspective.addRule(new GoModelElementToTemplateParameter());
 
         /*
          * Removed the next one due to issue 2165.
@@ -533,6 +536,7 @@
             new GoInteractionToMessages(), new GoLinkToStimuli(),
             new GoMessageToAction(), new GoModelElementToComment(),
             new GoModelElementToBehavior(),
+            new GoModelElementToTemplateParameter(),
             new GoModelElementToContents(),
             new GoModelElementToContainedDiagrams(),
             new GoModelElementToContainedLostElements(),

Added: trunk/src/argouml-app/src/org/argouml/ui/explorer/rules/GoModelElementToTemplateParameter.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/explorer/rules/GoModelElementToTemplateParameter.java?view=markup&pathrev=17540
==============================================================================
--- (empty file)
+++ trunk/src/argouml-app/src/org/argouml/ui/explorer/rules/GoModelElementToTemplateParameter.java	2009-11-24 15:45:54-0800
@@ -0,0 +1,36 @@
+package org.argouml.ui.explorer.rules;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.argouml.i18n.Translator;
+import org.argouml.model.Model;
+
+public class GoModelElementToTemplateParameter extends AbstractPerspectiveRule {
+
+    @Override
+    public Collection getChildren(Object parent) {
+        if (Model.getFacade().isAClassifier(parent)) {
+            return Model.getFacade().getTemplateParameters(parent);
+        }
+        return Collections.emptyList();
+    }
+
+    @Override
+    public String getRuleName() {
+        return Translator.localize("misc.model-element.template-parameter");
+    }
+
+    public Set getDependencies(Object parent) {
+//        if (Model.getFacade().isAClassifier(parent)) {
+//            Set set = new HashSet();
+//            set.add(parent);
+//            return set;
+//        }
+        return Collections.emptySet();
+    }
+
+
+}

Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/ElementPropPanelFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/ElementPropPanelFactory.java?view=diff&pathrev=17540&r1=17539&r2=17540
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/ElementPropPanelFactory.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/ElementPropPanelFactory.java	2009-11-24 15:45:54-0800
@@ -99,6 +99,7 @@
 import org.argouml.uml.ui.foundation.core.PropPanelParameter;
 import org.argouml.uml.ui.foundation.core.PropPanelPermission;
 import org.argouml.uml.ui.foundation.core.PropPanelRelationship;
+import org.argouml.uml.ui.foundation.core.PropPanelTemplateParameter;
 import org.argouml.uml.ui.foundation.core.PropPanelUsage;
 import org.argouml.uml.ui.foundation.extension_mechanisms.PropPanelStereotype;
 import org.argouml.uml.ui.foundation.extension_mechanisms.PropPanelTagDefinition;
@@ -199,6 +200,8 @@
                 return new PropPanelStimulus();
             } else if (Model.getFacade().isATaggedValue(element)) {
                 return new PropPanelTaggedValue();
+            } else if (Model.getFacade().isATemplateParameter(element)) {
+                return new PropPanelTemplateParameter();
             } else if (Model.getFacade().isATagDefinition(element)) {
                 return new PropPanelTagDefinition();
             } else if (Model.getFacade().isATransition(element)) {

Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/UmlObjectPropPanelFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/UmlObjectPropPanelFactory.java?view=diff&pathrev=17540&r1=17539&r2=17540
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/UmlObjectPropPanelFactory.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/UmlObjectPropPanelFactory.java	2009-11-24 15:45:54-0800
@@ -26,6 +26,7 @@
 
 import org.argouml.model.Model;
 import org.argouml.uml.ui.foundation.core.PropPanelElementResidence;
+import org.argouml.uml.ui.foundation.core.PropPanelTemplateParameter;
 import org.argouml.uml.ui.model_management.PropPanelElementImport;
 
 /**
@@ -59,6 +60,9 @@
         if (Model.getFacade().isAElementResidence(object)) {
             return new PropPanelElementResidence();
         }
+        if (Model.getFacade().isATemplateParameter(object)) {
+            return new PropPanelTemplateParameter();
+        }
         return null;
     }
 

Added: trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelTemplateParameter.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelTemplateParameter.java?view=markup&pathrev=17540
==============================================================================
--- (empty file)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelTemplateParameter.java	2009-11-24 15:45:54-0800
@@ -0,0 +1,78 @@
+// $Id$
+// Copyright (c) 1996-2007 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.ui.foundation.core;
+
+import javax.swing.JTextField;
+
+import org.argouml.i18n.Translator;
+import org.argouml.model.Model;
+import org.argouml.uml.ui.PropPanel;
+import org.argouml.uml.ui.UMLPlainTextDocument;
+import org.argouml.uml.ui.UMLTextField2;
+
+/**
+ * PropPanel for a TemplateParameter.
+ * @author alepekhin
+ *
+ */
+public class PropPanelTemplateParameter extends PropPanelModelElement {
+
+    private static final long serialVersionUID = 8466952187322427678L;
+
+    public PropPanelTemplateParameter() {
+        super("label.template-parameter", null);
+        addField(Translator.localize("label.name"), new UMLTextField2(new UMLTemplateParameterDocument(
+                "TemplateParameter")));
+        // TODO: not implemented yet
+        addField("Type", new JTextField(""));
+        addField("Default Value", new JTextField(""));
+    }
+
+    public static class UMLTemplateParameterDocument extends
+            UMLPlainTextDocument {
+
+        private static final long serialVersionUID = -2597673735297949111L;
+
+        public UMLTemplateParameterDocument(String name) {
+            super(name);
+        }
+
+        private Object getParameter() {
+            return Model.getFacade().getParameter(getTarget());
+        }
+
+        @Override
+        protected void setProperty(String name) {
+            Model.getCoreHelper().setName(getParameter(), name);
+        }
+
+        @Override
+        protected String getProperty() {
+            String name = Model.getFacade().getName(getParameter());
+            return name;
+        }
+    }
+
+}

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

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.