* @param link
* the link that was added.
*/
public void onLinkAdded(final LinkInformation link)
{
LinkInformation addedLink = link;
if (null == addedLink)
{
addedLink = new LinkInformation();
}
selector.setLink(addedLink);
if (!addedLink.getImageUrls().isEmpty())
{
displayPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().hasThumbnail());
}
linkUrlDisplay.setText("source: " + addedLink.getSource());
title.setVisibleLength(MAX_LENGTH);
title.setValue(addedLink.getTitle());
title.addBlurHandler(new BlurHandler()
{
public void onBlur(final BlurEvent event)
{
// This check is a workaround for the real problem, which is that the blur handler is getting wired up
// multiple times (once on the first time the user clicks 'add link' and once when the activity is
// posted and everything is being cleared out). Maybe this control will get redesigned when
// PostToStreamComposite gets refactored from MVC to the current design.
if (link != null)
{
link.setTitle(title.getValue());
}
}
});
linkDesc.setText(addedLink.getDescription());
}