use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerContextMenuSupportTest method testContextMenuCellIsNotSelectedCell.
@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));
}
use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerContextMenuSupportTest method makeDecisionTable.
private GuidedDecisionTableView.Presenter makeDecisionTable(final double x, final double y) {
final GridData uiModel = spy(new BaseGridData());
final GuidedDecisionTableView.Presenter dtPresenter = mock(GuidedDecisionTableView.Presenter.class);
final GuidedDecisionTableView dtView = mock(GuidedDecisionTableView.class);
final GridRenderer renderer = mock(GridRenderer.class);
final BaseGridRendererHelper helper = mock(BaseGridRendererHelper.class);
uiModel.appendRow(new BaseGridRow());
when(dtPresenter.getView()).thenReturn(dtView);
when(dtPresenter.getAccess()).thenReturn(mock(GuidedDecisionTablePresenter.Access.class));
when(dtPresenter.getModel()).thenReturn(mock(GuidedDecisionTable52.class));
when(dtView.getViewport()).thenReturn(viewport);
when(dtView.getLayer()).thenReturn(layer);
when(dtView.getLocation()).thenReturn(new Point2D(x, y));
when(dtView.getAbsoluteX()).thenReturn(x);
when(dtView.getAbsoluteY()).thenReturn(y);
when(dtView.getWidth()).thenReturn(50.0);
when(dtView.getHeight()).thenReturn(52.0);
when(dtView.getModel()).thenReturn(uiModel);
when(dtView.getRenderer()).thenReturn(renderer);
when(renderer.getHeaderHeight()).thenReturn(32.0);
when(dtView.getRendererHelper()).thenReturn(helper);
when(helper.getColumnInformation(any(Double.class))).thenReturn(columnInformation);
return dtPresenter;
}
use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerContextMenuSupportTest method onContextMenuWithCellSelectionManagerWithChangeInSelection.
@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();
}
use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerPresenterTest method makeDecisionTable.
private GuidedDecisionTableView.Presenter makeDecisionTable() {
final GuidedDecisionTableView.Presenter dtPresenter = mock(GuidedDecisionTableView.Presenter.class);
final GuidedDecisionTableView dtView = mock(GuidedDecisionTableView.class);
final GridData dtData = new BaseGridData();
when(dtPresenter.getView()).thenReturn(dtView);
when(dtPresenter.getAccess()).thenReturn(mock(GuidedDecisionTablePresenter.Access.class));
when(dtPresenter.getModel()).thenReturn(mock(GuidedDecisionTable52.class));
when(dtView.getModel()).thenReturn(dtData);
return dtPresenter;
}
use of org.uberfire.ext.wires.core.grids.client.model.GridData in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method onOtherwiseCellSingleCellSelected.
@Test
public void onOtherwiseCellSingleCellSelected() throws VetoException {
final GridData uiModel = dtPresenter.getUiModel();
uiModel.selectCell(0, 0);
dtPresenter.onOtherwiseCell();
verify(synchronizer, times(1)).setCellOtherwiseState(eq(0), eq(0));
}
Aggregations