svn commit: r16537 - trunk/src/argouml-app/src/org/argouml/uml/diagram: static_structure/ui ui

Michiel van der Wulp <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2009-01-06 23:24:02-0800
New Revision: 16537

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigKeyword.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java

Log:
Improvement on the fix for issue 5593: Enumerations get a <<datatype>> keyword.
This reinstates the "final" on the keyword string, since it is a better design.

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java?view=diff&pathrev=16537&r1=16536&r2=16537
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java	2009-01-06 23:24:02-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2008 The Regents of the University of California. All
+// Copyright (c) 1996-2009 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
@@ -44,8 +44,11 @@
  * (cloned from FigInterface - perhaps they should both specialize
  * a common supertype).
  * <p>
- * A Datatype may show compartments for stereotypes
- * and operations. Attributes are not supported in ArgoUML.
+ * A DataType may show compartments for stereotypes
+ * and operations. Attributes are not supported in ArgoUML. <p>
+ * 
+ * Every DataType shows a keyword, but it is not 
+ * always <<datatype>>, e.g. for an Enumeration.
  */
 public class FigDataType extends FigClassifierBox {
 
@@ -85,7 +88,7 @@
     }
 
     private void constructFigs() {
-        getStereotypeFig().setKeyword("datatype");
+        getStereotypeFig().setKeyword(getKeyword());
 
 
         setSuppressCalcBounds(true);
@@ -161,7 +164,18 @@
         this(gm, node);        
         getStereotypeFig().setKeyword(keyword);
     }
-    
+
+    /**
+     * This function shall return the keyword to be used by the constructor. <p>
+     * 
+     * Subclasses of DataType shall 
+     * override this method to set their own keyword.
+     * 
+     * @return the string to be used as the keyword
+     */
+    protected String getKeyword() {
+        return "datatype";
+    }
 
     /*
      * @see org.tigris.gef.presentation.Fig#makeSelection()

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java?view=diff&pathrev=16537&r1=16536&r2=16537
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java	2009-01-06 23:24:02-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2008 The Regents of the University of California. All
+// Copyright (c) 1996-2009 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
@@ -39,7 +39,6 @@
 import org.argouml.uml.diagram.DiagramSettings;
 import org.argouml.uml.diagram.ui.EnumLiteralsCompartmentContainer;
 import org.argouml.uml.diagram.ui.FigEnumLiteralsCompartment;
-import org.argouml.uml.diagram.ui.FigStereotypesGroup;
 import org.argouml.uml.ui.foundation.core.ActionAddEnumerationLiteral;
 import org.tigris.gef.base.Selection;
 import org.tigris.gef.graph.GraphModel;
@@ -71,8 +70,6 @@
     @Deprecated
     public FigEnumeration() {
         super();
-        FigStereotypesGroup fsc = getStereotypeFig();
-        fsc.setKeyword("enumeration");
 
         enableSizeChecking(true);
         setSuppressCalcBounds(false);
@@ -114,7 +111,6 @@
     public FigEnumeration(Object owner, Rectangle bounds,
             DiagramSettings settings) {
         super(owner, bounds, settings);
-        getStereotypeFig().setKeyword("enumeration");
 
         enableSizeChecking(true);
         setSuppressCalcBounds(false);
@@ -125,6 +121,11 @@
 
         setBounds(getBounds());
     }
+
+    @Override
+    protected String getKeyword() {
+        return "enumeration";
+    }
     
     /*
      * @see org.argouml.uml.diagram.static_structure.ui.FigDataType#makeSelection()

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigKeyword.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigKeyword.java?view=diff&pathrev=16537&r1=16536&r2=16537
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigKeyword.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigKeyword.java	2009-01-06 23:24:02-0800
@@ -47,7 +47,7 @@
  */
 public class FigKeyword extends FigSingleLineText {
 
-    private String keywordText;
+    private final String keywordText;
 
     /**
      * @param keyword the text to show
@@ -93,7 +93,7 @@
      */
     @Override
     public void setText(String text) {
-        keywordText = text;
+        assert keywordText.equals(text);
         super.setText(NotationUtilityUml.formatStereotype(text,
                 getSettings().getNotationSettings().isUseGuillemets()));
     }

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java?view=diff&pathrev=16537&r1=16536&r2=16537
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java	2009-01-06 23:24:02-0800
@@ -299,8 +299,6 @@
             } else {
                 // The keyword fig already exists.
                 removeCollection.remove(keywordFig);
-                // Make sure it has the right text
-                keywordFig.setText(keyword);
             }
             ++stereotypeCount;
         }

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

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.