當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。