Search in sources :

Example 21 with RowNumberColumn

use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn 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();
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) BaseGridColumn(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) ContextMenuHandler(com.google.gwt.event.dom.client.ContextMenuHandler) Test(org.junit.Test)

Example 22 with RowNumberColumn

use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn 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));
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) BaseGridColumn(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) ContextMenuHandler(com.google.gwt.event.dom.client.ContextMenuHandler) Test(org.junit.Test)

Example 23 with RowNumberColumn

use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn 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));
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) BaseGridColumn(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) ContextMenuHandler(com.google.gwt.event.dom.client.ContextMenuHandler) Test(org.junit.Test)

Example 24 with RowNumberColumn

use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn 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();
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) BaseGridColumn(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) ContextMenuHandler(com.google.gwt.event.dom.client.ContextMenuHandler) GridCell(org.uberfire.ext.wires.core.grids.client.model.GridCell) Test(org.junit.Test)

Aggregations

RowNumberColumn (org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn)24 Test (org.junit.Test)17 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)11 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)9 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)9 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)9 ContextMenuHandler (com.google.gwt.event.dom.client.ContextMenuHandler)6 BaseGridColumn (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn)6 ArrayList (java.util.ArrayList)4 Before (org.junit.Before)4 ExpressionEditorColumn (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn)4 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)3 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)3 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)2 BaseExpressionGrid (org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid)2 BaseGrid (org.kie.workbench.common.dmn.client.widgets.grid.BaseGrid)2 DMNGridLayer (org.kie.workbench.common.dmn.client.widgets.layer.DMNGridLayer)2 GridCell (org.uberfire.ext.wires.core.grids.client.model.GridCell)2 Layer (com.ait.lienzo.client.core.shape.Layer)1 Point2D (com.ait.lienzo.client.core.types.Point2D)1