Commit 939b39af by Antti Tönkyrä

Tagging UI / ActionLog tweaks

1 parent 0e48a8ea
......@@ -79,7 +79,10 @@ public class ActionLogBean implements ActionLogBeanLocal {
@Override
@RolesAllowed(ContentPermission.S_MANAGE_ACTIONLOG)
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)
......
......@@ -26,7 +26,7 @@ public class ActionLogFacade extends IntegerPkGenericFacade<ActionLogMessage> {
super(ActionLogMessage.class);
}
@Deprecated
public List<ActionLogMessage> getAllSortedByTimestamp(LanEvent event) {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<ActionLogMessage> cq = cb.createQuery(ActionLogMessage.class);
......
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"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"
xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">
<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"
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>
<ui:composition template="#{sessionHandler.template}">
<f:metadata>
<f:event type="preRenderView" listener="#{actionLogMessageView.initView}" />
<f:event type="preRenderView"
listener="#{actionLogMessageView.initView}" />
</f:metadata>
<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>
<p>#{i18n['actionlog.messagelist.description']}</p>
<h:form id="actionlog_create">
<h:form id="actionlog">
<h2>#{i18n['actionlog.create.header']}</h2>
<p:messages />
<h:panelGrid columns="2">
......@@ -21,38 +28,49 @@
<h:outputText value="#{i18n['actionlog.create.message']}" />
<h:outputText value="#{i18n['actionlog.create.taskradio']}" />
<h:outputText />
<p:inputText value="#{actionLogCreateView.message}" />
<p:inputText value="#{actionLogCreateView.message}" style="width: 400px;" />
<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 columns="1">
<p:tagCloud model="#{actionLogMessageView.tagCloud}">
<p:ajax event="select" listener="#{actionLogMessageView.onTagSelect}" update="@form" />
</p:tagCloud>
<p:ajax event="select"
listener="#{actionLogMessageView.onTagSelect}"
update="@form,actionlogtable" />
</p:tagCloud>
<h:panelGroup layout="block">
<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>
</h:panelGroup>
</h:panelGrid>
</h:panelGrid>
</h:form>
<div class="clearfix"></div>
<h2>#{i18n['actionlog.tasklist.header']}</h2>
<div id="actionlog">
<h:form id="refresh">
<p:poll interval="10" update="actionlogtable" onerror="location.reload();" />
<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" >
<!-- </h:form>-->
<div class="clearfix"></div>
<h2>#{i18n['actionlog.tasklist.header']}</h2>
<div id="actionlog">
<!-- <h:form id="refresh"> -->
<p:poll interval="10" update="actionlogtable"
onerror="location.reload();" />
<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>
<f:facet name="header">
<h:outputText value="#{i18n['actionlog.time']}" />
</f:facet>
<h:outputText value="#{message.time}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}"
timeZone="#{sessionHandler.timezone}" />
</h:outputText>
</p:column>
<p:column>
......@@ -79,11 +97,11 @@
<h:link rendered="#{!empty message.state}" outcome="taskview">
<f:param name="id" value="#{message.id}" />
Näytä tehtävä
</h:link>
</h:link>
</p:column>
</p:dataTable>
</h:form>
</div>
</div>
</h:form>
</ui:define>
</ui:composition>
</h:body>
......
@CHARSET "utf-8";
/*
#actionlog_create .row {
display: block;
clear: both;
......@@ -81,11 +81,11 @@
.taskHeader {
color: #7DAC0C;
font-size: 120%;
font-size: 120%;
font-weight: bold;
}
.sendbutton2 {
border: 1px solid #aaa;
margin-left: 10px;
}
\ No newline at end of file
}*/
\ No newline at end of file
package fi.codecrew.moya.web.cdiview.actionlog;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.List;
......@@ -37,18 +38,21 @@ public class ActionLogMessageView extends GenericCDIView {
if(super.requirePermissions(ContentPermission.MANAGE_ACTIONLOG)) {
this.beginConversation();
if(tagCloud == null || activeTags == null) {
tagCloud = new DefaultTagCloudModel();
for(ActionLogMessageTag almt : actionLogBean.getAllTags()) {
tagCloud.addTag(new DefaultTagCloudItem(almt.getTag(), 1));
}
refreshTagCloud();
if(activeTags == null) {
activeTags = new ArrayList<>();
}
}
}
public void refreshTagCloud() {
tagCloud = new DefaultTagCloudModel();
for(ActionLogMessageTag almt : actionLogBean.getAllTags()) {
tagCloud.addTag(new DefaultTagCloudItem(almt.getTag(), 1));
}
}
public boolean getUpdateEnabled() {
return updateEnabled;
......@@ -67,7 +71,6 @@ public class ActionLogMessageView extends GenericCDIView {
}
public void onTagSelect(SelectEvent event) {
System.err.println("T+" + activeTags.size());
TagCloudItem item = (TagCloudItem)event.getObject();
ActionLogMessageTag almt = actionLogBean.getActionLogMessageTagByString(item.getLabel());
......@@ -75,6 +78,16 @@ public class ActionLogMessageView extends GenericCDIView {
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() {
return this.activeTags;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!