notifications/src/main/java/org/gcube/portlets/user/notifications/client/view/templates/SingleNotificationView.java

47 lines
1.4 KiB
Java
Raw Normal View History

package org.gcube.portlets.user.notifications.client.view.templates;
import org.gcube.portal.databook.client.GCubeSocialNetworking;
import org.gcube.portal.databook.shared.Notification;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
public class SingleNotificationView extends Composite {
private static NotificationsDayUiBinder uiBinder = GWT
.create(NotificationsDayUiBinder.class);
interface NotificationsDayUiBinder extends
UiBinder<Widget, SingleNotificationView> {
}
private Notification myNotification;
@UiField
Image notificationImage;
@UiField HTMLPanel mainPanel;
@UiField HTML notificationText;
@UiField HTML timeArea;
public SingleNotificationView(Notification toShow) {
initWidget(uiBinder.createAndBindUi(this));
myNotification = toShow;
String notificationToShow = toShow.getDescription();
notificationText.setHTML(
"<a class=\"link\" href=\""+GCubeSocialNetworking.USER_PROFILE_LINK+"\">"+
toShow.getSenderFullName()+"</a> " + notificationToShow);
timeArea.setHTML(DateTimeFormat.getFormat("MMMM dd, h:mm a").format(toShow.getTime()));
}
}