* This adds the widget to the UI, also adding the remove icon.
*/
private Widget wrapRHSWidget( final RuleModel model,
int i,
RuleModellerWidget w ) {
final DirtyableFlexTable wrapper = new DirtyableFlexTable();
final Image remove = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
remove.setTitle( Constants.INSTANCE.RemoveThisAction() );
final int idx = i;
remove.addClickHandler( new ClickHandler() {
public void onClick( ClickEvent event ) {
if ( Window.confirm( Constants.INSTANCE.RemoveThisItem() ) ) {
model.removeRhsItem( idx );
refreshWidget();
//Signal possible change in Template variables
TemplateVariablesChangedEvent tvce = new TemplateVariablesChangedEvent( model );
eventBus.fireEventFromSource( tvce,
model );
}
}
} );
// if ( !(w instanceof ActionRetractFactWidget) ) {
// w.setWidth( "100%" );
// horiz.setWidth( "100%" );
// }
wrapper.getColumnFormatter().setWidth( 0,
"100%" );
w.setWidth( "100%" );
wrapper.setWidget( 0,
0,
w );
if ( !( this.lockRHS() || w.isReadOnly() ) || !w.isFactTypeKnown() ) {
wrapper.setWidget( 0,
1,
remove );
wrapper.getColumnFormatter().setWidth( 1,
"20px" );
}
return wrapper;
}