svn commit: r17504 - trunk/modules/dev/src/org/argouml/dev: . test

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2009-11-20 06:52:21-0800
New Revision: 17504

Modified:
   trunk/modules/dev/src/org/argouml/dev/DeveloperModule.java
   trunk/modules/dev/src/org/argouml/dev/test/TestPanel.java

Log:
Demo a simple JPanel added to details pane. This needs to be easier and more consistent for any area of the screen.

Modified: trunk/modules/dev/src/org/argouml/dev/DeveloperModule.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/modules/dev/src/org/argouml/dev/DeveloperModule.java?view=diff&pathrev=17504&r1=17503&r2=17504
==============================================================================
--- trunk/modules/dev/src/org/argouml/dev/DeveloperModule.java	(original)
+++ trunk/modules/dev/src/org/argouml/dev/DeveloperModule.java	2009-11-20 06:52:21-0800
@@ -25,8 +25,6 @@
 package org.argouml.dev;
 
 import java.awt.BorderLayout;
-import java.util.ArrayList;
-import java.util.List;
 
 import javax.swing.JComponent;
 import javax.swing.JLabel;
@@ -36,13 +34,12 @@
 import javax.swing.SwingConstants;
 
 import org.apache.log4j.Logger;
-import org.argouml.application.api.AbstractArgoJPanel;
 import org.argouml.dev.figinspector.FigInspectorPanel;
 import org.argouml.dev.test.TestPanel;
-import org.argouml.moduleloader.DetailsTabProvider;
 import org.argouml.moduleloader.ModuleInterface;
 import org.argouml.ui.AboutBox;
 import org.argouml.ui.ContextActionFactoryManager;
+import org.argouml.ui.DetailsPane;
 import org.argouml.ui.ProjectBrowser;
 import org.tigris.gef.undo.UndoManager;
 
@@ -51,12 +48,14 @@
  *
  * @author Bob Tarling
  */
-public final class DeveloperModule implements ModuleInterface,
-        DetailsTabProvider {
+public final class DeveloperModule implements ModuleInterface {
 
     private static final Logger LOG = Logger.getLogger(DeveloperModule.class);
     private static String aboutName = "Dev module";
     
+    private TestPanel testPanel;
+    private JTabbedPane devPanel;
+    
     /**
      * Wrapper.
      */
@@ -83,7 +82,7 @@
         // TODO: Modify to handle per-project undo
         UndoManager.getInstance().setUndoMax(10);
 
-        JTabbedPane devPanel = new JTabbedPane();
+        devPanel = new JTabbedPane();
 
         JComponent undoLogPanel = UndoLogPanel.getInstance();
         devPanel.addTab("Undo Stack", undoLogPanel);
@@ -100,6 +99,10 @@
         ProjectBrowser.getInstance().addPanel(devPanel, 
                 ProjectBrowser.Position.East);
 
+        DetailsPane detailsPane = (DetailsPane) ProjectBrowser.getInstance().getDetailsPane();
+        testPanel = new TestPanel();
+        detailsPane.addTab(testPanel, true);
+
         /* Demonstrate the About Box interface to add a tab: */
         JPanel tab = new JPanel(new BorderLayout());
         JLabel lbl1 = new JLabel(
@@ -107,6 +110,7 @@
                 + "<p>by</p><p>Bob Tarling</p></html>");
         lbl1.setHorizontalAlignment(SwingConstants.CENTER);
         tab.add(lbl1, BorderLayout.NORTH);
+
         AboutBox.addAboutTab(aboutName, tab);
         
         ContextActionFactoryManager.addContextPopupFactory(
@@ -127,10 +131,15 @@
         UndoManager.getInstance().empty();
         UndoManager.getInstance().setUndoMax(0);
 
-        JComponent undoLogPanel = UndoLogPanel.getInstance();
-        ProjectBrowser.getInstance().removePanel(undoLogPanel);
+        ProjectBrowser.getInstance().removePanel(devPanel);
         
         AboutBox.removeAboutTab(aboutName);
+        
+        DetailsPane detailsPane = (DetailsPane) ProjectBrowser.getInstance().getDetailsPane();
+        detailsPane.removeTab(testPanel);
+        
+        testPanel = null;
+        
         return true;
     }
 
@@ -163,14 +172,4 @@
      */
     private static final long serialVersionUID = -2570516012301142091L;
 
-    /**
-     * Return our details tab(s).  Proof of concept only.
-     * @return a list of details tabs
-     * @see org.argouml.moduleloader.DetailsTabProvider#getDetailsTabs()
-     */
-    public List<AbstractArgoJPanel> getDetailsTabs() {        
-        List<AbstractArgoJPanel> result = new ArrayList<AbstractArgoJPanel>();
-        result.add(TestPanel.getInstance());
-        return result;
-    }
 }

Modified: trunk/modules/dev/src/org/argouml/dev/test/TestPanel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/modules/dev/src/org/argouml/dev/test/TestPanel.java?view=diff&pathrev=17504&r1=17503&r2=17504
==============================================================================
--- trunk/modules/dev/src/org/argouml/dev/test/TestPanel.java	(original)
+++ trunk/modules/dev/src/org/argouml/dev/test/TestPanel.java	2009-11-20 06:52:21-0800
@@ -24,37 +24,22 @@
 
 package org.argouml.dev.test;
 
-import org.argouml.application.api.AbstractArgoJPanel;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
 
 /**
  * Empty panel for testing.
  * 
  * @author Bob Tarling
  */
-public final class TestPanel
-    extends AbstractArgoJPanel {
-
-    /**
-     * The instance.
-     */
-    private static final TestPanel INSTANCE =
-        new TestPanel();
-
-    /**
-     * @return The instance.
-     */
-    public static TestPanel getInstance() {
-        return INSTANCE;
-    }
+public final class TestPanel extends JPanel {
 
     /**
      * Constructor.
      */
-    private TestPanel() {
-    }
-    
-    @Override
-    public String getTitle() {
-        return "Test panel";
+    public TestPanel() {
+        setName("Test Panel");
+        add(new JLabel("test"));
+        setEnabled(true);
     }
 }

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

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.