本文整理汇总了Java中com.google.gwt.event.dom.client.KeyPressEvent.stopPropagation方法的典型用法代码示例。如果您正苦于以下问题:Java KeyPressEvent.stopPropagation方法的具体用法?Java KeyPressEvent.stopPropagation怎么用?Java KeyPressEvent.stopPropagation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.event.dom.client.KeyPressEvent
的用法示例。
在下文中一共展示了KeyPressEvent.stopPropagation方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onKeyPress
import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
public void onKeyPress(KeyPressEvent event) {
ChartState chartInfo = getChartState(event);
Chart chart = chartInfo.chart;
int keyCode = event.getCharCode();
boolean handled = true;
if (keyCode == KeyCodes.KEY_TAB) {
handled = handleTabKey((Event)event.getNativeEvent(), chartInfo, keyCode, event.isShiftKeyDown());
} else if (keyCode == KEY_Z) {
chart.nextZoom();
} else if (keyCode == KEY_X) {
chart.prevZoom();
} else if (keyCode == KeyCodes.KEY_ENTER) {
chart.maxZoomToFocus();
} else {
handled = false;
}
chartInfo.setHandled(handled);
if (handled) {
event.stopPropagation();
event.preventDefault();
}
}
示例2: onKeyPress
import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@Override
public void onKeyPress(KeyPressEvent event) {
//Window.alert("Char code: '" + (int) getCharCode( event.getNativeEvent() ) + "', key code: " + event.getNativeEvent().getKeyCode());
//Substitute characters if the transliteration is on and the text input is enabled
if( textObject.isEnabled() ) {
final Character charCode = getCharCode( event.getNativeEvent() );
if( processNewCharacter( charCode ) ) {
event.stopPropagation();
event.preventDefault();
}
}
}
示例3: onKeyPress
import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@Override
public void onKeyPress(KeyPressEvent event) {
if (KeyCommandSet.toMask(event) == ShowHelpCommand.INSTANCE.keyMask) {
// Block the '?' key from triggering us to show right after
// we just hide ourselves.
//
event.stopPropagation();
event.preventDefault();
}
hide();
}
示例4: onKeyPress
import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@Override
public void onKeyPress(KeyPressEvent event) {
final KeyCommand k = map.get(toMask(event));
if (k != null) {
event.preventDefault();
event.stopPropagation();
k.onKeyPress(event);
}
}
示例5: onMessageKey
import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@UiHandler("message")
void onMessageKey(KeyPressEvent event) {
if ((event.getCharCode() == '\n' || event.getCharCode() == KeyCodes.KEY_ENTER)
&& event.isControlKeyDown()) {
event.preventDefault();
event.stopPropagation();
onSend(null);
}
}
示例6: onKeyPress
import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@Override
public void onKeyPress(KeyPressEvent event) {
if (event.getCharCode() == KeyCodes.KEY_ENTER) {
this.toggleOpen();
event.preventDefault();
event.stopPropagation();
}
}
示例7: onKeyPress
import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@Override
public void onKeyPress(KeyPressEvent event) {
boolean valid = false;
char pressed = event.getCharCode();
for (char c : ALLOWED_CHARS) {
if (c == pressed) {
valid = true;
break;
}
}
if (!valid) {
event.preventDefault();
event.stopPropagation();
}
}
示例8: handleKeyPress
import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@Override
protected boolean handleKeyPress(KeyPressEvent event) {
boolean b = handleKeyPress(event.getCharCode());
if (b) {
event.preventDefault();
event.stopPropagation();
}
return b;
}
示例9: onKeyPress
import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@Override
public void onKeyPress(KeyPressEvent event) {
code = new Code(event);
if (code.getCharCode() > 31 && code.getCharCode() < 127) processCode(code);
if (!keybuf.toString().equals("") && output != null){
for (int i = 0; i < keybuf.toString().getBytes().length; i++){
output.setInnerHTML(output.getInnerHTML() + "[ " + keybuf.toString().getBytes()[i] + " ]");
}
}
keybuf = new KeyBuffer();
event.stopPropagation();
event.preventDefault();
}
示例10: onKeyPress
import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@Override
public void onKeyPress(KeyPressEvent event) {
event.preventDefault();
event.stopPropagation();
}
示例11: onKeyPress
import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@Override
public void onKeyPress(KeyPressEvent event) {
event.stopPropagation();
}
示例12: onKeyPress
import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@Override
public void onKeyPress(KeyPressEvent event) {
final char code = event.getCharCode();
final int nativeCode = event.getNativeEvent().getKeyCode();
switch (nativeCode) {
case KeyCodes.KEY_ALT:
case KeyCodes.KEY_BACKSPACE:
case KeyCodes.KEY_CTRL:
case KeyCodes.KEY_DELETE:
case KeyCodes.KEY_DOWN:
case KeyCodes.KEY_END:
case KeyCodes.KEY_ENTER:
case KeyCodes.KEY_ESCAPE:
case KeyCodes.KEY_HOME:
case KeyCodes.KEY_LEFT:
case KeyCodes.KEY_PAGEDOWN:
case KeyCodes.KEY_PAGEUP:
case KeyCodes.KEY_RIGHT:
case KeyCodes.KEY_SHIFT:
case KeyCodes.KEY_TAB:
case KeyCodes.KEY_UP:
// Allow these, even if one of their assigned codes is
// identical to an ASCII character we do not want to
// allow in the box.
//
// We still want to let the user move around the input box
// with their arrow keys, or to move between fields using tab.
// Invalid characters introduced will be caught through the
// server's own validation of the input data.
//
break;
default:
final TextBox box = (TextBox) event.getSource();
final String re;
if (box.getCursorPos() == 0) {
re = Account.USER_NAME_PATTERN_FIRST;
} else {
re = Account.USER_NAME_PATTERN_REST;
}
if (!String.valueOf(code).matches("^" + re + "$")) {
event.preventDefault();
event.stopPropagation();
}
}
}
示例13: onSaveKeyPress
import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@UiHandler("save")
void onSaveKeyPress(KeyPressEvent e) {
if (e.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
e.stopPropagation();
}
}