svn commit: r19290 - trunk/src/argouml-core-notation/src/org/argouml/notation2

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2011-04-27 04:21:44-0700
New Revision: 19290

Added:
   trunk/src/argouml-core-notation/src/org/argouml/notation2/StereotypeUmlNotation.java
Modified:
   trunk/src/argouml-core-notation/src/org/argouml/notation2/UmlNotationLanguage.java

Log:
Work started on stereotype notation

Added: trunk/src/argouml-core-notation/src/org/argouml/notation2/StereotypeUmlNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-notation/src/org/argouml/notation2/StereotypeUmlNotation.java?view=markup&pathrev=19290
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-notation/src/org/argouml/notation2/StereotypeUmlNotation.java	2011-04-27 04:21:44-0700
@@ -0,0 +1,61 @@
+/* $Id$
+ *******************************************************************************
+ * Copyright (c) 2011 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:
+ *    Bob Tarling
+ *******************************************************************************
+ */
+
+package org.argouml.notation2;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.SwingUtilities;
+
+import org.argouml.model.InvalidElementException;
+import org.argouml.model.Model;
+
+public class StereotypeUmlNotation implements NotationText,
+        PropertyChangeListener {
+
+    final private NotatedItem notatedItem;
+
+    StereotypeUmlNotation(NotatedItem item) {
+        notatedItem = item;
+    }
+    
+    public Object getMetaType() {
+        return notatedItem.getMetaType();
+    }
+
+    public NotationType getNotationType() {
+        return notatedItem.getNotationType();
+    }
+
+    public void propertyChange(PropertyChangeEvent arg0) {
+        try {
+            final Object owner = notatedItem.getOwner();
+            final String name = Model.getFacade().getName(owner);
+            
+            Runnable doWorkRunnable = new Runnable() {
+                public void run() {
+                        NotationTextEvent event = new UmlNotationTextEvent(
+                                "<<" + name + ">>", 
+                                false, 
+                                false, 
+                                false);
+                        notatedItem.notationTextChanged(event);
+                }  
+            };
+            SwingUtilities.invokeLater(doWorkRunnable);
+        } catch (InvalidElementException e) {
+        }
+    }
+
+}

Modified: trunk/src/argouml-core-notation/src/org/argouml/notation2/UmlNotationLanguage.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-notation/src/org/argouml/notation2/UmlNotationLanguage.java?view=diff&pathrev=19290&r1=19289&r2=19290
==============================================================================
--- trunk/src/argouml-core-notation/src/org/argouml/notation2/UmlNotationLanguage.java	(original)
+++ trunk/src/argouml-core-notation/src/org/argouml/notation2/UmlNotationLanguage.java	2011-04-27 04:21:44-0700
@@ -13,6 +13,8 @@
 
 package org.argouml.notation2;
 
+import java.beans.PropertyChangeListener;
+
 import org.argouml.model.Model;
 
 class UmlNotationLanguage implements NotationLanguage {
@@ -23,9 +25,14 @@
 
     public NotationText createNotationText(NotatedItem item) {
         
-        NameUmlNotation nt = new NameUmlNotation(item);
+        final NotationText nt;
+        if (Model.getMetaTypes().getStereotype().equals(item.getMetaType())) {
+            nt = new StereotypeUmlNotation(item);
+        } else {
+            nt = new NameUmlNotation(item);
+        }
         Model.getPump().addModelEventListener(
-                nt, item.getOwner());
+                (PropertyChangeListener) nt, item.getOwner());
         
         return nt;
     }

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

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.