svn commit: r13411 - branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: b00__1
Date: 2007-08-19 11:30:50-0700
New Revision: 13411

Modified:
   branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java

Log:
Add the possibility to map property names

Modified: branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java?view=diff&rev=13411&p1=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java&p2=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java&r1=13410&r2=13411
==============================================================================
--- branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java	(original)
+++ branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/ModelEventPumpEUMLImpl.java	2007-08-19 11:30:50-0700
@@ -299,7 +299,7 @@
 
         if (notification.getEventType() == Notification.SET) {
             if (notification.getFeature() instanceof ENamedElement) {
-                String propName = ((ENamedElement) notification.getFeature()).getName();
+                String propName = mapPropertyName(((ENamedElement) notification.getFeature()).getName());
                 events.add(new EventAndListeners(new AttributeChangeEvent(
                         notification.getNotifier(), propName,
                         notification.getOldValue(), notification.getNewValue(),
@@ -310,16 +310,17 @@
                 || notification.getEventType() == Notification.REMOVE) {
             if (notification.getFeature() instanceof EReference) {
                 EReference ref = (EReference) notification.getFeature();
+                String propName = mapPropertyName(ref.getName());
                 if (notification.getEventType() == Notification.ADD) {
                     events.add(new EventAndListeners(new AddAssociationEvent(
-                            notification.getNotifier(), ref.getName(), null,
+                            notification.getNotifier(), propName, null,
                             notification.getNewValue(),
                             notification.getNewValue(), null), getListeners(
-                            notification.getNotifier(), ref.getName())));
+                            notification.getNotifier(), propName)));
                     events.add(new EventAndListeners(new AttributeChangeEvent(
-                            notification.getNotifier(), ref.getName(), null,
+                            notification.getNotifier(), propName, null,
                             notification.getNewValue(), null), getListeners(
-                            notification.getNotifier(), ref.getName())));
+                            notification.getNotifier(), propName)));
                 } else {
                     events.add(new EventAndListeners(
                             new DeleteInstanceEvent(
@@ -327,57 +328,58 @@
                                     "remove", null, null, null), getListeners(notification.getOldValue()))); //$NON-NLS-1$
                     events.add(new EventAndListeners(
                             new RemoveAssociationEvent(
-                                    notification.getNotifier(), ref.getName(),
+                                    notification.getNotifier(), propName,
                                     notification.getOldValue(), null,
                                     notification.getOldValue(), null),
                             getListeners(
-                                    notification.getNotifier(), ref.getName())));
+                                    notification.getNotifier(), propName)));
                     events.add(new EventAndListeners(
                             new AttributeChangeEvent(
-                                    notification.getNotifier(), ref.getName(),
+                                    notification.getNotifier(), propName,
                                     notification.getOldValue(), null, null),
                             getListeners(
-                                    notification.getNotifier(), ref.getName())));
+                                    notification.getNotifier(), propName)));
                 }
 
                 EReference oppositeRef = ref.getEOpposite();
                 if (oppositeRef != null) {
+                    propName = mapPropertyName(oppositeRef.getName());
                     if (notification.getEventType() == Notification.ADD) {
                         events.add(new EventAndListeners(
                                 new AddAssociationEvent(
                                         notification.getNewValue(),
-                                        oppositeRef.getName(), null,
+                                        propName, null,
                                         notification.getNotifier(),
                                         notification.getNotifier(), null),
                                 getListeners(
                                         notification.getNewValue(),
-                                        oppositeRef.getName())));
+                                        propName)));
                         events.add(new EventAndListeners(
                                 new AttributeChangeEvent(
                                         notification.getNewValue(),
-                                        oppositeRef.getName(), null,
+                                        propName, null,
                                         notification.getNotifier(), null),
                                 getListeners(
                                         notification.getNewValue(),
-                                        oppositeRef.getName())));
+                                        propName)));
                     } else {
                         events.add(new EventAndListeners(
                                 new AddAssociationEvent(
                                         notification.getOldValue(),
-                                        oppositeRef.getName(),
+                                        propName,
                                         notification.getNotifier(), null,
                                         notification.getNotifier(), null),
                                 getListeners(
                                         notification.getOldValue(),
-                                        oppositeRef.getName())));
+                                        propName)));
                         events.add(new EventAndListeners(
                                 new AttributeChangeEvent(
                                         notification.getOldValue(),
-                                        oppositeRef.getName(),
+                                        propName,
                                         notification.getNotifier(), null, null),
                                 getListeners(
                                         notification.getOldValue(),
-                                        oppositeRef.getName())));
+                                        propName)));
                     }
                 }
             }
@@ -444,5 +446,10 @@
     public void stopPumpingEvents() {
         rootContainerAdapter.setDeliverEvents(false);
     }
+    
+    private String mapPropertyName(String name) {
+        // TODO: map UML2 names to UML1.x names
+        return name;
+    }
 
 }
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.