svn commit: r14498 - trunk/src/argouml-app/src/org/argouml: i18n notation/providers/uml uml/diagram/deployment/ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2008-04-28 09:30:22-0700
New Revision: 14498

Modified:
   trunk/src/argouml-app/src/org/argouml/i18n/parsing.properties
   trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponent.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java

Log:
Corrected help-text for ComponentInstance: Notation for ComponentInstance does not support stereotypes.

Simplified the notation of FigComponentInstance.

Made the name of a new ComponentInstance underlined.

Comments, generics, style.

Issue 4903 only solved when a new ComponentInstance is drawn, not after loading.

Modified: trunk/src/argouml-app/src/org/argouml/i18n/parsing.properties
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/i18n/parsing.properties?view=diff&rev=14498&p1=trunk/src/argouml-app/src/org/argouml/i18n/parsing.properties&p2=trunk/src/argouml-app/src/org/argouml/i18n/parsing.properties&r1=14497&r2=14498
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/i18n/parsing.properties	(original)
+++ trunk/src/argouml-app/src/org/argouml/i18n/parsing.properties	2008-04-28 09:30:22-0700
@@ -70,7 +70,7 @@
   [ "<<" stereotype ">>" ]  name
 parsing.help.fig-componentinstance = Enter the name of the \
   componentinstance according: \
-  [ "<<" stereotype ">>" ] name [ ":" type [ "," type]*]
+  name [ ":" type [ "," type]*]
 parsing.help.fig-extensionpoint = Enter the Extension Point text according: \
   [ name ":" ] [ location ]
 parsing.help.fig-message = Enter the message definition according: \

Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java?view=diff&rev=14498&p1=trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java&p2=trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java&r1=14497&r2=14498
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java	2008-04-28 09:30:22-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 2005-2007 The Regents of the University of California. All
+// Copyright (c) 2005-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
@@ -52,6 +52,10 @@
 
     /**
      * Parse a line of the form: "name : base-component".
+     * <p>
+     * The base-component part is a comma separated list of Components. <p>
+     * 
+     * Note that stereotypes are not supported.
      *
      * {@inheritDoc}
      */
@@ -78,7 +82,7 @@
 
         tokenizer = new StringTokenizer(bases, ",");
 
