svn commit: r17510 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLExpandableRowSelector.java

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

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

Log:
Start work to steal the expand/collapse icon from the tree control.

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLExpandableRowSelector.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLExpandableRowSelector.java?view=diff&pathrev=17510&r1=17509&r2=17510
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLExpandableRowSelector.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLExpandableRowSelector.java	2009-11-20 12:09:21-0800
@@ -33,7 +33,9 @@
 import javax.swing.JButton;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
+import javax.swing.JTree;
 import javax.swing.ListModel;
+import javax.swing.plaf.TreeUI;
 import javax.swing.plaf.basic.BasicTreeUI;
 import javax.swing.plaf.metal.MetalTreeUI;
 
@@ -69,9 +71,21 @@
     public UMLExpandableRowSelector(UMLModelElementListModel model) {
         super(new BorderLayout());
         
-        BasicTreeUI btu = new MetalTreeUI();
-        Icon expandedIcon = btu.getExpandedIcon();
-        Icon collapsedIcon = btu.getCollapsedIcon();
+        final JTree dummyTree = new JTree();
+        
+        final TreeUI tu = dummyTree.getUI();
+        final Icon expandedIcon;
+        final Icon collapsedIcon;
+        
+        if (tu instanceof BasicTreeUI) {
+            BasicTreeUI btu = (BasicTreeUI) tu;
+            expandedIcon = btu.getExpandedIcon();
+            collapsedIcon = btu.getCollapsedIcon();
+        } else {
+            // TODO: We want some default icons of our own here
+            expandedIcon = null;
+            collapsedIcon = null;
+        }
         JPanel buttonPanel = new JPanel();
         buttonPanel.add(new ToolButton(new ExpandAction(expandedIcon)), BorderLayout.NORTH);
         add(buttonPanel, BorderLayout.WEST);

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

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.