List of usage examples for com.vaadin.ui AbstractField addShortcutListener
public Registration addShortcutListener(ShortcutListener shortcut)
From source file:com.shopwiki.vaadin.InlineForm.java
License:Apache License
protected InlineForm(final AbstractField field, String submitCaption, Handler<T> handler) { this.field = field; this.handler = handler; Button submitButton = new Button(submitCaption, this, "handle"); //submitButton.setClickShortcut(KeyCode.ENTER); // Putting the shortcut listener on the textField is better since it can check it the textField is the target field.addShortcutListener(new ShortcutListener(submitCaption, KeyCode.ENTER, null) { @Override/*from w ww. j ava 2s . c o m*/ public void handleAction(Object sender, Object target) { if (target == field) { handle(); } } }); addComponent(field); addComponent(submitButton); setSpacing(true); }