-        List classifiers = new ArrayList();
+        List<Object> classifiers = new ArrayList<Object>();
         Object ns = Model.getFacade().getNamespace(modelElement);
         if (ns != null) {
             while (tokenizer.hasMoreElements()) {

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java?view=diff&rev=14498&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java&r1=14497&r2=14498
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java	2008-04-28 09:30:22-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 2007 The Regents of the University of California. All
+// Copyright (c) 2007-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
@@ -28,7 +28,6 @@
 import java.awt.Dimension;
 import java.awt.Rectangle;
 import java.beans.PropertyChangeEvent;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
@@ -36,11 +35,8 @@
 import org.argouml.model.AssociationChangeEvent;
 import org.argouml.model.AttributeChangeEvent;
 import org.argouml.model.Model;
-import org.argouml.uml.diagram.ui.FigEdgeModelElement;
 import org.argouml.uml.diagram.ui.FigNodeModelElement;
-import org.tigris.gef.base.Selection;
 import org.tigris.gef.graph.GraphModel;
-import org.tigris.gef.presentation.Fig;
 import org.tigris.gef.presentation.FigRect;
 import org.tigris.gef.presentation.FigText;
 
@@ -59,23 +55,28 @@
      * left edge of the main rectangle. Originally named BIGPORT_X (which
      * explains what BX stands for).
      */
-    protected static final int BX = 10;
-    protected static final int FINGER_HEIGHT = BX;
-    protected static final int FINGER_WIDTH = BX * 2;
+    private static final int BX = 10;
+    private static final int FINGER_HEIGHT = BX;
+    private static final int FINGER_WIDTH = BX * 2;
     private static final int OVERLAP = 0;
-    protected static final int DEFAULT_WIDTH = 120;
-    protected static final int DEFAULT_HEIGHT = 80;
-    protected FigRect cover;
-    protected FigRect upperRect;
-    protected FigRect lowerRect;
+    private static final int DEFAULT_WIDTH = 120;
+    private static final int DEFAULT_HEIGHT = 80;
+    private FigRect cover;
+    private FigRect upperRect;
+    private FigRect lowerRect;
 
+    /**
+     * The constructor.
+     */
     public AbstractFigComponent() {
         super();
         cover = new FigRect(BX, 10, DEFAULT_WIDTH, DEFAULT_HEIGHT, Color.black,
                 Color.white);
-        upperRect = new FigRect(0, 2 * FINGER_HEIGHT, FINGER_WIDTH, FINGER_HEIGHT,
+        upperRect = new FigRect(0, 2 * FINGER_HEIGHT, 
+                FINGER_WIDTH, FINGER_HEIGHT,
                 Color.black, Color.white);
-        lowerRect = new FigRect(0, 5 * FINGER_HEIGHT, FINGER_WIDTH, FINGER_HEIGHT,
+        lowerRect = new FigRect(0, 5 * FINGER_HEIGHT, 
+                FINGER_WIDTH, FINGER_HEIGHT,
                 Color.black, Color.white);
 
         getNameFig().setLineWidth(0);
@@ -99,16 +100,11 @@
     public AbstractFigComponent(GraphModel gm, Object node) {
         this();
         setOwner(node);
-        if (Model.getFacade().isAClassifier(node)
-                && (Model.getFacade().getName(node) != null)) {
-            getNameFig().setText(Model.getFacade().getName(node));
-        }
-        updateBounds();
     }
 
     @Override
     public Object clone() {
-        FigComponent figClone = (FigComponent) super.clone();
+        AbstractFigComponent figClone = (AbstractFigComponent) super.clone();
         Iterator it = figClone.getFigs().iterator();
         figClone.setBigPort((FigRect) it.next());
         figClone.cover = (FigRect) it.next();
@@ -133,12 +129,8 @@
 
     @Override
     protected void updateListeners(Object oldOwner, Object newOwner) {
-        if (oldOwner != null) {
-            removeAllElementListeners();
-        }
+        super.updateListeners(oldOwner, newOwner);
         if (newOwner != null) {
-            // add the listeners to the newOwner
-            addElementListener(newOwner);
             Collection c = Model.getFacade().getStereotypes(newOwner);
             Iterator i = c.iterator();
             while (i.hasNext()) {
@@ -148,13 +140,6 @@
         }
     }
 
-    /**
-     * @param b switch underline on or off
-     */
-    public void setUnderline(boolean b) {
-        getNameFig().setUnderline(b);
-    }
-
     @Override
     public void setLineColor(Color c) {
         cover.setLineColor(c);
@@ -167,11 +152,6 @@
     }
 
     @Override
-    public Selection makeSelection() {
-        return new SelectionComponent(this);
-    }
-
-    @Override
     public Dimension getMinimumSize() {
         Dimension stereoDim = getStereotypeFig().getMinimumSize();
         Dimension nameDim = getNameFig().getMinimumSize();
@@ -219,47 +199,6 @@
         updateEdges();
     }
 
-    @Override
-    public void setEnclosingFig(Fig encloser) {
-
-        Object comp = getOwner();
-        if (encloser != null
-                && (Model.getFacade().isANode(encloser.getOwner()) 
-                        || Model.getFacade().isAComponent(encloser.getOwner()))
-                && getOwner() != null) {
-            if (Model.getFacade().isANode(encloser.getOwner())) {
-                Object node = encloser.getOwner();
-                if (!Model.getFacade().getDeploymentLocations(comp).contains(
-                        node)) {
-                    Model.getCoreHelper().addDeploymentLocation(comp, node);
-                }
-            }
-            super.setEnclosingFig(encloser);
-
-            if (getLayer() != null) {
-                // elementOrdering(figures);
-                List contents = new ArrayList(getLayer().getContents());
-                Iterator it = contents.iterator();
-                while (it.hasNext()) {
-                    Object o = it.next();
-                    if (o instanceof FigEdgeModelElement) {
-                        FigEdgeModelElement figedge = (FigEdgeModelElement) o;
-                        figedge.getLayer().bringToFront(figedge);
-                    }
-                }
-            }
-        } else if (encloser == null && getEnclosingFig() != null) {
-            Object encloserOwner = getEnclosingFig().getOwner();
-            if (Model.getFacade().isANode(encloserOwner)
-                    && (Model.getFacade().getDeploymentLocations(comp)
-                            .contains(encloserOwner))) {
-                Model.getCoreHelper().removeDeploymentLocation(comp,
-                        encloserOwner);
-            }
-            super.setEnclosingFig(encloser);
-        }
-    }
-
     /**
      * TODO: This is not used anywhere. Can we remove it?
      * 
@@ -287,18 +226,6 @@
     }
 
     @Override
-    protected void updateStereotypeText() {
-        getStereotypeFig().setOwner(getOwner());
-    }
-
-    @Override
-    protected void textEditStarted(FigText ft) {
-        if (ft == getNameFig()) {
-            showHelp("parsing.help.fig-component");
-        }
-    }
-
-    @Override
     public Rectangle getHandleBox() {
         Rectangle r = getBounds();
         return new Rectangle(r.x + BX, r.y, r.width - BX, r.height);

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponent.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponent.java?view=diff&rev=14498&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponent.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponent.java&r1=14497&r2=14498
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponent.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponent.java	2008-04-28 09:30:22-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-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
@@ -25,9 +25,17 @@
 package org.argouml.uml.diagram.deployment.ui;
 
 import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Vector;
 
+import org.argouml.model.Model;
+import org.argouml.uml.diagram.ui.FigEdgeModelElement;
+import org.tigris.gef.base.Selection;
 import org.tigris.gef.graph.GraphModel;
+import org.tigris.gef.presentation.Fig;
+import org.tigris.gef.presentation.FigText;
 
 /**
  * Class to display graphics for a UML Component in a diagram.
@@ -52,6 +60,58 @@
         super(gm, node);
     }
 
+    @Override
+    protected void textEditStarted(FigText ft) {
+        if (ft == getNameFig()) {
+            showHelp("parsing.help.fig-component");
+        }
+    }
+
+    @Override
+    public Selection makeSelection() {
+        return new SelectionComponent(this);
+    }
+
+    @Override
+    public void setEnclosingFig(Fig encloser) {
+
+        Object comp = getOwner();
+        if (encloser != null
+                && (Model.getFacade().isANode(encloser.getOwner()) 
+                        || Model.getFacade().isAComponent(encloser.getOwner()))
+                && getOwner() != null) {
+            if (Model.getFacade().isANode(encloser.getOwner())) {
+                Object node = encloser.getOwner();
+                if (!Model.getFacade().getDeploymentLocations(comp).contains(
+                        node)) {
+                    Model.getCoreHelper().addDeploymentLocation(comp, node);
+                }
+            }
+            super.setEnclosingFig(encloser);
+
+            if (getLayer() != null) {
+                // elementOrdering(figures);
+                List contents = new ArrayList(getLayer().getContents());
+                Iterator it = contents.iterator();
+                while (it.hasNext()) {
+                    Object o = it.next();
+                    if (o instanceof FigEdgeModelElement) {
+                        FigEdgeModelElement figedge = (FigEdgeModelElement) o;
+                        figedge.getLayer().bringToFront(figedge);
+                    }
+                }
+            }
+        } else if (encloser == null && getEnclosingFig() != null) {
+            Object encloserOwner = getEnclosingFig().getOwner();
+            if (Model.getFacade().isANode(encloserOwner)
+                    && (Model.getFacade().getDeploymentLocations(comp)
+                            .contains(encloserOwner))) {
+                Model.getCoreHelper().removeDeploymentLocation(comp,
+                        encloserOwner);
+            }
+            super.setEnclosingFig(encloser);
+        }
+    }
 
     /*
      * @see org.tigris.gef.ui.PopupGenerator#getPopUpActions(java.awt.event.MouseEvent)

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java?view=diff&rev=14498&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java&r1=14497&r2=14498
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java	2008-04-28 09:30:22-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-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
@@ -25,15 +25,12 @@
 package org.argouml.uml.diagram.deployment.ui;
 
 import java.awt.Color;
-import java.awt.Rectangle;
 import java.awt.event.MouseEvent;
-import java.beans.PropertyVetoException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
 import org.argouml.model.Model;
-import org.argouml.notation.NotationProvider;
 import org.argouml.notation.NotationProviderFactory2;
 import org.argouml.uml.diagram.ui.FigEdgeModelElement;
 import org.tigris.gef.base.Editor;
@@ -41,7 +38,6 @@
 import org.tigris.gef.base.Selection;
 import org.tigris.gef.graph.GraphModel;
 import org.tigris.gef.presentation.Fig;
-import org.tigris.gef.presentation.FigText;
 
 /**
  * Class to display graphics for a UML ComponentInstance in a diagram.
@@ -50,8 +46,6 @@
  */
 public class FigComponentInstance extends AbstractFigComponent {
 
-    private NotationProvider notationProvider;
-
     /**
      * Construct a default ComponentInstance figure.
      */
@@ -68,19 +62,12 @@
      */
     public FigComponentInstance(GraphModel gm, Object node) {
         super(gm, node);
+        getNameFig().setUnderline(true);
     }
 
-    /*
-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#initNotationProviders(java.lang.Object)
-     */
     @Override
-    protected void initNotationProviders(Object own) {
-        super.initNotationProviders(own);
-        if (Model.getFacade().isAComponentInstance(own)) {
-            notationProvider =
-                NotationProviderFactory2.getInstance().getNotationProvider(
-                    NotationProviderFactory2.TYPE_COMPONENTINSTANCE, own);
-        }
+    protected int getNotationProviderType() {
+        return NotationProviderFactory2.TYPE_COMPONENTINSTANCE;
     }
 
     /*
@@ -107,7 +94,6 @@
         }
     }
 
-   
     /*
      * @see org.tigris.gef.presentation.Fig#makeSelection()
      */
@@ -198,46 +184,4 @@
         }
     }
 
-
-    /*
-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEdited(org.tigris.gef.presentation.FigText)
-     */
-    @Override
-    protected void textEdited(FigText ft) throws PropertyVetoException {
-        if (ft == getNameFig()) {
-            notationProvider.parse(getOwner(), ft.getText());
-            ft.setText(notationProvider.toString(getOwner(), null));
-        }
-    }
-
-    /*
-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEditStarted(org.tigris.gef.presentation.FigText)
-     */
-    @Override
-    protected void textEditStarted(FigText ft) {
-        if (ft == getNameFig()) {
-            showHelp(notationProvider.getParsingHelp());
-        }
-    }
-
-    /*
-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateStereotypeText()
-     */
-    @Override
-    protected void updateStereotypeText() {
-        getStereotypeFig().setOwner(getOwner());
-    }
-    
-    /*
-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateNameText()
-     */
-    @Override
-    protected void updateNameText() {
-        if (isReadyToEdit()) {
-            getNameFig().setText(notationProvider.toString(getOwner(), null));
-        }
-        Rectangle r = getBounds();
-        setBounds(r.x, r.y, r.width, r.height);
-    }
-
 }
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.