Search in sources :

Example 6 with DMNGridData

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData in project kie-wb-common by kiegroup.

the class DeleteOutputClauseCommandTest method setup.

@Before
public void setup() {
    this.dtable = new DecisionTable();
    this.outputClause = new OutputClause();
    this.dtable.getOutput().add(outputClause);
    this.uiModel = new DMNGridData();
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModel.appendColumn(uiOutputClauseColumn);
    this.uiModel.appendColumn(uiDescriptionColumn);
    this.uiModelMapper = new DecisionTableUIModelMapper(() -> uiModel, () -> Optional.of(dtable), listSelector);
    this.command = spy(new DeleteOutputClauseCommand(dtable, uiModel, DecisionTableUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT + dtable.getInput().size(), uiModelMapper, canvasOperation));
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiOutputClauseColumn).getIndex();
    doReturn(2).when(uiDescriptionColumn).getIndex();
}
Also used : OutputClause(org.kie.workbench.common.dmn.api.definition.v1_1.OutputClause) DecisionTable(org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable) DecisionTableUIModelMapper(org.kie.workbench.common.dmn.client.editors.expressions.types.dtable.DecisionTableUIModelMapper) DMNGridData(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData) Before(org.junit.Before)

Example 7 with DMNGridData

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData in project kie-wb-common by kiegroup.

the class MoveColumnsCommandTest method setUp.

@Before
public void setUp() throws Exception {
    this.dtable = new DecisionTable();
    this.uiModel = new DMNGridData();
    dtable.getInput().add(inputClauseOne);
    dtable.getInput().add(inputClauseTwo);
    dtable.getInput().add(inputClauseThree);
    dtable.getOutput().add(outputClauseOne);
    dtable.getOutput().add(outputClauseTwo);
    dtable.getOutput().add(outputClauseThree);
    dtable.getRule().add(new DecisionRule() {

        {
            getInputEntry().add(new UnaryTests());
            getInputEntry().add(new UnaryTests());
            getInputEntry().add(new UnaryTests());
            getOutputEntry().add(new LiteralExpression());
            getOutputEntry().add(new LiteralExpression());
            getOutputEntry().add(new LiteralExpression());
        }
    });
    uiModel.appendColumn(uiRowNumberColumn);
    uiModel.appendColumn(uiInputClauseColumnOne);
    uiModel.appendColumn(uiInputClauseColumnTwo);
    uiModel.appendColumn(uiInputClauseColumnThree);
    uiModel.appendColumn(uiOutputClauseColumnOne);
    uiModel.appendColumn(uiOutputClauseColumnTwo);
    uiModel.appendColumn(uiOutputClauseColumnThree);
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiInputClauseColumnOne).getIndex();
    doReturn(2).when(uiInputClauseColumnTwo).getIndex();
    doReturn(3).when(uiInputClauseColumnThree).getIndex();
    doReturn(4).when(uiOutputClauseColumnOne).getIndex();
    doReturn(5).when(uiOutputClauseColumnTwo).getIndex();
    doReturn(6).when(uiOutputClauseColumnThree).getIndex();
}
Also used : DecisionTable(org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) DMNGridData(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData) UnaryTests(org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests) DecisionRule(org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule) Before(org.junit.Before)

Example 8 with DMNGridData

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData in project kie-wb-common by kiegroup.

the class MoveRowsCommandTest method setUp.

@Before
public void setUp() throws Exception {
    this.dtable = new DecisionTable();
    this.uiModel = new DMNGridData();
    dtable.getInput().add(inputClause);
    dtable.getOutput().add(outputClause);
    uiModel.appendColumn(uiRowNumberColumn);
    uiModel.appendColumn(uiInputClauseColumn);
    uiModel.appendColumn(uiOutputClauseColumn);
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiInputClauseColumn).getIndex();
    doReturn(2).when(uiOutputClauseColumn).getIndex();
    rowsUnderTest.clear();
    appendRow(0, "a");
    appendRow(1, "b");
    appendRow(2, "c");
}
Also used : DecisionTable(org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable) DMNGridData(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData) Before(org.junit.Before)

Example 9 with DMNGridData

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData in project kie-wb-common by kiegroup.

the class MoveColumnsCommandTest method setup.

@Before
public void setup() {
    this.relation = new Relation();
    this.uiModel = new DMNGridData();
    doReturn(ruleManager).when(handler).getRuleManager();
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiModelColumn1).getIndex();
    doReturn(2).when(uiModelColumn2).getIndex();
    addRelationColumn(II1);
    addRelationColumn(II2);
    addRelationRow(II1);
    addRelationRow(II2);
    addUiModelColumn(uiRowNumberColumn);
    addUiModelColumn(uiModelColumn1);
    addUiModelColumn(uiModelColumn2);
    addUiModelRow(0);
    addUiModelRow(1);
}
Also used : Relation(org.kie.workbench.common.dmn.api.definition.v1_1.Relation) DMNGridData(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData) Before(org.junit.Before)

Example 10 with DMNGridData

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData in project kie-wb-common by kiegroup.

the class MoveRowsCommandTest method setup.

@Before
public void setup() {
    this.relation = new Relation();
    this.uiModel = new DMNGridData();
    doReturn(ruleManager).when(handler).getRuleManager();
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiModelColumn1).getIndex();
    addRelationColumn(II1);
    addRelationColumn(II2);
    addRelationRow(II1);
    addRelationRow(II2);
    addUiModelColumn(uiRowNumberColumn);
    addUiModelColumn(uiModelColumn1);
    addUiModelRow(0);
    addUiModelRow(1);
}
Also used : Relation(org.kie.workbench.common.dmn.api.definition.v1_1.Relation) DMNGridData(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData) Before(org.junit.Before)

Aggregations

DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)21 Before (org.junit.Before)15 DecisionTable (org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable)8 DecisionTableUIModelMapper (org.kie.workbench.common.dmn.client.editors.expressions.types.dtable.DecisionTableUIModelMapper)5 GridDataCache (org.kie.workbench.common.dmn.client.widgets.grid.model.GridDataCache)5 DecisionRule (org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule)4 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)4 Test (org.junit.Test)3 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)3 HasName (org.kie.workbench.common.dmn.api.definition.HasName)3 Context (org.kie.workbench.common.dmn.api.definition.v1_1.Context)2 InputClause (org.kie.workbench.common.dmn.api.definition.v1_1.InputClause)2 OutputClause (org.kie.workbench.common.dmn.api.definition.v1_1.OutputClause)2 Relation (org.kie.workbench.common.dmn.api.definition.v1_1.Relation)2 DMNGridRow (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow)2 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)2 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)2 BaseGridWidget (org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidget)2 Invocation (org.kie.workbench.common.dmn.api.definition.v1_1.Invocation)1 UnaryTests (org.kie.workbench.common.dmn.api.definition.v1_1.UnaryTests)1