Search in sources :

Example 1 with HitPolicy

use of org.kie.workbench.common.dmn.api.definition.v1_1.HitPolicy in project kie-wb-common by kiegroup.

the class HitPolicyEditorViewImpl method setupHitPolicyEventHandler.

private void setupHitPolicyEventHandler() {
    setupChangeEventHandler(lstHitPolicies, () -> {
        final HitPolicy hp = HitPolicy.fromValue(lstHitPolicies.getValue());
        presenter.setHitPolicy(hp);
    });
}
Also used : HitPolicy(org.kie.workbench.common.dmn.api.definition.v1_1.HitPolicy)

Example 2 with HitPolicy

use of org.kie.workbench.common.dmn.api.definition.v1_1.HitPolicy in project kie-wb-common by kiegroup.

the class HitPolicyEditorImplTest method testSetHitPolicyNonNullControl.

@Test
public void testSetHitPolicyNonNullControl() {
    final HitPolicy hitPolicy = HitPolicy.ANY;
    when(control.getHitPolicy()).thenReturn(hitPolicy);
    editor.bind(control, UI_ROW_INDEX, UI_COLUMN_INDEX);
    reset(view);
    editor.setHitPolicy(hitPolicy);
    verify(control).setHitPolicy(eq(hitPolicy), commandCaptor.capture());
    commandCaptor.getValue().execute();
    verify(view).enableHitPolicies(eq(true));
}
Also used : HitPolicy(org.kie.workbench.common.dmn.api.definition.v1_1.HitPolicy) Test(org.junit.Test)

Example 3 with HitPolicy

use of org.kie.workbench.common.dmn.api.definition.v1_1.HitPolicy in project kie-wb-common by kiegroup.

the class HitPolicyEditorImplTest method testBindNonNullControlHitPolicy.

@Test
public void testBindNonNullControlHitPolicy() {
    final HitPolicy hitPolicy = HitPolicy.ANY;
    reset(view);
    when(control.getHitPolicy()).thenReturn(hitPolicy);
    editor.bind(control, UI_ROW_INDEX, UI_COLUMN_INDEX);
    verify(view).enableHitPolicies(eq(true));
    verify(view).initSelectedHitPolicy(eq(hitPolicy));
    verify(view).enableBuiltinAggregators(eq(false));
    verify(view).enableDecisionTableOrientation(eq(false));
}
Also used : HitPolicy(org.kie.workbench.common.dmn.api.definition.v1_1.HitPolicy) Test(org.junit.Test)

Example 4 with HitPolicy

use of org.kie.workbench.common.dmn.api.definition.v1_1.HitPolicy in project kie-wb-common by kiegroup.

the class SetHitPolicyCommandTest method makeCommand.

private void makeCommand(final HitPolicy hitPolicy) {
    this.dtable = new DecisionTable();
    this.dtable.setHitPolicy(hitPolicy);
    this.command = new SetHitPolicyCommand(dtable, NEW_HIT_POLICY, canvasOperation);
}
Also used : DecisionTable(org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable)

Example 5 with HitPolicy

use of org.kie.workbench.common.dmn.api.definition.v1_1.HitPolicy in project kie-wb-common by kiegroup.

the class RowNumberColumnHeaderMetaData method getTitle.

@Override
public String getTitle() {
    final HitPolicy hitPolicy = hitPolicySupplier.get();
    final BuiltinAggregator builtinAggregator = builtinAggregatorSupplier.get();
    final StringBuilder sb = new StringBuilder(hitPolicy.value().substring(0, 1).toUpperCase());
    if (HitPolicy.COLLECT == hitPolicy) {
        if (builtinAggregator != null) {
            sb.append(builtinAggregator.getCode());
        }
    }
    return sb.toString();
}
Also used : HitPolicy(org.kie.workbench.common.dmn.api.definition.v1_1.HitPolicy) BuiltinAggregator(org.kie.workbench.common.dmn.api.definition.v1_1.BuiltinAggregator)

Aggregations

HitPolicy (org.kie.workbench.common.dmn.api.definition.v1_1.HitPolicy)5 Test (org.junit.Test)3 BuiltinAggregator (org.kie.workbench.common.dmn.api.definition.v1_1.BuiltinAggregator)1 DecisionTable (org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable)1 SetBuiltinAggregatorCommand (org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.SetBuiltinAggregatorCommand)1 SetHitPolicyCommand (org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.SetHitPolicyCommand)1 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)1 CanvasViolation (org.kie.workbench.common.stunner.core.client.command.CanvasViolation)1