MiniBasketTag.additional_items=Es befinden sich noch {0} weitere Produkte im Warenkorb.
MiniBasketTag.to_basket=Zum Warenkorb
MiniBasketTag.header=Warenkorb
+Category.has_no_parent_category=Keine Elternkategorie
+Generic_YES=Ja
+Generic_NO=Nein
MiniBasketTag.additional_items=There are {0} items in the basket.
MiniBasketTag.to_basket=To basket
MiniBasketTag.header=Basket
+Category.has_no_parent_category=No parent category
+Generic_YES=Yes
+Generic_NO=No
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcoreee.beans.BaseFrameworkBean;
+import org.mxchange.jshopcore.model.basket.AddableBasketItem;
+import org.mxchange.jshopcore.model.basket.Basket;
import org.mxchange.jshopcore.model.basket.BasketSessionBeanRemote;
+import org.mxchange.jshopcore.model.basket.ShopBasket;
+import org.mxchange.jshopcore.model.item.BasketItem;
import org.mxchange.jshopcore.model.product.Product;
/**
* A bean for the basket
*
- * @author Roland Haeder
+ * @author Roland Haeder<roland@mxchange.org>
*/
-@Named("basket")
+@Named ("basket")
@SessionScoped
public class BasketWebBean extends BaseFrameworkBean implements BasketWebController {
private static final long serialVersionUID = 5_476_347_320_198L;
/**
- * Basket bean
+ * Basket bean
*/
private final BasketSessionBeanRemote basketBean;
/**
- * Current product instance
+ * Item basket ("cache")
*/
- private Product currentProduct;
+ private final Basket<AddableBasketItem> basket;
/**
* Default constructor
// Try to lookup
this.basketBean = (BasketSessionBeanRemote) context.lookup("ejb/stateless-basket"); //NOI18N
+
+ // Init basket "cache"
+ this.basket = new ShopBasket();
+ }
+
+ @Override
+ public boolean isProductAdded (final Product product) {
+ // Must not be null
+ if (null == product) {
+ // Abort here
+ throw new NullPointerException("product is null");
+ }
+
+ // Has the "cache" some entries?
+ if (!this.basket.isEmpty()) {
+ // Generate fake instance
+ AddableBasketItem item = new BasketItem(product);
+
+ // Then ask it about it
+ if (this.basket.isAdded(item)) {
+ // Found it
+ return true;
+ }
+ }
+
+ // Generate fake instance
+ AddableBasketItem item = new BasketItem(product);
+
+ // Ask bean about it
+ return this.basketBean.isAdded(item);
}
@Override
super.genericInit();
}
- @Override
- public void setCurrentProduct (final Product product) {
- this.currentProduct = product;
- }
-
/**
* Getter for basket bean instance
- *
+ *
* @return Basket bean instance
*/
private BasketSessionBeanRemote getBasketBean () {
- return basketBean;
+ return this.basketBean;
}
}
/**
* An interface for a basket
*
- * @author Roland Haeder
+ * @author Roland Haeder<roland@mxchange.org>
*/
public interface BasketWebController extends Serializable {
/**
public boolean hasItems ();
/**
- * Setter for current product instance
- *
+ * Checks whether the currently set product is added in basked
+ *
* @param product Product instance
+ * @return Whether the product is added
*/
- public void setCurrentProduct (final Product product);
+ public boolean isProductAdded (final Product product);
}
*/
package org.mxchange.pizzaapplication.beans.category;
-import java.rmi.RemoteException;
import javax.enterprise.context.SessionScoped;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Named;
/**
* Main application class
*
- * @author Roland Haeder
+ * @author Roland Haeder<roland@mxchange.org>
*/
@Named("admin_category")
@SessionScoped
// Deligate to bean
this.categoryBean.doAdminAddCategory(category);
- } catch (final CategoryTitleAlreadyUsedException | RemoteException ex) {
+ } catch (final CategoryTitleAlreadyUsedException ex) {
// Continue to throw
throw new FaceletException(ex);
}
/**
* An interface for product controllers for "ADMIN" role
*
- * @author Roland Haeder
+ * @author Roland Haeder<roland@mxchange.org>
*/
public interface AdminCategoryWebController {
+++ /dev/null
-/*
- * 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.controller;
-
-import java.rmi.RemoteException;
-import java.sql.SQLException;
-import java.util.Deque;
-import java.util.Queue;
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.SessionScoped;
-import javax.faces.FacesException;
-import javax.inject.Named;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcoreee.beans.BaseFrameworkBean;
-import org.mxchange.jshopcore.model.category.Category;
-import org.mxchange.jshopcore.model.category.CategorySessionBeanRemote;
-import org.mxchange.jshopcore.model.category.ProductCategory;
-import org.mxchange.jshopcore.model.product.Product;
-import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote;
-
-/**
- * Main application class
- *
- * @author Roland Haeder
- */
-@Named("controller")
-@SessionScoped
-public class PizzaShopWebBean extends BaseFrameworkBean implements PizzaShopWebController {
- /**
- * Serial id
- */
- private static final long serialVersionUID = 58_137_539_530_279L;
-
- /**
- * Remote bean for categories
- */
- private final CategorySessionBeanRemote categoryBean;
-
- /**
- * Remote bean for products
- */
- private final ProductSessionBeanRemote productBean;
-
- /**
- * Default constructor
- *
- * @throws javax.naming.NamingException Something happened here?
- */
- public PizzaShopWebBean () throws NamingException {
- // Get initial context
- InitialContext context = new InitialContext();
-
- // Try to lookup the bean
- this.categoryBean = (CategorySessionBeanRemote) context.lookup("ejb/stateless-category"); //NOI18N
-
- // Try to lookup the bean
- this.productBean = (ProductSessionBeanRemote) context.lookup("ejb/stateless-product"); //NOI18N
- }
-
- @PostConstruct
- public void init () throws RuntimeException {
- // Call super init first
- super.genericInit();
- }
-
- @Override
- public Queue<Product> getAvailableProducts () throws FacesException {
- try {
- return this.getProductBean().getAvailableProducts();
- } catch (final RemoteException ex) {
- // Continue to throw
- throw new FacesException(ex);
- }
- }
-
- @Override
- public Queue<Category> getAllCategories () throws FacesException {
- try {
- // Fake zero categoryBean
- Category c = new ProductCategory(0L, "Ist oberste Kategorie", 0L);
-
- // Get List back
- Deque<Category> deque = this.getCategoryBean().getAllCategories();
-
- // Add fake categoryBean
- deque.addFirst(c);
-
- // Return it
- return deque;
- } catch (final SQLException ex) {
- // Continue to throw
- throw new FacesException(ex);
- }
- }
-
- /**
- * Getter for shop remote bean
- *
- * @return Remote shop bean
- */
- private CategorySessionBeanRemote getCategoryBean () {
- return this.categoryBean;
- }
-
- /**
- * Getter for shop remote bean
- *
- * @return Remote shop bean
- */
- private ProductSessionBeanRemote getProductBean () {
- return this.productBean;
- }
-}
+++ /dev/null
-/*
- * 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.controller;
-
-import java.io.Serializable;
-import java.util.Queue;
-import javax.faces.view.facelets.FaceletException;
-import org.mxchange.jshopcore.model.category.Category;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * An interface for the shop
- *
- * @author Roland Haeder
- */
-public interface PizzaShopWebController extends Serializable {
-
- /**
- * Some "getter" for a linked list of only available products
- *
- * @return Only available products
- * @throws javax.faces.view.facelets.FaceletException If anything went wrong
- */
- public Queue<Product> getAvailableProducts () throws FaceletException;
-
- /**
- * Some "getter" for a linked list of all categories
- *
- * @return All categories
- * @throws javax.faces.view.facelets.FaceletException If anything went wrong
- */
- public Queue<Category> getAllCategories () throws FaceletException;
-}
--- /dev/null
+/*
+ * 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.controller;
+
+import java.util.Deque;
+import java.util.Queue;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.FacesException;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Named;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcoreee.beans.BaseFrameworkBean;
+import org.mxchange.jshopcore.model.category.Category;
+import org.mxchange.jshopcore.model.category.CategorySessionBeanRemote;
+import org.mxchange.jshopcore.model.category.ProductCategory;
+import org.mxchange.jshopcore.model.product.Product;
+import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote;
+
+/**
+ * Main application class
+ *
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named("controller")
+@SessionScoped
+public class ShopWebBean extends BaseFrameworkBean implements ShopWebController {
+ /**
+ * Serial id
+ */
+ private static final long serialVersionUID = 58_137_539_530_279L;
+
+ /**
+ * Remote bean for categories
+ */
+ private final CategorySessionBeanRemote categoryBean;
+
+ /**
+ * Remote bean for products
+ */
+ private final ProductSessionBeanRemote productBean;
+
+ /**
+ * Default constructor
+ *
+ * @throws javax.naming.NamingException Something happened here?
+ */
+ public ShopWebBean () throws NamingException {
+ // Get initial context
+ InitialContext context = new InitialContext();
+
+ // Try to lookup the bean
+ this.categoryBean = (CategorySessionBeanRemote) context.lookup("ejb/stateless-category"); //NOI18N
+
+ // Try to lookup the bean
+ this.productBean = (ProductSessionBeanRemote) context.lookup("ejb/stateless-product"); //NOI18N
+ }
+
+ @Override
+ public Deque<Category> getAllCategories () throws FacesException {
+ // Get List back
+ Deque<Category> deque = this.getCategoryBean().getAllCategories();
+
+ // Return it
+ return deque;
+ }
+
+ @Override
+ public Deque<Category> getAllCategoriesParent () throws FaceletException {
+ // Get regular list
+ Deque<Category> deque = this.getAllCategories();
+
+ // Create fake entry
+ Category fake = new ProductCategory(0L, this.getMessage("Category.has_no_parent_category"), 0L); //NOI18N
+
+ // Add it
+ deque.addFirst(fake);
+
+ // Return it
+ return deque;
+ }
+
+ @Override
+ public Queue<Product> getAvailableProducts () throws FacesException {
+ return this.getProductBean().getAvailableProducts();
+ }
+
+ @PostConstruct
+ public void init () {
+ // Call super init for getting resource bundle
+ super.genericInit();
+ }
+
+ /**
+ * Getter for shop remote bean
+ *
+ * @return Remote shop bean
+ */
+ private CategorySessionBeanRemote getCategoryBean () {
+ return this.categoryBean;
+ }
+
+ /**
+ * Getter for shop remote bean
+ *
+ * @return Remote shop bean
+ */
+ private ProductSessionBeanRemote getProductBean () {
+ return this.productBean;
+ }
+}
--- /dev/null
+/*
+ * 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.controller;
+
+import java.io.Serializable;
+import java.util.Deque;
+import java.util.Queue;
+import javax.faces.view.facelets.FaceletException;
+import org.mxchange.jshopcore.model.category.Category;
+import org.mxchange.jshopcore.model.product.Product;
+
+/**
+ * An interface for the shop
+ *
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface ShopWebController extends Serializable {
+
+ /**
+ * Some "getter" for a linked list of only available products
+ *
+ * @return Only available products
+ * @throws javax.faces.view.facelets.FaceletException If anything went wrong
+ */
+ public Queue<Product> getAvailableProducts () throws FaceletException;
+
+ /**
+ * Some "getter" for a linked list of all categories
+ *
+ * @return All categories
+ * @throws javax.faces.view.facelets.FaceletException If anything went wrong
+ */
+ public Deque<Category> getAllCategories () throws FaceletException;
+
+ /**
+ * Some "getter" for a linked list of all categories including "Has no
+ * parent" fake category.
+ *
+ * @return All categories
+ * @throws javax.faces.view.facelets.FaceletException If anything went wrong
+ */
+ public Deque<Category> getAllCategoriesParent () throws FaceletException;
+}
/**
* A customer bean which hides the customer instance
*
- * @author Roland Haeder
+ * @author Roland Haeder<roland@mxchange.org>
*/
@Named("customer")
@SessionScoped
/**
* An interface for customer beans
*
- * @author Roland Haeder
+ * @author Roland Haeder<roland@mxchange.org>
*/
public interface CustomerWebController extends Serializable {
/**
* A customer bean which hides the customer instance
*
- * @author Roland Haeder
+ * @author Roland Haeder<roland@mxchange.org>
*/
@Named ("gender")
@ApplicationScoped
/**
* An interface for data beans
*
- * @author Roland Haeder
+ * @author Roland Haeder<roland@mxchange.org>
*/
public interface GenderWebController extends Serializable {
*/
package org.mxchange.pizzaapplication.beans.product;
-import java.rmi.RemoteException;
import java.util.Deque;
-import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.ApplicationScoped;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Named;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcoreee.beans.BaseFrameworkBean;
import org.mxchange.jshopcore.exceptions.ProductTitleAlreadyUsedException;
+import org.mxchange.jshopcore.model.product.GenericProduct;
import org.mxchange.jshopcore.model.product.Product;
import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote;
/**
* Main application class
*
- * @author Roland Haeder
+ * @author Roland Haeder<roland@mxchange.org>
*/
-@Named("admin_product")
-@SessionScoped
+@Named ("admin_product")
+@ApplicationScoped
public class AdminProductWebBean extends BaseFrameworkBean implements AdminProductWebController {
+
/**
* Serial id
*/
private static final long serialVersionUID = 5_819_375_183_472_871L;
+
+
+ /**
+ * Property available
+ */
+ private Boolean available;
+
+ /**
+ * Category id
+ */
+ private Long categoryId;
+
+ /**
+ * Property price
+ */
+ private Float price;
/**
* Remote bean for products
*/
- private final ProductSessionBeanRemote product;
+ private final ProductSessionBeanRemote productBean;
+
+ /**
+ * Property title
+ */
+ private String title;
/**
* Default constructor
- *
+ *
* @throws javax.naming.NamingException Something happened here?
*/
public AdminProductWebBean () throws NamingException {
InitialContext context = new InitialContext();
// Try to lookup the bean
- this.product = (ProductSessionBeanRemote) context.lookup("ejb/stateless-product"); //NOI18N
+ this.productBean = (ProductSessionBeanRemote) context.lookup("ejb/stateless-product"); //NOI18N
}
@Override
- public void doAdminAddProduct (final Product product) throws FaceletException {
+ public void addProduct () throws FaceletException {
try {
+ // Create product instance
+ Product product = new GenericProduct();
+
+ // Add all
+ product.setAvailable(this.getAvailable());
+ product.setCategoryId(this.getCategoryId());
+ product.setPrice(this.getPrice());
+ product.setTitle(this.getTitle());
+
// Call bean
- this.product.doAdminAddProduct(product);
+ this.productBean.doAdminAddProduct(product);
+
+ // Set all to null
+ this.setAvailable(Boolean.FALSE);
+ this.setCategoryId(null);
+ this.setPrice(null);
+ this.setTitle(null);
} catch (final ProductTitleAlreadyUsedException ex) {
// Continue to throw
throw new FaceletException(ex);
@Override
public Deque<Product> getAllProducts () throws FaceletException {
- try {
- // Call bean
- return this.product.getAllProducts();
- } catch (final RemoteException ex) {
- // Continue to throw
- throw new FaceletException(ex);
- }
+ // Call bean
+ return this.productBean.getAllProducts();
+ }
+
+ @Override
+ public void setAvailable (final Boolean available) {
+ this.available = available;
+ }
+
+ @Override
+ public Long getCategoryId () {
+ return categoryId;
+ }
+
+ @Override
+ public void setCategoryId (Long categoryId) {
+ this.categoryId = categoryId;
+ }
+
+ @Override
+ public Float getPrice () {
+ return this.price;
+ }
+
+ @Override
+ public void setPrice (final Float price) {
+ this.price = price;
+ }
+
+ @Override
+ public String getTitle () {
+ return this.title;
+ }
+
+ @Override
+ public void setTitle (final String title) {
+ this.title = title;
+ }
+
+ @Override
+ public Boolean getAvailable () {
+ return this.available;
}
}
/**
* An interface for product controllers for "ADMIN" role
*
- * @author Roland Haeder
+ * @author Roland Haeder<roland@mxchange.org>
*/
public interface AdminProductWebController {
/**
* Adds given product data from request to database
*
- * @param product Product instance
* @throws javax.faces.view.facelets.FaceletException If something unexpected happened
*/
- public void doAdminAddProduct (final Product product) throws FaceletException;
+ public void addProduct () throws FaceletException;
/**
* Some "getter" for a linked list of all products
* @throws javax.faces.view.facelets.FaceletException If anything went wrong
*/
public Deque<Product> getAllProducts () throws FaceletException;
+
+ /**
+ * Getter for product's title property
+ *
+ * @return Product's title
+ */
+ public String getTitle ();
+
+ /**
+ * Setter for product's title property
+ *
+ * @param title Product's title
+ */
+ public void setTitle (final String title);
+
+ /**
+ * Getter for product's price property
+ *
+ * @return Product's price property
+ */
+ public Float getPrice ();
+
+ /**
+ * Setter for product's price property
+ *
+ * @param price Product's price property
+ */
+ public void setPrice (final Float price);
+
+ /**
+ * Setter for product's available property
+ *
+ * @param available Product's available property
+ */
+ public void setAvailable (final Boolean available);
+
+ /**
+ * Getter for product's available property
+ *
+ * @return Product's available property
+ */
+ public Boolean getAvailable ();
+
+ /**
+ * Getter for product's category id
+ *
+ * @return Product's category id
+ */
+ public Long getCategoryId ();
+
+ /**
+ * Setter for product's category id
+ *
+ * @param categoryId Product's category id
+ */
+ public void setCategoryId (final Long categoryId);
}
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
- <h:selectOneMenu class="select" id="category">
+ <h:selectOneMenu class="select" id="categoryId" value="#{admin_product.categoryId}">
<f:selectItems value="#{controller.allCategories}" var="cat" itemValue="#{cat.categoryId}" itemLabel="#{cat.title}" />
</h:selectOneMenu>
</ui:composition>
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
- <h:selectOneMenu class="select" id="parentId">
- <f:selectItems value="#{controller.allCategories}" var="parent_category" itemValue="#{parent_category.categoryId}" itemLabel="#{parent_category.title}" />
+ <h:selectOneMenu class="select" id="parentId" value="#{admin_category.parentId}">
+ <f:selectItems value="#{controller.allCategoriesParent}" var="parent_category" itemValue="#{parent_category.categoryId}" itemLabel="#{parent_category.title}" />
</h:selectOneMenu>
</ui:composition>
<ui:define name="content">
<div class="para">
<h:form acceptcharset="utf-8" id="form">
- <h:dataTable headerClass="table_header_column" rowClasses="table_row" styleClass="table" id="categories" value="#{controller.allCategories}" var="cat" rendered="#{cat != null}">
+ <h:dataTable headerClass="table_header_column" rowClasses="table_row" styleClass="table" id="categories" value="#{controller.allCategories}" var="cat">
<h:column>
<f:facet name="header">Auswählen:</f:facet>
#{cat.categoryId}:
<h:column>
<f:facet name="header">Elternkategorie:</f:facet>
- #{cat.categoryId}:
- #{controller.generateLinkForParent(cat)}
+ #{cat.parentId}
</h:column>
</h:dataTable>
<ui:define name="content">
<div class="para">
<h:form acceptcharset="utf-8" id="form">
- <h:dataTable columnClasses="table_row" headerClass="table_header_column" id="product_table" var="pro" value="#{admin_product.allProducts}">
+ <h:dataTable headerClass="table_header_column" id="product_table" var="pro" value="#{admin_product.allProducts}">
<h:column>
<f:facet name="header">Produktnummer:</f:facet>
- #{pro.id}:
- <h:selectBooleanCheckbox class="input" value="true" />
+ #{pro.id}:<h:selectBooleanCheckbox class="input" value="true" />
</h:column>
<h:column>
</h:column>
<h:column>
<f:facet name="header">Kategorie:</f:facet>
- ${controller.getPrintableProduktCategory(product)}
+ #{pro.categoryId}
</h:column>
<h:column>
<f:facet name="header">Verfügbar:</f:facet>
- ${controller.getPrintableProductAvailability(product)}
+ #{pro.available}
</h:column>
</h:dataTable>
<div class="table_footer">
<h:commandButton class="reset" type="reset" value="Formular zurücksetzen" />
- <h:commandButton class="submit" type="submit" id="edit" action="#{admin_product.ediProduct(product)}" value="Ändern" />
+ <h:commandButton class="submit" type="submit" id="edit" action="#{admin_product.editProduct(product)}" value="Ändern" />
<h:commandButton class="delete" type="submit" id="delete" action="#{admin_category.deleteProduct(product)}" value="Löschen" />
</div>
</h:form>
</div>
<div class="table_right">
- <h:inputText class="input" id="title" size="10" maxlength="255" />
+ <h:inputText class="input" id="title" size="10" maxlength="255" required="true" value="#{admin_product.title}" />
</div>
<div class="clear"></div>
</div>
<div class="table_right">
- <h:inputText class="input" id="price" size="10" maxlength="255" />
+ <h:inputText class="input" id="price" size="10" maxlength="255" required="true" value="#{admin_product.price}" />
</div>
<div class="clear"></div>
</div>
<div class="table_right">
- <select class="select" name="available" size="1">
- <option value="true">Ja</option>
- <option value="false">Nein</option>
- </select>
+ <h:selectOneListbox required="true" id="available" value="#{admin_product.available}" size="1" class="select">
+ <f:selectItem itemValue="true" itemLabel="#{msg.Generic_YES}" />
+ <f:selectItem itemValue="false" itemLabel="#{msg.Generic_NO}" />
+ </h:selectOneListbox>
</div>
<div class="clear"></div>
<tbody>
<ui:repeat var="product" value="#{controller.availableProducts}">
<h:form acceptcharset="utf-8" id="add_item">
-
- <f:viewAction action="#{basket.setCurrentProduct(product)}" />
-
- <ui:fragment rendered="#{basket.isCurrentProductAdded() == true}">
+ <ui:fragment rendered="#{basket.isProductAdded(product) == true}">
<tr>
<td class="table_data_column">
<h:link outcome="basket" title="Zum Warenkorb" value="Warenkorb" />
</tr>
</ui:fragment>
- <ui:fragment rendered="#{basket.isCurrentProductAdded() == false}">
+ <ui:fragment rendered="#{basket.isProductAdded(product) == false}">
<tr>
<td class="table_data_column">
- <h:commandButton class="submit" id="add" value="Hinzufügen" action="#{basket.addToBasket(product)}" />
+ <h:commandButton class="submit" id="add" value="Hinzufügen" action="#{basket.addItem(product)}" />
<h:inputHidden id="itemId" value="#{product.id}" />
<h:inputHidden id="itemType" value="Product" />
</td>