Forum Message UI Improvement (Thesis Board #3470) #61
@ -11,10 +11,24 @@ import java.util.Optional;
|
||||
|
||||
public abstract class AbstractReadStatePanel extends Panel {
|
||||
|
||||
public static final String TOGGLE = "toggle";
|
||||
static final String ICON = "icon";
|
||||
|
||||
public enum ShowReadStateTooltip {
|
||||
ENABLED,
|
||||
DISABLED
|
||||
}
|
||||
|
||||
private final Component icon;
|
||||
private final ShowReadStateTooltip showReadStateTooltip;
|
||||
|
||||
public AbstractReadStatePanel(final String id) {
|
||||
this(id, ShowReadStateTooltip.DISABLED);
|
||||
}
|
||||
|
||||
public AbstractReadStatePanel(final String id, final ShowReadStateTooltip showReadStateTooltip) {
|
||||
super(id);
|
||||
this.showReadStateTooltip = showReadStateTooltip;
|
||||
|
||||
AjaxFallbackLink<Void> link = new AjaxFallbackLink<>(TOGGLE) {
|
||||
@Override
|
||||
@ -35,11 +49,11 @@ public abstract class AbstractReadStatePanel extends Panel {
|
||||
protected abstract boolean isRead();
|
||||
protected abstract void onFlagClick(final AjaxRequestTarget target);
|
||||
|
||||
public static final String TOGGLE = "toggle";
|
||||
static final String ICON = "icon";
|
||||
public ShowReadStateTooltip getShowReadStateTooltip() {
|
||||
return showReadStateTooltip;
|
||||
}
|
||||
|
||||
private class UpdatingImage extends WebComponent {
|
||||
|
||||
public UpdatingImage(String id) {
|
||||
super(id);
|
||||
}
|
||||
@ -49,6 +63,10 @@ public abstract class AbstractReadStatePanel extends Panel {
|
||||
super.onComponentTag(tag);
|
||||
String state = isRead() ? "read" : "unread";
|
||||
tag.append("class", state, " ");
|
||||
|
||||
if (getShowReadStateTooltip() == ShowReadStateTooltip.ENABLED && !isRead()) {
|
||||
tag.put("title", getString("unread.msg"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
unread.msg=There are unread messages.
|
@ -194,7 +194,7 @@ public class SupervisorMyProjectsPanel extends Panel {
|
||||
|
||||
@Override
|
||||
public void populateItem(Item<ICellPopulator<Project>> item, String id, IModel<Project> projectModel) {
|
||||
item.add(new AbstractReadStatePanel(id) {
|
||||
item.add(new AbstractReadStatePanel(id, AbstractReadStatePanel.ShowReadStateTooltip.ENABLED) {
|
||||
@Override
|
||||
protected boolean isRead() {
|
||||
return !projectForumService.hasUnreadThreads(
|
||||
|
Loading…
x
Reference in New Issue
Block a user