]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Introduced new "getter" + moved div tag to menu.jsp
authorRoland Haeder <roland@mxchange.org>
Tue, 11 Aug 2015 09:01:21 +0000 (11:01 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 11 Aug 2015 09:01:21 +0000 (11:01 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java
src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java
web/bye.jsp
web/errorHandler.jsp
web/finished.jsp
web/form_handler/order.jsp
web/index.jsp
web/preview.jsp
web/static/menu.jsp

index 42b02c8f3dd32ecd44dfce558aa91a1bce891f53..8d16f755bd0214d7a430f678c09754e74372f165 100644 (file)
@@ -194,4 +194,19 @@ public interface PizzaApplication extends Application {
         * @param value Value to set
         */
        public void setValueInSession (final HttpSession session, final String key, final Object value);
+
+       /**
+        * Some "getter" for a an array of unmarked products
+        * 
+        * @param session HttpSession instance
+        * @return Unmarked products
+        */
+       public Product[] getUnmarkedProducts (final HttpSession session);
+
+       /**
+        * Some "getter" for a an array of all products
+        * 
+        * @return Unmarked products
+        */
+       public Product[] getProducts ();
 }
index df6cf19228334e3215c3d6b2a9967d6373381824..2da95069f36cd4c2d6b17641cecbe2ca8428c492 100644 (file)
@@ -1038,4 +1038,34 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
                // Return actual value
                return this.convertNullToEmpty(value);
        }
+
+       /**
+        * Gets an array of products from product iterator and unmarks them as ordered
+        * 
+        * @param session HttpSession instance
+        * @return Unmarked products
+        */
+       @Override
+       public Product[] getUnmarkedProducts (final HttpSession session) {
+               // Init array
+               Product[] array = this.getProducts();
+
+               // Unmark are all as ordered
+               for (final Product product : array) {
+                       this.unmarkProductAsOrdered(product, session);
+               }
+
+               // Return finished array
+               return array;
+       }
+
+       /**
+        * Some "getter" for a an array of all products
+        * 
+        * @return Unmarked products
+        */
+       @Override
+       public Product[] getProducts () {
+               return (Product[]) this.products.values().toArray();
+       }
 }
index acf5b790ec8292fccf24756a7e3ec77d83e967d0..b4a152f1066636b292e3efc0943eaa238cd4d440 100644 (file)
@@ -20,9 +20,7 @@
                        <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Sitzung beenden</h1>
                </div>
 
-               <div id="menu">
-                       <jsp:include page="/static/menu.jsp" flush="true" />
-               </div>
+               <jsp:include page="/static/menu.jsp" flush="true" />
 
                <div id="content_outer">
                        <div id="content_title">
index 0f45fade48a1acdd089a23cd8bf3ccb0da6899d6..8fe26c1b83ce840418e69e14c46ab95954afc7a8 100644 (file)
@@ -28,9 +28,7 @@
                        <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Fehler</h1>
                </div>
 
-               <div id="menu">
-                       <jsp:include page="/static/menu.jsp" flush="true" />
-               </div>
+               <jsp:include page="/static/menu.jsp" flush="true" />
 
                <div id="content_outer">
                        <div id="content_title">
index 2ad0f23ac7cdae8edad7f42615ef22ea9ecfd1a6..f8054014ac7a9023b5601b5c324cc258d45b46d9 100644 (file)
@@ -35,9 +35,7 @@
                        <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Vielen Dank!</h1>
                </div>
 
-               <div id="menu">
-                       <jsp:include page="/static/menu.jsp" flush="true" />
-               </div>
+               <jsp:include page="/static/menu.jsp" flush="true" />
 
                <div id="content_outer">
                        <div id="content_title">
index 6ddf7e7c12042268d499eb8ef6281c15b85538c5..e00ec747b8313d5ec7aa5a556a1e5b70d8ee85a3 100644 (file)
@@ -40,9 +40,7 @@
                        <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</h1>
                </div>
 
