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/gwt/view/client/DefaultSelectionEventManager.EventTranslator.html> 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 view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/fCdmQfB3l2EJ. 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.
