本文整理汇总了Java中com.google.gwt.event.dom.client.ContextMenuEvent类的典型用法代码示例。如果您正苦于以下问题:Java ContextMenuEvent类的具体用法?Java ContextMenuEvent怎么用?Java ContextMenuEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContextMenuEvent类属于com.google.gwt.event.dom.client包,在下文中一共展示了ContextMenuEvent类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VOpenLayersMap
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入依赖的package包/类
/**
* The constructor should first call super() to initialize the component and
* then handle any initialization relevant to Vaadin.
*/
public VOpenLayersMap() {
setWidth("500px");
setHeight("500px");
add(map);
add(fakePaintables);
fakePaintables.setVisible(false);
// This method call of the Paintable interface sets the component
// style name in DOM tree
setStyleName(CLASSNAME);
sinkEvents(Event.ONCONTEXTMENU);
addDomHandler(new ContextMenuHandler() {
public void onContextMenu(ContextMenuEvent event) {
handleBodyContextMenu(event);
}
}, ContextMenuEvent.getType());
}
示例2: MonthItemLabel
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入依赖的package包/类
/**
* Default constructor
*/
public MonthItemLabel() {
setStylePrimaryName(STYLENAME);
addDomHandler(contextMenuEvent -> {
calendar.getMouseEventListener().contextMenu(contextMenuEvent, MonthItemLabel.this);
contextMenuEvent.stopPropagation();
contextMenuEvent.preventDefault();
}, ContextMenuEvent.getType());
}
示例3: 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();
}
}
示例4: init
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入依赖的package包/类
@Override
protected void init() {
super.init();
getWidget().tabContextMenuHandler = new CubaTabSheetWidget.TabContextMenuHandler() {
@Override
public void onContextMenu(int tabIndex, ContextMenuEvent event) {
lastContextMenuX = WidgetUtil.getTouchOrMouseClientX(event.getNativeEvent());
lastContextMenuY = WidgetUtil.getTouchOrMouseClientY(event.getNativeEvent());
if (getState().hasActionsHandlers) {
rpc.onTabContextMenu(tabIndex);
event.stopPropagation();
event.preventDefault();
}
}
};
}
示例5: 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());
}
}
}
示例6: 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());
}
}
}
示例7: 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());
}
}
}
示例8: updateEventCaches
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入依赖的package包/类
/**
* Update event caches to keep track of the latest event of each instance.
* @param the event to cache
*/
private void updateEventCaches(Event<?> event){
if(event == null){
return;
}
if(event instanceof DoubleClickEvent){
doubleClickEvent = new org.gz.gwt.mousemanager.client.event.DoubleClickEvent((DoubleClickEvent)event, target);
}
if(event instanceof ClickEvent){
clickEvent = new org.gz.gwt.mousemanager.client.event.ClickEvent((ClickEvent)event, target);
}
if(event instanceof MouseUpEvent){
mouseUpEvent = new org.gz.gwt.mousemanager.client.event.MouseUpEvent((MouseUpEvent)event, target);
}
if(event instanceof MouseDownEvent){
mouseDownEvent = new org.gz.gwt.mousemanager.client.event.MouseDownEvent((MouseDownEvent)event, target);
}
if(event instanceof MouseMoveEvent){
mouseMoveEvent = new org.gz.gwt.mousemanager.client.event.MouseMoveEvent((MouseMoveEvent)event, target);
}
if(event instanceof MouseOverEvent){
mouseOverEvent = new org.gz.gwt.mousemanager.client.event.MouseOverEvent((MouseOverEvent)event, target);
}
if(event instanceof MouseOutEvent){
mouseOutEvent = new org.gz.gwt.mousemanager.client.event.MouseOutEvent((MouseOutEvent)event, target);
}
if(event instanceof MouseWheelEvent){
mouseWheelEvent = new org.gz.gwt.mousemanager.client.event.MouseWheelEvent((MouseWheelEvent)event, target);
}
if(event instanceof ContextMenuEvent){
contextMenuEvent = new org.gz.gwt.mousemanager.client.event.ContextMenuEvent();
}
}
示例9: init
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入依赖的package包/类
@PostConstruct
public void init() {
settings.setShowProgressbar(false);
settings.setPauseOnMouseOver(true);
settings.setAllowDismiss(true);
settings.setDelay(DELAY);
settings.setTimer(TIMER);
addDomHandler((e) -> {
e.preventDefault();
e.stopPropagation();
},
ContextMenuEvent.getType());
showLoading(false);
//getting initial palette position
paletteInitialTop = palettePanel.getAbsoluteTop();
paletteInitialLeft = palettePanel.getAbsoluteLeft();
}
示例10: onModuleLoad
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入依赖的package包/类
@Override
public void onModuleLoad() {
// Rest client configuration
RestClient.setJacksonMarshallingActive(true);
RestClient.setApplicationRoot("rs");
// Disable right click
RootLayoutPanel.get().addDomHandler(new ContextMenuHandler() {
@Override
public void onContextMenu(ContextMenuEvent event) {
event.preventDefault();
event.stopPropagation();
}
}, ContextMenuEvent.getType());
// Create main content
mainLayout = new MainLayout();
RootLayoutPanel.get().add(mainLayout);
// init
mainLayout.init();
}
示例11: 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;
}
示例12: PartStackViewImpl
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入依赖的package包/类
@Inject
public PartStackViewImpl(
PartStackUIResources resources, CoreLocalizationConstant localizationConstant) {
this.resources = resources;
this.localizationConstant = localizationConstant;
initWidget(UI_BINDER.createAndBindUi(this));
partStackContent.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
tabs = new HashMap<>();
partViewContainer =
new AcceptsOneWidget() {
@Override
public void setWidget(IsWidget widget) {
partStackContent.add(widget);
}
};
addDomHandler(this, MouseDownEvent.getType());
addDomHandler(this, ContextMenuEvent.getType());
setMaximized(false);
addMaximizeButton();
addHideButton();
addMenuButton();
}
示例13: EditorTabWidget
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入依赖的package包/类
@Inject
public EditorTabWidget(
@Assisted final EditorPartPresenter relatedEditorPart,
@Assisted EditorPartStack relatedEditorPartStack,
PartStackUIResources resources,
EditorTabContextMenuFactory editorTabContextMenu,
final EventBus eventBus,
final EditorAgent editorAgent) {
this.resources = resources;
this.relatedEditorPart = relatedEditorPart;
this.relatedEditorPartStack = relatedEditorPartStack;
this.editorAgent = editorAgent;
initWidget(UI_BINDER.createAndBindUi(this));
this.editorTabContextMenu = editorTabContextMenu;
this.file = relatedEditorPart.getEditorInput().getFile();
this.icon = relatedEditorPart.getTitleImage();
this.title.setText(file.getDisplayName());
// add "path" attribute describing the full path of opened file, will be used full for testing
this.title.getElement().setAttribute("path", file.getLocation().toString());
this.id = title + UUID.uuid(4);
iconPanel.add(getIcon());
addDomHandler(this, ClickEvent.getType());
addDomHandler(this, DoubleClickEvent.getType());
addDomHandler(this, ContextMenuEvent.getType());
eventBus.addHandler(ResourceChangedEvent.getType(), this);
eventBus.addHandler(FileEvent.TYPE, this);
sinkEvents(Event.ONMOUSEDOWN);
closeButton.addDomHandler(
event -> editorAgent.closeEditor(relatedEditorPart), ClickEvent.getType());
relatedEditorPart.addPropertyListener(
(source, propId) -> {
if (propId == EditorPartPresenter.PROP_INPUT) {
file = relatedEditorPart.getEditorInput().getFile();
title.setText(file.getDisplayName());
}
});
}
示例14: onContextMenu
import com.google.gwt.event.dom.client.ContextMenuEvent; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void onContextMenu(ContextMenuEvent event) {
// construct for each editor tab own context menu,
// that will have store information about selected virtual file and pin state at first step
// in future maybe we should create another mechanism to associate context menu with initial
// dto's
editorTabContextMenu
.newContextMenu(this, relatedEditorPart, relatedEditorPartStack)
.show(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
}