use of org.drools.workbench.models.datamodel.rule.FieldConstraint in project drools-wb by kiegroup.
the class FactPatternWidget method drawConstraints.
/**
* Render a hierarchy of constraints, hierarchy here means constraints that
* may themselves depend on members of constraint objects. With this code,
* the GUI enables clicking rules of the form: $result = RoutingResult(
* NerOption.types contains "arzt" )
* @param sortedConst a sorted list of constraints to display.
*/
protected void drawConstraints(List<FieldConstraint> sortedConst, HasConstraints hasConstraints) {
final FlexTable table = new FlexTable();
layout.setWidget(1, 0, table);
List<FieldConstraint> parents = new ArrayList<FieldConstraint>();
for (int i = 0; i < sortedConst.size(); i++) {
traverseSingleFieldConstraints(sortedConst, table, parents, hasConstraints, i);
// now the clear icon
final int currentRow = i;
Image clear = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
clear.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveThisWholeRestriction());
clear.addClickHandler(createClickHandlerForClearImageButton(currentRow));
if (!this.readOnly) {
// This used to be 5 and Connectives were not rendered
table.setWidget(currentRow, 6, clear);
}
}
}
use of org.drools.workbench.models.datamodel.rule.FieldConstraint in project drools-wb by kiegroup.
the class FactPatternWidget method traverseSingleFieldConstraints.
private void traverseSingleFieldConstraints(List<FieldConstraint> sortedConst, final FlexTable table, List<FieldConstraint> parents, HasConstraints hasConstraints, int i) {
int tabs = -1;
FieldConstraint current = sortedConst.get(i);
if (current instanceof SingleFieldConstraint) {
SingleFieldConstraint single = (SingleFieldConstraint) current;
FieldConstraint parent = single.getParent();
for (int j = 0; j < parents.size(); j++) {
FieldConstraint storedParent = parents.get(j);
if (storedParent != null && storedParent.equals(parent)) {
tabs = j + 1;
traverseForRemoval(parents, j);
parents.add(current);
break;
}
}
if (tabs < 0) {
tabs = 0;
parents.add(current);
}
}
renderFieldConstraint(table, i, current, hasConstraints, true, tabs);
}
use of org.drools.workbench.models.datamodel.rule.FieldConstraint in project drools-wb by kiegroup.
the class GuidedRuleTemplateIndexVisitor method visitFactPattern.
private void visitFactPattern(final FactPattern pattern) {
String fullyQualifiedClassName = getFullyQualifiedClassName(pattern.getFactType());
addResourceReference(fullyQualifiedClassName, ResourceType.JAVA);
for (FieldConstraint fc : pattern.getFieldConstraints()) {
visit(fc);
}
}
Aggregations