svn commit: r19234 - trunk/src/argouml-app/src/org/argouml/ui/DetailsPane.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2011-04-13 07:15:49-0700
New Revision: 19234

Modified:
   trunk/src/argouml-app/src/org/argouml/ui/DetailsPane.java

Log:
Issue 6227: Do not transfer target events from details pane to TabProp

Modified: trunk/src/argouml-app/src/org/argouml/ui/DetailsPane.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/DetailsPane.java?view=diff&pathrev=19234&r1=19233&r2=19234
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/ui/DetailsPane.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/ui/DetailsPane.java	2011-04-13 07:15:49-0700
@@ -506,11 +506,12 @@
         }
         Object target = TargetManager.getInstance().getSingleTarget();
         
-        // If sel is the ToDo Tab (i.e. is an instance of TabToDoTarget), we 
-        // don't need to do anything, because the ToDo Tab is already dealt 
-        // with by it's own listener. TabProps is also deals with itself.
-        // TODO: Do we really need this for anything?
         if (!(sel instanceof TabToDoTarget) && !(sel instanceof TabProps)) {
+            // TODO: Bob says - tabs that listen for target changes should register themselves
+            // not expect DetailsPane to listen and pass on the event. Otherwise these tabs
+            // always rely on DetailsPane. TabToDoTarget and TabProps currently
+            // listen directly.
+            
             // The other tabs need to be updated depending on the selection.
             if (sel instanceof TabTarget) {
                 ((TabTarget) sel).setTarget(target);
@@ -674,22 +675,28 @@
         for (int i = 0; i < tabPanelList.size(); i++) {
             JPanel tab = tabPanelList.get(i);
             boolean shouldEnable = false;
-            if (tab instanceof TargetListener) {
-                if (tab instanceof TabTarget) {
-                    shouldEnable = ((TabTarget) tab).shouldBeEnabled(target);
-                } else {
-                    if (tab instanceof TabToDoTarget) {
-                        shouldEnable = true;
+            if (!(tab instanceof TabToDoTarget) && !(tab instanceof TabProps)) {
+                // TODO: Bob says - tabs that listen for target changes should register themselves
+                // not expect DetailsPane to listen and pass on the event. Otherwise these tabs
+                // always rely on DetailsPane. TabToDoTarget and TabProps currently
+                // listen directly.
+                if (tab instanceof TargetListener) {
+                    if (tab instanceof TabTarget) {
+                        shouldEnable = ((TabTarget) tab).shouldBeEnabled(target);
+                    } else {
+                        if (tab instanceof TabToDoTarget) {
+                            shouldEnable = true;
+                        }
                     }
+                    // TODO: Do we want all enabled tabs to listen or only the one
+                    // that is selected/visible? - tfm
+                    removeTargetListener((TargetListener) tab);
+                    if (shouldEnable) {
+                        addTargetListener((TargetListener) tab);
+                    }
+    
+                    topLevelTabbedPane.setEnabledAt(i, shouldEnable);
                 }
-                // TODO: Do we want all enabled tabs to listen or only the one
-                // that is selected/visible? - tfm
-                removeTargetListener((TargetListener) tab);
-                if (shouldEnable) {
-                    addTargetListener((TargetListener) tab);
-                }
-
-                topLevelTabbedPane.setEnabledAt(i, shouldEnable);
             }
         }
     }

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

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.