box.addChangeListener( new ChangeListener() {
public void onChange(Widget w) {
String fieldName = box.getItemText( box.getSelectedIndex() );
String qualifiedName = factType + "." + fieldName;
String fieldType = (String) completions.fieldTypes.get(qualifiedName);
pattern.addConstraint( new SingleFieldConstraint( fieldName, fieldType, con ) );
modeller.refreshWidget();
popup.hide();
}
} );
popup.addAttribute(constants.AddARestrictionOnAField(), box );
final ListBox composites = new ListBox();
composites.addItem("...");
composites.addItem(constants.AllOfAnd(), CompositeFieldConstraint.COMPOSITE_TYPE_AND );
composites.addItem(constants.AnyOfOr(), CompositeFieldConstraint.COMPOSITE_TYPE_OR );
composites.setSelectedIndex( 0 );
composites.addChangeListener( new ChangeListener() {
public void onChange(Widget w) {
CompositeFieldConstraint comp = new CompositeFieldConstraint();
comp.compositeJunctionType = composites.getValue( composites.getSelectedIndex() );
pattern.addConstraint( comp );
modeller.refreshWidget();
popup.hide();
}
});
InfoPopup infoComp = new InfoPopup(constants.MultipleFieldConstraints(), constants.MultipleConstraintsTip1());
HorizontalPanel horiz = new HorizontalPanel();
horiz.add( composites );
horiz.add( infoComp );
if (con == null) {
popup.addAttribute(constants.MultipleFieldConstraint(), horiz );
}
//popup.addRow( new HTML("<hr/>") );
if (con == null) {
popup.addRow( new SmallLabel("<i>" + constants.AdvancedOptionsColon() + "</i>") ); //NON-NLS
final Button predicate = new Button(constants.NewFormula());
predicate.addClickListener( new ClickListener() {
public void onClick(Widget w) {
SingleFieldConstraint con = new SingleFieldConstraint();
con.constraintValueType = SingleFieldConstraint.TYPE_PREDICATE;
pattern.addConstraint( con );
modeller.refreshWidget();
popup.hide();
}