}
private void addPictureAttachment(ActivityObject object) {
StyledFlowPanel attachment = new StyledFlowPanel("wrapper");
StyledTooltipImage attachmentIcon = new StyledTooltipImage(OswClient
.getInstance().getPreference("theme_folder")
+ "assets/i-attachment.png", "icon", "");
StyledFlowPanel attachmentFlow = new StyledFlowPanel("image");
StyledFlowPanel wrapper = new StyledFlowPanel("metadata");
StyledLabel title = new StyledLabel("title", "");
StyledLabel description = new StyledLabel("description", "");
attachment.add(attachmentIcon);
attachment.add(attachmentFlow);
attachment.add(wrapper);
wrapper.add(title);
attachmentswrapper.add(attachment);
// show the link elements
for (int i = 0; i < object.getLinks().size(); i++) {
// get the url to the picture
if (object.hasLinks() && object.getLinks().get(0).hasRel()
&& object.getLinks().get(i).getRel().equals("alternate")) {
// get the link to the image
final StyledTooltipImage image = new StyledTooltipImage(object
.getLinks().get(i).getHref(), "attachment",
uiText.ShowPreview());
image.addStyleName("link");
// if the activity has a title
if (activity.hasTitle() && activity.getTitle().length() > 0) {
// and the link has a title as well
if (object.getLinks().get(i).hasTitle()
&& object.getLinks().get(i).getTitle().length() > 0) {
// check if they are the same and skip it on the link if
// so
// TODO this needs to be refactored to the
// object.getTitle()
if (!activity.getTitle().trim().equals(
object.getLinks().get(i).getTitle().trim())) {
title.setText(object.getLinks().get(i).getTitle());
}
}
// otherwise we can show it
// TODO this needs to be refactored to the object.getTitle()
} else {
title.setText(object.getLinks().get(i).getTitle());
}
attachmentFlow.add(image);
image.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
PicturePreviewDialog.getInstance().showDialog(
image.getUrl(), uiText.ImagePreview());
}
});
}
}