import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.GregorianCalendar;
import java.util.List;
import javax.annotation.PostConstruct;
*/
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
*/
private String addressbookName;
- /**
- * Remote address book bean
- */
- private AddressbookSessionBeanRemote addressbookBean;
-
/**
* Login controller
*/
}
}
- @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?
}
}
+ @Override
+ public List<Addressbook> allAddressbooks () {
+ return Collections.unmodifiableList(this.addressbookList);
+ }
+
@Override
public String getAddressbookName () {
return this.addressbookName;
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?
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
* @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 ();
}
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:
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:
<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>
</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>
--- /dev/null
+<?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>