]> git.mxchange.org Git - addressbook-war.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Mon, 12 Oct 2015 16:23:08 +0000 (18:23 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 12 Oct 2015 16:23:08 +0000 (18:23 +0200)
- added login_show_addressbook.xhtml
- added missing language elements
- listing of created address books should be "basicly finished"
- updated jar(s)

lib/jcontacts-core.jar
src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebBean.java
src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebController.java
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
web/WEB-INF/faces-config.xml
web/login/login_own_addressbooks.xhtml
web/login/login_show_addressbook.xhtml [new file with mode: 0644]

index 2cb80f4a3a16213629a0ee5d9ffe7d52260f25d7..f0cd6d5ddcb0b3ca18c1f908c8b87c98084f5dee 100644 (file)
Binary files a/lib/jcontacts-core.jar and b/lib/jcontacts-core.jar differ
index 2232b33cab3461b55d8785ce9b2909dc987939dd..237876dd9cb5f8cb92fed39dc24531da19cd3a32 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.addressbook.beans.addressbook;
 
 import java.text.MessageFormat;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.GregorianCalendar;
 import java.util.List;
 import javax.annotation.PostConstruct;
@@ -49,6 +50,11 @@ public class AddressbookWebBean implements AddressbookWebController {
         */
        private static final long serialVersionUID = 185_781_756_712_969L;
 
+       /**
+        * Remote address book bean
+        */
+       private AddressbookSessionBeanRemote addressbookBean;
+
        /////////////////////// Properties /////////////////////
        /**
         * A list of all user's address books
@@ -60,11 +66,6 @@ public class AddressbookWebBean implements AddressbookWebController {
         */
        private String addressbookName;
 
-       /**
-        * Remote address book bean
-        */
-       private AddressbookSessionBeanRemote addressbookBean;
-
        /**
         * Login controller
         */
@@ -88,30 +89,6 @@ public class AddressbookWebBean implements AddressbookWebController {
                }
        }
 
-       @PostConstruct
-       public void init () {
-               // Init list
-               this.addressbookList = new ArrayList<>(0);
-
-               // Is the user logged-in?
-               if (this.loginController.isUserLoggedIn()) {
-                       // Fill list with entries
-                       this.addressbookList = this.addressbookBean.getUsersList(this.loginController.getLoggedInUser());
-               }
-       }
-
-       @Override
-       public boolean hasCreatedAddressbooks () {
-               // Is the user logged in?
-               if (!this.loginController.isUserLoggedIn()) {
-                       // Not logged in
-                       throw new FaceletException("This method can only be called as logged-in user."); //NOI18N
-               }
-
-               // Check if the list is filled
-               return (!this.addressbookList.isEmpty());
-       }
-
        @Override
        public void addAddressbook () {
                // Is this name already used?
@@ -152,6 +129,11 @@ public class AddressbookWebBean implements AddressbookWebController {
                }
        }
 
+       @Override
+       public List<Addressbook> allAddressbooks () {
+               return Collections.unmodifiableList(this.addressbookList);
+       }
+
        @Override
        public String getAddressbookName () {
                return this.addressbookName;
@@ -162,6 +144,30 @@ public class AddressbookWebBean implements AddressbookWebController {
                this.addressbookName = addressbookName;
        }
 
+       @Override
+       public boolean hasCreatedAddressbooks () {
+               // Is the user logged in?
+               if (!this.loginController.isUserLoggedIn()) {
+                       // Not logged in
+                       throw new FaceletException("This method can only be called as logged-in user."); //NOI18N
+               }
+
+               // Check if the list is filled
+               return (!this.addressbookList.isEmpty());
+       }
+
+       @PostConstruct
+       public void init () {
+               // Init list
+               this.addressbookList = new ArrayList<>(0);
+
+               // Is the user logged-in?
+               if (this.loginController.isUserLoggedIn()) {
+                       // Fill list with entries
+                       this.addressbookList = this.addressbookBean.getUsersList(this.loginController.getLoggedInUser());
+               }
+       }
+
        @Override
        public boolean isAddressbookNameUsed (final String addressbookName) {
                // Is it zero size?
index 3d5a8154a4e26ae7571022ef77d12f7d58fa689a..6a60b22af93c38271bb00b4bd4bf3215252d16b4 100644 (file)
@@ -17,6 +17,8 @@
 package org.mxchange.addressbook.beans.addressbook;
 
 import java.io.Serializable;
+import java.util.List;
+import org.mxchange.addressbook.model.addressbook.Addressbook;
 
 /**
  * An interface for user beans
@@ -61,4 +63,11 @@ public interface AddressbookWebController extends Serializable {
         * @return Whether the name has already been used by the user
         */
        public boolean isAddressbookNameUsed (final String addressbookName);
+
+       /**
+        * Returns all address books with this user
+        * <p>
+        * @return A list of all address books by this user
+        */
+       public List<Addressbook> allAddressbooks ();
 }
index 531219f3556fa3453e494191c256b807e62ff1f0..d60fb749f3e662feff67f4d6e4b877416fde3084 100644 (file)
@@ -172,3 +172,13 @@ LOGIN_ENTER_ADDRESSBOOK_NAME=Names des Adressbuches:
 COUNTRY_GERMANY=Deutschland
 COUNTRY_PHILIPPINES=Philippinen
 NONE_SELECTED=k.A.
+ADDRESSBOOK_ID=Id-Nummer:
+ADDRESSBOOK_ID_TITLE=Identifizierende, eindeutige Nummer
+ADDRESSBOOK_NAME=Addressbuchname:
+ADDRESSBOOK_NAME_TITLE=Name des Adressbuches
+ADDRESSBOOK_CREATED=Erstellt:
+ADDRESSBOOK_CREATED_TITLE=Wann das Adressbuch erstellt wurde.
+LINK_LOGIN_SHOW_ADDRESS_BOOK_TITLE=Adressbuch anzeigen
+PAGE_TITLE_LOGIN_SHOW_ADDRESSBOOK=Adressbuch anzeigen
+#Please fix German "umlaut"
+CONTENT_TITLE_LOGIN_SHOW_ADDRESSBOOK=Anzeigen des ausgewaehlten Adressbuchs:
index 59f80a45f1c5ead580e446c81ce5163aa5cebe10..869815e4cef45e2cf09a10bb4cc5d3e62f74b04d 100644 (file)
@@ -172,3 +172,12 @@ LOGIN_ENTER_ADDRESSBOOK_NAME=Name of address book:
 COUNTRY_GERMANY=Germany
 COUNTRY_PHILIPPINES=Philippines
 NONE_SELECTED=Empty
+ADDRESSBOOK_ID=Id number:
+ADDRESSBOOK_ID_TITLE=Identifying unique number
+ADDRESSBOOK_NAME=Address book name:
+ADDRESSBOOK_NAME_TITLE=Name of the address book
+ADDRESSBOOK_CREATED=Created:
+ADDRESSBOOK_CREATED_TITLE=When the address book was created.
+LINK_LOGIN_SHOW_ADDRESS_BOOK_TITLE=Show address book
+PAGE_TITLE_LOGIN_SHOW_ADDRESSBOOK=Show address book
+CONTENT_TITLE_LOGIN_SHOW_ADDRESSBOOK=Show selected address book:
index d03e8b3509844844da832479914f9942ea06f857..ed980d6b69847508059f4a577d80cf0cd9878a34 100644 (file)
                        <from-outcome>login_add_addressbook</from-outcome>
                        <to-view-id>/login/login_add_addressbook.xhtml</to-view-id>
                </navigation-case>
+               <navigation-case>
+                       <from-outcome>login_show_addressbook</from-outcome>
+                       <to-view-id>/login/login_show_addressbook.xhtml</to-view-id>
+               </navigation-case>
        </navigation-rule>
        <application>
                <locale-config>
index 561a1c790742938d8b92ac169a0aebca645201b3..7938ed5dcdbafb6901a9e896e2116ac7cccd3705 100644 (file)
                        </div>
 
                        <div class="para">
-                               <h:dataTable id="table_own_addressbooks" var="addressbook" value="#{addressbookController.allAddressbooks}" styleClass="table" summary="#{msg.TABLE_SUMMARY_LIST_OWN_ADDRESSBOOKS}" rendered="#{addressbookController.hasCreatedAddressbooks()}">
+                               <h:dataTable id="table_own_addressbooks" var="addressbook" value="#{addressbookController.allAddressbooks()}" styleClass="table" summary="#{msg.TABLE_SUMMARY_LIST_OWN_ADDRESSBOOKS}" rendered="#{addressbookController.hasCreatedAddressbooks()}">
+                                       <h:column>
+                                               <f:facet name="header">#{msg.ADDRESSBOOK_ID}</f:facet>
+
+                                               <h:outputText id="addressbookId" value="#{addressbook.addressbookId}" title="#{msg.ADDRESSBOOK_ID_TITLE}" />
+                                       </h:column>
+
+                                       <h:column>
+                                               <f:facet name="header">#{msg.ADDRESSBOOK_NAME}</f:facet>
+
+                                               <h:link outcome="login_show_addressbook" title="#{msg.LINK_LOGIN_SHOW_ADDRESS_BOOK_TITLE}">
+                                                       <f:param name="addressbook_id" value="#{addressbook.addressbookId}" />
+                                                       <h:outputText id="addressbookName" value="#{addressbook.addressbookName}" title="#{msg.ADDRESSBOOK_NAME_TITLE}" />
+                                               </h:link>
+                                       </h:column>
+
+                                       <h:column>
+                                               <f:facet name="header">#{msg.ADDRESSBOOK_CREATED}</f:facet>
+
+                                               <h:outputFormat id="addressbookCreated" value="#{addressbook.addressbookCreated.time}" title="#{msg.ADDRESSBOOK_CREATED_TITLE}">
+                                                       <f:convertDateTime for="addressbookCreated" type="both" timeStyle="short" dateStyle="medium" />
+                                               </h:outputFormat>
+                                       </h:column>
                                </h:dataTable>
                        </div>
 
diff --git a/web/login/login_show_addressbook.xhtml b/web/login/login_show_addressbook.xhtml
new file mode 100644 (file)
index 0000000..d2a8d1e
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+         xmlns:ui="http://java.sun.com/jsf/facelets"
+         xmlns:h="http://xmlns.jcp.org/jsf/html"
+         xmlns:f="http://xmlns.jcp.org/jsf/core"
+         >
+
+       <ui:composition template="/WEB-INF/templates/login/login_base.tpl">
+               <ui:define name="login_title">#{msg.PAGE_TITLE_LOGIN_SHOW_ADDRESSBOOK}</ui:define>
+
+               <ui:define name="content_header">
+                       #{msg.CONTENT_TITLE_LOGIN_SHOW_ADDRESSBOOK}
+               </ui:define>
+
+               <ui:define name="content">
+                       Here goes your content.
+               </ui:define>
+       </ui:composition>
+</html>