当前位置: 首页>>代码示例>>Java>>正文


Java KeyDownEvent.getNativeKeyCode方法代码示例

本文整理汇总了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);
	        }
	   });
	}
}
 
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:17,代码来源:KeyShortcutHandler.java

示例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();
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:21,代码来源:EscKeyDownHandler.java

示例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());
	}
}
 
开发者ID:Novartis,项目名称:ontobrowser,代码行数:19,代码来源:HistoryPopup.java

示例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);
	}
}
 
开发者ID:Novartis,项目名称:ontobrowser,代码行数:19,代码来源:SearchInputView.java

示例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;
  }
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:19,代码来源:DlgChatInput.java

示例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());
      }
    }
  }
}
 
开发者ID:showlowtech,项目名称:google-apis-explorer,代码行数:20,代码来源:FullView.java

示例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();
	}
}
 
开发者ID:mateusz-matela,项目名称:djvu-html5,代码行数:25,代码来源:SinglePageLayout.java

示例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);
						}
					}
				}
			}
		}
	};
}
 
开发者ID:qafedev,项目名称:qafe-platform,代码行数:19,代码来源:EventFactory.java

示例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();
	}
}
 
开发者ID:PRImA-Research-Lab,项目名称:prima-aletheia-web-emop,代码行数:21,代码来源:WebLayoutEditor.java

示例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();
		}
	}
}
 
开发者ID:Rise-Vision,项目名称:rva,代码行数:21,代码来源:PresentationManageWidget.java

示例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();
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:21,代码来源:KeyDownHandlerCommon.java

示例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();
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:20,代码来源:KeyDownHandlerDatePicker.java

示例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);
    }
}
 
开发者ID:tepi,项目名称:ImageViewer,代码行数:22,代码来源:VImageViewer.java

示例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();
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:9,代码来源:BookmarkPopupContents.java

示例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();
    }
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:8,代码来源:MonthGrid.java


注:本文中的com.google.gwt.event.dom.client.KeyDownEvent.getNativeKeyCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。