Toggle navigation
Toggle navigation
This project
Loading...
Sign in
grogv3
/
grog-cubi
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jean-Francois Leveque
2016-10-21 17:59:25 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0fed081d389222e67cc4ac636defbd80ad929d76
0fed081d
1 parent
b498567e
https://tree.taiga.io/project/jr-utily-grog-v3/us/44
https://tree.taiga.io/project/jr-utily-grog-v3/task/77
WiP
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
11 deletions
src/main/java/org/legrog/presentation/ListPublisherRevisionsBean.java
src/main/webapp/WEB-INF/faces-config.xml
src/main/webapp/index.xhtml
src/main/webapp/listPublisherRevisions.xhtml
src/main/java/org/legrog/presentation/ListPublisherRevisionsBean.java
View file @
0fed081
...
...
@@ -4,28 +4,72 @@ import org.legrog.application.PublisherRevisionService;
import
org.legrog.application.PublisherService
;
import
org.legrog.entities.Publisher
;
import
org.legrog.entities.PublisherRevision
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
javax.annotation.PostConstruct
;
import
javax.enterprise.context.RequestScoped
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
@Named
@RequestScoped
public
class
ListPublisherRevisionsBean
{
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Inject
PublisherRevisionService
publisherRevisionService
;
private
Integer
publisherId
;
private
boolean
viewAll
;
private
List
<
PublisherRevision
>
publisherRevisions
;
public
List
<
PublisherRevision
>
getPublisherRevisions
()
{
return
publisherRevisions
;
}
/*
if (!viewAll) {
logger.info("!viewAll");
ArrayList<PublisherRevision> filteredPublisherRevisions= new ArrayList<PublisherRevision>();
Iterator<PublisherRevision> publisherRevisionIterator = filteredPublisherRevisions.iterator();
while (publisherRevisionIterator.hasNext()) {
PublisherRevision publisherRevision = publisherRevisionIterator.next();
if (publisherRevision.getPublisher().getPublisherId() == publisherId.intValue()) {
filteredPublisherRevisions.add(publisherRevision);
}
}
publisherRevisions = filteredPublisherRevisions;
}
*/
@PostConstruct
public
void
init
()
{
publisherRevisions
=
publisherRevisionService
.
getAllPublisherRevisions
();
logger
.
info
(
"init"
);
}
public
void
setView
()
{
logger
.
info
(
"setView"
);
logger
.
info
(
"publisherId = "
+
publisherId
);
viewAll
=
false
;
if
(
publisherId
==
null
)
{
viewAll
=
true
;
}
}
public
Integer
getPublisherId
()
{
return
publisherId
;
}
public
void
setPublisherId
(
Integer
publisherId
)
{
this
.
publisherId
=
publisherId
;
}
public
boolean
isViewAll
()
{
return
viewAll
;
}
}
...
...
src/main/webapp/WEB-INF/faces-config.xml
View file @
0fed081
...
...
@@ -39,10 +39,6 @@
<from-outcome>
listUsers
</from-outcome>
<to-view-id>
/listUsers.xhtml
</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>
addPublisher
</from-outcome>
<to-view-id>
/addPublisher.xhtml
</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>
/addPublisher.xhtml
</from-view-id>
...
...
src/main/webapp/index.xhtml
View file @
0fed081
...
...
@@ -39,14 +39,14 @@
</h:commandLink>
</li>
<li>
<h:
commandLink
action=
"addPublisher
"
>
<h:outputText
value=
"Add Publisher"
/>
</h:
commandL
ink>
<h:
link
outcome=
"/addPublisher.xhtml
"
>
<h:outputText
value=
"Add
a
Publisher"
/>
</h:
l
ink>
</li>
<li>
<h:
commandLink
action=
"listPublisherRevisions
"
>
<h:
link
outcome=
"/listPublisherRevisions.xhtml
"
>
<h:outputText
value=
"List Publisher Revisions"
/>
</h:
commandL
ink>
</h:
l
ink>
</li>
</ul>
</h:form>
...
...
src/main/webapp/listPublisherRevisions.xhtml
View file @
0fed081
...
...
@@ -5,6 +5,10 @@
xmlns:h=
"http://xmlns.jcp.org/jsf/html"
xmlns:ui=
"http://xmlns.jcp.org/jsf/facelets"
xmlns:f=
"http://xmlns.jcp.org/jsf/core"
>
<f:metadata>
<f:viewParam
name=
"publisherId"
value=
"#{listPublisherRevisionsBean.publisherId}"
/>
<f:viewAction
action=
"#{listPublisherRevisionsBean.setView}"
/>
</f:metadata>
<h:body>
<h:form>
<h:commandLink
action=
"home"
>
...
...
@@ -12,6 +16,7 @@
</h:commandLink>
</h:form>
<h:link
rendered=
"#{not listPublisherRevisionsBean.viewAll}"
outcome=
"/listPublisherRevisions.xhtml"
>
Voir tous les éditeurs
</h:link>
<h:outputText
rendered=
"#{listPublisherRevisionsBean.publisherRevisions.isEmpty()}"
>
Liste des révisions est vide
</h:outputText>
<h:dataTable
value=
"#{listPublisherRevisionsBean.publisherRevisions}"
var=
"revision"
>
<h:column>
...
...
@@ -20,9 +25,12 @@
<f:param
name=
"publisherRevisionId"
value=
"#{revision.publisherRevisionId}"
/>
</h:link>
</h:column>
<h:column>
<h:column
rendered=
"#{listPublisherRevisionsBean.viewAll}"
>
<f:facet
name=
"header"
>
Editeur
</f:facet>
#{revision.publisher.publisherId}
<h:link
outcome=
"/listPublisherRevisions.xhtml"
>
<f:param
name=
"publisherId"
value=
"#{revision.publisher.publisherId}"
/>
</h:link>
</h:column>
<h:column>
<f:facet
name=
"header"
>
Name
</f:facet>
...
...
Please
register
or
login
to post a comment