]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Thu, 3 Sep 2015 13:33:34 +0000 (15:33 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 3 Sep 2015 13:33:34 +0000 (15:33 +0200)
- added DataBean which will hold "static" data, e.g. genders
- continued with improvements
Signed-off-by:Roland Häder <roland@mxchange.org>

15 files changed:
lib/jcore.jar
lib/jsfcore.jar
src/java/org/mxchange/pizzaapplication/beans/enums/DataBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/enums/PizzaServiceDataBean.java [new file with mode: 0644]
web/WEB-INF/faces-config.xml
web/WEB-INF/templates.dist/guest_page.xhtml
web/WEB-INF/templates/base.tpl
web/WEB-INF/templates/generic/gender_selection_box.tpl
web/customer/login.xhtml
web/customer/lost_passwd.xhtml
web/customer/register.xhtml
web/imprint.xhtml
web/index.xhtml
web/privacy.xhtml
web/terms.xhtml

index 526b59ecc5ea534f708216abf6c4ce26d6498229..74d0330e214ade54a63d465aaf71f359a475023c 100644 (file)
Binary files a/lib/jcore.jar and b/lib/jcore.jar differ
index e49e7da85edc2d5d0509cf856c7ba53b384aa5e4..80348e4c7d70650e6892ac3f44339a6ab0cb2183 100644 (file)
Binary files a/lib/jsfcore.jar and b/lib/jsfcore.jar differ
diff --git a/src/java/org/mxchange/pizzaapplication/beans/enums/DataBean.java b/src/java/org/mxchange/pizzaapplication/beans/enums/DataBean.java
new file mode 100644 (file)
index 0000000..6a7d400
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.enums;
+
+import java.util.List;
+import org.mxchange.jcore.contact.Gender;
+import org.mxchange.jshop.beans.FrameworkBean;
+
+/**
+ * An interface for data beans
+ *
+ * @author Roland Haeder
+ */
+public interface DataBean extends FrameworkBean {
+       /**
+        * Getter for all genders as array
+        *
+        * @return All genders as array
+        */
+       public Gender[] getGenders ();
+       /**
+        * Getter for only selectable genders as array, UNKNOWN is not selectable
+        *
+        * @return All genders as array
+        */
+       public List<Gender> getSelectableGenders ();
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/enums/PizzaServiceDataBean.java b/src/java/org/mxchange/pizzaapplication/beans/enums/PizzaServiceDataBean.java
new file mode 100644 (file)
index 0000000..152f60b
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.enums;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+import org.mxchange.jcore.contact.Gender;
+import org.mxchange.jshop.beans.BaseFrameworkBean;
+
+/**
+ * A customer bean which hides the customer instance
+ *
+ * @author Roland Haeder
+ */
+@Named ("data")
+@ApplicationScoped
+public class PizzaServiceDataBean extends BaseFrameworkBean implements DataBean {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 835482364189L;
+
+       @Override
+       public Gender[] getGenders () {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("Genders={0} - EXIT!", Arrays.toString(Gender.values())));
+
+               // Return it
+               return Gender.values();
+       }
+
+       @Override
+       public List<Gender> getSelectableGenders () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
+               // Init array
+               List<Gender> genders = new ArrayList<>(this.getGenders().length - 1);
+
+               // Debug message
+               this.getLogger().debug(MessageFormat.format("genders.size()={0}", genders.size()));
+
+               // Return it
+               for (final Gender gender : Gender.values()) {
+                       // Debug message
+                       this.getLogger().debug(MessageFormat.format("gender={0}", gender));
+
+                       // Is it unknown?
+                       if (!gender.equals(Gender.UNKNOWN)) {
+                               // Debug message
+                               this.getLogger().debug(MessageFormat.format("gender={0} - adding ...", gender));
+
+                               // Not, then add it
+                               boolean added = genders.add(gender);
+
+                               // Debug message
+                               this.getLogger().debug(MessageFormat.format("added={0}", added));
+                       }
+               }
+
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("genders={0} - EXIT!", genders)); //NOI18N
+
+               // Return it
+               return genders;
+       }
+}
index d7b1bde5d722572bc31a46ec17391bcd6e46cacb..59dad75770b26f8ab9b7f6509bec6174056c4af0 100644 (file)
@@ -7,4 +7,8 @@
                <validator-id>PrivacyTermsCheckboxValidator</validator-id>
                <validator-class>org.mxchange.jsfcore.validator.bool.privacy_terms.PrivacyTermsCheckboxValidator</validator-class>
        </validator>
+       <validator>
+               <validator-id>NameValidator</validator-id>
+               <validator-class>org.mxchange.jsfcore.validator.string.names.NameValidator</validator-class>
+       </validator>
 </faces-config>
index d045118dbeeb0c0fef9ea9a4dfc2062c217645e5..7439d6380fd583b639a5f0b7ff1bcff2d300546a 100644 (file)
@@ -1,5 +1,4 @@
-<?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">
+<?xml version="1.0" encoding="UTF-8" ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://xmlns.jcp.org/jsf/html"
index 7c5763ffae87d6bc143255dc5961825fb2da85af..3aecd84035fc6eb6713b1962478af1f0c310dd05 100644 (file)
@@ -1,12 +1,13 @@
 <?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:h="http://java.sun.com/jsf/html"
-       xmlns:ui="http://java.sun.com/jsf/facelets">
+       xmlns:ui="http://java.sun.com/jsf/facelets"
+       xmlns:f="http://xmlns.jcp.org/jsf/core">
 
        <h:head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+               <f:loadBundle var="msg" basename="org.mxchange.localization.bundle" />
                <h:outputStylesheet name="./css/default.css"/>
                <h:outputStylesheet name="./css/cssLayout.css"/>
                <title>Pizza-Service - <ui:insert name="title">Default title</ui:insert></title>
index 18b0d360940d03be3da84f6cb240f438ed01fa55..7360554eae031e0b57b7ce95c1225cdbc037bc9b 100644 (file)
@@ -7,9 +7,7 @@
        <!--
        TODO: Missing pre-select of choosen gender
        //-->
-       <h:selectOneListbox class="select" id="gender" size="1">
-               <ui:repeat var="gender" value="#{Gender.values()}">
-                       <option value="#{gender.name()}">#{gender}</option>
-               </ui:repeat>
-       </h:selectOneListbox>
+       <h:selectOneMenu class="select" id="gender" value="#{customer.gender}">
+               <f:selectItems value="#{data.selectableGenders}" var="gender" itemValue="#{gender}" itemLabel="#{msg[gender.messageKey]}" />
+       </h:selectOneMenu>
 </ui:composition>
index ab2c954d55db90c49912bb37318e29097a43acee..198e37cb54b65b3bb878dba25228faaa6f6edffa 100644 (file)
@@ -1,5 +1,4 @@
-<?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">
+<?xml version="1.0" encoding="UTF-8" ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://xmlns.jcp.org/jsf/html"
index e08d28cb88d9990a42aea587bbfa126220abfca3..0535296ca335f20dd6a6f7e67fe91a5f50326d0e 100644 (file)
@@ -1,5 +1,4 @@
-<?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">
+<?xml version="1.0" encoding="UTF-8" ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://xmlns.jcp.org/jsf/html"
index 82ecef8e3097df7acdfd80bef53676a087a76fbd..3be507e3467845e72915c91dd0544d65c7c1b155 100644 (file)
@@ -1,5 +1,4 @@
-<?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">
+<?xml version="1.0" encoding="UTF-8" ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://xmlns.jcp.org/jsf/html"
@@ -43,7 +42,6 @@
                                                                </div>
 
                                                                <div class="table_right">
-                                                                       <c:set var="enabled" scope="request" value="true" />
                                                                        <ui:include src="/WEB-INF/templates/generic/gender_selection_box.tpl" />
                                                                </div>
 
@@ -68,7 +66,9 @@
                                                                </div>
 
                                                                <div class="table_right">
-                                                                       <h:inputText class="input" id="firstName" size="10" maxlength="255" value="#{customer.firstName}" required="true" />
+                                                                       <h:inputText class="input" id="firstName" size="10" maxlength="255" value="#{customer.firstName}" required="true">
+                                                                               <f:validator validatorId="NameValidator" />
+                                                                       </h:inputText>
                                                                </div>
 
                                                                <div class="clear"></div>
@@ -80,7 +80,9 @@
                                                                </div>
 
                                                                <div class="table_right">
-                                                                       <h:inputText class="input" id="familyName" size="10" maxlength="255" value="#{customer.familyName}" required="true" />
+                                                                       <h:inputText class="input" id="familyName" size="10" maxlength="255" value="#{customer.familyName}" required="true">
+                                                                               <f:validator validatorId="NameValidator" />
+                                                                       </h:inputText>
                                                                </div>
 
                                                                <div class="clear"></div>
@@ -92,7 +94,9 @@
                                                                </div>
 
                                                                <div class="table_right">
-                                                                       <h:inputText class="input" id="street" size="20" maxlength="255" value="#{customer.street}" required="true" />
+                                                                       <h:inputText class="input" id="street" size="20" maxlength="255" value="#{customer.street}" required="true">
+                                                                               <f:validator validatorId="NameValidator" />
+                                                                       </h:inputText>
                                                                </div>
 
                                                                <div class="clear"></div>
                                                                </div>
 
                                                                <div class="table_right">
-                                                                       <h:inputText class="input" id="houseNumber" size="3" maxlength="5" value="#{customer.houseNumber}" required="true" />
+                                                                       <h:inputText class="input" id="houseNumber" size="3" maxlength="5" value="#{customer.houseNumber}" required="true">
+                                                                               <f:validateLongRange minimum="1" maximum="500" />
+                                                                       </h:inputText>
                                                                </div>
 
                                                                <div class="clear"></div>
                                                                </div>
 
                                                                <div class="table_right">
-                                                                       <h:inputText class="input" id="city" size="10" maxlength="255" value="#{customer.city}" required="true" />
+                                                                       <h:inputText class="input" id="city" size="10" maxlength="255" value="#{customer.city}" required="true">
+                                                                               <f:validator validatorId="NameValidator" />
+                                                                       </h:inputText>
                                                                </div>
 
                                                                <div class="clear"></div>
index f7512adf5764e2da212c4800c9a487d39d8878dd..f31594d20af2d8e6d8577b6d6ef68ed24dad0e90 100644 (file)
@@ -1,5 +1,4 @@
-<?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">
+<?xml version="1.0" encoding="UTF-8" ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://xmlns.jcp.org/jsf/html"
index 6e9ce0ff4c375c7137f663a73337c7baf333b94e..46c3fc01ee7e033481f06cf4c0a15b8db3878dc4 100644 (file)
@@ -1,5 +1,4 @@
-<?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">
+<?xml version="1.0" encoding="UTF-8" ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://xmlns.jcp.org/jsf/html"
index 99a005429add6dcbae33bcca3740e612df02c9ad..108532c148afa47c8e089fd6ddfe2fc782f7bbe1 100644 (file)
@@ -1,5 +1,4 @@
-<?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">
+<?xml version="1.0" encoding="UTF-8" ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://xmlns.jcp.org/jsf/html"
index 89bcf35dbabd36a41055ada239fcfb995cf3a47c..8f6484d6a332eea1991e6f7daa1ca0397cd0688d 100644 (file)
@@ -1,5 +1,4 @@
-<?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">
+<?xml version="1.0" encoding="UTF-8" ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://xmlns.jcp.org/jsf/html"