});
label.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
// get the app instance from the session manager
AbstractApplication app = OswClient.getInstance()
.getCurrentApplication();
ProfileWindow profileWindow = (ProfileWindow) app
.addWindow(ProfileWindow.class.toString(), 1);
profileWindow.setJID(recipientJID);
profileWindow.show();
}
});
authorWrapper.add(label);
if (recipients.hasNext()) {
authorWrapper.add(new StyledLabel("separator", ", "));
}
}
}
statuswrapper.add(statusIcon);
statuswrapper2.add(authorWrapper);
statuswrapper2.add(statusLabel);
statuswrapper.add(statuswrapper2);
infowrapper.add(infoIcon);
infowrapper.add(infoLabel);
flow.add(statuswrapper);
flow.add(attachmentswrapper);
flow.add(infowrapper);
hpanel.add(avatarwrapper);
avatarwrapper.getElement().setAttribute(
"style",
"background-image: url('"
+ OswClient.getInstance().getPreference("theme_folder")
+ "assets/avatar-loader.gif');");
hpanel.add(flow);
hpanel.setCellWidth(avatarwrapper, "40px");
// display who can see your own items
List<String> visibility = new ArrayList<String>();
if (activity.getActor().getUri().equals(
OswServiceFactory.getService().getUserBareJID())) {
// show the acl rule
for (AclRule rule : activity.getAclRules()) {
for (AclAction action : rule.getActions(AclAction.ACTION_VIEW,
AclAction.PERMISSION_GRANT)) {
for (AclSubject subject : rule.getSubjects()) {
if (subject.getType().equals(AclSubject.EVERYONE)) {
visibility.add(uiText.Everyone());
} else if (subject.getType().equals(AclSubject.GROUP)) {
visibility.add(subject.getName());
} else if (subject.getType().equals(AclSubject.PERSON)) {
visibility.add(subject.getName());
}
}
}
}
// and add a special style to show this is your own item
addStyleName("isOwner");
}
statusLabel.setText(" - " + activity.getTitle());
String info = "";
info += getFormattedDate(activity.getPublished());
if (!visibility.isEmpty())
info += " - " + uiText.VisibleTo() + " " + FormatHelper.implode(visibility, ", ");
// if (location != "") info += " - From: " + location;
// if (tags != "") info += " - Tagged: " + tags;
infoLabel.setText(info);
author.setTitle(uiText.ViewProfileOf() + " " + activity.getActor().getUri());
// check for any attachments
for (int i = 0; i < activity.getObjects().size(); i++) {
if (activity.getObjects().get(i).getType().equals(
ActivityObject.PICTURE)) {
addPictureAttachment(activity.getObjects().get(i));
} else if (activity.getObjects().get(i).getType().equals(
ActivityObject.LINK)) {
addLinkAttachment(activity.getObjects().get(i));
}
}
statusActivity.add(hpanel);
add(statusActivity);
// add styles
avatarImage.setStyleName("avatar");
infoLabel.setStyleName("info");
addStyleName("statusActivityWrapper");
// handlers
author.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
// get the app instance from the session manager
AbstractApplication app = OswClient.getInstance()
.getCurrentApplication();
ProfileWindow profileWindow = (ProfileWindow) app.addWindow(
ProfileWindow.class.toString(), 1);
profileWindow.setJID(activity.getActor().getUri());
profileWindow.show();
}
});