当前位置: 首页>>代码示例>>Java>>正文


Java ContextMenuHandler.onContextMenu方法代码示例

本文整理汇总了Java中com.google.gwt.event.dom.client.ContextMenuHandler.onContextMenu方法的典型用法代码示例。如果您正苦于以下问题:Java ContextMenuHandler.onContextMenu方法的具体用法?Java ContextMenuHandler.onContextMenu怎么用?Java ContextMenuHandler.onContextMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.event.dom.client.ContextMenuHandler的用法示例。


在下文中一共展示了ContextMenuHandler.onContextMenu方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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));
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:26,代码来源:GuidedDecisionTableModellerContextMenuSupportTest.java

示例2: 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();
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:26,代码来源:GuidedDecisionTableModellerContextMenuSupportTest.java

示例3: 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));
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:28,代码来源:GuidedDecisionTableModellerContextMenuSupportTest.java

示例4: 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));
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:40,代码来源:GuidedDecisionTableModellerContextMenuSupportTest.java

示例5: 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();
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:35,代码来源:GuidedDecisionTableModellerContextMenuSupportTest.java

示例6: 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();
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:30,代码来源:GuidedDecisionTableModellerContextMenuSupportTest.java

示例7: testContextMenuCellIsNotSelectedCell

import com.google.gwt.event.dom.client.ContextMenuHandler; //导入方法依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testContextMenuCellIsNotSelectedCell() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final GridData uiModel = dtPresenter.getView().getModel();
    final GridColumn uiColumn = new RowNumberColumn();

    uiModel.appendColumn(uiColumn);
    uiModel.appendRow(new BaseGridRow());

    //Cell associated with Mock onContextMenu Event has indices (0,0)
    uiModel.selectCells(1, 0, 1, 1);

    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);

    // this method is called if the handler does a selectCell, which should occur for this test case
    verify(cellSelectionStrategy,
           times(1)).handleSelection(any(GridData.class),
                                     eq(0),
                                     eq(0),
                                     eq(false),
                                     eq(false));

    verify(rowContextMenu,
           times(1)).show(any(Integer.class),
                          any(Integer.class));
    verify(cellContextMenu,
           never()).show(any(Integer.class),
                         any(Integer.class));
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:44,代码来源:GuidedDecisionTableModellerContextMenuSupportTest.java

示例8: onContextMenuWithMultipleTables

import com.google.gwt.event.dom.client.ContextMenuHandler; //导入方法依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void onContextMenuWithMultipleTables() {
    final GuidedDecisionTableView.Presenter dtPresenter1 = makeDecisionTable(0,
                                                                             0);
    final GuidedDecisionTableView.Presenter dtPresenter2 = makeDecisionTable(200,
                                                                             200);
    when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {{
        add(dtPresenter1);
        add(dtPresenter2);
    }});

    final GridData uiModel1 = dtPresenter1.getView().getModel();
    final GridData uiModel2 = dtPresenter2.getView().getModel();

    final GridColumn uiColumn = new BaseGridColumn(mock(GridColumn.HeaderMetaData.class),
                                                   mock(GridColumnRenderer.class),
                                                   100.0);

    uiModel1.appendColumn(uiColumn);
    uiModel2.appendColumn(uiColumn);

    when(uiModel1.getCell(any(Integer.class),
                          any(Integer.class))).thenReturn(uiCell);
    when(uiModel2.getCell(any(Integer.class),
                          any(Integer.class))).thenReturn(uiCell);

    when(columnInformation.getColumn()).thenReturn(uiColumn);

    final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);

    when(nativeEvent.getClientX()).thenReturn(50);
    when(nativeEvent.getClientY()).thenReturn(50);

    handler.onContextMenu(event);

    verify(cellSelectionStrategy,
           times(1)).handleSelection(uiModelCaptor.capture(),
                                     any(Integer.class),
                                     any(Integer.class),
                                     any(Boolean.class),
                                     any(Boolean.class));
    assertEquals(uiModel1,
                 uiModelCaptor.getValue());

    when(nativeEvent.getClientX()).thenReturn(250);
    when(nativeEvent.getClientY()).thenReturn(250);

    handler.onContextMenu(event);

    verify(cellSelectionStrategy,
           times(2)).handleSelection(uiModelCaptor.capture(),
                                     any(Integer.class),
                                     any(Integer.class),
                                     any(Boolean.class),
                                     any(Boolean.class));
    assertEquals(uiModel2,
                 uiModelCaptor.getValue());
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:60,代码来源:GuidedDecisionTableModellerContextMenuSupportTest.java


注:本文中的com.google.gwt.event.dom.client.ContextMenuHandler.onContextMenu方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。