From 11b3ee8d6ebd78c361fbcebd46c4c816b806ccdf Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Wed, 19 Mar 2014 18:46:15 +0100 Subject: Add key binding draft --- src/esieequest/view/web/WebInterface.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/esieequest/view/web/WebInterface.java b/src/esieequest/view/web/WebInterface.java index 221eea9..f1abe9d 100644 --- a/src/esieequest/view/web/WebInterface.java +++ b/src/esieequest/view/web/WebInterface.java @@ -6,8 +6,15 @@ import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.KeyDownHandler; +import com.google.gwt.event.dom.client.KeyPressEvent; +import com.google.gwt.event.dom.client.KeyPressHandler; +import com.google.gwt.event.dom.client.KeyUpEvent; +import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.Event.NativePreviewEvent; +import com.google.gwt.user.client.Event.NativePreviewHandler; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Frame; @@ -77,6 +84,7 @@ class WebInterface extends Composite implements View { public WebInterface() { this.initWidget(WebInterface.uiBinder.createAndBindUi(this)); this.bindInputField(); + this.bindKeys(); this.bindButtons(); } @@ -125,6 +133,17 @@ class WebInterface extends Composite implements View { }); } + /** + * Binds keys + */ + private void bindKeys() { + Event.addNativePreviewHandler(new NativePreviewHandler() { + public void onPreviewNativeEvent(NativePreviewEvent event) { + int key = event.getNativeEvent().getKeyCode(); + } + }); + } + /** * Binds the buttons to send a defined command to the controller. */ -- cgit v1.2.3