Search in sources :

Example 1 with CellSelectionManager

use of org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionManager in project kie-wb-common by kiegroup.

the class ExpressionContainerGridTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.expressionGridCache = new ExpressionGridCacheImpl();
    this.gridLayer = spy(new DMNGridLayer());
    this.grid = new ExpressionContainerGrid(gridLayer, cellEditorControls, translationService, listSelector, sessionManager, sessionCommandManager, canvasCommandFactory, expressionEditorDefinitionsSupplier, () -> expressionGridCache, onHasExpressionChanged, onHasNameChanged, refreshFormPropertiesEvent, domainObjectSelectionEvent) {

        @Override
        public CellSelectionManager getCellSelectionManager() {
            return cellSelectionManager;
        }
    };
    this.gridLayer.add(grid);
    final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
    expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
    expressionEditorDefinitions.add(literalExpressionEditorDefinition);
    when(expressionEditorDefinitionsSupplier.get()).thenReturn(expressionEditorDefinitions);
    when(literalExpressionEditor.isCacheable()).thenReturn(true);
    when(literalExpressionEditor.getParentInformation()).thenReturn(parent);
    when(literalExpressionEditor.getModel()).thenReturn(new BaseGridData());
    when(literalExpressionEditorDefinition.getModelClass()).thenReturn(Optional.of(literalExpression));
    when(literalExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(literalExpressionEditor));
    when(undefinedExpressionEditor.getParentInformation()).thenReturn(parent);
    when(undefinedExpressionEditor.getModel()).thenReturn(new BaseGridData());
    when(undefinedExpressionEditorDefinition.getModelClass()).thenReturn(Optional.empty());
    when(undefinedExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(undefinedExpressionEditor));
    when(sessionManager.getCurrentSession()).thenReturn(session);
    when(session.getCanvasHandler()).thenReturn(canvasHandler);
    when(canvasHandler.getGraphExecutionContext()).thenReturn(graphExecutionContext);
    doReturn(mock(Bounds.class)).when(gridLayer).getVisibleBounds();
    when(canvasHandler.getDiagram()).thenReturn(diagram);
    when(diagram.getGraph()).thenReturn(graph);
    when(graph.nodes()).thenReturn(Collections.singletonList(node));
    when(parent.getGridWidget()).thenReturn(grid);
    when(parent.getRowIndex()).thenReturn(0);
    when(parent.getColumnIndex()).thenReturn(0);
    doAnswer((i) -> i.getArguments()[0].toString()).when(translationService).format(Mockito.<String>any());
}
Also used : ExpressionEditorDefinitions(org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions) HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) Optional(java.util.Optional) Bounds(org.uberfire.ext.wires.core.grids.client.model.Bounds) ExpressionGridCacheImpl(org.kie.workbench.common.dmn.client.widgets.grid.ExpressionGridCacheImpl) CellSelectionManager(org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionManager) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) DMNGridLayer(org.kie.workbench.common.dmn.client.widgets.layer.DMNGridLayer) Before(org.junit.Before)

Aggregations

Optional (java.util.Optional)1 Before (org.junit.Before)1 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)1 ExpressionEditorDefinitions (org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions)1 ExpressionGridCacheImpl (org.kie.workbench.common.dmn.client.widgets.grid.ExpressionGridCacheImpl)1 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)1 DMNGridLayer (org.kie.workbench.common.dmn.client.widgets.layer.DMNGridLayer)1 Bounds (org.uberfire.ext.wires.core.grids.client.model.Bounds)1 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)1 CellSelectionManager (org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionManager)1