本文整理匯總了Java中com.google.gwt.user.client.Event.ONCONTEXTMENU屬性的典型用法代碼示例。如果您正苦於以下問題:Java Event.ONCONTEXTMENU屬性的具體用法?Java Event.ONCONTEXTMENU怎麽用?Java Event.ONCONTEXTMENU使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.google.gwt.user.client.Event
的用法示例。
在下文中一共展示了Event.ONCONTEXTMENU屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onBrowserEvent
@Override
public void onBrowserEvent(Event event) {
if (contextMenuHandler != null && event.getTypeInt() == Event.ONCONTEXTMENU) {
contextMenuHandler.onContextMenu(event);
return;
}
if ((event.getTypeInt() == Event.ONCLICK
|| event.getTypeInt() == Event.ONMOUSEDOWN)
&& event.getButton() != NativeEvent.BUTTON_LEFT) {
event.preventDefault();
event.stopPropagation();
return;
}
super.onBrowserEvent(event);
}
示例2: onBrowserEvent
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
if (isEnabled() && event.getTypeInt() == Event.ONCONTEXTMENU) {
if (getStyleName().contains("-header-sortable")) {
_delegate.showSortMenu(td, cid);
}
event.preventDefault();
event.stopPropagation();
}
}
示例3: handleEventInner
private void handleEventInner(Event event) {
switch (DOM.eventGetType(event)) {
case Event.ONCONTEXTMENU:
event.preventDefault();
break;
case Event.ONKEYPRESS:
case Event.ONKEYDOWN: {
// NOTE(user): It is necessary to stop propagation on the key events to
// prevent them from leaking to the blip/wave presenters.
int keyCode = DOM.eventGetKeyCode(event);
// Move left/right to previous/next drop down widget
switch (keyCode) {
case KeyCodes.KEY_LEFT:
case KeyCodes.KEY_RIGHT:
handler.handleLeftRight(keyCode == KeyCodes.KEY_RIGHT);
event.stopPropagation();
return;
case KeyCodes.KEY_ENTER:
event.stopPropagation();
}
if (keyCode >= '1' && keyCode <= '9') {
// TODO(danilatos): Is this ok? i18n etc?
int index = keyCode - '1';
if (index >= 0 && index < getItems().size()) {
MenuItem item = getItems().get(index);
if (item == null) {
return;
}
item.getCommand().execute();
DOM.eventPreventDefault(event);
}
}
break;
}
case Event.ONMOUSEOUT: {
// Need to check that we really seem to have left the menu, as
// mouse-out events get triggered whenever the mouse moves between
// selections in the menu.
EventTarget target = event.getRelatedEventTarget();
Element targetElement = Element.as(target);
if (!getElement().isOrHasChild(targetElement)) {
handler.handleMouseOut();
}
break;
}
case Event.ONMOUSEOVER: {
handler.handleMouseOver();
break;
}
}
}