svn commit: r17502 - trunk/src/argouml-app/src/org/argouml/uml/ui

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

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanelFactory.java
   trunk/src/argouml-app/src/org/argouml/uml/ui/TabProps.java

Log:
Allow any type of JPanel in the details pane

Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanelFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanelFactory.java?view=diff&pathrev=17502&r1=17501&r2=17502
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanelFactory.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanelFactory.java	2009-11-20 04:06:33-0800
@@ -24,6 +24,8 @@
 
 package org.argouml.uml.ui;
 
+import javax.swing.JPanel;
+
 /**
  * Interface for a factory of proppanels, 
  * which are created based on a given object.
@@ -49,5 +51,5 @@
      * @param object the object to create a new PropPanel for
      * @return the new proppanel or null
      */
-    PropPanel createPropPanel(Object object);
+    JPanel createPropPanel(Object object);
 }

Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/TabProps.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/TabProps.java?view=diff&pathrev=17502&r1=17501&r2=17502
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/TabProps.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/TabProps.java	2009-11-20 04:06:33-0800
@@ -70,8 +70,8 @@
     private static final Logger LOG = Logger.getLogger(TabProps.class);
 
     private JPanel blankPanel = new JPanel();
-    private Hashtable<Class, TabModelTarget> panels = 
-        new Hashtable<Class, TabModelTarget>();
+    private Hashtable<Class, JPanel> panels = 
+        new Hashtable<Class, JPanel>();
     private JPanel lastPanel;
     private String panelClassBaseName = "";
 
@@ -197,10 +197,10 @@
             repaint();
             lastPanel = blankPanel;
         } else {
-            TabModelTarget newPanel = null;
+            JPanel newPanel = null;
             newPanel = findPanelFor(target);
-            if (newPanel != null) {
-                addTargetListener(newPanel);
+            if (newPanel != null && newPanel instanceof TabModelTarget) {
+                addTargetListener((TabModelTarget) newPanel);
             }
             if (newPanel instanceof JPanel) {
                 add((JPanel) newPanel, BorderLayout.CENTER);
@@ -227,11 +227,11 @@
      * @param trgt the target class
      * @return the tab panel
      */
-    private TabModelTarget findPanelFor(Object trgt) {
+    private JPanel findPanelFor(Object trgt) {
         // TODO: No test coverage for this or createPropPanel? - tfm
         
         /* 1st attempt: get a panel that we created before: */
-        TabModelTarget panel = panels.get(trgt.getClass());
+        JPanel panel = panels.get(trgt.getClass());
         if (panel != null) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Getting prop panel for: " + trgt.getClass().getName()
@@ -262,8 +262,8 @@
      * @param targetObject the target object
      * @return A new prop panel to display any model element of the given type
      */
-    private TabModelTarget createPropPanel(Object targetObject) {
-	TabModelTarget propPanel = null;
+    private JPanel createPropPanel(Object targetObject) {
+	JPanel propPanel = null;
 
 	for (PropPanelFactory factory
 	        : PropPanelFactoryManager.getFactories()) {

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

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.