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