use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData in project kie-wb-common by kiegroup.
the class BaseEditorDefinitionTest method testCacheWhenNotNested.
@Test
public void testCacheWhenNotNested() {
final Optional<String> UUID = Optional.of("uuid");
final GridDataCache.CacheResult<DMNGridData> result1 = definition.getData(UUID, definition.getModelClass());
assertCacheResult(result1, false);
final GridDataCache.CacheResult<DMNGridData> result2 = definition.getData(UUID, definition.getModelClass());
assertCacheResult(result2, true);
final DMNGridData uiModel1 = result1.getGridData();
final DMNGridData uiModel2 = result2.getGridData();
assertThat(uiModel1).isSameAs(uiModel2);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData 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;
}
};
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData in project kie-wb-common by kiegroup.
the class ExpressionEditorColumnTest method mockEditor.
@SuppressWarnings("unchecked")
private BaseExpressionGrid mockEditor(final double padding, final double... widthOfCells) {
final GridColumn.HeaderMetaData headerMetaData = mock(GridColumn.HeaderMetaData.class);
final GridColumnRenderer gridColumnRenderer = mock(GridColumnRenderer.class);
final BaseExpressionGrid gridWidget = mock(BaseExpressionGrid.class);
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 null;
}
@Override
protected void initialiseUiColumns() {
for (double width : widthOfCells) {
model.appendColumn(new DMNGridColumn<GridWidget, Object>(headerMetaData, gridColumnRenderer, gridWidget) {
{
setMinimumWidth(width);
setWidth(width);
}
});
}
}
@Override
protected void initialiseUiModel() {
// Nothing for this test
}
@Override
protected boolean isHeaderHidden() {
return false;
}
@Override
public double getPadding() {
return padding;
}
};
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData in project kie-wb-common by kiegroup.
the class FunctionGridTest method testInitialSetupFromDefinition.
@Test
public void testInitialSetupFromDefinition() {
setupGrid(0);
final GridData uiModel = grid.getModel();
assertTrue(uiModel instanceof DMNGridData);
assertEquals(1, uiModel.getColumnCount());
assertTrue(uiModel.getColumns().get(0) instanceof ExpressionEditorColumn);
assertEquals(1, uiModel.getRowCount());
assertTrue(uiModel.getCell(0, 0).getValue() instanceof ExpressionCellValue);
final ExpressionCellValue dcv = (ExpressionCellValue) uiModel.getCell(0, 0).getValue();
assertEquals(literalExpressionEditor, dcv.getValue().get());
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData in project kie-wb-common by kiegroup.
the class AddInputClauseCommandTest method setUp.
@Before
public void setUp() throws Exception {
this.dtable = new DecisionTable();
this.uiModel = new DMNGridData();
this.uiModel.appendColumn(uiRowNumberColumn);
this.inputClause = new InputClause();
this.uiModelMapper = new DecisionTableUIModelMapper(() -> uiModel, () -> Optional.of(dtable), listSelector);
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiInputClauseColumn).getIndex();
}
Aggregations