use of org.drools.workbench.screens.guided.rule.client.editor.OperatorSelection in project drools-wb by kiegroup.
the class FactPatternWidget method createCEPWindowWidget.
// Widget for CEP 'windows'
private Widget createCEPWindowWidget(final RuleModeller modeller, final HasCEPWindow c) {
final HorizontalPanel hp = new HorizontalPanel();
modeller.getDataModelOracle().isFactTypeAnEvent(pattern.getFactType(), new Callback<Boolean>() {
@Override
public void callback(final Boolean result) {
if (Boolean.TRUE.equals(result)) {
final Label lbl = new Label(HumanReadableConstants.INSTANCE.OverCEPWindow());
lbl.setStyleName("paddedLabel");
hp.add(lbl);
final CEPWindowOperatorsDropdown cwo = new CEPWindowOperatorsDropdown(c, readOnly);
if (!isReadOnly()) {
cwo.addValueChangeHandler(new ValueChangeHandler<OperatorSelection>() {
public void onValueChange(ValueChangeEvent<OperatorSelection> event) {
setModified(true);
OperatorSelection selection = event.getValue();
String selected = selection.getValue();
c.getWindow().setOperator(selected);
}
});
}
hp.add(cwo);
}
}
});
return hp;
}
use of org.drools.workbench.screens.guided.rule.client.editor.OperatorSelection in project drools-wb by kiegroup.
the class Connectives method connectiveOperatorDropDown.
private void connectiveOperatorDropDown(final ConnectiveConstraint cc, final Callback<Widget> callback) {
if (!isReadOnly) {
final String factType = cc.getFactType();
final String fieldName = cc.getFieldName();
this.getDataModelOracle().getConnectiveOperatorCompletions(factType, fieldName, new Callback<String[]>() {
@Override
public void callback(final String[] operators) {
final CEPOperatorsDropdown dropdown = getDropdown(operators, cc);
dropdown.addPlaceholder(GuidedRuleEditorResources.CONSTANTS.pleaseChoose(), "");
dropdown.addValueChangeHandler(new ValueChangeHandler<OperatorSelection>() {
public void onValueChange(ValueChangeEvent<OperatorSelection> event) {
OperatorSelection selection = event.getValue();
String selected = selection.getValue();
cc.setOperator(selected);
}
});
callback.callback(dropdown);
}
});
} else {
final SmallLabel w = new SmallLabel("<b>" + (cc.getOperator() == null ? GuidedRuleEditorResources.CONSTANTS.pleaseChoose() : HumanReadable.getOperatorDisplayName(cc.getOperator())) + "</b>");
callback.callback(w);
}
}
Aggregations