/** * Get the widest Cell from a list of content * * @param values * @return */ public int getMaximumElementWidth(List< ? extends V> values) { int maximumWidth = 0; for ( V value : values ) { int w = getElementWidth( value ); if ( w > maximumWidth ) { maximumWidth = w; } } if ( minWidth == null ) { return maximumWidth; } return minWidth > maximumWidth ? minWidth : maximumWidth; }
public ConversionMessageWidget( ConversionMessage message ) { initWidget( uiBinder.createAndBindUi( this ) ); switch ( message.getMessageType() ) { case ERROR: this.image.setResource( Resources.INSTANCE.images().error() ); break; case INFO: this.image.setResource( Resources.INSTANCE.images().information() ); break; case WARNING: this.image.setResource( Resources.INSTANCE.images().warning() ); break; } this.label.setText( message.getMessage() ); //Make containing Panel the width of the content to ensure scrollbars operate correctly int width = widthCalculator.getElementWidth( message.getMessage() ) + 32; setWidth( width + "px" ); }