use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class InvocationGrid method clearExpressionType.
void clearExpressionType(final int uiRowIndex) {
final GridCellTuple gc = new GridCellTuple(uiRowIndex, InvocationUIModelMapper.BINDING_EXPRESSION_COLUMN_INDEX, this);
final HasExpression hasExpression = expression.get().getBinding().get(uiRowIndex);
sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new ClearExpressionTypeCommand(gc, hasExpression, uiModelMapper, () -> synchroniseViewWhenExpressionEditorChanged(this)));
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class CommandUtilsTest method testExtractCellValueNoValue.
@Test
public void testExtractCellValueNoValue() throws Exception {
final int rowIndex = 123;
final int columnIndex = 456;
final GridData gridData = mock(GridData.class);
final GridWidget gridWidget = mock(GridWidget.class);
final GridCellTuple cellTuple = new GridCellTuple(rowIndex, columnIndex, gridWidget);
doReturn(gridData).when(gridWidget).getModel();
doReturn(null).when(gridData).getCell(rowIndex, columnIndex);
Assertions.assertThat(CommandUtils.extractGridCellValue(cellTuple)).isEmpty();
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class CommandUtilsTest method testExtractCellValue.
@Test
public void testExtractCellValue() throws Exception {
final int rowIndex = 123;
final int columnIndex = 456;
final GridCellValue gridCellValue = mock(GridCellValue.class);
final GridCell gridCell = mock(GridCell.class);
final GridData gridData = mock(GridData.class);
final GridWidget gridWidget = mock(GridWidget.class);
final GridCellTuple cellTuple = new GridCellTuple(rowIndex, columnIndex, gridWidget);
doReturn(gridData).when(gridWidget).getModel();
doReturn(gridCell).when(gridData).getCell(rowIndex, columnIndex);
doReturn(gridCellValue).when(gridCell).getValue();
Assertions.assertThat(CommandUtils.extractGridCellValue(cellTuple)).hasValue(gridCellValue);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class CommandUtilsTest method testUpdateParentInformation_WithMultipleColumns.
@Test
public void testUpdateParentInformation_WithMultipleColumns() {
setupUiModel(Pair.newPair(new ExpressionEditorColumn(gridLayer, new BaseHeaderMetaData("column"), gridWidget), (rowIndex) -> {
final BaseExpressionGrid grid = mock(BaseExpressionGrid.class);
final GridCellTuple gct = new GridCellTuple(rowIndex, 0, mock(GridWidget.class));
when(grid.getParentInformation()).thenReturn(gct);
return new ExpressionCellValue(Optional.of(grid));
}), Pair.newPair(new RowNumberColumn(), (rowIndex) -> new BaseGridCellValue<>(rowIndex + 1)));
assertParentInformationValues(0);
uiModel.moveColumnTo(0, uiModel.getColumns().get(1));
CommandUtils.updateParentInformation(uiModel);
assertParentInformationValues(1);
}
Aggregations