use of com.google.gwt.event.dom.client.ContextMenuHandler in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerContextMenuSupportTest method testContextMenuCellIsSelectedCell.
@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));
}
use of com.google.gwt.event.dom.client.ContextMenuHandler in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerContextMenuSupportTest method onContextMenu_RowContextMenu.
@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));
}
use of com.google.gwt.event.dom.client.ContextMenuHandler in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerContextMenuSupportTest method onContextMenuWithoutCellSelectionManager.
@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.getSelectionStrategy()).thenReturn(null);
final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
handler.onContextMenu(event);
verify(layer, never()).batch();
}
use of com.google.gwt.event.dom.client.ContextMenuHandler in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerContextMenuSupportTest method onContextMenuWithCellSelectionManagerWithoutChangeInSelection.
@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();
}
Aggregations