Wow, thanks for the quick response, Thomas! I found the problem with multi-selection -- it doesn't work with this setting:
cellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.BOUND_TO_SELECTION); I added that because I don't like the way SingleSelectionModel works without it (i.e. it's different from the way the native HTML select widget works). I didn't realize that it also disables the ability of users to manage multi-selection. Should be easily fixed; just set the KeyboardSelectionPolicy as needed along with the SelectionModel. I'll have to look into the event preview handler; it looks like it'll take some fiddling to sort out. On Jun 16, 3:01 pm, Thomas Broyer <[email protected]> wrote: > On Thursday, June 16, 2011 11:44:56 PM UTC+2, Jim Douglas wrote: > > > I'm getting slightly overwhelmed by the infrastructure required to > > manage a CellList, so I might be missing something really simple. How > > do I set a CellList so that users can't change the selection with the > > keyboard or mouse, while leaving programmatic selection in place > > (which might be either MultiSelectionModel or SingleSelectionModel)? > > You can use setCellEventPreviewHandler to control how selection is handled; > notably by passing a DefaultSelectionEventManager, for instance a custom one > (createCustomManager) whose > EventTranslator<http://google-web-toolkit.googlecode.com/svn/javadoc/2.3/com/google/g...> > always > returns false from clearSelection and IGNORE from translateSelectionEvent. > (not tested, but I guess it should work) > > > And a marginally related subject -- is there no default UI for > > managing multi-selection? If I define an HTML select widget (GWT > > ListBox) for multiple selection, there's a standard UI (hold down a > > modifier key while clicking the mouse). > > The default behavior should allow it (provided you use a > MultiSelectionModel, of course): Ctrl+Click to toggle an item to add/remove > from the current selection, Shift+Click for the whole range between the > current "anchor" (last place clicked without "shift" pressed) and the > clicked row. It should also work with the keyboard: up/down to move, space > to change selection (with Ctrl or Shift to add/remove a single item or range > of items) > This is the behavior of DefaultSelectionEventManager.createDefaultManager(), > which is the default behavior of any AbstractHasData. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
