本文整理汇总了Java中com.google.gwt.event.dom.client.KeyDownEvent.getNativeKeyCode方法的典型用法代码示例。如果您正苦于以下问题:Java KeyDownEvent.getNativeKeyCode方法的具体用法?Java KeyDownEvent.getNativeKeyCode怎么用?Java KeyDownEvent.getNativeKeyCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.event.dom.client.KeyDownEvent
的用法示例。
在下文中一共展示了KeyDownEvent.getNativeKeyCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(final KeyDownEvent event) {
if (event.getNativeKeyCode() == keyCode) {
actionButton.fireEvent( new GwtEvent<ClickHandler>() {
@Override
public com.google.gwt.event.shared.GwtEvent.Type<ClickHandler> getAssociatedType() {
return ClickEvent.getType();
}
@Override
protected void dispatch(final ClickHandler handler) {
handler.onClick(null);
}
});
}
}
示例2: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent keyDownEvent) {
if (keyDownEvent.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
SimplePanel panel = WidgetUtil.findWidget(WidgetUtil.getFocusedElement(), SimplePanel.class);
if (panel != null) {
WidgetUtil.focus(panel.getParent().getElement());
// prevent further bubbling of the event as it has only
// navigational purpose if thrown at this depth. A subsequent
// press of ESC is not stopped, so ESC abort actions of the
// application should work as soon as the focus is in
// "navigational mode" on a grid-cell
keyDownEvent.preventDefault();
keyDownEvent.stopPropagation();
}
}
}
示例3: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
int keyCode = event.getNativeKeyCode();
if((keyCode == KEY_BACKSPACE || keyCode >= KEY_DELETE)
&& keyCode != 91 && keyCode != 93) { // Command/Window keyboard keys
cancelTimer();
timer = new Timer() {
public void run() {
dataProvider.setFilter(filterTextBox.getValue());
}
};
timer.schedule(TIMEOUT);
} else if(keyCode == KEY_ENTER) {
cancelTimer();
dataProvider.setFilter(filterTextBox.getValue());
}
}
示例4: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
int keyCode = event.getNativeKeyCode();
if((keyCode == KEY_BACKSPACE || keyCode >= KEY_DELETE)
&& keyCode != 91 && keyCode != 93) { // Command/Window keyboard keys
cancelTimer();
timer = new Timer() {
public void run() {
eventBus.fireEventFromSource(new SearchEvent(searchInput.getValue()), searchInput);
}
};
timer.schedule(TIMEOUT);
} else if(keyCode == KEY_ENTER) {
cancelTimer();
eventBus.fireEventFromSource(new SearchEvent(searchInput.getValue()), searchInput);
}
}
示例5: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent p_event)
{
switch( p_event.getNativeKeyCode() )
{
case KeyCodes.KEY_ESCAPE:
hide();
p_event.stopPropagation();
break;
case KeyCodes.KEY_ENTER:
sendMessage();
p_event.stopPropagation();
p_event.getNativeEvent().stopPropagation();
break;
default:
break;
}
}
示例6: searchBoxEnter
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@UiHandler("searchBox")
void searchBoxEnter(KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
SuggestionDisplay suggestionDisplay = searchBox.getSuggestionDisplay();
// This should always be true unless GWT changes the type of the suggestion generated by the
// SuggestBox. It is too complicated and nasty to switch out the SuggestBox suggestion display
// factory, so we're left with this type safety check and broken functionality if GWT changes.
Preconditions.checkState(suggestionDisplay instanceof DefaultSuggestionDisplay);
// At this point this should always be true.
if (suggestionDisplay instanceof DefaultSuggestionDisplay) {
DefaultSuggestionDisplay suggestions = (DefaultSuggestionDisplay) suggestionDisplay;
if (!suggestions.isSuggestionListShowing()) {
presenter.handleSearch(searchBox.getValue());
}
}
}
}
示例7: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
int key = event.getNativeKeyCode();
if (event.isControlKeyDown()) {
if (key == KEY_PLUS || key == KEY_MINUS) {
app.getToolbar().zoomChangeClicked(key == KEY_PLUS ? 1 : -1);
event.preventDefault();
}
} else if (!event.isShiftKeyDown()) {
boolean handled = true;
switch (key) {
case KeyCodes.KEY_HOME:
changePage(0, -1, -1);
break;
case KeyCodes.KEY_END:
changePage(dataStore.getPageCount() - 1, 1, 1);
break;
default:
handled = false;
}
if (handled)
event.preventDefault();
}
}
示例8: createSuggestionHandler
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
public static KeyDownHandler createSuggestionHandler(final UIObject sender, final EventListenerGVO ev, final List<InputVariableGVO> input) {
return new KeyDownHandler() {
public void onKeyDown(KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
if (event.getSource() instanceof QSuggestBox) {
QSuggestBox qSuggestBox = (QSuggestBox) event.getSource();
String expression = qSuggestBox.getText();
if (expression != null) {
if (expression.length() >= qSuggestBox.getSuggestCharactersLength()) {
qSuggestBox.clearSuggestions();
CallbackHandler.createCallBack(sender, QAMLConstants.EVENT_ONCHANGE, ev, input);
}
}
}
}
}
};
}
示例9: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
try {
if (event.isRightArrow())
pageView.getScrollPanel().scroll(10, 0);
else if (event.isLeftArrow())
pageView.getScrollPanel().scroll(-10, 0);
else if (event.isUpArrow())
pageView.getScrollPanel().scroll(0, -10);
else if (event.isDownArrow())
pageView.getScrollPanel().scroll(0, 10);
else if (event.getNativeKeyCode() == KeyCodes.KEY_PAGEDOWN)
selectNextObject();
else if (event.getNativeKeyCode() == KeyCodes.KEY_PAGEUP)
selectPreviousObject();
} catch (Exception exc) {
logManager.logError(ERROR_UNSPECIFIED, "Error in onKeyDown()");
exc.printStackTrace();
}
}
示例10: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
// Use the popup's key preview hooks to close the dialog when either
// enter or escape is pressed.
int eventCode = event.getNativeKeyCode();
// check if CTRL key is pressed & another key is sending the event
if (event.isControlKeyDown() && eventCode != 17 && !PlaceholderManageWidget.getInstance().isShowing()
&& !preOptionsPopupWidget.isShowing()) {
// Code 67 = c
if (eventCode == 67 && copyPlaceholderButton.isEnabled()) {
if (copyPlaceholder()) {
event.stopPropagation();
}
}
// Code ?? = v
else if (eventCode == 86 && contentBar.getSelectedTab() == LAYOUT_INDEX) {
pastePlaceholder();
}
}
}
示例11: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(final KeyDownEvent e) {
final int keyCode = e.getNativeKeyCode();
final boolean isShiftKeyDown = e.isShiftKeyDown();
switch (keyCode) {
case KeyCodes.KEY_TAB:
case KeyCodes.KEY_ENTER:
gridCell.flush();
moveSelection(keyCode,
isShiftKeyDown);
e.preventDefault();
case KeyCodes.KEY_ESCAPE:
gridCell.destroyResources();
gridPanel.setFocus(true);
gridLayer.batch();
}
e.stopPropagation();
}
示例12: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(final KeyDownEvent e) {
final int keyCode = e.getNativeKeyCode();
final boolean isShiftKeyDown = e.isShiftKeyDown();
switch (keyCode) {
case KeyCodes.KEY_TAB:
case KeyCodes.KEY_ESCAPE:
gridCell.destroyResources();
case KeyCodes.KEY_ENTER:
moveSelection(keyCode,
isShiftKeyDown);
gridPanel.setFocus(true);
gridLayer.batch();
}
e.stopPropagation();
}
示例13: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
/**
* Handles key events
*/
public void onKeyDown(KeyDownEvent event) {
if (KeyCodes.KEY_HOME == event.getNativeKeyCode()) {
centerImageIndex = 0;
renderImages();
updateCenterImage();
} else if (KeyCodes.KEY_END == event.getNativeKeyCode()) {
centerImageIndex = amountOfImages - 1;
renderImages();
updateCenterImage();
} else if (event.isRightArrow() || event.isDownArrow()) {
moveImages(false);
} else if (event.isLeftArrow() || event.isUpArrow()) {
moveImages(true);
} else if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER
|| event.getNativeKeyCode() == 32) {
imageClicked(visibleImages.length / 2);
}
}
示例14: titleKeyDownHandler
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@UiHandler("titleTextBox")
public void titleKeyDownHandler(KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
presenter.applyBookmark();
} else if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
presenter.discardChanges();
}
}
示例15: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
int keycode = event.getNativeKeyCode();
if (KeyCodes.KEY_ESCAPE == keycode && selectionStart != null) {
cancelRangeSelection();
}
}