[cp-patches] FYI: JList.setValueIsAdjusting() fixlet

David Gilbert david.gilbert at object-refinery.com
Mon Jun 26 14:13:05 UTC 2006


This patch (committed) fixes a bug in the JList class:

2006-06-26  David Gilbert  <david.gilbert at object-refinery.com>

	* javax/swing/JList.java
	(valueIsAdjusting): Removed,
	(init): Removed initialization of valueIsAdjusting field,
	(getValueIsAdjusting): Fetch value from selection model,
	(setValueIsAdjusting): Store value in selection model.

Regards,

Dave
-------------- next part --------------
Index: javax/swing/JList.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JList.java,v
retrieving revision 1.56
diff -u -r1.56 JList.java
--- javax/swing/JList.java	26 Jun 2006 13:23:29 -0000	1.56
+++ javax/swing/JList.java	26 Jun 2006 13:56:41 -0000
@@ -944,17 +944,6 @@
    */
   ListSelectionModel selectionModel;
 
-
-  /**
-   * This property indicates that the list's selection is currently
-   * "adjusting" -- perhaps due to a user actively dragging the mouse over
-   * multiple list elements -- and is therefore likely to change again in
-   * the near future. A {@link ListSelectionListener} might choose to delay
-   * updating its view of the list's selection until this property is
-   * false, meaning that the adjustment has completed.
-   */
-  boolean valueIsAdjusting;
-
   /** 
    * This property indicates a <em>preference</em> for the number of rows
    * displayed in the list, and will scale the
@@ -1085,7 +1074,6 @@
     fixedCellWidth = -1;
     layoutOrientation = VERTICAL;
     opaque = true;
-    valueIsAdjusting = false;
     visibleRowCount = 7;
 
     cellRenderer = new DefaultListCellRenderer();
@@ -2184,23 +2172,25 @@
   }
 
   /**
-   * Returns the value of the <code>valueIsAdjusting</code> property.
+   * Returns the <code>valueIsAdjusting</code> flag from the list's selection
+   * model.
    *
    * @return the value
    */
   public boolean getValueIsAdjusting()
   {
-    return valueIsAdjusting;
+    return selectionModel.getValueIsAdjusting();
   }
 
   /**
-   * Sets the <code>valueIsAdjusting</code> property.
+   * Sets the <code>valueIsAdjusting</code> flag in the list's selection 
+   * model.
    *
    * @param isAdjusting the new value
    */
   public void setValueIsAdjusting(boolean isAdjusting)
   {
-    valueIsAdjusting = isAdjusting;
+    selectionModel.setValueIsAdjusting(isAdjusting);
   }
 
   /**


More information about the Classpath-patches mailing list