use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorColumnTest method testMinimalWidthNoCellsInMiddle.
/**
* [100]
* -
* [50][60]
*/
@Test
public void testMinimalWidthNoCellsInMiddle() throws Exception {
gridData.appendColumn(column);
gridData.appendRow(new DMNGridRow());
gridData.appendRow(new DMNGridRow());
gridData.appendRow(new DMNGridRow());
mockCells(0, 0, 100);
mockCells(1, 0);
mockCells(2, 0, 50, 60);
Assertions.assertThat(column.getMinimumWidth()).isEqualTo(110);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorColumnTest method testMinimalWidthThreeCellsSum.
/**
* [100]
* [50][60]
* [50][60][10]
*/
@Test
public void testMinimalWidthThreeCellsSum() throws Exception {
gridData.appendColumn(column);
gridData.appendRow(new DMNGridRow());
gridData.appendRow(new DMNGridRow());
gridData.appendRow(new DMNGridRow());
mockCells(0, 0, 100);
mockCells(1, 0, 50, 60);
mockCells(2, 0, 50, 60, 10);
Assertions.assertThat(column.getMinimumWidth()).isEqualTo(120);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorColumnTest method testUpdateInternalWidthNoCellsInMiddle.
@Test
public void testUpdateInternalWidthNoCellsInMiddle() throws Exception {
gridData.appendColumn(column);
gridData.appendRow(new DMNGridRow());
gridData.appendRow(new DMNGridRow());
gridData.appendRow(new DMNGridRow());
mockCells(0, 0, 100);
mockCells(1, 0);
mockCells(2, 0, 50, 60);
column.setWidthInternal(200D);
Assertions.assertThat(getColumnWidth(0, 0, 0)).isEqualTo(200D);
Assertions.assertThat(getColumnWidth(2, 0, 0)).isEqualTo(50D);
Assertions.assertThat(getColumnWidth(2, 0, 1)).isEqualTo(150D);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class InvocationUIModelMapperTest 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();
doReturn(uiModel).when(gridWidget).getModel();
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
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());
final LiteralExpression invocationExpression = new LiteralExpression();
invocationExpression.setText("invocation-expression");
final LiteralExpression bindingExpression = new LiteralExpression();
bindingExpression.setText("binding-expression");
final Binding binding = new Binding();
final InformationItem parameter = new InformationItem();
parameter.setName(new Name("p0"));
binding.setParameter(parameter);
binding.setExpression(bindingExpression);
this.invocation = new Invocation();
this.invocation.setExpression(invocationExpression);
this.invocation.getBinding().add(binding);
this.mapper = new InvocationUIModelMapper(gridWidget, () -> uiModel, () -> Optional.of(invocation), expressionEditorDefinitionsSupplier, listSelector, 0);
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 DeleteContextEntryCommandTest method setup.
@Before
public void setup() {
this.context = new Context();
this.context.getContextEntry().add(new ContextEntry());
this.uiModel = new BaseGridData(false);
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendColumn(uiRowNumberColumn);
doReturn(ruleManager).when(handler).getRuleManager();
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiModelColumn).getIndex();
}
Aggregations