use of org.kie.workbench.common.dmn.api.definition.model.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();
}
use of org.kie.workbench.common.dmn.api.definition.model.HitPolicy in project kie-wb-common by kiegroup.
the class HitPolicyPopoverViewImpl method setupHitPolicyEventHandler.
private void setupHitPolicyEventHandler() {
setupChangeEventHandler(lstHitPolicies, () -> {
final HitPolicy hp = HitPolicy.fromValue(lstHitPolicies.getValue());
presenter.setHitPolicy(hp);
});
}
use of org.kie.workbench.common.dmn.api.definition.model.HitPolicy in project kie-wb-common by kiegroup.
the class DecisionTableGridTest method testSetHitPolicy.
@Test
public void testSetHitPolicy() {
final HitPolicy hitPolicy = HitPolicy.ANY;
setupGrid(makeHasNameForDecision(), 0);
grid.setHitPolicy(hitPolicy, command);
verify(sessionCommandManager).execute(eq(canvasHandler), setHitPolicyCommandCaptor.capture());
final CompositeCommand<AbstractCanvasHandler, CanvasViolation> setHitPolicyCommand = setHitPolicyCommandCaptor.getValue();
assertEquals(2, setHitPolicyCommand.getCommands().size());
assertTrue(setHitPolicyCommand.getCommands().get(0) instanceof SetBuiltinAggregatorCommand);
assertTrue(setHitPolicyCommand.getCommands().get(1) instanceof SetHitPolicyCommand);
setHitPolicyCommand.execute(canvasHandler);
verify(gridLayer, atLeast(1)).batch();
verify(command).execute();
assertEquals(hitPolicy, expression.get().getHitPolicy());
assertNull(expression.get().getAggregation());
}
use of org.kie.workbench.common.dmn.api.definition.model.HitPolicy in project kie-wb-common by kiegroup.
the class HitPolicyPopoverImplTest 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));
}
use of org.kie.workbench.common.dmn.api.definition.model.HitPolicy in project kie-wb-common by kiegroup.
the class HitPolicyPopoverImplTest 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));
}
Aggregations