svn commit: r17507 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels: module panel

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2009-11-20 10:07:02-0800
New Revision: 17507

Modified:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/module/XmlPropertyPanelsModule.java
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/panel/XmlPropertyPanel.java

Log:
Temporarily allow the XML property panel to be viewed at the same time as the old panel implementation

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/module/XmlPropertyPanelsModule.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/module/XmlPropertyPanelsModule.java?view=diff&pathrev=17507&r1=17506&r2=17507
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/module/XmlPropertyPanelsModule.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/module/XmlPropertyPanelsModule.java	2009-11-20 10:07:02-0800
@@ -24,10 +24,15 @@
 
 package org.argouml.core.propertypanels.module;
 
+import javax.swing.JPanel;
+
 import org.apache.log4j.Logger;
 import org.argouml.core.propertypanels.panel.XMLPropPanelFactory;
 import org.argouml.core.propertypanels.panel.XmlPropertyPanel;
 import org.argouml.moduleloader.ModuleInterface;
+import org.argouml.ui.DetailsPane;
+import org.argouml.ui.ProjectBrowser;
+import org.argouml.ui.targetmanager.TargetManager;
 import org.argouml.uml.ui.PropPanelFactory;
 import org.argouml.uml.ui.PropPanelFactoryManager;
 
@@ -48,33 +53,57 @@
     private static final Logger LOG =
         Logger.getLogger(XmlPropertyPanel.class);
     
-    private XmlPropertyPanel panel;
+    private TempTabPage tempPanel;
+    
+    /**
+     * It is useful during testing to view the current and new property panels
+     * side by side. This can be switched by changing this flag to replace
+     * the existing panels instead. Once XML Property Panels goes live all the
+     * code dependent on this being false can be removed and the flag itself
+     * removed.
+     */
+    private final static boolean REPLACE = false;
     
-    public boolean disable() {
-        return true;
-    }
-
     public boolean enable() { 
-        /* Set up the property panels for UML elements: */
-        try {
-            // Comment this out to see both panels together
-            PropPanelFactory elementFactory = XMLPropPanelFactory.getInstance();
-            PropPanelFactoryManager.addPropPanelFactory(elementFactory);
-            panel = new XmlPropertyPanel();
-            // comment out to here
+        
+        if (REPLACE) {
+            /* Set up the property panels for UML elements: */
+            try {
+                PropPanelFactory elementFactory = XMLPropPanelFactory.getInstance();
+                PropPanelFactoryManager.addPropPanelFactory(elementFactory);
+                return true;
+            } catch (Exception e) {
+                LOG.error("Exception caught", e);
+                return false;
+            }
+        } else {
+            DetailsPane detailsPane = (DetailsPane) ProjectBrowser.getInstance().getDetailsPane();
+            tempPanel = new TempTabPage();
+            detailsPane.addTab(tempPanel, true);
+            
+            TempListener listener = new TempListener(tempPanel);
+            TargetManager.getInstance().addTargetListener(listener);
             return true;
-        } catch (Exception e) {
-            LOG.error("Exception caught", e);
-            return false;
         }
     }
 
-    // Uncomment this to see both panels together
-//    public List<AbstractArgoJPanel> getDetailsTabs() {        
-//        List<AbstractArgoJPanel> result = new ArrayList<AbstractArgoJPanel>();
-//        result.add(panel);
-//        return result;
-//    }
+    public boolean disable() {
+        if (REPLACE) {
+            /* Set up the property panels for UML elements: */
+            try {
+                PropPanelFactory elementFactory = XMLPropPanelFactory.getInstance();
+                PropPanelFactoryManager.removePropPanelFactory(elementFactory);
+                return true;
+            } catch (Exception e) {
+                LOG.error("Exception caught", e);
+                return false;
+            }
+        } else {
+            DetailsPane detailsPane = (DetailsPane) ProjectBrowser.getInstance().getDetailsPane();
+            detailsPane.removeTab(tempPanel);
+            return true;
+        }
+    }
 
     public String getInfo(int type) {
         switch (type) {

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/panel/XmlPropertyPanel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/panel/XmlPropertyPanel.java?view=diff&pathrev=17507&r1=17506&r2=17507
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/panel/XmlPropertyPanel.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/panel/XmlPropertyPanel.java	2009-11-20 10:07:02-0800
@@ -43,5 +43,6 @@
     
     public XmlPropertyPanel() {
         super(new LabelledLayout());
+        setName("UML Properties");
     }
 }

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

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.