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

项目:platypus-js    文件:EventsExecutor.java   
public void setKeyPressed(JavaScriptObject aValue) {
    if (keyPressed != aValue) {
        if (keyDownReg != null) {
            keyDownReg.removeHandler();
            keyDownReg = null;
        }
        keyPressed = aValue;
        if (keyPressed != null && component instanceof HasKeyDownHandlers) {
            keyDownReg = ((HasKeyDownHandlers) component).addKeyDownHandler(new KeyDownHandler() {
                @Override
                public void onKeyDown(KeyDownEvent event) {
                    if (keyPressed != null) {
                        event.stopPropagation();
                        executeEvent(keyPressed, EventsPublisher.publish(event));
                    }
                }
            });
        }
    }
}
项目:unitimes    文件:FilterBox.java   
private void fixHandlers(final FilterBox box, Widget w) {
    if (w instanceof HasBlurHandlers)
        ((HasBlurHandlers)w).addBlurHandler(box.iBlurHandler);
    if (w instanceof HasFocusHandlers)
        ((HasFocusHandlers)w).addFocusHandler(box.iFocusHandler);
    if (w instanceof HasKeyDownHandlers)
        ((HasKeyDownHandlers)w).addKeyDownHandler(new KeyDownHandler() {
            @Override
            public void onKeyDown(KeyDownEvent event) {
                if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE)
                    if (box.isFilterPopupShowing()) box.hideFilterPopup();
            }
        });
}
项目:r01fb    文件:GWTWidgets.java   
/**
 * Sets the KeyDown event handler in many widgets
 * @param handler the handler
 * @param widgets the widgets
 */
public static void addKeyDownHandler(final KeyDownHandler handler,final HasKeyDownHandlers... widgets) {
    if (handler != null && widgets != null && widgets.length > 0) {
        for (HasKeyDownHandlers w : widgets) {
            if (w != null) w.addKeyDownHandler(handler);
        }
    }
}
项目:unitime    文件:FilterBox.java   
private void fixHandlers(final FilterBox box, Widget w) {
    if (w instanceof HasBlurHandlers)
        ((HasBlurHandlers)w).addBlurHandler(box.iBlurHandler);
    if (w instanceof HasFocusHandlers)
        ((HasFocusHandlers)w).addFocusHandler(box.iFocusHandler);
    if (w instanceof HasKeyDownHandlers)
        ((HasKeyDownHandlers)w).addKeyDownHandler(new KeyDownHandler() {
            @Override
            public void onKeyDown(KeyDownEvent event) {
                if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE)
                    if (box.isFilterPopupShowing()) box.hideFilterPopup();
            }
        });
}