Java 类com.google.gwt.event.dom.client.HasKeyPressHandlers 实例源码

项目:sc2gears    文件:ClientUtils.java   
/**
 * Adds a {@link KeyPressHandler} to the specified widget which calls {@link Button#click()} on <code>targetButton</code>
 * when the Enter key is pressed.
 * @param widget       widget to add the key handler to
 * @param targetButton target button to activate when the enter key is pressed
 */
public static void addEnterTarget( final HasKeyPressHandlers widget, final Button targetButton ) {
    widget.addKeyPressHandler( new KeyPressHandler() {
        @Override
        public void onKeyPress( final KeyPressEvent event ) {
            if ( event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER )
                targetButton.click();
        }
    } );
}
项目:platypus-js    文件:EventsExecutor.java   
public void setKeyTyped(JavaScriptObject aValue) {
    if (keyTyped != aValue) {
        if (keyTypedReg != null) {
            keyTypedReg.removeHandler();
            keyTypedReg = null;
        }
        keyTyped = aValue;
        if (keyTyped != null && component instanceof HasKeyPressHandlers) {
            keyTypedReg = ((HasKeyPressHandlers) component).addKeyPressHandler(new KeyPressHandler() {
                @Override
                public void onKeyPress(KeyPressEvent event) {
                    if (keyTyped != null) {
                        event.stopPropagation();
                        executeEvent(keyTyped, EventsPublisher.publish(event));
                    }
                }
            });
        }
    }
}
项目:gwt-bean-validators    文件:BeanValidationInitializer.java   
/**
 * initialize one editor.
 *
 * @param editor editor to initialize
 */
@SuppressWarnings({"rawtypes", "unchecked"})
public void initializeEditors(final Object editor) {
  if (editor instanceof HasValueChangeHandlers && this.valueChangeHandler != null) {
    ((HasValueChangeHandlers) editor).addValueChangeHandler(this.valueChangeHandler);
    // if widget has a value change handler, validate on change
    if (this.validateOnVueChangeHandler != null) {
      ((HasValueChangeHandlers) editor).addValueChangeHandler(this.validateOnVueChangeHandler);
    }
  }
  // if widget has a key up handler, validate on key up
  if (editor instanceof HasKeyUpHandlers && this.validateOnKeyUpHandler != null) {
    ((HasKeyUpHandlers) editor).addKeyUpHandler(this.validateOnKeyUpHandler);
  }
  // try to submit form on return
  if (editor instanceof HasKeyPressHandlers && this.commitOnReturnHandler != null) {
    ((HasKeyPressHandlers) editor).addKeyPressHandler(this.commitOnReturnHandler);
  }
}
项目:r01fb    文件:GWTWidgets.java   
/**
 * Sets the KeyPress() event handler in many widgets
 * @param handler the handler
 * @param widgets the widgets
 */
public static void addKeyPressHandler(final KeyPressHandler handler,final HasKeyPressHandlers... widgets) {
    if (handler != null && widgets != null && widgets.length > 0) {
        for (HasKeyPressHandlers w : widgets) {
            if (w != null) w.addKeyPressHandler(handler);
        }
    }
}
项目:gwt-bean-validators    文件:AbstractDecorator.java   
@Override
public final HandlerRegistration addKeyPressHandler(final KeyPressHandler phandler) {
  if (this.contents.getWidget() instanceof HasKeyPressHandlers) {
    return ((HasKeyPressHandlers) this.contents.getWidget()).addKeyPressHandler(phandler);
  } else {
    return null;
  }
}
项目:yaph    文件:LoginView.java   
@Override
public HasKeyPressHandlers getLoginKeyPress() {
    return login;
}
项目:yaph    文件:LoginView.java   
@Override
public HasKeyPressHandlers getPasswdKeyPress() {
    return passwd;
}
项目:yaph    文件:LoginView.java   
@Override
public HasKeyPressHandlers getLoginKeyPress() {
    return login;
}
项目:yaph    文件:LoginView.java   
@Override
public HasKeyPressHandlers getPasswdKeyPress() {
    return passwd;
}
项目:opennmszh    文件:SearchPopup.java   
@Override
public HasKeyPressHandlers getTextBox() {
    return m_tf;
}
项目:OpenNMS    文件:SearchPopup.java   
@Override
public HasKeyPressHandlers getTextBox() {
    return m_tf;
}
项目:OpenNMS    文件:SearchPopup.java   
@Override
public HasKeyPressHandlers getTextBox() {
    return m_tf;
}
项目:yaph    文件:LoginPresenter.java   
HasKeyPressHandlers getLoginKeyPress();
项目:yaph    文件:LoginPresenter.java   
HasKeyPressHandlers getPasswdKeyPress();
项目:opennmszh    文件:DefaultResourceListPresenter.java   
HasKeyPressHandlers getTextBox();
项目:OpenNMS    文件:DefaultResourceListPresenter.java   
HasKeyPressHandlers getTextBox();
项目:OpenNMS    文件:DefaultResourceListPresenter.java   
HasKeyPressHandlers getTextBox();