for ( int i = 0; i < sce.getFactTypes().length; i++ ) {
types.addItem( sce.getFactTypes()[i] );
}
pop.addAttribute( Constants.INSTANCE.FactType(),
types );
final TextBox binding = new BindingTextBox();
binding.addChangeHandler( new ChangeHandler() {
public void onChange(ChangeEvent event) {
binding.setText( binding.getText().replace( " ",
"" ) );
}
} );
pop.addAttribute( Constants.INSTANCE.Binding(),
binding );
//Patterns can be negated, i.e. "not Pattern(...)"
final CheckBox chkNegated = new CheckBox();
chkNegated.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent event) {
boolean isPatternNegated = chkNegated.getValue();
binding.setEnabled( !isPatternNegated );
}
} );
pop.addAttribute( Constants.INSTANCE.negatePattern(),
chkNegated );
Button ok = new Button( Constants.INSTANCE.OK() );
ok.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent w) {
boolean isPatternNegated = chkNegated.getValue();
String ft = types.getItemText( types.getSelectedIndex() );
String fn = isPatternNegated ? "" : binding.getText();
if ( !isPatternNegated ) {
if ( fn.equals( "" ) ) {
Window.alert( Constants.INSTANCE.PleaseEnterANameForFact() );
return;
} else if ( fn.equals( ft ) ) {