本文整理汇总了Java中com.google.gwt.event.dom.client.ContextMenuHandler类的典型用法代码示例。如果您正苦于以下问题:Java ContextMenuHandler类的具体用法?Java ContextMenuHandler怎么用?Java ContextMenuHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContextMenuHandler类属于com.google.gwt.event.dom.client包,在下文中一共展示了ContextMenuHandler类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VOpenLayersMap
import com.google.gwt.event.dom.client.ContextMenuHandler; //导入依赖的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: setPlatypusPopupMenu
import com.google.gwt.event.dom.client.ContextMenuHandler; //导入依赖的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.ContextMenuHandler; //导入依赖的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.ContextMenuHandler; //导入依赖的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_RowContextMenu
import com.google.gwt.event.dom.client.ContextMenuHandler; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void onContextMenu_RowContextMenu() {
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
final GridData uiModel = dtPresenter.getView().getModel();
final GridColumn uiColumn = new RowNumberColumn();
uiModel.appendColumn(uiColumn);
when(columnInformation.getColumn()).thenReturn(uiColumn);
when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {{
add(dtPresenter);
}});
final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
handler.onContextMenu(event);
verify(rowContextMenu,
times(1)).show(any(Integer.class),
any(Integer.class));
verify(cellContextMenu,
never()).show(any(Integer.class),
any(Integer.class));
}
示例6: onContextMenuWithoutCellSelectionManager
import com.google.gwt.event.dom.client.ContextMenuHandler; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void onContextMenuWithoutCellSelectionManager() {
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
final GridData uiModel = dtPresenter.getView().getModel();
final GridColumn uiColumn = new RowNumberColumn();
uiModel.appendColumn(uiColumn);
when(columnInformation.getColumn()).thenReturn(uiColumn);
when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {{
add(dtPresenter);
}});
final GridCell uiCell = mock(GridCell.class);
when(uiModel.getCell(any(Integer.class),
any(Integer.class))).thenReturn(uiCell);
when(uiCell.getSelectionManager()).thenReturn(null);
final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
handler.onContextMenu(event);
verify(layer,
never()).batch();
}
示例7: setup
import com.google.gwt.event.dom.client.ContextMenuHandler; //导入依赖的package包/类
@Before
public void setup() {
when(gridLayer.addNodeMouseMoveHandler(any(NodeMouseMoveHandler.class))).thenReturn(mock(HandlerRegistration.class));
when(gridLayer.addNodeMouseOutHandler(any(NodeMouseOutHandler.class))).thenReturn(mock(HandlerRegistration.class));
when(view.addKeyDownHandler(any(KeyDownHandler.class))).thenReturn(mock(HandlerRegistration.class));
when(view.addContextMenuHandler(any(ContextMenuHandler.class))).thenReturn(mock(HandlerRegistration.class));
when(view.addMouseDownHandler(any(MouseDownHandler.class))).thenReturn(mock(HandlerRegistration.class));
when(view.getGridLayerView()).thenReturn(gridLayer);
when(view.getBounds()).thenReturn(bounds);
final GuidedDecisionTableModellerPresenter wrapped = new GuidedDecisionTableModellerPresenter(view,
dtablePresenterProvider,
contextMenuSupport,
updateRadarEvent,
pinnedEvent,
columnHeaderPopOver,
wizardManagedInstance);
presenter = spy(wrapped);
when(dtablePresenterProvider.get()).thenReturn(dtablePresenter);
when(dtablePresenter.getView()).thenReturn(dtableView);
when(dtableView.getModel()).thenReturn(new BaseGridData());
}
示例8: onModuleLoad
import com.google.gwt.event.dom.client.ContextMenuHandler; //导入依赖的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();
}
示例9: onContextMenu_CellContextMenu
import com.google.gwt.event.dom.client.ContextMenuHandler; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void onContextMenu_CellContextMenu() {
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
final GridData uiModel = dtPresenter.getView().getModel();
final GridColumn uiColumn = new BaseGridColumn(mock(GridColumn.HeaderMetaData.class),
mock(GridColumnRenderer.class),
100.0);
uiModel.appendColumn(uiColumn);
when(columnInformation.getColumn()).thenReturn(uiColumn);
when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {{
add(dtPresenter);
}});
final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
handler.onContextMenu(event);
verify(rowContextMenu,
never()).show(any(Integer.class),
any(Integer.class));
verify(cellContextMenu,
times(1)).show(any(Integer.class),
any(Integer.class));
}
示例10: testContextMenuCellIsSelectedCell
import com.google.gwt.event.dom.client.ContextMenuHandler; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testContextMenuCellIsSelectedCell() {
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
final GridData uiModel = dtPresenter.getView().getModel();
final GridColumn uiColumn = new RowNumberColumn();
uiModel.appendColumn(uiColumn);
//Cell associated with Mock onContextMenu Event has indices (0,0)
uiModel.selectCells(0, 0, 1, 1);
when(columnInformation.getColumn()).thenReturn(uiColumn);
when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {
{
add(dtPresenter);
}
});
final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
handler.onContextMenu(event);
// this method is called if the handler does a selectCell, which should not occur for this test case
verify(cellSelectionStrategy,
never()).handleSelection(any(GridData.class),
any(Integer.class),
any(Integer.class),
any(Boolean.class),
any(Boolean.class));
verify(rowContextMenu,
times(1)).show(any(Integer.class),
any(Integer.class));
verify(cellContextMenu,
never()).show(any(Integer.class),
any(Integer.class));
}
示例11: onContextMenuWithCellSelectionManagerWithChangeInSelection
import com.google.gwt.event.dom.client.ContextMenuHandler; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void onContextMenuWithCellSelectionManagerWithChangeInSelection() {
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
final GridData uiModel = dtPresenter.getView().getModel();
final GridColumn uiColumn = new RowNumberColumn();
uiModel.appendColumn(uiColumn);
when(columnInformation.getColumn()).thenReturn(uiColumn);
when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {{
add(dtPresenter);
}});
when(uiModel.getCell(any(Integer.class),
any(Integer.class))).thenReturn(uiCell);
when(cellSelectionStrategy.handleSelection(any(GridData.class),
any(Integer.class),
any(Integer.class),
any(Boolean.class),
any(Boolean.class))).thenReturn(true);
final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
handler.onContextMenu(event);
verify(cellSelectionStrategy,
times(1)).handleSelection(eq(uiModel),
eq(0),
eq(0),
eq(false),
eq(false));
verify(layer,
times(1)).batch();
}
示例12: onContextMenuWithCellSelectionManagerWithoutChangeInSelection
import com.google.gwt.event.dom.client.ContextMenuHandler; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void onContextMenuWithCellSelectionManagerWithoutChangeInSelection() {
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
final GridData uiModel = dtPresenter.getView().getModel();
final GridColumn uiColumn = new RowNumberColumn();
uiModel.appendColumn(uiColumn);
when(columnInformation.getColumn()).thenReturn(uiColumn);
when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {{
add(dtPresenter);
}});
when(uiModel.getCell(any(Integer.class),
any(Integer.class))).thenReturn(uiCell);
final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
handler.onContextMenu(event);
verify(cellSelectionStrategy,
times(1)).handleSelection(eq(uiModel),
eq(0),
eq(0),
eq(false),
eq(false));
verify(layer,
never()).batch();
}
示例13: addContextMenuHandler
import com.google.gwt.event.dom.client.ContextMenuHandler; //导入依赖的package包/类
public HandlerRegistration addContextMenuHandler(ContextMenuHandler handler) {
return addDomHandler(handler, ContextMenuEvent.getType());
}
示例14: getContextMenuHandler
import com.google.gwt.event.dom.client.ContextMenuHandler; //导入依赖的package包/类
public ContextMenuHandler getContextMenuHandler(final GuidedDecisionTableModellerView.Presenter modellerPresenter) {
return new GuidedDecisionTableModellerContextMenuHandler(modellerPresenter,
cellContextMenu,
rowContextMenu);
}