]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Brought back the mini basket "tag" to live + added post-construct init() method.
authorRoland Haeder <roland@mxchange.org>
Sun, 6 Sep 2015 09:13:36 +0000 (11:13 +0200)
committerRoland Haeder <roland@mxchange.org>
Sun, 6 Sep 2015 09:13:36 +0000 (11:13 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

14 files changed:
lib/jcoreee.jar
nbproject/project.properties
src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/basket/PizzaServiceBasketWebBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/controller/PizzaServiceWebBean.java
src/java/org/mxchange/pizzaapplication/beans/controller/PizzaWebBean.java
src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerWebBean.java
src/java/org/mxchange/pizzaapplication/beans/data/DataWebBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/data/PizzaServiceDataWebBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/enums/DataWebBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/enums/PizzaServiceDataWebBean.java [deleted file]
web/WEB-INF/templates/basket/mini_basket.tpl [new file with mode: 0644]
web/WEB-INF/templates/basket/mini_basket_empty.tpl [new file with mode: 0644]
web/WEB-INF/templates/guest/guest_base.tpl

index 6b049a2cc5958ef61960a46098335ae642c838c6..e94d33f4b7bc5b18217ee5a4cb36a81e3c77a032 100644 (file)
Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ
index c8f807dd5fa102e39b7918825307b9dbbfaa694e..dff1975c98411102c627dd80de0935fbd6f5f616 100644 (file)
@@ -3,6 +3,14 @@ annotation.processing.enabled.in.editor=true
 annotation.processing.processors.list=
 annotation.processing.run.all.processors=true
 annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+auxiliary.org-netbeans-modules-css-prep.less_2e_compiler_2e_options=
+auxiliary.org-netbeans-modules-css-prep.less_2e_enabled=false
+auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css
+auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options=
+auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=false
+auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css
+auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=Facelets
+auxiliary.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=js/libs
 build.classes.dir=${build.web.dir}/WEB-INF/classes
 build.classes.excludes=**/*.java,**/*.form
 build.dir=build
@@ -62,9 +70,9 @@ javac.classpath=\
     ${file.reference.log4j-core-2.3.jar}:\
     ${file.reference.log4j-web-2.3.jar}
 # Space-separated list of extra javac options
-javac.compilerargs=
+javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
 javac.debug=true
-javac.deprecation=false
+javac.deprecation=true
 javac.processorpath=\
     ${javac.classpath}
 javac.source=1.7
@@ -75,20 +83,21 @@ javac.test.classpath=\
 javac.test.processorpath=\
     ${javac.test.classpath}
 javadoc.additionalparam=
-javadoc.author=false
+javadoc.author=true
 javadoc.encoding=${source.encoding}
 javadoc.noindex=false
 javadoc.nonavbar=false
 javadoc.notree=false
 javadoc.preview=true
-javadoc.private=false
+javadoc.private=true
 javadoc.splitindex=true
 javadoc.use=true
-javadoc.version=false
-javadoc.windowtitle=
+javadoc.version=true
+javadoc.windowtitle=Pizza-Service Application
 lib.dir=${web.docbase.dir}/WEB-INF/lib
 persistence.xml.dir=${conf.dir}
 platform.active=default_platform
+project.license=gpl30
 project.PizzaService-lib=../pizzaservice-lib
 reference.PizzaService-lib.jar=${project.PizzaService-lib}/dist/PizzaService-lib.jar
 resource.dir=setup
diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebBean.java
new file mode 100644 (file)
index 0000000..55bd408
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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.basket;
+
+import org.mxchange.jcoreee.beans.FrameworkBean;
+
+/**
+ * An interface for a basket
+ *
+ * @author Roland Haeder
+ */
+public interface PizzaBasketWebBean extends FrameworkBean {
+       /**
+        * Checks whether the basket is empty
+        *
+        * @return Whether the basket is empty
+        */
+       public boolean isEmpty ();
+
+       /**
+        * Checks whether the basket has items in it. This method is wrapper to isEmpty()
+        *
+        * @return Whether the basket is empty
+        */
+       public boolean hasItems ();
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaServiceBasketWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/basket/PizzaServiceBasketWebBean.java
new file mode 100644 (file)
index 0000000..0b185c0
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.basket;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Named;
+import org.mxchange.jcoreee.beans.BaseFrameworkBean;
+
+/**
+ * A bean for the basket
+ *
+ * @author Roland Haeder
+ */
+@Named("basket")
+@SessionScoped
+public class PizzaServiceBasketWebBean extends BaseFrameworkBean implements PizzaBasketWebBean {
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 5476347320198L;
+
+       @Override
+       public boolean isEmpty () {
+               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+       }
+
+       @Override
+       public boolean hasItems () {
+               // Call above and invert it
+               return (!this.isEmpty());
+       }
+
+       @Override
+       @PostConstruct
+       public void init () throws RuntimeException {
+               // Call super init first
+               super.localInit();
+       }
+}
index 06465f622e15bcc63537bc4afa02e1b9b63bb763..41cbd641c08d05c9b776f7d7d8411ace55063d76 100644 (file)
@@ -17,7 +17,6 @@
 package org.mxchange.pizzaapplication.beans.controller;
 
 import java.io.IOException;
-import java.rmi.RemoteException;
 import java.sql.SQLException;
 import java.util.Deque;
 import java.util.Iterator;
@@ -79,91 +78,88 @@ public class PizzaServiceWebBean extends BaseFrameworkBean implements PizzaWebBe
 
        @Override
        @PostConstruct
-       public void init () throws FacesException {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Super call
-               super.init();
+       public void init () throws RuntimeException {
+               // Call super init first
+               super.localInit();
        }
 
        @Override
-       public Iterator<Product> getAvailableProductsIterator () throws RemoteException {
+       public Iterator<Product> getAvailableProductsIterator () throws FacesException {
                try {
                        return this.remote.getAvailableProductsIterator();
                } catch (final IOException | SQLException ex) {
                        // Continue to throw
-                       throw new RemoteException("getAvailableProductsIterator() failed", ex);
+                       throw new FacesException(ex);
                }
        }
 
        @Override
-       public Iterator<Product> getAllProductsIterator () throws RemoteException {
+       public Iterator<Product> getAllProductsIterator () throws FacesException {
                try {
                        return this.remote.getAllProductsIterator();
                } catch (final IOException | SQLException ex) {
                        // Continue to throw
-                       throw new RemoteException("getAllProductsIterator() failed.", ex);
+                       throw new FacesException(ex);
                }
        }
 
        @Override
-       public Deque<Product> getAvailableProducts () throws RemoteException {
+       public Deque<Product> getAvailableProducts () throws FacesException {
                try {
                        return this.remote.getAvailableProducts();
                } catch (final IOException | SQLException ex) {
                        // Continue to throw
-                       throw new RemoteException("getAvailableProducts() failed.", ex);
+                       throw new FacesException(ex);
                }
        }
 
        @Override
-       public Deque<Product> getAllProducts () throws RemoteException {
+       public Deque<Product> getAllProducts () throws FacesException {
                try {
                        return this.remote.getAllProducts();
                } catch (final IOException | SQLException ex) {
                        // Continue to throw
-                       throw new RemoteException("getAllProducts() failed", ex);
+                       throw new FacesException(ex);
                }
        }
 
        @Override
-       public Iterator<Category> getAllCategoriesIterator () throws RemoteException {
+       public Iterator<Category> getAllCategoriesIterator () throws FacesException {
                try {
                        return this.remote.getAllCategoriesIterator();
                } catch (final IOException | SQLException ex) {
                        // Continue to throw
-                       throw new RemoteException("getAllCategoriesIterator() failed.", ex);
+                       throw new FacesException(ex);
                }
        }
 
        @Override
-       public Deque<Category> getAllCategories () throws RemoteException {
+       public Deque<Category> getAllCategories () throws FacesException {
                try {
                        return this.remote.getAllCategories();
                } catch (final IOException | SQLException ex) {
                        // Continue to throw
-                       throw new RemoteException("getAllCategories() failed.", ex);
+                       throw new FacesException(ex);
                }
        }
 
        @Override
-       public void doAdminAddCategory (final Category category) throws RemoteException {
+       public void doAdminAddCategory (final Category category) throws FacesException {
                try {
                        this.remote.doAdminAddCategory(category);
                } catch (final IOException | SQLException | CategoryTitleAlreadyUsedException ex) {
                        // Continue to throw
-                       throw new RemoteException("doAdminAddCategory() failed.", ex);
+                       throw new FacesException(ex);
                }
        }
 
        @Override
-       public void doAdminAddProduct (final Product product) throws RemoteException {
+       public void doAdminAddProduct (final Product product) throws FacesException {
                try {
                        this.remote.doAdminAddProduct(product);
                } catch (final IOException | SQLException | ProductTitleAlreadyUsedException ex) {
                        // Continue to throw
-                       throw new RemoteException("doAdminAddProduct() failed.", ex);
+                       throw new FacesException(ex);
                }
        }
 }
index 02c3f5eed7f4dba29882ff4c23433c1d198104c8..fb92bcc978bee84a55e209b140288e9984d8a2a5 100644 (file)
  */
 package org.mxchange.pizzaapplication.beans.controller;
 
-import java.rmi.RemoteException;
 import java.util.Deque;
 import java.util.Iterator;
+import javax.faces.view.facelets.FaceletException;
 import org.mxchange.jcoreee.beans.FrameworkBean;
 import org.mxchange.jshopcore.model.category.Category;
 import org.mxchange.jshopcore.model.product.Product;
 
 /**
+ * An interface for the shop
  *
  * @author Roland Haeder
  */
@@ -33,63 +34,63 @@ public interface PizzaWebBean extends FrameworkBean {
         * Some "getter" for an iterator of only available products
         * 
         * @return Only available products
-        * @throws java.rmi.RemoteException If anything went wrong
+        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
         */
-       public Iterator<Product> getAvailableProductsIterator () throws RemoteException;
+       public Iterator<Product> getAvailableProductsIterator () throws FaceletException;
 
        /**
         * Some "getter" for an iterator of all products
         *
         * @return All products
-        * @throws java.rmi.RemoteException If anything went wrong
+        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
         */
-       public Iterator<Product> getAllProductsIterator () throws RemoteException;
+       public Iterator<Product> getAllProductsIterator () throws FaceletException;
 
        /**
         * Some "getter" for an iterator of all categories
         *
         * @return All categories
-        * @throws java.rmi.RemoteException If anything went wrong
+        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
         */
-       public Iterator<Category> getAllCategoriesIterator () throws RemoteException;
+       public Iterator<Category> getAllCategoriesIterator () throws FaceletException;
 
        /**
         * Some "getter" for a linked list of only available products
         * 
         * @return Only available products
-        * @throws java.rmi.RemoteException If anything went wrong
+        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
         */
-       public Deque<Product> getAvailableProducts () throws RemoteException;
+       public Deque<Product> getAvailableProducts () throws FaceletException;
 
        /**
         * Some "getter" for a linked list of all products
         *
         * @return All products
-        * @throws java.rmi.RemoteException If anything went wrong
+        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
         */
-       public Deque<Product> getAllProducts () throws RemoteException;
+       public Deque<Product> getAllProducts () throws FaceletException;
 
        /**
         * Some "getter" for a linked list of all categories
         *
         * @return All categories
-        * @throws java.rmi.RemoteException If anything went wrong
+        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
         */
-       public Deque<Category> getAllCategories () throws RemoteException;
+       public Deque<Category> getAllCategories () throws FaceletException;
 
        /**
         * Adds given category data from request to database
         *
         * @param category Category instance
-        * @throws java.rmi.RemoteException If something unexpected happened
+        * @throws javax.faces.view.facelets.FaceletException If something unexpected happened
         */
-       public void doAdminAddCategory (final Category category) throws RemoteException;
+       public void doAdminAddCategory (final Category category) throws FaceletException;
 
        /**
         * Adds given product data from request to database
         *
         * @param product Product instance
-        * @throws java.rmi.RemoteException If something unexpected happened
+        * @throws javax.faces.view.facelets.FaceletException If something unexpected happened
         */
-       public void doAdminAddProduct (final Product product) throws RemoteException;
+       public void doAdminAddProduct (final Product product) throws FaceletException;
 }
index 5154463bcbe22b3871e51a3ef3723588727b309f..efafe691cb03168fe9afb03094a8323f1fa33c00 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.pizzaapplication.beans.customer;
 
+import javax.annotation.PostConstruct;
 import javax.ejb.EJB;
 import javax.enterprise.context.SessionScoped;
 import javax.inject.Named;
@@ -46,4 +47,11 @@ public class PizzaServiceCustomerWebBean extends BaseFrameworkBean implements Cu
         */
        public PizzaServiceCustomerWebBean () {
        }
+
+       @Override
+       @PostConstruct
+       public void init () throws RuntimeException {
+               // Call super init first
+               super.localInit();
+       }
 }
diff --git a/src/java/org/mxchange/pizzaapplication/beans/data/DataWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/data/DataWebBean.java
new file mode 100644 (file)
index 0000000..6393c84
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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.data;
+
+import java.util.List;
+import org.mxchange.jcore.model.contact.gender.Gender;
+import org.mxchange.jcoreee.beans.FrameworkBean;
+
+/**
+ * An interface for data beans
+ *
+ * @author Roland Haeder
+ */
+public interface DataWebBean extends FrameworkBean {
+
+       /**
+        * Getter for all genders as array
+        *
+        * @return All genders as array
+        */
+       public Gender[] allGenders ();
+
+       /**
+        * Getter for only selectable genders as array, UNKNOWN is not selectable
+        *
+        * @return All genders as array
+        */
+       public List<Gender> selectableGenders ();
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/data/PizzaServiceDataWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/data/PizzaServiceDataWebBean.java
new file mode 100644 (file)
index 0000000..b8c95af
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * 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.data;
+
+import java.text.MessageFormat;
+import java.util.List;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcore.model.contact.gender.Gender;
+import org.mxchange.jcoreee.beans.BaseFrameworkBean;
+import org.mxchange.jshopeelib.beans.remote.data.ShopDataBeanRemote;
+
+/**
+ * A customer bean which hides the customer instance
+ *
+ * @author Roland Haeder
+ */
+@Named ("data")
+@ApplicationScoped
+public class PizzaServiceDataWebBean extends BaseFrameworkBean implements DataWebBean {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 835482364189L;
+
+       /**
+        * Remote bean
+        */
+       private final ShopDataBeanRemote remote;
+
+       /**
+        * Default constructor
+        * 
+        * @throws javax.naming.NamingException If something happens?
+        */
+       public PizzaServiceDataWebBean () throws NamingException {
+               // Get initial context
+               InitialContext context = new InitialContext();
+
+               // Try to lookup bean
+               this.remote = (ShopDataBeanRemote) context.lookup("ejb/stateless-data");
+       }
+
+       @Override
+       public Gender[] allGenders () {
+               // Trace message
+               this.getLogger().trace("CALLED!");
+
+               // Return it
+               return this.getRemote().allGenders();
+       }
+
+       @Override
+       public List<Gender> selectableGenders () {
+               // Trace message
+               this.getLogger().trace("CALLED!"); //NOI18N
+
+               // Init array
+               // TODO Call EJB here?
+               List<Gender> genders = this.getRemote().selectableGenders();
+
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("genders={0} - EXIT!", genders)); //NOI18N
+
+               // Return it
+               return genders;
+       }
+
+       /**
+        * @return the remote
+        */
+       private ShopDataBeanRemote getRemote () {
+               return this.remote;
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/enums/DataWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/enums/DataWebBean.java
deleted file mode 100644 (file)
index 076b02b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.model.contact.gender.Gender;
-import org.mxchange.jcoreee.beans.FrameworkBean;
-
-/**
- * An interface for data beans
- *
- * @author Roland Haeder
- */
-public interface DataWebBean extends FrameworkBean {
-
-       /**
-        * Getter for all genders as array
-        *
-        * @return All genders as array
-        */
-       public Gender[] allGenders ();
-
-       /**
-        * Getter for only selectable genders as array, UNKNOWN is not selectable
-        *
-        * @return All genders as array
-        */
-       public List<Gender> selectableGenders ();
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/enums/PizzaServiceDataWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/enums/PizzaServiceDataWebBean.java
deleted file mode 100644 (file)
index 06b8161..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.List;
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Named;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcore.model.contact.gender.Gender;
-import org.mxchange.jcoreee.beans.BaseFrameworkBean;
-import org.mxchange.jshopeelib.beans.remote.data.ShopDataBeanRemote;
-
-/**
- * A customer bean which hides the customer instance
- *
- * @author Roland Haeder
- */
-@Named ("data")
-@ApplicationScoped
-public class PizzaServiceDataWebBean extends BaseFrameworkBean implements DataWebBean {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 835482364189L;
-
-       /**
-        * Remote bean
-        */
-       private final ShopDataBeanRemote remote;
-
-       /**
-        * Default constructor
-        * 
-        * @throws javax.naming.NamingException If something happens?
-        */
-       public PizzaServiceDataWebBean () throws NamingException {
-               // Get initial context
-               InitialContext context = new InitialContext();
-
-               // Try to lookup bean
-               this.remote = (ShopDataBeanRemote) context.lookup("ejb/stateless-data");
-       }
-
-       @Override
-       public Gender[] allGenders () {
-               // Trace message
-               this.getLogger().trace("CALLED!");
-
-               // Return it
-               return this.getRemote().allGenders();
-       }
-
-       @Override
-       public List<Gender> selectableGenders () {
-               // Trace message
-               this.getLogger().trace("CALLED!"); //NOI18N
-
-               // Init array
-               // TODO Call EJB here?
-               List<Gender> genders = this.getRemote().selectableGenders();
-
-               // Trace message
-               this.getLogger().trace(MessageFormat.format("genders={0} - EXIT!", genders)); //NOI18N
-
-               // Return it
-               return genders;
-       }
-
-       /**
-        * @return the remote
-        */
-       private ShopDataBeanRemote getRemote () {
-               return this.remote;
-       }
-}
diff --git a/web/WEB-INF/templates/basket/mini_basket.tpl b/web/WEB-INF/templates/basket/mini_basket.tpl
new file mode 100644 (file)
index 0000000..050ca2c
--- /dev/null
@@ -0,0 +1,24 @@
+<ui:composition
+       xmlns="http://www.w3.org/1999/xhtml"
+       xmlns:f="http://java.sun.com/jsf/core"
+       xmlns:h="http://java.sun.com/jsf/html"
+       xmlns:ui="http://java.sun.com/jsf/facelets">
+
+       <div class="mini_basket_box">
+               <div class="mini_basket_header">
+                       #{msg.mini_basket.header}
+               </div>
+
+               <div class="mini_basket_last">
+                       #{msg.mini_basket.last_item}
+               </div>
+
+               <div class="mini_basket_more">
+                       #{msg.mini_basket.additional_items}
+               </div>
+
+               <div class="mini_basket_link">
+                       <h:link id="to_basket" outcome="basket" title="#{msg.mini_basket.to_basket}" value="#{msg.mini_basket.to_basket}" />
+               </div>
+       </div>
+</ui:composition>
diff --git a/web/WEB-INF/templates/basket/mini_basket_empty.tpl b/web/WEB-INF/templates/basket/mini_basket_empty.tpl
new file mode 100644 (file)
index 0000000..a4339b7
--- /dev/null
@@ -0,0 +1,10 @@
+<ui:composition
+       xmlns="http://www.w3.org/1999/xhtml"
+       xmlns:f="http://java.sun.com/jsf/core"
+       xmlns:h="http://java.sun.com/jsf/html"
+       xmlns:ui="http://java.sun.com/jsf/facelets">
+
+       <div class="mini_basket_box">
+               #{MiniBasketTag.basket_is_empty}
+       </div>
+</ui:composition>
index 5d8856b0215c2cf333ed02606175f402267b0d60..58f5a1e2eb80bfaef54d7efbbd1ac668d837a058 100644 (file)
@@ -1,13 +1,15 @@
 <ui:composition
        template="/WEB-INF/templates/base.tpl"
        xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:f="http://java.sun.com/jsf/core"
-       xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets">
 
        <!--
-       TODO Unused:
-       xmlns:basket="http://mxchange.org/jshop/tags/basket"
-       <basket:mini_basket basket="#{basket}" />
+       Show basket if it contains items, else show an empty basket.
        //-->
+       <ui:fragment rendered="#{basket.isEmpty()}">
+               <ui:include src="/WEB-INF/templates/basket/mini_basket_empty.tpl" />
+       </ui:fragment>
+       <ui:fragment rendered="#{basket.hasItems()}">
+               <ui:include src="/WEB-INF/templates/basket/mini_basket.tpl" />
+       </ui:fragment>
 </ui:composition>