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

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2010-09-26 07:35:44-0700
New Revision: 18781

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

Log:
Remove the toolbar from RowSelector. It is now managed as the "expansion" in LabelledLayout

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/LabelledComponent.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/LabelledComponent.java?view=diff&pathrev=18781&r1=18780&r2=18781
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/LabelledComponent.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/LabelledComponent.java	2010-09-26 07:35:44-0700
@@ -39,10 +39,9 @@
 package org.argouml.core.propertypanels.ui;
 
 import java.awt.BorderLayout;
-import java.awt.Color;
 import java.awt.Component;
-import java.awt.Cursor;
 import java.awt.Dimension;
+import java.awt.GridLayout;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
 import java.util.Set;
@@ -55,10 +54,11 @@
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JTree;
-import javax.swing.plaf.TreeUI;
 import javax.swing.plaf.basic.BasicTreeUI;
 import javax.swing.plaf.metal.MetalTreeUI;
 
+import org.tigris.swidgets.FlexiGridLayout;
+
 /**
  * A wrapped label and component pair
  * 
@@ -78,6 +78,7 @@
      */
     private static Icon expandedIcon;
 
+    private JComponent expansion;
     /**
      * The icon to use when the control is collapsed
      */
@@ -130,14 +131,14 @@
             label = new JLabel(name);
             label.setLabelFor(component);
             JPanel labelPanel = new JPanel();
-            labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.X_AXIS));
+            labelPanel.setLayout(new FlexiGridLayout(1, 2, FlexiGridLayout.ROWCOLPREFERRED));
             labelPanel.add(label);
-            leftPanel = new JPanel();
-            leftPanel.add(labelPanel, BorderLayout.CENTER);
+            leftPanel = new JPanel(new BorderLayout());
+            leftPanel.add(labelPanel, BorderLayout.NORTH);
             add(leftPanel, BorderLayout.WEST);
             if (component instanceof Expandable && ((Expandable) component).isExpandable()) {
                 expander = new JLabel();
-        	leftPanel.add(expander, BorderLayout.EAST);
+        	labelPanel.add(expander);
         	addMouseListener(this);
                 setIcon();
                 if (EXPANDED_CONTROLS.contains(getId())) {
@@ -222,12 +223,15 @@
         }
 
         setIcon();
-        if (expandable.getExpansion() != null) {
-            expandable.getExpansion().setVisible(expanded);
+        
+        if (expansion == null) {
+            expansion = expandable.getExpansion();
+            leftPanel.add(expansion, BorderLayout.CENTER);
         }
+        expansion.setVisible(expanded);
 
         // Force the parent to redraw
-        Component c = component.getParent();
+        Component c = component.getParent().getParent();
         if (c != null) {
             c.invalidate();
             c.validate();

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=18781&r1=18780&r2=18781
==============================================================================
--- 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-09-26 07:35:44-0700
@@ -156,11 +156,6 @@
     private MovedModelElement movedModelElement = new MovedModelElement();
 
     /**
-     * The toolbar of controls for manipulating items in the list
-     */
-    private final JToolBar toolbar;
-
-    /**
      * The delete action that we must enable/disable
      */
     private final DeleteAction deleteAction;
@@ -288,7 +283,6 @@
         if (!expandable && !expanded) {
             jscroll.setVerticalScrollBarPolicy(
                     JScrollPane.VERTICAL_SCROLLBAR_NEVER);
-            toolbar = null;
             deleteAction = null;
             moveUpAction = null;
             moveDownAction = null;
@@ -389,35 +383,22 @@
                     actions.addAll(createActions);
                 }
                 
-                List<Action> navigateActions = new ArrayList<Action>();
                 if (Model.getUmlHelper().isMovable(metaType)) {
                     moveUpAction = new MoveUpAction();
                     moveDownAction = new MoveDownAction();
                     moveTopAction = new MoveTopAction();
                     moveBottomAction = new MoveBottomAction();
-                    navigateActions.add(moveUpAction);
-                    navigateActions.add(moveDownAction);
-                    navigateActions.add(moveTopAction);
-                    navigateActions.add(moveBottomAction);
+                    actions.add(moveUpAction);
+                    actions.add(moveDownAction);
+                    actions.add(moveTopAction);
+                    actions.add(moveBottomAction);
                 } else {
                     moveUpAction = null;
                     moveDownAction = null;
                     moveTopAction = null;
                     moveBottomAction = null;
                 }
-                actions.addAll(navigateActions);
-
-                Object[] actionsArray = actions.toArray();
-                
-                final ToolBarFactory tbf = new ToolBarFactory(actions);
-                toolbar = tbf.createToolBar();
-                toolbar.setRollover(true);
-                toolbar.setOrientation(ToolBar.VERTICAL);
             } else {
-                final ToolBarFactory tbf = new ToolBarFactory(new Object[] {});
-                toolbar = tbf.createToolBar();
-                toolbar.setRollover(true);
-                toolbar.setOrientation(ToolBar.VERTICAL);
                 moveUpAction = null;
                 moveDownAction = null;
                 moveTopAction = null;
@@ -425,16 +406,7 @@
                 deleteAction = null;
             }
 
-            JPanel buttonPanel =
-                new JPanel(new FlexiGridLayout(
-                        2, 1, FlexiGridLayout.ROWCOLPREFERRED));
             this.addMouseListener(this);
-            // TODO: In think this will always be true
-            if (toolbar != null) {
-                toolbar.setVisible(false);
-                buttonPanel.add(toolbar);
-            }
-            add(buttonPanel, BorderLayout.WEST);
 
             if (!Model.getModelManagementHelper().isReadOnly(target)) {
             	if (deleteAction != null) {
@@ -481,8 +453,7 @@
         }
         return size;
     }
-
-
+    
     /**
      * @return the preferred size as the height of one row in a JList
      */
@@ -538,7 +509,38 @@
     }
     
     public JComponent getExpansion() {
-	return toolbar;
+	actions.size();
+	ArrayList actions1 = new ArrayList(actions.size() / 2 + actions.size() % 2);
+	ArrayList actions2 = new ArrayList(actions.size() / 2);
+	
+	Object[] actionPair = {
+	    actions1, actions2
+	};
+	
+	for (int i=0; i < actions.size(); ++i) {
+	    if (i % 2 == 0) {
+		actions1.add(actions.get(i));
+	    } else {
+		actions2.add(actions.get(i));
+	    }
+	}
+	
+        final ToolBarFactory tbf = new ToolBarFactory(actions1);
+        JToolBar toolbar = tbf.createToolBar();
+        toolbar.setRollover(true);
+        final ToolBarFactory tbf2 = new ToolBarFactory(actions2);
+        JToolBar toolbar2 = tbf2.createToolBar();
+        toolbar2.setRollover(true);
+        
+        JComponent expander =
+            new JPanel(new FlexiGridLayout(
+        	    2, 1, 0, 0,
+        	    FlexiGridLayout.HORIZONTAL,
+        	    FlexiGridLayout.EAST));
+        expander.add(toolbar);
+        expander.add(toolbar2);
+        
+        return expander;
     }
     
     public boolean isExpanded() {

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

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.