}
private FlexTable render(final VerifyFact vf) {
FlexTable data = new FlexTable();
for ( int i = 0; i < vf.getFieldValues().size(); i++ ) {
final VerifyField fld = (VerifyField) vf.getFieldValues().get( i );
data.setWidget( i,
1,
new SmallLabel( fld.getFieldName() + ":" ) );
data.getFlexCellFormatter().setHorizontalAlignment( i,
1,
HasHorizontalAlignment.ALIGN_RIGHT );
final ListBox opr = new ListBox();
opr.addItem( Constants.INSTANCE.equalsScenario(),
"==" );
opr.addItem( Constants.INSTANCE.doesNotEqualScenario(),
"!=" );
if ( fld.getOperator().equals( "==" ) ) {
opr.setSelectedIndex( 0 );
} else {
opr.setSelectedIndex( 1 );
}
opr.addChangeHandler( new ChangeHandler() {
public void onChange(ChangeEvent event) {
fld.setOperator( opr.getValue( opr.getSelectedIndex() ) );
}
} );
data.setWidget( i,
2,
opr );
Widget cellEditor = new VerifyFieldConstraintEditor( type,
new ValueChanged() {
public void valueChanged(String newValue) {
fld.setExpected( newValue );
}
},
fld,
sce,
this.scenario,
this.executionTrace );
data.setWidget( i,
3,
cellEditor );
Image del = DroolsGuvnorImages.INSTANCE.DeleteItemSmall();
del.setAltText(Constants.INSTANCE.RemoveThisFieldExpectation());
del.setTitle(Constants.INSTANCE.RemoveThisFieldExpectation());
del.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent w) {
if (Window.confirm(Constants.INSTANCE.AreYouSureYouWantToRemoveThisFieldExpectation(
fld.getFieldName()))) {
vf.getFieldValues().remove(fld);
FlexTable data = render(vf);
outer.setWidget(1,
0,
data);
}
}
});
data.setWidget( i,
4,
del );
if ( showResults && fld.getSuccessResult() != null ) {
if ( !fld.getSuccessResult().booleanValue() ) {
data.setWidget( i,
0,
new Image( DroolsGuvnorImageResources.INSTANCE.warning() ) );
data.setWidget( i,
5,
new HTML( Constants.INSTANCE.ActualResult( fld.getActualResult() ) ) );
data.getCellFormatter().addStyleName( i,
5,
"testErrorValue" ); //NON-NLS