svn commit: r18178 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2010-03-27 10:09:23-0700
New Revision: 18178

Modified:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SimpleListModel.java

Log:
Remember what list controls have been expanded

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java?view=diff&pathrev=18178&r1=18177&r2=18178
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java	2010-03-27 10:09:23-0700
@@ -48,6 +48,8 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
 
 import javax.swing.Action;
 import javax.swing.DefaultListModel;
@@ -127,6 +129,8 @@
      */
     private final boolean readonly;
     
+    private static final Set<String> EXPANDED_CONTROLS = new TreeSet<String>();
+    
     static {
         // Extract the icon that is used by the tree control
         // for the current look and feel
@@ -437,6 +441,11 @@
             
             getModel().addListDataListener(this);
         }
+        
+        if (EXPANDED_CONTROLS.contains(getId())) {
+        	toggleExpansion();
+        }
+        
     }
 
     /**
@@ -502,6 +511,12 @@
      */
     private void toggleExpansion() {
         expanded = !expanded;
+        
+        if (expanded) {
+        	EXPANDED_CONTROLS.add(getId());
+        } else {
+        	EXPANDED_CONTROLS.remove(getId());
+        }
 
         setIcon();
         if (toolbar != null) {
@@ -509,8 +524,23 @@
         }
 
         // Force the parent to redraw
-        getParent().invalidate();
-        getParent().validate();
+        Component c = getParent();
+        if (c != null) {
+            c.invalidate();
+            c.validate();
+        }
+    }
+    
+    private String getId() {
+        final String id;
+    	ListModel model = getList().getModel();
+    	if (model instanceof SimpleListModel) {
+    		SimpleListModel slm = (SimpleListModel) model;
+    		id = slm.getPropertyName() + ":" + slm.getMetaType();
+    	} else {
+    		id = model.getClass().getName();
+    	}
+    	return id;
     }
 
     /**
@@ -528,7 +558,6 @@
      * Remove all the listeners that were added in the constructor
      */
     public void removeNotify() {
-        LOG.info("The RowSelector is being removed from a panel");
     	if (!readonly) {
             getList().removeListSelectionListener(this);
 	        getList().removeListSelectionListener(deleteAction);

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SimpleListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SimpleListModel.java?view=diff&pathrev=18178&r1=18177&r2=18178
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SimpleListModel.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SimpleListModel.java	2010-03-27 10:09:23-0700
@@ -98,7 +98,11 @@
         if (metaTypes.size() > 0) {
             return metaTypes.get(0);
         }
-	return getterSetterManager.getMetaType(propertyName);
+        return getterSetterManager.getMetaType(propertyName);
+    }
+    
+    public String getPropertyName() {
+    	return propertyName;
     }
     
     public List getMetaTypes() {

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

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.