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

项目:gwt-traction    文件:AutoSizingBase.java   
protected void onKeyCodeEvent(KeyCodeEvent event, String newShadowText) {
// ignore arrow keys
switch (event.getNativeKeyCode()) {
case KeyCodes.KEY_UP:
case KeyCodes.KEY_DOWN:
case KeyCodes.KEY_LEFT:
case KeyCodes.KEY_RIGHT:
    break;
default:
    // don't do this if there's a selection because it will get smaller
    if (box.getSelectionLength() == 0) {
    setShadowText(newShadowText);
    adjustSize();       
    break;
    }
}   
   }
项目:opennmszh    文件:KscAddGraphPresenter.java   
@Override
public void onKeyCodeEvent(final KeyCodeEvent<?> event, final String searchText) {
    final int keyCode = event.getNativeEvent().getKeyCode();
    final boolean isKeyUp = event instanceof KeyUpEvent;
    final boolean isKeyDown = event instanceof KeyDownEvent;

    if (isKeyUp && keyCode == KeyCodes.KEY_ESCAPE) {
        GWT.log("escape, hiding results");
        m_view.hidePopup();
    } else if (isKeyUp && keyCode == KeyCodes.KEY_BACKSPACE && searchText.length() == 0) {
        m_view.hidePopup();
        m_view.setDataList(EMPTY_KSCREPORT_LIST);
        m_view.clearSelection();
    } else if (isKeyDown && keyCode == KeyCodes.KEY_ENTER && m_view.getSelectedReport() != null && m_view.getTitle() != null && !m_view.isPopupShowing()) {
        onAddButtonClicked();
    } else if (isKeyUp) {
        if (searchText.length() == 0) {
            GWT.log("search text is empty");
            m_view.setDataList(EMPTY_KSCREPORT_LIST);
        } else {
            GWT.log("search text is not empty");
            final List<KscReport> results = filterResultsByName(searchText);
            if (keyCode == KeyCodes.KEY_ENTER && results.size() == 1) {
                m_view.hidePopup();
                m_view.select(results.get(0));
            } else {
                m_view.setDataList(results);
                m_view.showPopup();
                m_view.clearSelection();
            }
        }
    }
}
项目:OpenNMS    文件:KscAddGraphPresenter.java   
@Override
public void onKeyCodeEvent(final KeyCodeEvent<?> event, final String searchText) {
    final int keyCode = event.getNativeEvent().getKeyCode();
    final boolean isKeyUp = event instanceof KeyUpEvent;
    final boolean isKeyDown = event instanceof KeyDownEvent;

    if (isKeyUp && keyCode == KeyCodes.KEY_ESCAPE) {
        GWT.log("escape, hiding results");
        m_view.hidePopup();
    } else if (isKeyUp && keyCode == KeyCodes.KEY_BACKSPACE && searchText.length() == 0) {
        m_view.hidePopup();
        m_view.setDataList(EMPTY_KSCREPORT_LIST);
        m_view.clearSelection();
    } else if (isKeyDown && keyCode == KeyCodes.KEY_ENTER && m_view.getSelectedReport() != null && m_view.getTitle() != null && !m_view.isPopupShowing()) {
        onAddButtonClicked();
    } else if (isKeyUp) {
        if (searchText.length() == 0) {
            GWT.log("search text is empty");
            m_view.setDataList(EMPTY_KSCREPORT_LIST);
        } else {
            GWT.log("search text is not empty");
            final List<KscReport> results = filterResultsByName(searchText);
            if (keyCode == KeyCodes.KEY_ENTER && results.size() == 1) {
                m_view.hidePopup();
                m_view.select(results.get(0));
            } else {
                m_view.setDataList(results);
                m_view.showPopup();
                m_view.clearSelection();
            }
        }
    }
}
项目:OpenNMS    文件:KscAddGraphPresenter.java   
@Override
public void onKeyCodeEvent(final KeyCodeEvent<?> event, final String searchText) {
    final int keyCode = event.getNativeEvent().getKeyCode();
    final boolean isKeyUp = event instanceof KeyUpEvent;
    final boolean isKeyDown = event instanceof KeyDownEvent;

    if (isKeyUp && keyCode == KeyCodes.KEY_ESCAPE) {
        GWT.log("escape, hiding results");
        m_view.hidePopup();
    } else if (isKeyUp && keyCode == KeyCodes.KEY_BACKSPACE && searchText.length() == 0) {
        m_view.hidePopup();
        m_view.setDataList(EMPTY_KSCREPORT_LIST);
        m_view.clearSelection();
    } else if (isKeyDown && keyCode == KeyCodes.KEY_ENTER && m_view.getSelectedReport() != null && m_view.getTitle() != null && !m_view.isPopupShowing()) {
        onAddButtonClicked();
    } else if (isKeyUp) {
        if (searchText.length() == 0) {
            GWT.log("search text is empty");
            m_view.setDataList(EMPTY_KSCREPORT_LIST);
        } else {
            GWT.log("search text is not empty");
            final List<KscReport> results = filterResultsByName(searchText);
            if (keyCode == KeyCodes.KEY_ENTER && results.size() == 1) {
                m_view.hidePopup();
                m_view.select(results.get(0));
            } else {
                m_view.setDataList(results);
                m_view.showPopup();
                m_view.clearSelection();
            }
        }
    }
}
项目:opennmszh    文件:KscAddGraphView.java   
void onKeyCodeEvent(KeyCodeEvent<?> event, String searchText);
项目:OpenNMS    文件:KscAddGraphView.java   
void onKeyCodeEvent(KeyCodeEvent<?> event, String searchText);
项目:OpenNMS    文件:KscAddGraphView.java   
void onKeyCodeEvent(KeyCodeEvent<?> event, String searchText);