Example usage for com.google.gwt.event.dom.client HasKeyPressHandlers addKeyPressHandler

List of usage examples for com.google.gwt.event.dom.client HasKeyPressHandlers addKeyPressHandler

Introduction

In this page you can find the example usage for com.google.gwt.event.dom.client HasKeyPressHandlers addKeyPressHandler.

Prototype

HandlerRegistration addKeyPressHandler(KeyPressHandler handler);

Source Link

Document

Adds a KeyPressEvent handler.

Usage

From source file:com.tasktop.c2c.server.tasks.client.widgets.AbstractEditTaskDialog.java

License:Open Source License

protected void attachEnterForSubmit(HasKeyPressHandlers widget) {
    widget.addKeyPressHandler(new KeyPressHandler() {

        @Override/*from   ww w  .jav  a2  s .co m*/
        public void onKeyPress(KeyPressEvent event) {
            if (KeyCodes.KEY_ENTER == event.getUnicodeCharCode()) {
                onSave(null);
            }
        }
    });
}

From source file:net.sf.mmm.client.ui.impl.gwt.handler.event.KeyboardFilterAdapter.java

License:Apache License

/**
 * This method adds this keyboard-filter to the given <code>widget</code>.
 * /*from w ww.j  a va  2  s  .  c  o  m*/
 * @param widget is the widget where to add this filter.
 */
public void add(HasKeyPressHandlers widget) {

    assert (this.handlerRegistration == null);
    this.handlerRegistration = widget.addKeyPressHandler(this);
}