Refactoring

This commit is contained in:
Andreas Svanberg 2024-05-31 14:50:57 +02:00
parent eccf6937a3
commit 69f4b9b440
3 changed files with 4 additions and 4 deletions
view/src/main/java/se/su/dsv/scipro

@ -20,7 +20,7 @@ public abstract class AbstractReadStatePanel extends Panel {
@Override
public void onClick(final Optional<AjaxRequestTarget> target) {
target.ifPresent(t -> {
toggleReadState(t);
onFlagClick(t);
t.add(icon);
});
}
@ -33,7 +33,7 @@ public abstract class AbstractReadStatePanel extends Panel {
}
protected abstract boolean isRead();
protected abstract void toggleReadState(final AjaxRequestTarget target);
protected abstract void onFlagClick(final AjaxRequestTarget target);
public static final String TOGGLE = "toggle";
static final String ICON = "icon";

@ -31,7 +31,7 @@ public class ThreadReadStatePanel extends AbstractReadStatePanel {
}
@Override
protected void toggleReadState(final AjaxRequestTarget target) {
protected void onFlagClick(final AjaxRequestTarget target) {
boolean read = isRead();
basicForumService.setThreadRead(SciProSession.get().getUser(), model.getObject(), !read);

@ -117,7 +117,7 @@ public class NotificationDataPanel extends Panel {
}
@Override
protected void toggleReadState(final AjaxRequestTarget target) {
protected void onFlagClick(final AjaxRequestTarget target) {
Notification notification = rowModel.getObject();
notification.setUnread(!notification.isUnread());
notificationService.save(notification);