Here is the test code:
public class KeyboardSelectionPolicyDISABLEDTest {
interface Binder extends UiBinder<HTMLPanel,
KeyboardSelectionPolicyDISABLEDTest> {
}
private static final Binder binder = GWT.create(Binder.class);
private static final Logger l =
Logger.getLogger(KeyboardSelectionPolicyDISABLEDTest.class.getName());
private final HTMLPanel rootElement;
@UiField
CellTable<String> table;
public KeyboardSelectionPolicyDISABLEDTest() {
rootElement = binder.createAndBindUi(this);
final ArrayList<String> list = new ArrayList<String>();
list.add("item 1");
list.add("item 2");
final ListDataProvider<String> items = new
ListDataProvider<String>();
items.setList(list);
items.addDataDisplay(table);
final TextColumn<String> column = new TextColumn<String>() {
@Override
public String getValue(String object) {
return object;
}
};
table.addColumn(column);
table.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.DISABLED);
table.addDomHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent event) {
l.info("Key code:" + event.getNativeEvent().getKeyCode() +
"; Key:" + event.getNativeEvent().getCharCode());
}
}, KeyPressEvent.getType());
}
public Widget getWidget() {
return rootElement;
}
}
When the line:
table.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.DISABLED);
is commented than the keyboard events are logged. When the line is not
commented, no events are logged.
I think this is a problem because regardless of the selection policy I want
to receive keyboard events. CellList behaves the same.
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors