]> git.mxchange.org Git - addressbook-war.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Fri, 9 Oct 2015 18:58:29 +0000 (20:58 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 9 Oct 2015 19:00:43 +0000 (21:00 +0200)
- form adding address books is "basicly finished"
- added all its language strings
- added bean method createAddressbook()
- added field addressbookName
- added a description to web.xml
- registered newly added validator for address book names (doubles are allowed)

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/WEB-INF/glassfish-web.xml
web/WEB-INF/web.xml
web/login/login_add_addressbook.xhtml

index 7bd707f9a3b3ed64285213fe5ae7657a3f00a9ac..5661a9259d95c2e03a838780c963b38deaa83c6d 100644 (file)
@@ -50,6 +50,11 @@ public class AddressbookWebBean implements AddressbookWebController {
         */
        private List<Addressbook> addressbookList;
 
+       /**
+        * Name of the address book
+        */
+       private String addressbookName;
+
        /**
         * Remote addressbook bean
         */
@@ -101,4 +106,19 @@ public class AddressbookWebBean implements AddressbookWebController {
                // Check if the list is filled
                return (!this.addressbookList.isEmpty());
        }
+
+       @Override
+       public void addAddressbook() {
+               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+       }
+
+       @Override
+       public String getAddressbookName() {
+               return this.addressbookName;
+       }
+
+       @Override
+       public void setAddressbookName(final String addressbookName) {
+               this.addressbookName = addressbookName;
+       }
 }
index f8c076df6cab6ad35c863aafc88366aa3e197dfa..56af2ea788fa4ad3a3f42fac5a3f5c5303494f43 100644 (file)
@@ -31,5 +31,25 @@ public interface AddressbookWebController extends Serializable {
         * <p>
         * @return Whether the user has created at least one addressbook
         */
-       public boolean hasCreatedAddressbooks ();
+       public boolean hasCreatedAddressbooks();
+
+       /**
+        * Creates a new address book with a name. For this method to work it is
+        * vital that the user is logged into his/her account.
+        */
+       public void addAddressbook();
+
+       /**
+        * Getter for address book name
+        * <p>
+        * @return Address book name
+        */
+       public String getAddressbookName();
+
+       /**
+        * Setter for address book name
+        * <p>
+        * @param addressbookName Address book name
+        */
+       public void setAddressbookName(final String addressbookName);
 }
index 1f23fbd87b63063faa29a1b38d44ab3829609eea..f3a6603d75512d113995f9d8538f58692174d024 100644 (file)
@@ -164,3 +164,8 @@ LINK_LOGIN_ADD_ADDITIONAL_ADDRESSBOOK_TITLE=Legen Sie ein weiteres Adressbuch an
 LINK_LOGIN_ADD_FIRST_ADDRESSBOOK_TITLE=Legen Sie Ihr erstes Adressbuch an. Dies ist f\u00fcr das Verwalten von Kontakten erforderlich.
 PAGE_TITLE_LOGIN_ADD_ADDRESSBOOK=Neues Adressbuch anlegen
 CONTENT_TITLE_LOGIN_ADD_ADDRESSBOOK=Legen Sie ein neues Addressbuch an:
+FORM_LOGIN_ADD_ADDRESSBOOK_TITLE=Ein neues Adressbuch anlegen:
+LOGIN_ADDRESSBOOK_NAME_REQUIRED_MESSAGE=Bitte geben Sie einen Namen fuer Ihr Adressbuch ein. Beispiele: Private Kontakte
+LOGIN_ENTER_ADDRESSBOOK_NAME_TITLE=Vergeben Sie hier einen Name fuer Ihr Adressbuch. Beispiel: Private Kontakte
+BUTTON_LOGIN_ADD_ADDRESSBOOK=Adressbuch anlegen
+LOGIN_ENTER_ADDRESSBOOK_NAME=Names des Adressbuches:
index dff016b07aebfdc4ac4d09cbcd541508777123dd..e1fc0286cec59cef8c6098c4832d17db6077651e 100644 (file)
@@ -163,4 +163,9 @@ LINK_LOGIN_ADD_FIRST_ADDRESSBOOK=Create first address book
 LINK_LOGIN_ADD_ADDITIONAL_ADDRESSBOOK_TITLE=You can create an additional address book here. This way you can organize your contacts.
 LINK_LOGIN_ADD_FIRST_ADDRESSBOOK_TITLE=Create your first address book. This is required to manage your contacts.
 PAGE_TITLE_LOGIN_ADD_ADDRESSBOOK=Create new address book
-CONTENT_TITLE_LOGIN_ADD_ADDRESSBOOK=Create a new address book:
+CONTENT_TITLE_LOGIN_ADD_ADDRESSBOOK=You can create a new address book here:
+FORM_LOGIN_ADD_ADDRESSBOOK_TITLE=Create a new address book:
+LOGIN_ADDRESSBOOK_NAME_REQUIRED_MESSAGE=Please enter a name for your address book. Examples: Private contacts
+LOGIN_ENTER_ADDRESSBOOK_NAME_TITLE=Here you can give your address book a name. Example: Private contacts
+BUTTON_LOGIN_ADD_ADDRESSBOOK=Create address book
+LOGIN_ENTER_ADDRESSBOOK_NAME=Name of address book:
index 1386e115959c6c9bc13ffe8c24f27a06c97cbb15..7d1d930e65141eda17157ce8fe46e154e3d47ebf 100644 (file)
                <validator-id>NameValidator</validator-id>
                <validator-class>org.mxchange.jcoreee.validator.string.names.NameValidator</validator-class>
        </validator>
+       <validator>
+               <validator-id>AddressbookNameValidator</validator-id>
+               <validator-class>org.mxchange.addressbook.validator.names.AddressbookNameValidator</validator-class>
+       </validator>
        <navigation-rule>
                <from-view-id>*</from-view-id>
                <navigation-case>
index 80dc0809eddfc69eac812b948c6b5c92150e5521..b70617b4789ffb46b59220a95c2e94b78eb295cf 100644 (file)
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
 <glassfish-web-app error-url="">
-  <context-root>/addressbook-war</context-root>
-  <class-loader delegate="true"/>
-  <jsp-config>
-    <property name="keepgenerated" value="true">
-      <description>Keep a copy of the generated servlet class' java code.</description>
-    </property>
-  </jsp-config>
+       <context-root>/addressbook-war</context-root>
+       <class-loader delegate="true"/>
+       <jsp-config>
+               <property name="keepgenerated" value="true">
+                       <description>Keep a copy of the generated servlet class' java code.</description>
+               </property>
+       </jsp-config>
 </glassfish-web-app>
index f827361252a2efb0e689abe59ef9412e8e876433..4daac62165f25f6b556c31cb32ebd9bcf3c89968 100644 (file)
@@ -1,69 +1,70 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
-    <display-name>Addressbook Application v1.0</display-name>
-    <context-param>
-        <param-name>javax.faces.PROJECT_STAGE</param-name>
-        <param-value>Development</param-value>
-    </context-param>
-    <servlet>
-        <servlet-name>Faces Servlet</servlet-name>
-        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
-        <load-on-startup>1</load-on-startup>
-    </servlet>
-    <servlet-mapping>
-        <servlet-name>Faces Servlet</servlet-name>
-        <url-pattern>/faces/*</url-pattern>
-    </servlet-mapping>
-    <session-config>
-        <session-timeout>
+       <description>An online address book application to share private and business memebers between all members. It is also possible that the user's profile can be made visible to outside.</description>
+       <display-name>Addressbook Application v1.0</display-name>
+       <context-param>
+               <param-name>javax.faces.PROJECT_STAGE</param-name>
+               <param-value>Development</param-value>
+       </context-param>
+       <servlet>
+               <servlet-name>Faces Servlet</servlet-name>
+               <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+               <load-on-startup>1</load-on-startup>
+       </servlet>
+       <servlet-mapping>
+               <servlet-name>Faces Servlet</servlet-name>
+               <url-pattern>/faces/*</url-pattern>
+       </servlet-mapping>
+       <session-config>
+               <session-timeout>
                        30
                </session-timeout>
-    </session-config>
-    <welcome-file-list>
-        <welcome-file>faces/index.xhtml</welcome-file>
-    </welcome-file-list>
-    <security-constraint>
-        <display-name>LoginConstraint</display-name>
-        <web-resource-collection>
-            <web-resource-name>loginArea</web-resource-name>
-            <description>Login area</description>
-            <url-pattern>/llogin/*</url-pattern>
-        </web-resource-collection>
-        <auth-constraint>
-            <description>User Authentication</description>
-            <role-name>user</role-name>
-        </auth-constraint>
-    </security-constraint>
-    <security-constraint>
-        <display-name>AdminConstraint</display-name>
-        <web-resource-collection>
-            <web-resource-name>admin</web-resource-name>
-            <description>Administrative area</description>
-            <url-pattern>/admin/*</url-pattern>
-        </web-resource-collection>
-        <auth-constraint>
-            <description>Admin authentication</description>
-            <role-name>admin</role-name>
-        </auth-constraint>
-    </security-constraint>
-    <login-config>
-        <auth-method>FORM</auth-method>
-        <realm-name>Loginbereich / Login area</realm-name>
-        <form-login-config>
-            <form-login-page>/user/login.xhtml</form-login-page>
-            <form-error-page>/user/login_error.xhtml</form-error-page>
-        </form-login-config>
-    </login-config>
-    <security-role>
-        <description>A logged-in user that has previously registered himself/herself.</description>
-        <role-name>user</role-name>
-    </security-role>
-    <mime-mapping>
-        <extension>tpl</extension>
-        <mime-type>text/plain</mime-type>
-    </mime-mapping>
-    <security-role>
-        <description>Administrativre rule</description>
-        <role-name>admin</role-name>
-    </security-role>
+       </session-config>
+       <welcome-file-list>
+               <welcome-file>faces/index.xhtml</welcome-file>
+       </welcome-file-list>
+       <security-constraint>
+               <display-name>LoginConstraint</display-name>
+               <web-resource-collection>
+                       <web-resource-name>loginArea</web-resource-name>
+                       <description>Login area</description>
+                       <url-pattern>/llogin/*</url-pattern>
+               </web-resource-collection>
+               <auth-constraint>
+                       <description>User Authentication</description>
+                       <role-name>user</role-name>
+               </auth-constraint>
+       </security-constraint>
+       <security-constraint>
+               <display-name>AdminConstraint</display-name>
+               <web-resource-collection>
+                       <web-resource-name>admin</web-resource-name>
+                       <description>Administrative area</description>
+                       <url-pattern>/admin/*</url-pattern>
+               </web-resource-collection>
+               <auth-constraint>
+                       <description>Admin authentication</description>
+                       <role-name>admin</role-name>
+               </auth-constraint>
+       </security-constraint>
+       <login-config>
+               <auth-method>FORM</auth-method>
+               <realm-name>Loginbereich / Login area</realm-name>
+               <form-login-config>
+                       <form-login-page>/user/login.xhtml</form-login-page>
+                       <form-error-page>/user/login_error.xhtml</form-error-page>
+               </form-login-config>
+       </login-config>
+       <security-role>
+               <description>A logged-in user that has previously registered himself/herself.</description>
+               <role-name>user</role-name>
+       </security-role>
+       <mime-mapping>
+               <extension>tpl</extension>
+               <mime-type>text/plain</mime-type>
+       </mime-mapping>
+       <security-role>
+               <description>Administrativre rule</description>
+               <role-name>admin</role-name>
+       </security-role>
 </web-app>
index 219d8749fbee42aa7a3e307c7ddbf2bd97cf0bac..30f86dafb6bc92e7cd68bc314563499698561365 100644 (file)
 
                <ui:define name="content">
                        <h:form id="add_addressbook" acceptcharset="utf-8">
-                               
+                               <div class="table">
+                                       <div class="table_header">
+                                               #{msg.FORM_LOGIN_ADD_ADDRESSBOOK_TITLE}
+                                       </div>
+
+                                       <div class="table_row">
+                                               <div class="table_left">
+                                                       <h:outputLabel for="addressbookName" value="#{msg.LOGIN_ENTER_ADDRESSBOOK_NAME}"/>
+                                               </div>
+
+                                               <div class="table_right">
+                                                       <h:inputText class="input" id="addressbookName" value="#{addressbookController.addressbookName}" maxlength="50" size="20" title="#{msg.LOGIN_ENTER_ADDRESSBOOK_NAME_TITLE}" required="true" requiredMessage="#{msg.LOGIN_ADDRESSBOOK_NAME_REQUIRED_MESSAGE}">
+                                                               <f:validator for="addressbookName" validatorId="AddressbookNameValidator" />
+                                                       </h:inputText>
+                                               </div>
+                                       </div>
+
+                                       <div class="table_footer">
+                                               <h:commandButton class="reset" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
+                                               <h:commandButton class="submit" type="submit" id="register" value="#{msg.BUTTON_LOGIN_ADD_ADDRESSBOOK}" action="#{addressbookController.addAddressbook()}" />
+                                       </div>
+                               </div>
                        </h:form>
                </ui:define>
        </ui:composition>