Forum Message UI Improvement (Thesis Board #3470) #61
@ -1,11 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org">
|
|
||||||
<head>
|
|
||||||
<title></title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<wicket:panel>
|
|
||||||
<span wicket:id="msgCount"></span>
|
|
||||||
</wicket:panel>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,29 +0,0 @@
|
|||||||
package se.su.dsv.scipro.forum.panels;
|
|
||||||
|
|
||||||
import org.apache.wicket.markup.ComponentTag;
|
|
||||||
import org.apache.wicket.markup.html.basic.Label;
|
|
||||||
import org.apache.wicket.markup.html.panel.Panel;
|
|
||||||
import org.apache.wicket.model.Model;
|
|
||||||
|
|
||||||
public abstract class NumberOfMessagesPanel extends Panel {
|
|
||||||
|
|
||||||
private Model<String> model = Model.of("");
|
|
||||||
|
|
||||||
public NumberOfMessagesPanel(final String id) {
|
|
||||||
super(id);
|
|
||||||
add(new Label("msgCount", model));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onComponentTag(ComponentTag tag) {
|
|
||||||
super.onComponentTag(tag);
|
|
||||||
|
|
||||||
long count = getMessageCount();
|
|
||||||
|
|
||||||
if (count > 0) {
|
|
||||||
model.setObject("(" + count + ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract long getMessageCount();
|
|
||||||
}
|
|
@ -44,7 +44,9 @@
|
|||||||
|
|
||||||
<wicket:fragment wicket:id="readStateColumnMarkupId">
|
<wicket:fragment wicket:id="readStateColumnMarkupId">
|
||||||
<span wicket:id="flag"></span>
|
<span wicket:id="flag"></span>
|
||||||
<wicket:container wicket:id="counter"></wicket:container>
|
<wicket:enclosure child="counter">
|
||||||
|
(<wicket:container wicket:id="counter"></wicket:container>)
|
||||||
|
</wicket:enclosure>
|
||||||
</wicket:fragment>
|
</wicket:fragment>
|
||||||
</wicket:panel>
|
</wicket:panel>
|
||||||
</body>
|
</body>
|
||||||
|
@ -15,6 +15,7 @@ import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColu
|
|||||||
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
|
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
|
||||||
import org.apache.wicket.extensions.markup.html.repeater.data.table.LambdaColumn;
|
import org.apache.wicket.extensions.markup.html.repeater.data.table.LambdaColumn;
|
||||||
import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
|
import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
|
||||||
|
import org.apache.wicket.markup.html.basic.Label;
|
||||||
import org.apache.wicket.markup.html.form.EnumChoiceRenderer;
|
import org.apache.wicket.markup.html.form.EnumChoiceRenderer;
|
||||||
import org.apache.wicket.markup.html.form.Form;
|
import org.apache.wicket.markup.html.form.Form;
|
||||||
import org.apache.wicket.markup.html.form.LambdaChoiceRenderer;
|
import org.apache.wicket.markup.html.form.LambdaChoiceRenderer;
|
||||||
@ -257,7 +258,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) {
|
||||||
// Since table cell only can contain one item, we use Wicket Fragment here. It will contains two components,
|
// Since table cell only can contain one item, we use Wicket Fragment here. It will contain two components,
|
||||||
// one for flag, one for unread messages counter.
|
// one for flag, one for unread messages counter.
|
||||||
|
|
||||||
Fragment fragment = new Fragment(id, "readStateColumnMarkupId", SupervisorMyProjectsPanel.this);
|
Fragment fragment = new Fragment(id, "readStateColumnMarkupId", SupervisorMyProjectsPanel.this);
|
||||||
@ -289,14 +290,15 @@ public class SupervisorMyProjectsPanel extends Panel {
|
|||||||
|
|
||||||
fragment.add(readStatePanel);
|
fragment.add(readStatePanel);
|
||||||
|
|
||||||
fragment.add(
|
Label counterLabel = new Label("counter", msgCount) {
|
||||||
new NumberOfMessagesPanel("counter") {
|
|
||||||
@Override
|
@Override
|
||||||
public long getMessageCount() {
|
protected void onConfigure() {
|
||||||
return msgCount;
|
super.onConfigure();
|
||||||
|
setVisible(msgCount > 0);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
);
|
|
||||||
|
fragment.add(counterLabel);
|
||||||
|
|
||||||
item.add(fragment);
|
item.add(fragment);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user