}
final FormStylePopup form = new FormStylePopup( images.newexWiz(),
constants.FieldValue() );
Button lit = new Button( constants.LiteralValue() );
lit.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent event) {
con.setConstraintValueType( isDropDownDataEnum && dropDownData != null ? SingleFieldConstraint.TYPE_ENUM : SingleFieldConstraint.TYPE_LITERAL );
doTypeChosen( form );
}
} );
boolean showLiteralOrFormula = true;
if ( con instanceof SingleFieldConstraint ) {
SingleFieldConstraint sfc = (SingleFieldConstraint) con;
if ( sfc.getFieldType().equals( SuggestionCompletionEngine.TYPE_THIS ) ) {
showLiteralOrFormula = SuggestionCompletionEngine.isCEPOperator( sfc.getOperator() );
}
} else if ( con instanceof ConnectiveConstraint ) {
ConnectiveConstraint cc = (ConnectiveConstraint) con;
if ( cc.getFieldType().equals( SuggestionCompletionEngine.TYPE_THIS ) ) {
showLiteralOrFormula = SuggestionCompletionEngine.isCEPOperator( cc.getOperator() );
}
}
if ( showLiteralOrFormula ) {
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.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent event) {
con.setConstraintValueType( BaseSingleFieldConstraint.TYPE_TEMPLATE );
doTypeChosen( form );
}
} );
form.addAttribute( templateKeyLabel + ":",
widgets( templateKeyButton,
new InfoPopup( templateKeyLabel,
constants.LiteralValTip() ) ) );
}
if ( showLiteralOrFormula ) {
form.addRow( new HTML( "<hr/>" ) );
form.addRow( new SmallLabel( constants.AdvancedOptions() ) );
}
//only want to show variables if we have some !
List<String> bindingsInScope = this.model.getBoundVariablesInScope( this.constraint );
if ( bindingsInScope.size() > 0
|| SuggestionCompletionEngine.TYPE_COLLECTION.equals( this.fieldType ) ) {
List<String> applicableBindingsInScope = getApplicableBindingsInScope( bindingsInScope );
if ( applicableBindingsInScope.size() > 0 ) {
Button variable = new Button( constants.BoundVariable() );
variable.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent event) {
con.setConstraintValueType( SingleFieldConstraint.TYPE_VARIABLE );
doTypeChosen( form );
}
} );
form.addAttribute( constants.AVariable(),
widgets( variable,
new InfoPopup( constants.ABoundVariable(),
constants.BoundVariableTip() ) ) );
}
}
if ( showLiteralOrFormula ) {
Button formula = new Button( constants.NewFormula() );
formula.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent event) {
con.setConstraintValueType( 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.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent event) {
con.setConstraintValueType( SingleFieldConstraint.TYPE_EXPR_BUILDER_VALUE );
doTypeChosen( form );
}