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

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2008-05-31 05:15:11-0700
New Revision: 14844

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java
   trunk/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java
   trunk/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java

Log:
Fix height of single row lists

Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java?view=diff&rev=14844&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java&r1=14843&r2=14844
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/PropPanel.java	2008-05-31 05:15:11-0700
@@ -714,34 +714,22 @@
         // ignored        
     }
 
-
-    /**
-     * Create a single row scroll pane backed by a JList.
-     *
-     * @param list the list to be used to back the scroll pane
-     * @return a scrollpane with a single row
-     */
     protected JScrollPane getSingleRowScroll(JList list) {
         // TODO: Temporary fix while we find something better - tfm
         list.setVisibleRowCount(2);
 //        list.setVisibleRowCount(1);
         JScrollPane pane = new JScrollPane(list);
-        // Scroll bar is not allowed to take up more than 20% of height
-//        pane.getHorizontalScrollBar().setMaximumSize(
-//                new Dimension(1000, 
-//                        list.getPreferredScrollableViewportSize().height / 5));
         return pane;
     }
-
+    
     /**
-     * Create a single row scroll pane backed by a UMLLinkedList which uses
-     * the given list model.
+     * Create a single row scroll pane backed by a ListModel.
      *
-     * @param model the list to be used to back the scroll pane
+     * @param model the ListModel to be used to back the scroll pane
      * @return a scrollpane with a single row
      */
-    protected JScrollPane getSingleRowScroll(ListModel model) {
-        return getSingleRowScroll(new UMLLinkedList(model));
+    protected UMLSingleRowSelector getSingleRowScroll(ListModel model) {
+        UMLSingleRowSelector pane = new UMLSingleRowSelector(model);
+        return pane;
     }
-
 }

Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java?view=diff&rev=14844&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java&r1=14843&r2=14844
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/ScrollList.java	2008-05-31 05:15:11-0700
@@ -29,6 +29,7 @@
 import java.awt.event.KeyEvent;
 import java.awt.event.KeyListener;
 
+import javax.swing.JList;
 import javax.swing.JScrollPane;
 import javax.swing.ListModel;
 import javax.swing.ScrollPaneConstants;
@@ -49,7 +50,7 @@
     /**
      * The Component that this scroll is wrapping.
      */
-    private Component list;
+    private JList list;
     
     /**
      * Builds a JList from a given list model and wraps
@@ -64,18 +65,43 @@
      * Builds a JList from a given list model and wraps
      * in a scrollable view.
      * @param listModel The model from which to build the list
+     * @param visibleRowCount an integer specifying the preferred number of
+     * rows to display without requiring scrolling
+     */
+    public ScrollList(ListModel listModel, int visibleRowCount) {
+        setHorizontalScrollBarPolicy(
+                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+        list = new UMLLinkedList(listModel, true, true);
+        list.setVisibleRowCount(visibleRowCount);
+        setViewportView(list);
+    }
+
+    /**
+     * Builds a JList from a given list model and wraps
+     * in a scrollable view.
+     * @param listModel The model from which to build the list
      * @param showIcon show an icon with elements in the list
      * @param showPath show containment path for elements in list
      */
     public ScrollList(ListModel listModel, boolean showIcon, boolean showPath) {
         setHorizontalScrollBarPolicy(
                 ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
-        setViewportView(new UMLLinkedList(listModel, showIcon, showPath));
+        list = new UMLLinkedList(listModel, showIcon, showPath);
+        setViewportView(list);
     }
     
-    public void setViewportView(Component view) {
-        super.setViewportView(view);
-        list = view;
+    /**
+     * Builds a JList from a given list model and wraps
+     * in a scrollable view.
+     * @param listModel The model from which to build the list
+     * @param showIcon show an icon with elements in the list
+     * @param showPath show containment path for elements in list
+     */
+    public ScrollList(JList list) {
+        setHorizontalScrollBarPolicy(
+                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+        this.list = list;
+        setViewportView(list);
     }
     
     /**

Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java?view=diff&rev=14844&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java&r1=14843&r2=14844
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/UMLSingleRowSelector.java	2008-05-31 05:15:11-0700
@@ -57,7 +57,7 @@
         
         JList associationList = new UMLLinkedList(model);
         associationList.setVisibleRowCount(1);
-        scroll = new JScrollPane(associationList);
+        scroll = new ScrollList(associationList);
         add(scroll);
         
         preferredSize = scroll.getPreferredSize();
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.