-               <div id="menu">
-                       <jsp:include page="/static/menu.jsp" flush="true" />
-               </div>
+               <jsp:include page="/static/menu.jsp" flush="true" />
 
                <div id="content_outer">
                        <div id="content_title">
index d293fa266dc974fcdb42cf99ccc9056341aaf29a..b72daf9af70c407d7d3907636fb364be96555b55 100644 (file)
@@ -29,9 +29,7 @@
                        <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Eingangsseite</h1>
                </div>
 
-               <div id="menu">
-                       <jsp:include page="/static/menu.jsp" flush="true" />
-               </div>
+               <jsp:include page="/static/menu.jsp" flush="true" />
 
                <div id="content_outer">
                        <div id="content_title">
 
                                        <tbody class="table_body">
                                                <%
-                                               // Get iterator from products
-                                               Iterator<Map.Entry<String, Product>> iterator = app.getProductsIterator();
-
-                                               // Iterate over all
-                                               while (iterator.hasNext()) {
-                                                       // Get entry
-                                                       Map.Entry<String, Product> entry = iterator.next();
-
-                                                       // Get product
-                                                       Product product = entry.getValue();
-                                                       app.unmarkProductAsOrdered(product, session);
+                                               // Much smaller loop
+                                               for (final Product product : app.getUnmarkedProducts(session)) {
                                                        %>
                                                        <tr>
                                                                <td>
index 22f8e7e879c954013c0630404f509b3e939c564c..86d3832e5222a404756dca00a2c6b289480721a8 100644 (file)
@@ -34,9 +34,7 @@
                        <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Bestellung anzeigen</h1>
                </div>
 
-               <div id="menu">
-                       <jsp:include page="/static/menu.jsp" flush="true" />
-               </div>
+               <jsp:include page="/static/menu.jsp" flush="true" />
 
                <div id="content_outer">
                        <div id="content_title">
                                        </thead>
                                        <tbody class="table_body">
                                                <%
-                                               // Get iterator from products
-                                               Iterator<Map.Entry<String, Product>> iterator = app.getProductsIterator();
-
-                                               // Iterate over all
-                                               while (iterator.hasNext()) {
-                                                       // Get entry
-                                                       Map.Entry<String, Product> entry = iterator.next();
-
-                                                       // Get product
-                                                       Product product = entry.getValue();
+                                               for (final Product product : app.getProducts()) {
                                                        %>
                                                        <tr>
                                                                <td>
index 8136267b3129e3662c2e7dd8c9ac4e3756f5e159..c022e1512a4e5721fcb4c3e1c2981d3326088b31 100644 (file)
@@ -4,9 +4,11 @@
     Author     : Roland Haeder
 --%>
 
-<ul>
-       <li><a href="<%=request.getContextPath()%>/index.jsp" title="Eingangsseite">Home</a></li>
-       <li><a href="<%=request.getContextPath()%>/preview.jsp" title="Bestellseite">Bestellung</a></li>
-       <li><a href="<%=request.getContextPath()%>/finished.jsp" title="Bestellung abgeschlossen">Vielen Dank</a></li>
-       <li><a href="<%=request.getContextPath()%>/bye.jsp" title="Sitzung beennden">Sitzung beenden</a></li>
-</ul>
+<div id="menu">
+       <ul>
+               <li><a href="<%=request.getContextPath()%>/index.jsp" title="Eingangsseite">Home</a></li>
+               <li><a href="<%=request.getContextPath()%>/preview.jsp" title="Bestellseite">Bestellung</a></li>
+               <li><a href="<%=request.getContextPath()%>/finished.jsp" title="Bestellung abgeschlossen">Vielen Dank</a></li>
+               <li><a href="<%=request.getContextPath()%>/bye.jsp" title="Sitzung beennden">Sitzung beenden</a></li>
+       </ul>
+</div>