private FlexTable render(final FixtureList rfl,
final Scenario sc) {
FlexTable data = new DirtyableFlexTable();
for ( int i = 0; i < rfl.size(); i++ ) {
final VerifyRuleFired v = (VerifyRuleFired) rfl.get( i );
if ( showResults && v.getSuccessResult() != null ) {
if ( !v.getSuccessResult().booleanValue() ) {
data.setWidget( i,
0,
new Image( images.warning() ) );
data.setWidget( i,
4,
new HTML( Format.format( constants.ActualResult(),
v.getActualResult() ) ) );
data.getCellFormatter().addStyleName( i,
4,
"testErrorValue" ); //NON-NLS
} else {
data.setWidget( i,
0,
new Image( images.testPassed() ) );
}
}
data.setWidget( i,
1,
new SmallLabel( v.getRuleName() + ":" ) );
data.getFlexCellFormatter().setAlignment( i,
1,
HasHorizontalAlignment.ALIGN_RIGHT,
HasVerticalAlignment.ALIGN_MIDDLE );
final ListBox b = new ListBox();
b.addItem( constants.firedAtLeastOnce(),
"y" );
b.addItem( constants.didNotFire(),
"n" );
b.addItem( constants.firedThisManyTimes(),
"e" );
final TextBox num = new TextBox();
num.setVisibleLength( 5 );
if ( v.getExpectedFire() != null ) {
b.setSelectedIndex( (v.getExpectedFire().booleanValue()) ? 0 : 1 );
num.setVisible( false );
} else {
b.setSelectedIndex( 2 );
String xc = (v.getExpectedCount() != null) ? "" + v.getExpectedCount().intValue() : "0";
num.setText( xc );
}
b.addChangeHandler( new ChangeHandler() {
public void onChange(ChangeEvent event) {
String s = b.getValue( b.getSelectedIndex() );
if ( s.equals( "y" ) || s.equals( "n" ) ) {
num.setVisible( false );
v.setExpectedFire( (s.equals( "y" )) ? Boolean.TRUE : Boolean.FALSE );
v.setExpectedCount( null );
} else {
num.setVisible( true );
v.setExpectedFire( null );
num.setText( "1" );
v.setExpectedCount( new Integer( 1 ) );
}
}
} );
b.addItem( constants.ChooseDotDotDot() );
num.addChangeHandler( new ChangeHandler() {
public void onChange(ChangeEvent event) {
v.setExpectedCount( new Integer( num.getText() ) );
}
} );
HorizontalPanel h = new HorizontalPanel();
h.add( b );