Author: bobtarling
Date: 2011-05-04 07:28:34-0700
New Revision: 19346

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

Log:
After a notation is created and attached to its listener fire a first event 
straight back to the listeenr telling it what npotation text to display - as a 
result stereotypes now display after being applied in the UML2 activity diagram 
(but not yet in the right place)

Modified: 
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=diff&pathrev=19346&r1=19345&r2=19346
==============================================================================
--- 
trunk/src/argouml-core-notation/src/org/argouml/notation2/StereotypeUmlNotation.java
        (original)
+++ 
trunk/src/argouml-core-notation/src/org/argouml/notation2/StereotypeUmlNotation.java
        2011-05-04 07:28:34-0700
@@ -41,13 +41,14 @@
     public void propertyChange(PropertyChangeEvent arg0) {
         try {
             final Object owner = notatedItem.getOwner();
-            final String name = Model.getFacade().getName(owner);
+            final String name = "<<" + Model.getFacade().getName(owner) + ">>";
+            final boolean isAbstract = Model.getFacade().isAbstract(owner);
             
             Runnable doWorkRunnable = new Runnable() {
                 public void run() {
                         NotationTextEvent event = new UmlNotationTextEvent(
-                                "<<" + name + ">>", 
-                                false, 
+                                name, 
+                                isAbstract, 
                                 false, 
                                 false);
                         notatedItem.notationTextChanged(event);

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=19346&r1=19345&r2=19346
==============================================================================
--- 
trunk/src/argouml-core-notation/src/org/argouml/notation2/UmlNotationLanguage.java
  (original)
+++ 
trunk/src/argouml-core-notation/src/org/argouml/notation2/UmlNotationLanguage.java
  2011-05-04 07:28:34-0700
@@ -26,7 +26,8 @@
     public NotationText createNotationText(NotatedItem item) {
         
         final NotationText nt;
-        if (Model.getMetaTypes().getStereotype().equals(item.getMetaType())) {
+        if (Model.getCoreHelper().isSubType(
+                Model.getMetaTypes().getStereotype(), item.getMetaType())) {
             nt = new StereotypeUmlNotation(item);
         } else {
             nt = new NameUmlNotation(item);
@@ -34,6 +35,10 @@
         Model.getPump().addModelEventListener(
                 (PropertyChangeListener) nt, item.getOwner());
         
+        // As soon as we've created a notation and have registered it listener
+        // force an event to go to the listener so it draws for the first time.
+        ((PropertyChangeListener) nt).propertyChange(null);
+        
         return nt;
     }
 }

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

To unsubscribe from this discussion, e-mail: 
[[email protected]].

Reply via email to