Hi I should probably have mentioned this, but the reason I didn't apply this fix to ListView was because ListView#setSelectMode(SelectMode) does not call clearSelection() - it directly updates the selectedRanges field.
So I'm thinking that we should also change ListView#setSelectMode to call clearSelection() so that it correctly fires a selectedRangesChanged event when setSelectMode(NONE) is called. -- Noel [email protected] wrote: > Author: gbrown > Date: Tue Aug 17 12:10:44 2010 > New Revision: 986287 > > URL: http://svn.apache.org/viewvc?rev=986287&view=rev > Log: > Apply TableView fix from revision 985932 to ListView. > > Modified: > pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java > pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java > > Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java > URL: > http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java?rev=986287&r1=986286&r2=986287&view=diff > ============================================================================== > --- pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java (original) > +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java Tue Aug 17 > 12:10:44 2010 > @@ -35,7 +35,6 @@ import org.apache.pivot.util.ListenerLis > import org.apache.pivot.util.Vote; > import org.apache.pivot.wtk.content.ListViewItemRenderer; > > - > /** > * Component that displays a sequence of items, optionally allowing a user > * to select or check one or more items. > @@ -1012,7 +1011,9 @@ public class ListView extends Component > throw new IllegalArgumentException("selectedRanges is null."); > } > > - if (selectMode == SelectMode.NONE) { > + // When we're in mode NONE, the only thing we can do is to clear the > selection > + if (selectMode == SelectMode.NONE > + && selectedRanges.getLength() > 0) { > throw new IllegalArgumentException("Selection is not enabled."); > } > > > Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java > URL: > http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java?rev=986287&r1=986286&r2=986287&view=diff > ============================================================================== > --- pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java (original) > +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java Tue Aug 17 > 12:10:44 2010 > @@ -1668,8 +1668,9 @@ public class TableView extends Component > throw new IllegalArgumentException("selectedRanges is null."); > } > > - // when we're in mode NONE, the only thing we can do is to clear the > selection > - if (selectMode == SelectMode.NONE && selectedRanges.getLength() > 0) > { > + // When we're in mode NONE, the only thing we can do is to clear the > selection > + if (selectMode == SelectMode.NONE > + && selectedRanges.getLength() > 0) { > throw new IllegalArgumentException("Selection is not enabled."); > } > > >
