use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class RelationColumnTest method setUp.
@Before
public void setUp() throws Exception {
parentUiModel = new BaseGridData();
parentUiModel.appendRow(new BaseGridRow());
parentUiModel.appendRow(new BaseGridRow());
parentUiModel.appendColumn(mock(ExpressionEditorColumn.class));
final GridCellTuple parent = new GridCellTuple(0, 0, parentGridWidget);
doReturn(parentUiModel).when(parentGridWidget).getModel();
doReturn(widget).when(domElement).getWidget();
doReturn(parent).when(gridWidget).getParentInformation();
doReturn(100.0).when(gridWidget).getWidth();
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class CommandUtilsTest method testUpdateParentInformation_WithExpressionColumn.
@Test
public void testUpdateParentInformation_WithExpressionColumn() {
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));
}));
assertParentInformationValues(0);
uiModel.moveRowTo(0, uiModel.getRow(ROW_COUNT - 1));
CommandUtils.updateParentInformation(uiModel);
assertParentInformationValues(0);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class ExpressionContainerUIModelMapperTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
uiModel = new BaseGridData();
uiModel.appendRow(new DMNGridRow());
uiModel.appendColumn(uiExpressionColumn);
doReturn(0).when(uiExpressionColumn).getIndex();
doReturn(MINIMUM_COLUMN_WIDTH).when(uiExpressionColumn).getMinimumWidth();
parent = new GridCellTuple(0, 0, expressionContainerGrid);
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
doReturn(Optional.of(literalExpression)).when(literalExpressionEditorDefinition).getModelClass();
doReturn(Optional.of(literalExpression)).when(literalExpressionEditor).getExpression();
doReturn(Optional.of(literalExpressionEditor)).when(literalExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
doReturn(Optional.empty()).when(undefinedExpressionEditorDefinition).getModelClass();
doReturn(Optional.of(undefinedExpressionEditor)).when(undefinedExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
mapper = new ExpressionContainerUIModelMapper(parent, () -> uiModel, () -> Optional.ofNullable(expression), () -> NODE_UUID, () -> hasExpression, () -> Optional.of(hasName), expressionEditorDefinitionsSupplier, listSelector);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class UndefinedExpressionUIModelMapperTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.uiModel = new BaseGridData();
this.uiModel.appendColumn(uiColumn);
this.uiModel.appendRow(new DMNGridRow());
this.mapper = new UndefinedExpressionUIModelMapper(() -> uiModel, () -> Optional.ofNullable(expression), listSelector, hasExpression, new GridCellTuple(PARENT_ROW_INDEX, PARENT_COLUMN_INDEX, parentGridWidget));
this.cellValueSupplier = () -> Optional.of(new ExpressionCellValue(Optional.of(editor)));
when(parentGridWidget.getModel()).thenReturn(parentGridUiModel);
when(parentGridUiModel.getCell(eq(PARENT_ROW_INDEX), eq(PARENT_COLUMN_INDEX))).thenReturn(parentGridUiCell);
when(parentGridUiCell.getSelectionStrategy()).thenReturn(parentGridUiCellCellSelectionStrategy);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple in project kie-wb-common by kiegroup.
the class BaseExpressionGridRenderingTest method getGrid.
@Override
@SuppressWarnings("unchecked")
public BaseExpressionGrid getGrid() {
final GridCellTuple parent = new GridCellTuple(0, 0, null);
final HasExpression hasExpression = mock(HasExpression.class);
final Optional<LiteralExpression> expression = Optional.of(mock(LiteralExpression.class));
final Optional<HasName> hasName = Optional.of(mock(HasName.class));
return new BaseExpressionGrid(parent, Optional.empty(), hasExpression, expression, hasName, gridPanel, gridLayer, new GridDataCache.CacheResult(new DMNGridData(), false), renderer, definitionUtils, sessionManager, sessionCommandManager, canvasCommandFactory, cellEditorControls, listSelector, translationService, 0) {
@Override
protected BaseUIModelMapper makeUiModelMapper() {
return mapper;
}
@Override
protected void initialiseUiColumns() {
// Nothing for this test
}
@Override
protected void initialiseUiModel() {
// Nothing for this test
}
@Override
protected boolean isHeaderHidden() {
return isHeaderHidden;
}
};
}
Aggregations