Commit 939b39af by Antti Tönkyrä

Tagging UI / ActionLog tweaks

1 parent 0e48a8ea
...@@ -79,7 +79,10 @@ public class ActionLogBean implements ActionLogBeanLocal { ...@@ -79,7 +79,10 @@ public class ActionLogBean implements ActionLogBeanLocal {
@Override @Override
@RolesAllowed(ContentPermission.S_MANAGE_ACTIONLOG) @RolesAllowed(ContentPermission.S_MANAGE_ACTIONLOG)
public List<ActionLogMessage> getAllActionLogEventsByFilter(List<ActionLogMessageTag> filterTags) { public List<ActionLogMessage> getAllActionLogEventsByFilter(List<ActionLogMessageTag> filterTags) {
return actionLogFacade.getAllSortedByTimestampFiltered(permissionBean.getCurrentUser().getEvent(), filterTags); if(filterTags.size() == 0)
return actionLogFacade.getAllSortedByTimestamp(permissionBean.getCurrentUser().getEvent());
else
return actionLogFacade.getAllSortedByTimestampFiltered(permissionBean.getCurrentUser().getEvent(), filterTags);
} }
@RolesAllowed(ContentPermission.S_MANAGE_ACTIONLOG) @RolesAllowed(ContentPermission.S_MANAGE_ACTIONLOG)
......
...@@ -26,7 +26,7 @@ public class ActionLogFacade extends IntegerPkGenericFacade<ActionLogMessage> { ...@@ -26,7 +26,7 @@ public class ActionLogFacade extends IntegerPkGenericFacade<ActionLogMessage> {
super(ActionLogMessage.class); super(ActionLogMessage.class);
} }
@Deprecated
public List<ActionLogMessage> getAllSortedByTimestamp(LanEvent event) { public List<ActionLogMessage> getAllSortedByTimestamp(LanEvent event) {
CriteriaBuilder cb = getEm().getCriteriaBuilder(); CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<ActionLogMessage> cq = cb.createQuery(ActionLogMessage.class); CriteriaQuery<ActionLogMessage> cq = cb.createQuery(ActionLogMessage.class);
......
<!DOCTYPE html <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/cditools/user" <html xmlns="http://www.w3.org/1999/xhtml"
xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools="http://java.sun.com/jsf/composite/cditools"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:body> <h:body>
<ui:composition template="#{sessionHandler.template}"> <ui:composition template="#{sessionHandler.template}">
<f:metadata> <f:metadata>
<f:event type="preRenderView" listener="#{actionLogMessageView.initView}" /> <f:event type="preRenderView"
listener="#{actionLogMessageView.initView}" />
</f:metadata> </f:metadata>
<ui:define name="content"> <ui:define name="content">
<h:outputStylesheet library="style" name="templates/insomnia2/css/actionlog.css" /> <h:outputStylesheet library="style"
name="templates/insomnia2/css/actionlog.css" />
<h1>#{i18n['actionlog.messagelist.header']}</h1> <h1>#{i18n['actionlog.messagelist.header']}</h1>
<p>#{i18n['actionlog.messagelist.description']}</p> <p>#{i18n['actionlog.messagelist.description']}</p>
<h:form id="actionlog_create"> <h:form id="actionlog">
<h2>#{i18n['actionlog.create.header']}</h2> <h2>#{i18n['actionlog.create.header']}</h2>
<p:messages /> <p:messages />
<h:panelGrid columns="2"> <h:panelGrid columns="2">
...@@ -21,38 +28,49 @@ ...@@ -21,38 +28,49 @@
<h:outputText value="#{i18n['actionlog.create.message']}" /> <h:outputText value="#{i18n['actionlog.create.message']}" />
<h:outputText value="#{i18n['actionlog.create.taskradio']}" /> <h:outputText value="#{i18n['actionlog.create.taskradio']}" />
<h:outputText /> <h:outputText />
<p:inputText value="#{actionLogCreateView.message}" /> <p:inputText value="#{actionLogCreateView.message}" style="width: 400px;" />
<p:selectBooleanCheckbox value="#{actionLogCreateView.task}" /> <p:selectBooleanCheckbox value="#{actionLogCreateView.task}" />
<h:commandButton class="sendbutton" action="#{actionLogCreateView.send}" value="#{i18n['actionlog.create.submitbutton']}" /> <h:commandButton class="sendbutton"
action="#{actionLogCreateView.send}"
value="#{i18n['actionlog.create.submitbutton']}" update="@form" />
</h:panelGrid> </h:panelGrid>
<h:panelGrid columns="1"> <h:panelGrid columns="1">
<p:tagCloud model="#{actionLogMessageView.tagCloud}"> <p:tagCloud model="#{actionLogMessageView.tagCloud}">
<p:ajax event="select" listener="#{actionLogMessageView.onTagSelect}" update="@form" /> <p:ajax event="select"
</p:tagCloud> listener="#{actionLogMessageView.onTagSelect}"
update="@form,actionlogtable" />
</p:tagCloud>
<h:panelGroup layout="block"> <h:panelGroup layout="block">
<ui:repeat id="selectedtags" var="tag" value="#{actionLogMessageView.activeTags}"> <ui:repeat id="selectedtags" var="tag" value="#{actionLogMessageView.activeTags}">
<span style="border: 1px solid #0af; display: inline-block; padding: 2px">#{tag.tag}</span> <!-- <span style="border: 1px solid #0af; display: inline-block; padding: 2px">#{tag.tag}</span> -->
<p:commandButton actionListener="#{actionLogMessageView.selectFilterTag(tag.tag)}" value="#{tag.tag}" immediate="true" update="@form" />
</ui:repeat> </ui:repeat>
</h:panelGroup> </h:panelGroup>
</h:panelGrid> </h:panelGrid>
</h:panelGrid> </h:panelGrid>
</h:form> <!-- </h:form>-->
<div class="clearfix"></div> <div class="clearfix"></div>
<h2>#{i18n['actionlog.tasklist.header']}</h2> <h2>#{i18n['actionlog.tasklist.header']}</h2>
<div id="actionlog"> <div id="actionlog">
<h:form id="refresh"> <!-- <h:form id="refresh"> -->
<p:poll interval="10" update="actionlogtable" onerror="location.reload();" /> <p:poll interval="10" update="actionlogtable"
<p:dataTable styleClass="bordertable" rowStyleClass="#{message.state.name}" onerror="location.reload();" />
id="actionlogtable" value="#{actionLogMessageView.messages}" var="message" paginator="true" rows="30" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="30,50,100" > <p:dataTable styleClass="bordertable"
rowStyleClass="#{message.state.name}" id="actionlogtable"
value="#{actionLogMessageView.messages}" var="message"
paginator="true" rows="30"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="30,50,100">
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['actionlog.time']}" /> <h:outputText value="#{i18n['actionlog.time']}" />
</f:facet> </f:facet>
<h:outputText value="#{message.time}"> <h:outputText value="#{message.time}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" /> <f:convertDateTime pattern="#{sessionHandler.datetimeFormat}"
timeZone="#{sessionHandler.timezone}" />
</h:outputText> </h:outputText>
</p:column> </p:column>
<p:column> <p:column>
...@@ -79,11 +97,11 @@ ...@@ -79,11 +97,11 @@
<h:link rendered="#{!empty message.state}" outcome="taskview"> <h:link rendered="#{!empty message.state}" outcome="taskview">
<f:param name="id" value="#{message.id}" /> <f:param name="id" value="#{message.id}" />
Näytä tehtävä Näytä tehtävä
</h:link> </h:link>
</p:column> </p:column>
</p:dataTable> </p:dataTable>
</h:form> </div>
</div> </h:form>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
</h:body> </h:body>
......
@CHARSET "utf-8"; @CHARSET "utf-8";
/*
#actionlog_create .row { #actionlog_create .row {
display: block; display: block;
clear: both; clear: both;
...@@ -81,11 +81,11 @@ ...@@ -81,11 +81,11 @@
.taskHeader { .taskHeader {
color: #7DAC0C; color: #7DAC0C;
font-size: 120%; font-size: 120%;
font-weight: bold; font-weight: bold;
} }
.sendbutton2 { .sendbutton2 {
border: 1px solid #aaa; border: 1px solid #aaa;
margin-left: 10px; margin-left: 10px;
} }*/
\ No newline at end of file \ No newline at end of file
package fi.codecrew.moya.web.cdiview.actionlog; package fi.codecrew.moya.web.cdiview.actionlog;
import java.awt.event.ActionEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -37,18 +38,21 @@ public class ActionLogMessageView extends GenericCDIView { ...@@ -37,18 +38,21 @@ public class ActionLogMessageView extends GenericCDIView {
if(super.requirePermissions(ContentPermission.MANAGE_ACTIONLOG)) { if(super.requirePermissions(ContentPermission.MANAGE_ACTIONLOG)) {
this.beginConversation(); this.beginConversation();
if(tagCloud == null || activeTags == null) { refreshTagCloud();
tagCloud = new DefaultTagCloudModel();
if(activeTags == null) {
for(ActionLogMessageTag almt : actionLogBean.getAllTags()) {
tagCloud.addTag(new DefaultTagCloudItem(almt.getTag(), 1));
}
activeTags = new ArrayList<>(); activeTags = new ArrayList<>();
} }
} }
} }
public void refreshTagCloud() {
tagCloud = new DefaultTagCloudModel();
for(ActionLogMessageTag almt : actionLogBean.getAllTags()) {
tagCloud.addTag(new DefaultTagCloudItem(almt.getTag(), 1));
}
}
public boolean getUpdateEnabled() { public boolean getUpdateEnabled() {
return updateEnabled; return updateEnabled;
...@@ -67,7 +71,6 @@ public class ActionLogMessageView extends GenericCDIView { ...@@ -67,7 +71,6 @@ public class ActionLogMessageView extends GenericCDIView {
} }
public void onTagSelect(SelectEvent event) { public void onTagSelect(SelectEvent event) {
System.err.println("T+" + activeTags.size());
TagCloudItem item = (TagCloudItem)event.getObject(); TagCloudItem item = (TagCloudItem)event.getObject();
ActionLogMessageTag almt = actionLogBean.getActionLogMessageTagByString(item.getLabel()); ActionLogMessageTag almt = actionLogBean.getActionLogMessageTagByString(item.getLabel());
...@@ -75,6 +78,16 @@ public class ActionLogMessageView extends GenericCDIView { ...@@ -75,6 +78,16 @@ public class ActionLogMessageView extends GenericCDIView {
activeTags.add(almt); activeTags.add(almt);
} }
public void selectFilterTag(String tag) {
for(ActionLogMessageTag almt : this.activeTags) {
if(tag.equals(almt.getTag())) {
this.activeTags.remove(almt);
break;
}
}
}
public List<ActionLogMessageTag> getActiveTags() { public List<ActionLogMessageTag> getActiveTags() {
return this.activeTags; return this.activeTags;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!