doTypeChosen(form);
}
});
form.addAttribute(constants.LiteralValue() + ":",
widgets(lit,
new InfoPopup(constants.LiteralValue(),
constants.LiteralValTip())));
if (modeller.isTemplate()) {
String templateKeyLabel = constants.TemplateKey();
Button templateKeyButton = new Button(templateKeyLabel);
templateKeyButton.addClickListener(new ClickListener() {
public void onClick(Widget arg0) {
con.constraintValueType = ISingleFieldConstraint.TYPE_TEMPLATE;
doTypeChosen(form);
}
});
form.addAttribute(templateKeyLabel + ":",
widgets(templateKeyButton,
new InfoPopup(templateKeyLabel,
constants.LiteralValTip())));
}
form.addRow(new HTML("<hr/>"));
form.addRow(new SmallLabel(constants.AdvancedOptions()));
//only want to show variables if we have some !
if (this.model.getBoundVariablesInScope(this.constraint).size() > 0 || SuggestionCompletionEngine.TYPE_COLLECTION.equals(this.fieldType)) {
List vars = this.model.getBoundFacts();
boolean foundABouncVariableThatMatches = false;
for (int i = 0; i < vars.size(); i++) {
String var = (String) vars.get(i);
FactPattern f = model.getBoundFact(var);
String fieldConstraint = model.getFieldConstraint(var);
if ((f != null && f.factType.equals(this.fieldType)) || this.fieldType.equals(fieldConstraint)) {
foundABouncVariableThatMatches = true;
break;
} else {
// for collection, present the list of possible bound variable
String factCollectionType = sce.getParametricFieldType(pattern.factType,
this.fieldName);
if ((f != null && factCollectionType != null && f.factType.equals(factCollectionType)) || (factCollectionType != null && factCollectionType.equals(fieldConstraint))) {
foundABouncVariableThatMatches = true;
break;
}
}
}
if (foundABouncVariableThatMatches == true) {
Button variable = new Button(constants.BoundVariable());
variable.addClickListener(new ClickListener() {
public void onClick(Widget w) {
con.constraintValueType = SingleFieldConstraint.TYPE_VARIABLE;
doTypeChosen(form);
}
});
form.addAttribute(constants.AVariable(),
widgets(variable,
new InfoPopup(constants.ABoundVariable(),
constants.BoundVariableTip())));
}
}
Button formula = new Button(constants.NewFormula());
formula.addClickListener(new ClickListener() {
public void onClick(Widget w) {
con.constraintValueType = SingleFieldConstraint.TYPE_RET_VALUE;
doTypeChosen(form);
}
});
form.addAttribute(constants.AFormula() + ":",
widgets(formula,
new InfoPopup(constants.AFormula(),
constants.FormulaExpressionTip())));
Button expression = new Button(constants.ExpressionEditor());
expression.addClickListener(new ClickListener() {
public void onClick(Widget w) {
con.constraintValueType = SingleFieldConstraint.TYPE_EXPR_BUILDER;
doTypeChosen(form);
}
});
form.addAttribute(constants.ExpressionEditor() + ":",
widgets(expression,
new InfoPopup(constants.ExpressionEditor(),
constants.ExpressionEditor())));
form.show();
}