本文整理汇总了Java中com.google.gwt.event.dom.client.KeyDownEvent.stopPropagation方法的典型用法代码示例。如果您正苦于以下问题:Java KeyDownEvent.stopPropagation方法的具体用法?Java KeyDownEvent.stopPropagation怎么用?Java KeyDownEvent.stopPropagation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.event.dom.client.KeyDownEvent
的用法示例。
在下文中一共展示了KeyDownEvent.stopPropagation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
}
示例2: 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;
}
}
示例3: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(final KeyDownEvent event) {
final GridWidget selectedGridWidget = getSelectedGridWidget();
if (selectedGridWidget == null) {
return;
}
final KeyboardOperation operation = getOperation(event);
if (operation == null) {
return;
}
final boolean redraw = operation.perform(selectedGridWidget,
event.isShiftKeyDown(),
event.isControlKeyDown());
event.preventDefault();
event.stopPropagation();
flushDOMElements(selectedGridWidget);
if (redraw) {
gridLayer.draw();
}
}
示例4: 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();
}
}
}
示例5: 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();
}
示例6: 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();
}
示例7: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown(KeyDownEvent event) {
if (this.enabled && !this.readonly) {
int keyCode = event.getNativeKeyCode();
debug("VComboBoxMultiselect: key down: " + keyCode);
if (this.dataReceivedHandler.isWaitingForFilteringResponse() && navigationKeyCodes.contains(keyCode)
&& (!this.allowNewItems || keyCode != KeyCodes.KEY_ENTER)) {
/*
* Keyboard navigation events should not be handled while we are
* waiting for a response. This avoids flickering, disappearing
* items, wrongly interpreted responses and more.
*/
debug("Ignoring " + keyCode + " because we are waiting for a filtering response");
DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
event.stopPropagation();
return;
}
if (this.suggestionPopup.isAttached()) {
debug("Keycode " + keyCode + " target is popup");
popupKeyDown(event);
} else {
debug("Keycode " + keyCode + " target is text field");
inputFieldKeyDown(event);
}
}
}
示例8: inputFieldKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
/**
* Triggered when a key is pressed in the text box
*
* @param event
* The KeyDownEvent
*/
private void inputFieldKeyDown(KeyDownEvent event) {
debug("VComboBoxMultiselect: inputFieldKeyDown(" + event.getNativeKeyCode() + ")");
switch (event.getNativeKeyCode()) {
case KeyCodes.KEY_DOWN:
case KeyCodes.KEY_UP:
case KeyCodes.KEY_PAGEDOWN:
case KeyCodes.KEY_PAGEUP:
// open popup as from gadget
filterOptions(-1, "");
this.tb.selectAll();
this.dataReceivedHandler.popupOpenerClicked();
break;
case KeyCodes.KEY_ENTER:
/*
* This only handles the case when new items is allowed, a text is
* entered, the popup opener button is clicked to close the popup
* and enter is then pressed (see #7560).
*/
if (!this.allowNewItems) {
return;
}
if (this.currentSuggestion != null && this.tb.getText()
.equals(this.currentSuggestion.getReplacementString())) {
// Retain behavior from #6686 by returning without stopping
// propagation if there's nothing to do
return;
}
this.dataReceivedHandler.reactOnInputWhenReady(this.tb.getText());
event.stopPropagation();
break;
}
}
示例9: inputFieldKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
protected void inputFieldKeyDown(KeyDownEvent event) {
switch (event.getNativeKeyCode()) {
case KeyCodes.KEY_ENTER:
//case KeyCodes.KEY_ESCAPE:
//refs platform #1197
//ESC shortcut used by window
if (!event.isAnyModifierKeyDown()) {
event.stopPropagation();
}
break;
}
}
示例10: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
public void onKeyDown(KeyDownEvent event) {
ChartState chartInfo = getChartState(event);
Chart chart = chartInfo.chart;
boolean handled = true;
int keyCode = event.getNativeKeyCode();
// all checks (except TAB) are to prevent focus stealing by the browser.
if (keyCode == KeyCodes.KEY_PAGEUP) {
} else if (keyCode == KeyCodes.KEY_PAGEDOWN) {
} else if (keyCode == KeyCodes.KEY_UP) {
if (UP_NUM < KEY_DOWN_MAX) {
if (UP_NUM != 0) {
chart.nextZoom();
}
UP_NUM++;
}
} else if (keyCode == KeyCodes.KEY_DOWN) {
if (DOWN_NUM < KEY_DOWN_MAX) {
if (DOWN_NUM != 0) {
chart.prevZoom();
}
DOWN_NUM++;
}
} else if (keyCode == KeyCodes.KEY_TAB) {
handled = handleTabKey((Event) event.getNativeEvent(), chartInfo, keyCode,
event.isShiftKeyDown());
} else {
handled = false;
}
chartInfo.setHandled(handled);
if (handled) {
event.stopPropagation();
event.preventDefault();
}
}
示例11: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
public void onKeyDown(KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_DOWN) {
adjustHighligtedIdx(1);
event.stopPropagation();
} else if (event.getNativeKeyCode() == KeyCodes.KEY_UP) {
adjustHighligtedIdx(-1);
event.stopPropagation();
}
}
示例12: onKeyDownInput
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@UiHandler("input")
void onKeyDownInput(KeyDownEvent e) {
if (e.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
onCancel(null);
} else if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
e.stopPropagation();
e.preventDefault();
onSave(null);
}
}
示例13: getEnterDomHandler
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
protected KeyDownHandler getEnterDomHandler() {
return new KeyDownHandler() {
@Override
public void onKeyDown(KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
if (handleDefaultAction()) {
event.preventDefault();
event.stopPropagation();
}
}
}
};
}
示例14: onKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
@Override
public void onKeyDown( KeyDownEvent event )
{
if( event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE )
{
if( edition == null )
return;
event.stopPropagation();
event.preventDefault();
killCurrentEdit();
}
else if( event.getNativeKeyCode() == KeyCodes.KEY_TAB )
{
if( edition == null )
return;
event.stopPropagation();
event.preventDefault();
// find next cell to be edited
int editionRow = getRow( refMng.getRef( edition.editedObject ) );
CellPos pos = null;
if( event.isShiftKeyDown() )
pos = getPrevPos( editionRow, edition.editedCol );
else
pos = getNextPos( editionRow, edition.editedCol );
if( pos != null )
{
beginEdit( pos.row, pos.col );
return;
}
}
}
示例15: popupKeyDown
import com.google.gwt.event.dom.client.KeyDownEvent; //导入方法依赖的package包/类
/**
* Triggered when a key was pressed in the suggestion popup.
*
* @param event
* The KeyDownEvent of the key
*/
private void popupKeyDown(KeyDownEvent event) {
debug("VComboBoxMultiselect: popupKeyDown(" + event.getNativeKeyCode() + ")");
// Propagation of handled events is stopped so other handlers such as
// shortcut key handlers do not also handle the same events.
switch (event.getNativeKeyCode()) {
case KeyCodes.KEY_DOWN:
this.suggestionPopup.selectNextItem();
DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
event.stopPropagation();
break;
case KeyCodes.KEY_UP:
this.suggestionPopup.selectPrevItem();
DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
event.stopPropagation();
break;
case KeyCodes.KEY_PAGEDOWN:
selectNextPage();
event.stopPropagation();
break;
case KeyCodes.KEY_PAGEUP:
selectPrevPage();
event.stopPropagation();
break;
case KeyCodes.KEY_ESCAPE:
reset();
DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
event.stopPropagation();
break;
case KeyCodes.KEY_TAB:
case KeyCodes.KEY_ENTER:
// queue this, may be cancelled by selection
int selectedIndex = this.suggestionPopup.menu.getSelectedIndex();
if (!this.allowNewItems && selectedIndex != -1) {
debug("index before: " + selectedIndex);
if (this.showClearButton) {
selectedIndex = selectedIndex - 1;
}
if (this.showSelectAllButton) {
selectedIndex = selectedIndex - 1;
}
debug("index after: " + selectedIndex);
if (selectedIndex == -2) {
this.clearCmd.execute();
} else if (selectedIndex == -1) {
if (this.showSelectAllButton) {
this.selectAllCmd.execute();
} else {
this.clearCmd.execute();
}
}
debug("entered suggestion: " + this.currentSuggestions.get(selectedIndex).caption);
onSuggestionSelected(this.currentSuggestions.get(selectedIndex));
} else {
this.dataReceivedHandler.reactOnInputWhenReady(this.tb.getText());
}
event.stopPropagation();
break;
}
}