hide set all read and pagfinator
Change-Id: I5dc916501b6276ecbe34554c0b91ada3b818f689
This commit is contained in:
parent
33501a3ab4
commit
5bad95a58f
@ -37,6 +37,8 @@ public class NotificationsPanel extends Panel {
|
||||
|
||||
@SpringBean
|
||||
private WebNotificationDao webNotificationDao;
|
||||
|
||||
private int countOfNotifications = 0;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
@ -53,6 +55,8 @@ public class NotificationsPanel extends Panel {
|
||||
return webNotificationDao.getCountOfWebNotifications(SciProSession.get().getUser());
|
||||
}
|
||||
};
|
||||
|
||||
countOfNotifications = numberOfNotificationsModel.getObject();
|
||||
|
||||
Label newNotifications = new Label("newNotifications", numberOfNotificationsModel);
|
||||
|
||||
@ -96,6 +100,7 @@ public class NotificationsPanel extends Panel {
|
||||
notification.setReadByUser(true);
|
||||
webNotificationDao.save(notification);
|
||||
target.addComponent(webMarkupContainer);
|
||||
countOfNotifications = numberOfNotificationsModel.getObject();
|
||||
}
|
||||
});
|
||||
|
||||
@ -108,15 +113,30 @@ public class NotificationsPanel extends Panel {
|
||||
|
||||
@Override
|
||||
public void onClick(AjaxRequestTarget target) {
|
||||
for (WebNotification webnotification : webNotificationDao.getWebNotifications(SciProSession
|
||||
.get().getUser())) {
|
||||
for (WebNotification webnotification : webNotificationDao
|
||||
.getWebNotifications(SciProSession.get().getUser())) {
|
||||
webnotification.setReadByUser(true);
|
||||
webNotificationDao.save(webnotification);
|
||||
webNotificationDao.save(webnotification);
|
||||
}
|
||||
target.addComponent(webMarkupContainer);
|
||||
}
|
||||
});
|
||||
PagingNavigator pagingNavigator = new PagingNavigator("paging", notifications);
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return countOfNotifications > 0;
|
||||
};
|
||||
}.setOutputMarkupPlaceholderTag(true));
|
||||
|
||||
PagingNavigator pagingNavigator = new PagingNavigator("paging", notifications){
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return countOfNotifications > 0;
|
||||
};
|
||||
};
|
||||
pagingNavigator.setOutputMarkupPlaceholderTag(true);
|
||||
webMarkupContainer.add(pagingNavigator);
|
||||
webMarkupContainer.add(notifications);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user