NO_EMAIL_ADDRESS_ENTERED=Sie haben keine EMail-Adresse eingegeben.
NO_PASSWORD_ENTERED=Sie haben kein Passwort eingegeben.
ERROR_AMOUNT_IS_NOT_LONG=Die eingegebene Menge ist keine Zahl.
+PAGE_TITLE_INDEX_WELCOME=Willkommen!
+SUB_TITLE_INDEX_WELCOME=Willkommen zum Pizza-Service
+FOLLOWING_PRODUCT_ARE_AVAILABLE=Folgende Produkte k\u00f6nnen bestellt werden:
+SUBMIT_ADD_ITEM_TO_BASKET=Hinzuf\u00fcgen
+LINK_TITLE_TO_BASKET=Weiter zum Warenkorb.
+LINK_CHANGE_IN_BASKET=Im Warenkorb \u00e4ndern
+SINGLE_ITEM_PRICE=Einzelpreis:
+CHANGE_ITEM_AMOUNT=Bestellmenge \u00e4ndern:
+TOTAL_ITEM_PRICE=Zwischensumme:
+TOTAL_ORDER_PRICE=Gesamtsumme:
+NO_ITEMS_ADDED_TO_BASKET=Es befinden sich derzeit keine Artikel im Warenkorb.
+ITEM_NOT_ORDERED=Nicht bestellt.
NO_EMAIL_ADDRESS_ENTERED=You have entered no email address.
NO_PASSWORD_ENTERED=You have entered no password.
ERROR_AMOUNT_IS_NOT_LONG=The entered amount is not a number.
+PAGE_TITLE_INDEX_WELCOME=Welcome!
+SUB_TITLE_INDEX_WELCOME=Welcome to Pizza-Service
+FOLLOWING_PRODUCT_ARE_AVAILABLE=Following products can be ordered:
+SUBMIT_ADD_ITEM_TO_BASKET=Add
+LINK_TITLE_TO_BASKET=Continued to basket page.
+LINK_CHANGE_IN_BASKET=Change in basket
+SINGLE_ITEM_PRICE=Single price:
+CHANGE_ITEM_AMOUNT=Change ordered amount:
+TOTAL_ITEM_PRICE=Sub total:
+TOTAL_ORDER_PRICE=Gesamtsumme:
+NO_ITEMS_ADDED_TO_BASKET=There are no items in the basket.
+ITEM_NOT_ORDERED=Not ordered.
import javax.enterprise.context.SessionScoped;
import javax.faces.FacesException;
import javax.inject.Named;
+import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcoreee.beans.BaseFrameworkBean;
*/
public BasketWebBean () throws NamingException {
// Get initial context
- InitialContext context = new InitialContext();
+ Context context = new InitialContext();
// Get new application instance
this.basket = new ShopBasket();
// Is the current item/amount set?
if (this.getCurrentItem() == null) {
// Current item is null
- throw new NullPointerException("currentItem is null");
+ throw new NullPointerException("currentItem is null"); //NOI18N
} else if (this.getCurrentItem().getProduct() == null) {
// Product is null
- throw new NullPointerException("currentItem.product is null");
+ throw new NullPointerException("currentItem.product is null"); //NOI18N
} else if (this.getCurrentItem().getAmount() == null) {
// Amount is null
- throw new NullPointerException("currentItem.amount is null");
+ throw new NullPointerException("currentItem.amount is null"); //NOI18N
}
// Caculate item's price
@Override
public Float calculateItemPrice (final AddableBasketItem item) {
- // Caculate item's price
- Float totalPrice = (item.getProduct().getPrice() * item.getAmount());
+ // Default value
+ Float totalPrice = 0.0f;
+
+ // Is it a product?
+ if (item.isProductType()) {
+ // Caculate item's price
+ totalPrice = (item.getProduct().getPrice() * item.getAmount());
+ }
// Return it
return totalPrice;
return totalPrice;
}
+ @Override
+ public String changeItem (final AddableBasketItem item) {
+ // Default is not found
+ String targetPage = "item_not_changed"; //NOI18N
+
+ // Lookup item in basket
+ for (final AddableBasketItem basketItem : this.allItems()) {
+ // Is it the same?
+ if (basketItem.equals(item)) {
+ // Found it, so allow redirect to proper page
+ targetPage = "basket"; //NOI18N
+ break;
+ }
+ }
+
+ // Return page
+ return targetPage;
+ }
+
@Override
public Long getAmount () {
return this.amount;
* @return Item amount of given product
*/
public Long getItemAmount (final Product product);
+
+ /**
+ * Changes given item instance's amount in basket and redirects to proper
+ * page. If the item is not found, another "error" page is called.
+ *
+ * @param item Item instance to change
+ * @return Page redirection
+ */
+ public String changeItem (final AddableBasketItem item);
}
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
+import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcoreee.beans.BaseFrameworkBean;
*/
public AdminCategoryWebBean () throws NamingException {
// Get initial context
- InitialContext context = new InitialContext();
+ Context context = new InitialContext();
// Try to lookup the bean
this.categoryBean = (AdminCategorySessionBeanRemote) context.lookup("ejb/stateless-admin-category"); //NOI18N
import javax.faces.FacesException;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Named;
+import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcoreee.beans.BaseFrameworkBean;
try {
// Get initial context
- InitialContext context = new InitialContext();
+ Context context = new InitialContext();
// Try to lookup the bean
CategorySessionBeanRemote categoryBean = (CategorySessionBeanRemote) context.lookup("ejb/stateless-category"); //NOI18N
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
+import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcore.model.contact.gender.Gender;
*/
public CustomerWebBean () throws NamingException {
// Get initial context
- InitialContext context = new InitialContext();
+ Context context = new InitialContext();
// Set gender to UNKNOWN
this.gender = Gender.UNKNOWN;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import javax.inject.Named;
+import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcoreee.beans.BaseFrameworkBean;
*/
public AdminProductWebBean () throws NamingException {
// Get initial context
- InitialContext context = new InitialContext();
+ Context context = new InitialContext();
// Try to lookup the bean
this.productBean = (AdminProductSessionBeanRemote) context.lookup("ejb/stateless-admin-product"); //NOI18N
<from-outcome>admin_index</from-outcome>
<to-view-id>/admin/index.xhtml</to-view-id>
</navigation-case>
- <navigation-case>
- <from-outcome>basket</from-outcome>
- <to-view-id>/basket.xhtml</to-view-id>
- </navigation-case>
+ <navigation-case>
+ <from-outcome>basket</from-outcome>
+ <to-view-id>/basket.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>item_not_changed</from-outcome>
+ <to-view-id>/errorHandler.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/index.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>item_added</from-outcome>
+ <to-view-id>/item_added.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
- <navigation-rule>
- <from-view-id>/index.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>item_added</from-outcome>
- <to-view-id>/item_added.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
</faces-config>
</h:column>
<h:column>
- <f:facet name="header">Einzelpreis:</f:facet>
+ <f:facet name="header">#{msg.SINGLE_ITEM_PRICE}</f:facet>
#{product.price}
</h:column>
<div class="table_row">
<div class="table_left">
- Einzelpreis:
+ #{msg.SINGLE_ITEM_PRICE}
<div class="tiny">(z.B. <em>50.0</em>)</div>
</div>
</h:column>
<h:column>
- <f:facet name="header">Einzelpreis:</f:facet>
+ <f:facet name="header">#{msg.SINGLE_ITEM_PRICE}</f:facet>
<div class="item_price">
<ui:fragment rendered="#{item.isProductType()}">
</h:column>
<h:column>
- <f:facet name="header">Anzahl ändern:</f:facet>
+ <f:facet name="header">#{msg.CHANGE_ITEM_AMOUNT}</f:facet>
<h:form acceptcharset="utf-8" id="add_item">
<h:commandButton class="submit" id="add" value="Ändern" action="#{basketController.changeItem(item)}" title="#{msg.BUTTON_TITLE_CHANGE_ITEM_AMOUNT}" />
</h:column>
<h:column>
- <f:facet name="header">Zwischensumme:</f:facet>
+ <f:facet name="header">#{msg.TOTAL_ITEM_PRICE}</f:facet>
<div class="item_total_price">
<h:outputText class="price" id="item_price" value="#{basketController.calculateItemPrice(item)}" rendered="#{item.isProductType()}">
</h:dataTable>
<div class="totals_container">
- Gesamtsumme:
+ #{msg.TOTAL_ORDER_PRICE}
<h:outputText class="price" id="total_sum" value="#{basketController.calculateTotalPrice()}">
<f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" locale="de_DE" />
</h:outputText>
</div>
- <h:outputText class="empty_basket" value="Es befinden sich derzeit keine Artikel im Warenkorb." rendered="#{basketController.isEmpty()}" />
+ <h:outputText class="empty_basket" value="#{msg.NO_ITEMS_ADDED_TO_BASKET}" rendered="#{basketController.isEmpty()}" />
</ui:define>
<ui:define name="footer">
//-->
<ui:composition template="/WEB-INF/templates/guest/guest_base.tpl">
- <ui:define name="title">Willkommen!</ui:define>
+ <ui:define name="title">#{msg.PAGE_TITLE_INDEX_WELCOME}</ui:define>
<ui:define name="menu">
<ui:include id="menu" class="guest_menu" src="/WEB-INF/templates/guest/guest_menu.tpl" />
</ui:define>
<ui:define name="content_header">
- Willkommen zum Pizza-Service
+ #{msg.SUB_TITLE_INDEX_WELCOME}
</ui:define>
<ui:define name="content">
<div class="table">
<div class="table_header">
- Folgendes kann bestellt werden:
+ #{msg.FOLLOWING_PRODUCTS_ARE_AVAILABLE}
</div>
</div>
<div class="item_actions">
<ui:fragment rendered="#{!basketController.isProductAdded(product)}">
<h:form acceptcharset="utf-8" id="add_item">
- <h:commandButton class="submit" id="add" value="Hinzufügen" action="#{basketController.addItem(product)}" title="#{msg.BUTTON_TITLE_ADD_ITEM_TO_BASKET}" />
+ <h:commandButton class="submit" id="add" value="#{msg.SUBMIT_ADD_ITEM_TO_BASKET}" action="#{basketController.addItem(product)}" title="#{msg.BUTTON_TITLE_ADD_ITEM_TO_BASKET}" />
<h:inputText class="input" id="amount" size="3" maxlength="20" value="#{basketController.amount}" title="#{msg.INPUT_TITLE_ENTER_ITEM_AMOUNT}">
<!--
</div>
<div class="item_basket_link">
- <h:link outcome="basket" title="Zum Warenkorb" value="Im Warenkorb ändern" />
+ <h:link outcome="basket" title="#{msg.LINK_TITLE_TO_BASKET}" value="#{msg.LINK_CHANGE_IN_BASKET}" />
</div>
<div class="clear"></div>
<div class="table_right">
<div class="item_price">
- Einzelpreis:
+ #{msg.SINGLE_ITEM_PRICE}
<h:outputText class="price" value="#{product.price}">
<f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" locale="de_DE" />
</h:outputText>
</div>
<div class="item_total_price">
- Zwischensumme:
- <h:outputText class="price" value="Nicht bestellt." rendered="#{!basketController.isProductAdded(product)}" />
+ #{msg.TOTAL_ITEM_PRICE}
+ <h:outputText class="price" value="#{msg.ITEM_NOT_ORDERED}" rendered="#{!basketController.isProductAdded(product)}" />
<h:outputText class="price" value="#{basketController.calculateCurrentItemPrice()}" rendered="#{basketController.isProductAdded(product)}">
<f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" locale="de_DE" />
</h:outputText>
</h:dataTable>
<div id="totals_container">
- Gesamtsumme:
+ #{msg.TOTAL_ORDER_PRICE}
<h:outputText class="price" id="total_sum" value="#{basketController.calculateTotalPrice()}">
<f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" locale="de_DE" />
</h:outputText>
>
<ui:composition template="/WEB-INF/templates/guest/guest_base.tpl">
- <ui:define name="guest_title">Produkt zum Warenkorb hinzugefuegt</ui:define>
+ <ui:define name="guest_title">Produkt zum Warenkorb hinzugefügt</ui:define>
<ui:define name="menu">
<ui:include id="menu" class="guest_menu" src="/WEB-INF/templates/guest/guest_menu.tpl" />
</ui:define>
<ui:define name="content_header">
- Produkt zum Warenkorb hinzugefuegt
+ Produkt zum Warenkorb hinzugefügt
</ui:define>
<ui:define name="content">
- Das Produkt wurde zum Warenkorb hinzugefuegt.
+ Das Produkt wurde zum Warenkorb hinzugefügt.
</ui:define>
<ui:define name="footer">