use of org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.AddDecisionRuleCommand in project kie-wb-common by kiegroup.
the class DecisionTableGrid method addDecisionRule.
void addDecisionRule(final int index) {
getExpression().get().ifPresent(dtable -> {
final GridRow decisionTableRow = new LiteralExpressionGridRow();
final DecisionRule decisionRule = DecisionRuleFactory.makeDecisionRule(dtable);
sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddDecisionRuleCommand(dtable, decisionRule, model, decisionTableRow, index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING)));
});
}
use of org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.AddDecisionRuleCommand in project kie-wb-common by kiegroup.
the class DecisionTableGrid method duplicateDecisionRule.
void duplicateDecisionRule(final int index) {
getExpression().get().ifPresent(dtable -> {
final GridRow decisionTableRow = new LiteralExpressionGridRow();
final DecisionRule decisionRule = DecisionRuleFactory.duplicateDecisionRule(index, dtable);
sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddDecisionRuleCommand(dtable, decisionRule, model, decisionTableRow, index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING)));
});
}
use of org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.AddDecisionRuleCommand in project kie-wb-common by kiegroup.
the class DecisionTableGridTest method addDecisionRule.
private void addDecisionRule(final int index) {
grid.addDecisionRule(index);
verify(sessionCommandManager).execute(eq(canvasHandler), addDecisionRuleCommandCaptor.capture());
final AddDecisionRuleCommand addDecisionRuleCommand = addDecisionRuleCommandCaptor.getValue();
addDecisionRuleCommand.execute(canvasHandler);
}
use of org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.AddDecisionRuleCommand in project kie-wb-common by kiegroup.
the class DecisionTableGridTest method testDuplicateDecisionRule.
@Test
@SuppressWarnings("unchecked")
public void testDuplicateDecisionRule() {
setupGrid(makeHasNameForDecision(), 0);
final DecisionTable dtable = grid.getExpression().get().get();
assertThat(dtable.getRule().size()).isEqualTo(1);
final DecisionRule rule0 = dtable.getRule().get(0);
assertThat(rule0.getInputEntry().size()).isEqualTo(1);
assertThat(rule0.getOutputEntry().size()).isEqualTo(1);
rule0.getInputEntry().get(0).getText().setValue("input");
rule0.getOutputEntry().get(0).getText().setValue("output");
rule0.getDescription().setValue("description");
grid.duplicateDecisionRule(0);
verify(sessionCommandManager).execute(eq(canvasHandler), addDecisionRuleCommandCaptor.capture());
final AddDecisionRuleCommand addDecisionRuleCommand = addDecisionRuleCommandCaptor.getValue();
addDecisionRuleCommand.execute(canvasHandler);
assertThat(dtable.getRule().size()).isEqualTo(2);
final DecisionRule rule1 = dtable.getRule().get(1);
assertThat(rule1.getInputEntry().size()).isEqualTo(1);
assertThat(rule1.getOutputEntry().size()).isEqualTo(1);
assertThat(rule0.getInputEntry().get(0).getText().getValue()).isEqualTo("input");
assertThat(rule0.getOutputEntry().get(0).getText().getValue()).isEqualTo("output");
assertThat(rule0.getDescription().getValue()).isEqualTo("description");
assertThat(rule1.getInputEntry().get(0).getText().getValue()).isEqualTo("input");
assertThat(rule1.getOutputEntry().get(0).getText().getValue()).isEqualTo("output");
assertThat(rule1.getDescription().getValue()).isEqualTo("description");
verifyCommandExecuteOperation(BaseExpressionGrid.RESIZE_EXISTING);
}
Aggregations