use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class BaseExpressionGridRenderingTest method setup.
@Before
@Override
public void setup() {
super.setup();
doReturn(false).when(context).isSelection();
doReturn(new BaseBounds(0, 0, 1000, 1000)).when(gridLayer).getVisibleBounds();
grid.getModel().appendColumn(new RowNumberColumn());
grid.getModel().appendRow(new DMNGridRow());
doReturn(renderSelectorCommand).when(renderer).renderSelector(anyDouble(), anyDouble(), any(BaseGridRendererHelper.RenderingInformation.class));
doReturn(renderSelectedCellsCommand).when(renderer).renderSelectedCells(any(GridData.class), any(GridBodyRenderContext.class), any(BaseGridRendererHelper.class));
final List<RendererCommand> renderHeaderCommands = new ArrayList<>();
renderHeaderCommands.add(renderHeaderBackgroundCommand);
renderHeaderCommands.add(renderHeaderGridLinesCommand);
renderHeaderCommands.add(renderHeaderContentCommand);
doReturn(renderHeaderCommands).when(renderer).renderHeader(any(GridData.class), any(GridHeaderRenderContext.class), any(BaseGridRendererHelper.class), any(BaseGridRendererHelper.RenderingInformation.class));
final List<RendererCommand> renderBodyCommands = new ArrayList<>();
renderBodyCommands.add(renderBodyGridBackgroundCommand);
renderBodyCommands.add(renderBodyGridLinesCommand);
renderBodyCommands.add(renderBodyGridContentCommand);
doReturn(renderBodyCommands).when(renderer).renderBody(any(GridData.class), any(GridBodyRenderContext.class), any(BaseGridRendererHelper.class), any(BaseGridRendererHelper.RenderingInformation.class));
doReturn(renderHeaderBodyDividerCommand).when(renderer).renderHeaderBodyDivider(anyDouble());
doReturn(renderGridBoundaryCommand).when(renderer).renderGridBoundary(any(GridBoundaryRenderContext.class));
doReturn(BaseExpressionGridRenderer.HEADER_HEIGHT).when(renderer).getHeaderHeight();
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class ContextGrid method initialiseUiModel.
@Override
public void initialiseUiModel() {
expression.ifPresent(c -> {
c.getContextEntry().stream().forEach(ce -> {
model.appendRow(new DMNGridRow());
uiModelMapper.fromDMNModel(model.getRowCount() - 1, 0);
uiModelMapper.fromDMNModel(model.getRowCount() - 1, 1);
uiModelMapper.fromDMNModel(model.getRowCount() - 1, 2);
});
});
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class ContextGrid method addContextEntry.
void addContextEntry(final int index) {
expression.ifPresent(c -> {
final ContextEntry ce = new ContextEntry();
ce.setVariable(new InformationItem());
sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddContextEntryCommand(c, ce, model, new DMNGridRow(), index, uiModelMapper, this::synchroniseView));
});
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class BaseContextUIModelMapperTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiNameColumn);
this.uiModel.appendColumn(uiExpressionEditorColumn);
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiNameColumn).getIndex();
doReturn(2).when(uiExpressionEditorColumn).getIndex();
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());
this.context = new Context();
this.context.getContextEntry().add(new ContextEntry() {
{
setVariable(new InformationItem() {
{
setName(new Name("ii1"));
}
});
}
});
this.context.getContextEntry().add(new ContextEntry() {
{
setExpression(new LiteralExpression());
}
});
this.mapper = getMapper();
this.cellValueSupplier = Optional::empty;
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorColumnTest method testMinimalWidthThreeCellsSumWithPadding.
/**
* (10)[100](10)
* (10)[50][60](10)
* (10)[50][60][10](10)
*/
@Test
public void testMinimalWidthThreeCellsSumWithPadding() throws Exception {
gridData.appendColumn(column);
gridData.appendRow(new DMNGridRow());
gridData.appendRow(new DMNGridRow());
gridData.appendRow(new DMNGridRow());
mockCellsWithPadding(0, 0, PADDING, 100);
mockCellsWithPadding(1, 0, PADDING, 50, 60);
mockCellsWithPadding(2, 0, PADDING, 50, 60, 10);
Assertions.assertThat(column.getMinimumWidth()).isEqualTo(140);
}
Aggregations