Search in sources :

Example 86 with BaseGridRow

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.

the class ExpressionEditorColumnTest method testMinimalWidthOneCellInEachRowWithPadding.

/**
 * (10)[100](10)
 * (10)[150](10)
 * (10)[125](10)
 */
@Test
public void testMinimalWidthOneCellInEachRowWithPadding() {
    gridData.appendColumn(column);
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    mockCellsWithPadding(0, 0, PADDING, 100);
    mockCellsWithPadding(1, 0, PADDING, 150);
    mockCellsWithPadding(2, 0, PADDING, 125);
    assertThat(column.getMinimumWidth()).isEqualTo(170);
}
Also used : BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) Test(org.junit.Test)

Example 87 with BaseGridRow

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.

the class ExpressionEditorColumnTest method testMinimalWidthDefaultWidth.

/**
 * [99]
 * [30][30][30]
 * [49][50]
 */
@Test
public void testMinimalWidthDefaultWidth() {
    gridData.appendColumn(column);
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    mockCells(0, 0, 99);
    mockCells(1, 0, 30, 30, 30);
    mockCells(2, 0, 49, 50);
    assertThat(column.getMinimumWidth()).isEqualTo(DEFAULT_WIDTH);
}
Also used : BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) Test(org.junit.Test)

Example 88 with BaseGridRow

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow 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() {
    gridData.appendColumn(column);
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    mockCellsWithPadding(0, 0, PADDING, 100);
    mockCellsWithPadding(1, 0, PADDING, 50, 60);
    mockCellsWithPadding(2, 0, PADDING, 50, 60, 10);
    assertThat(column.getMinimumWidth()).isEqualTo(140);
}
Also used : BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) Test(org.junit.Test)

Example 89 with BaseGridRow

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.

the class ExpressionEditorColumnTest method testMinimalWidthOneCellInEachRow.

/**
 * [100]
 * [150]
 * [125]
 */
@Test
public void testMinimalWidthOneCellInEachRow() {
    gridData.appendColumn(column);
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    mockCells(0, 0, 100d);
    mockCells(1, 0, 150);
    mockCells(2, 0, 125);
    assertThat(column.getMinimumWidth()).isEqualTo(150);
}
Also used : BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) Test(org.junit.Test)

Example 90 with BaseGridRow

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.

the class AddOutputClauseCommandTest method testCanvasCommandAddOutputClauseToRuleWithInputs.

@Test
public void testCanvasCommandAddOutputClauseToRuleWithInputs() throws Exception {
    makeCommand(DecisionTableUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT + 1);
    final String ruleInputValue = "in value";
    final String ruleOutputValue = "out value";
    dtable.getInput().add(new InputClause());
    dtable.getRule().add(new DecisionRule() {

        {
            getInputEntry().add(new UnaryTests() {

                {
                    getText().setValue(ruleInputValue);
                }
            });
            getOutputEntry().add(new LiteralExpression() {

                {
                    getText().setValue(ruleOutputValue);
                }
            });
        }
    });
    // Graph command populates OutputEntries so overwrite with test values
    final Command<GraphCommandExecutionContext, RuleViolation> graphCommand = command.newGraphCommand(canvasHandler);
    graphCommand.execute(graphCommandExecutionContext);
    dtable.getRule().get(0).getOutputEntry().get(0).getText().setValue(ruleOutputValue);
    doReturn(1).when(uiInputClauseColumn).getIndex();
    doReturn(2).when(uiOutputClauseColumn).getIndex();
    uiModel.appendColumn(uiInputClauseColumn);
    uiModel.appendRow(new BaseGridRow());
    uiModelMapper.fromDMNModel(0, 1);
    final Command<AbstractCanvasHandler, CanvasViolation> canvasAddOutputClauseCommand = command.newCanvasCommand(canvasHandler);
    canvasAddOutputClauseCommand.execute(canvasHandler);
    assertEquals(ruleInputValue, uiModel.getRow(0).getCells().get(1).getValue().getValue());
    assertEquals(ruleOutputValue, uiModel.getRow(0).getCells().get(2).getValue().getValue());
    assertEquals(3, uiModel.getColumnCount());
    assertEquals(CanvasCommandResultBuilder.SUCCESS, canvasAddOutputClauseCommand.undo(canvasHandler));
    assertEquals(2, uiModel.getColumnCount());
    verify(executeCanvasOperation).execute();
    verify(undoCanvasOperation).execute();
    verify(command, times(2)).updateParentInformation();
}
Also used : CanvasViolation(org.kie.workbench.common.stunner.core.client.command.CanvasViolation) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) LiteralExpression(org.kie.workbench.common.dmn.api.definition.model.LiteralExpression) GraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) UnaryTests(org.kie.workbench.common.dmn.api.definition.model.UnaryTests) InputClause(org.kie.workbench.common.dmn.api.definition.model.InputClause) DecisionRule(org.kie.workbench.common.dmn.api.definition.model.DecisionRule) Test(org.junit.Test)

Aggregations

BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)104 Test (org.junit.Test)57 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)25 Before (org.junit.Before)24 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)19 CanvasViolation (org.kie.workbench.common.stunner.core.client.command.CanvasViolation)18 GridRow (org.uberfire.ext.wires.core.grids.client.model.GridRow)18 List (org.kie.workbench.common.dmn.api.definition.model.List)14 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)14 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)11 Optional (java.util.Optional)10 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)10 InformationItem (org.kie.workbench.common.dmn.api.definition.model.InformationItem)10 DecisionRule (org.kie.workbench.common.dmn.api.definition.model.DecisionRule)9 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)9 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)9 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)9 RowNumberColumn (org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn)9 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)8 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)8