use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class RelationGridTest method setUp.
@Before
public void setUp() throws Exception {
tupleWithoutValue = new GridCellTuple(0, 1, gridWidget);
tupleWithValue = new GridCellValueTuple<>(0, 1, gridWidget, new BaseGridCellValue<>("value"));
definition = new RelationEditorDefinition(gridPanel, gridLayer, definitionUtils, sessionManager, sessionCommandManager, canvasCommandFactory, cellEditorControls, listSelector, translationService);
final Decision decision = new Decision();
decision.setName(new Name("name"));
hasName = Optional.of(decision);
expression = definition.getModelClass();
doReturn(canvasHandler).when(dmnClientFullSession).getCanvasHandler();
doReturn(dmnClientFullSession).when(sessionManager).getCurrentSession();
doReturn(parentGridData).when(parentGridWidget).getModel();
doReturn(Collections.singletonList(parentGridColumn)).when(parentGridData).getColumns();
parent = spy(new GridCellTuple(0, 0, parentGridWidget));
when(gridWidget.getModel()).thenReturn(new BaseGridData(false));
doAnswer((i) -> i.getArguments()[0].toString()).when(translationService).format(anyString());
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class DMNGridLayerTest method testGhostRenderingLiteralExpression.
@Test
public void testGhostRenderingLiteralExpression() {
final LiteralExpressionGrid literalExpressionGrid = mock(LiteralExpressionGrid.class);
final GridCellTuple parentGridCellTuple = new GridCellTuple(0, 0, container);
GwtMockito.useProviderForType(Group.class, clazz -> ghostGroup);
doReturn(new HashSet<>(Arrays.asList(container, literalExpressionGrid))).when(gridLayer).getGridWidgets();
doReturn(ghostRectangle).when(gridLayer).getGhostRectangle();
doReturn(parentGridCellTuple).when(literalExpressionGrid).getParentInformation();
gridLayer.select(literalExpressionGrid);
gridLayer.doBatch();
assertGhostRendering();
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class DMNGridLayerTest method testGhostRenderingUndefinedExpression.
@Test
public void testGhostRenderingUndefinedExpression() {
final UndefinedExpressionGrid undefinedExpressionGrid = mock(UndefinedExpressionGrid.class);
final GridCellTuple parentGridCellTuple = new GridCellTuple(0, 0, container);
GwtMockito.useProviderForType(Group.class, clazz -> ghostGroup);
doReturn(new HashSet<>(Arrays.asList(container, undefinedExpressionGrid))).when(gridLayer).getGridWidgets();
doReturn(ghostRectangle).when(gridLayer).getGhostRectangle();
doReturn(parentGridCellTuple).when(undefinedExpressionGrid).getParentInformation();
gridLayer.select(undefinedExpressionGrid);
gridLayer.doBatch();
assertGhostRendering();
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class BaseContextUIModelMapperTest method testFromDMNModelUndefinedExpression.
@Test
public void testFromDMNModelUndefinedExpression() {
mapper.fromDMNModel(0, 2);
assertTrue(uiModel.getCell(0, 2).getValue() instanceof ExpressionCellValue);
final ExpressionCellValue dcv0 = (ExpressionCellValue) uiModel.getCell(0, 2).getValue();
assertEquals(undefinedExpressionEditor, dcv0.getValue().get());
verify(undefinedExpressionEditorDefinition).getEditor(parentCaptor.capture(), eq(Optional.empty()), eq(context.getContextEntry().get(0)), eq(Optional.empty()), eq(Optional.of(context.getContextEntry().get(0).getVariable())), eq(1));
final GridCellTuple parent = parentCaptor.getValue();
assertEquals(0, parent.getRowIndex());
assertEquals(2, parent.getColumnIndex());
assertEquals(gridWidget, parent.getGridWidget());
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class BaseContextUIModelMapperTest method testFromDMNModelLiteralExpression.
@Test
@SuppressWarnings("unchecked")
public void testFromDMNModelLiteralExpression() {
mapper.fromDMNModel(1, 2);
assertTrue(uiModel.getCell(1, 2).getValue() instanceof ExpressionCellValue);
final ExpressionCellValue dcv1 = (ExpressionCellValue) uiModel.getCell(1, 2).getValue();
assertEquals(literalExpressionEditor, dcv1.getValue().get());
verify(literalExpressionEditorDefinition).getEditor(parentCaptor.capture(), eq(Optional.empty()), eq(context.getContextEntry().get(1)), eq(Optional.of(context.getContextEntry().get(1).getExpression())), eq(Optional.empty()), eq(1));
final GridCellTuple parent = parentCaptor.getValue();
assertEquals(1, parent.getRowIndex());
assertEquals(2, parent.getColumnIndex());
assertEquals(gridWidget, parent.getGridWidget());
}
Aggregations