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


Java KeyPressEvent.stopPropagation方法代码示例

本文整理汇总了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();
  }
}
 
开发者ID:codeaudit,项目名称:gwt-chronoscope,代码行数:26,代码来源:ChartKeyPressHandler.java

示例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();
		}
	}
}
 
开发者ID:ivan-zapreev,项目名称:x-cure-chat,代码行数:13,代码来源:Transliterator.java

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

示例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);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:KeyCommandSet.java

示例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);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:ActionMessageBox.java

示例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();
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:9,代码来源:AbstractDropdown.java

示例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();
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:16,代码来源:InputEmail.java

示例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;
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:10,代码来源:StaticStringTokenHelper.java

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

示例10: onKeyPress

import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@Override
public void onKeyPress(KeyPressEvent event) {
	event.preventDefault();
	event.stopPropagation();
}
 
开发者ID:ivan-zapreev,项目名称:x-cure-chat,代码行数:6,代码来源:SiteLoadingGlassPanel.java

示例11: onKeyPress

import com.google.gwt.event.dom.client.KeyPressEvent; //导入方法依赖的package包/类
@Override
public void onKeyPress(KeyPressEvent event) {
  event.stopPropagation();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:5,代码来源:GlobalKey.java

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

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


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