FlowPanel panel = new FlowPanel();
initWidget( panel );
DOM.setStyleAttribute( panel.getElement(), "whiteSpace", "nowrap" );
DOM.setStyleAttribute( getElement(), "whiteSpace", "nowrap" );
ImageHyperlink link = new ImageHyperlink( new Image( GWT.getHostPageBaseURL() + ImageProvider.MSG_ATTACHMENT ) );
link.addLeftButtonListener( new MainLinkLeftButtonListener() );
link.addRightButtonListener( new MainLinkRightButtonListener() );
panel.add( link );
ImageHyperlink link2 = new ImageHyperlink();
link2.setText( attachment.getFileName() );
link2.addLeftButtonListener( new MainLinkLeftButtonListener() );
link2.addRightButtonListener( new MainLinkRightButtonListener() );
panel.add( link2 );
panel.add( new HTML( " (" + attachment.getSizeText() + ") " ) );
if ( attachment.isPreview() ) {
ToolTip tip = new ToolTip();
String url = ServiceProvider.getRetrieveImageServletUrl( attachment.getMessageId(), attachment.getIndex(),
true );
tip.setHtml( "<img src=\"" + url + "\"/>" );
tip.setWidth( 300 );
tip.setHeight( 200 );
tip.applyTo( this.getElement() );
}
ImageHyperlink downloadLink = new ImageHyperlink( new Image( GWT.getHostPageBaseURL()
+ ImageProvider.MSG_DOWNLOAD ) );
downloadLink.addLeftButtonListener( new DownloadLeftButtonListener() );
panel.add( downloadLink );
panel.add( new HTML( " " ) );
this.downloadAttachmentAction = new DownloadAttachmentAction( attachment );
this.viewAttachmentAction = new ViewAttachmentAction( attachment );