add( headerPanel );
setStyleName( "fact-model-fact-edit-selections" );
setWidth( "100%" );
}
} );
FlexCellFormatter formatter = tb.getFlexCellFormatter();
formatter.setColSpan( 0,
0,
2 );
formatter.setStyleName( 0,
0,
factHeaderStyle );
formatter.setHorizontalAlignment( 0,
0,
HasHorizontalAlignment.ALIGN_LEFT );
for ( int j = 0; j < mm.fields.size(); j++ ) {
final FieldMetaModel fm = (FieldMetaModel) mm.fields.get( j );
String ms = Format.format( constants.FieldName(),
fm.name );
tb.setWidget( j + 1,
0,
new HTML( ms ) );
formatter.setHorizontalAlignment( j + 1,
0,
HasHorizontalAlignment.ALIGN_RIGHT );
HorizontalPanel type = new HorizontalPanel();
type.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE );
type.add( new SmallLabel( getDesc( fm ) ) );
ImageButton del = new ImageButton( "images/delete_item_small.gif" ); //NON-NLS
del.addClickListener( new ClickListener() {
public void onClick(Widget w) {
if ( Window.confirm( Format.format( constants.AreYouSureYouWantToRemoveTheField0(),
fm.name ) ) ) {
mm.fields.remove( fm );
editingFact = m.models.indexOf( mm );
renderEditor();
}
}
} );
ImageButton edit = new ImageButton( "images/edit.gif" ); //NON-NLS
edit.addClickListener( new ClickListener() {
public void onClick(Widget arg0) {
showFieldEditor( m,
mm,
fm );
}
} );
type.add( edit );
type.add( del );
tb.setWidget( j + 1,
1,
type );
formatter.setHorizontalAlignment( j + 1,
1,
HasHorizontalAlignment.ALIGN_LEFT );
}
}