本文整理汇总了Java中com.google.gwt.event.dom.client.ContextMenuEvent.stopPropagation方法的典型用法代码示例。如果您正苦于以下问题:Java ContextMenuEvent.stopPropagation方法的具体用法?Java ContextMenuEvent.stopPropagation怎么用?Java ContextMenuEvent.stopPropagation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.event.dom.client.ContextMenuEvent
的用法示例。
在下文中一共展示了ContextMenuEvent.stopPropagation方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleBodyContextMenu
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入方法依赖的package包/类
@Override
protected void handleBodyContextMenu(ContextMenuEvent event) {
if (customContextMenu == null) {
super.handleBodyContextMenu(event);
} else if (!selectedIds.isEmpty()) {
int left = event.getNativeEvent().getClientX();
int top = event.getNativeEvent().getClientY();
top += Window.getScrollTop();
left += Window.getScrollLeft();
showContextMenuPopup(left, top);
event.stopPropagation();
event.preventDefault();
}
}
示例2: setPlatypusPopupMenu
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入方法依赖的package包/类
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
if (menu != aMenu) {
if (menuTriggerReg != null)
menuTriggerReg.removeHandler();
menu = aMenu;
if (menu != null) {
menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {
@Override
public void onContextMenu(ContextMenuEvent event) {
event.preventDefault();
event.stopPropagation();
menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
menu.show();
}
}, ContextMenuEvent.getType());
}
}
}
示例3: setPlatypusPopupMenu
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入方法依赖的package包/类
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
if (menu != aMenu) {
if (menuTriggerReg != null)
menuTriggerReg.removeHandler();
menu = aMenu;
if (menu != null) {
menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {
@Override
public void onContextMenu(ContextMenuEvent event) {
event.preventDefault();
event.stopPropagation();
menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
menu.show();
}
}, ContextMenuEvent.getType());
}
}
}
示例4: setPlatypusPopupMenu
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入方法依赖的package包/类
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
if (contextMenu != aMenu) {
if (menuTriggerReg != null)
menuTriggerReg.removeHandler();
contextMenu = aMenu;
if (contextMenu != null) {
menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {
@Override
public void onContextMenu(ContextMenuEvent event) {
event.preventDefault();
event.stopPropagation();
contextMenu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
contextMenu.show();
}
}, ContextMenuEvent.getType());
}
}
}
示例5: onContextMenu
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入方法依赖的package包/类
@Override
public boolean onContextMenu(ContextMenuEvent event, Element context) {
// Ignore quasi-deleted or disabled blip.
if (DomUtil.isQuasiDeleted(context) || !isEnabled()) {
return false;
}
menuContextElement = context;
menuContextEvent = event.getNativeEvent();
hideAndScheduleShowPopupMenu();
event.stopPropagation();
event.preventDefault();
return true;
}
示例6: handleBodyContextMenu
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入方法依赖的package包/类
protected void handleBodyContextMenu(ContextMenuEvent event) {
if (bodyActionKeys != null) {
clickedLonLat = getMap().getLonLatFromPixel(
Pixel.create(getMapClickLeftPosition(event),
getMapClickTopPosition(event)));
Projection projection = getMap().getBaseLayer().getProjection();
Projection apiProjection = getProjection();
clickedLonLat.transform(projection, apiProjection);
client.getContextMenu().showAt(this,
getWindowClickLeftPosition(event),
getWindowClickTopPosition(event));
event.stopPropagation();
event.preventDefault();
}
}
示例7: onContextMenu
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入方法依赖的package包/类
@Override
public void onContextMenu(ContextMenuEvent event) {
if (dispatch(event, event.getNativeEvent().getEventTarget().<Element>cast()) ) {
event.stopPropagation();
}
}
示例8: onContextMenu
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入方法依赖的package包/类
@Override
public void onContextMenu(final ContextMenuEvent event) {
event.preventDefault();
event.stopPropagation();
final boolean isShiftKeyDown = event.getNativeEvent().getShiftKey();
final boolean isControlKeyDown = event.getNativeEvent().getCtrlKey();
final int eventX = event.getNativeEvent().getClientX();
final int eventY = event.getNativeEvent().getClientY();
final int canvasX = getRelativeX(event);
final int canvasY = getRelativeY(event);
for (GuidedDecisionTableView.Presenter dtPresenter : modellerPresenter.getAvailableDecisionTables()) {
final GuidedDecisionTableView gridView = dtPresenter.getView();
final GridData gridModel = gridView.getModel();
final Point2D ap = CoordinateUtilities.convertDOMToGridCoordinate(gridView,
new Point2D(canvasX,
canvasY));
final Integer uiRowIndex = CoordinateUtilities.getUiRowIndex(gridView,
ap.getY());
final Integer uiColumnIndex = CoordinateUtilities.getUiColumnIndex(gridView,
ap.getX());
if (uiRowIndex == null || uiColumnIndex == null) {
continue;
}
final GridColumn<?> column = gridModel.getColumns().get(uiColumnIndex);
if (column instanceof IsRowDragHandle) {
rowContextMenu.show(eventX,
eventY);
} else {
cellContextMenu.show(eventX,
eventY);
}
// the original column index before any moves
final int modelColumnIndex = column.getIndex();
// selected cells of UIModel whose column index is that of the context menu selected cell
final Stream<SelectedCell> modelColumnSelectedCells = gridModel.getSelectedCells().stream().filter(cell -> cell.getColumnIndex() == modelColumnIndex);
// does row index of context menu selected cell match one in UIModel selected cells?
final boolean isContextMenuCellSelectedCell = modelColumnSelectedCells.map(GridData.SelectedCell::getRowIndex).anyMatch(rowIndex -> rowIndex == uiRowIndex);
// if cell selected for context menu is not one of the selected cells from CTRL or SHIFT then handle the selected cell
if (!isContextMenuCellSelectedCell) {
selectCell(uiRowIndex,
uiColumnIndex,
gridView,
isShiftKeyDown,
isControlKeyDown);
}
}
}