From 18c7a23eb22e52b846ebfe04d493a990499c4b5f Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 4 Sep 2015 19:35:08 +0200 Subject: [PATCH] =?utf8?q?No=20longer=20here=20(see=20jshop)=20Signed-off-?= =?utf8?q?by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../tags/basket/BasketTag.java | 37 ---- .../tags/basket/MiniBasketTag.java | 181 ------------------ 2 files changed, 218 deletions(-) delete mode 100644 src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java delete mode 100644 src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java diff --git a/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java b/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java deleted file mode 100644 index 139e50b1..00000000 --- a/src/java/org/mxchange/pizzaapplication/tags/basket/BasketTag.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2015 quix0r - * - * 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 . - */ -package org.mxchange.pizzaapplication.tags.basket; - -import javax.servlet.jsp.tagext.BodyTag; -import org.mxchange.jshop.beans.basket.BasketBean; - -/** - * - * @author quix0r - */ -public interface BasketTag extends BodyTag { - - /** - * @return the basket - */ - public BasketBean getBasket (); - - /** - * @param basket the basket to set - */ - public void setBasket (final BasketBean basket); -} diff --git a/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java b/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java deleted file mode 100644 index d8391cfe..00000000 --- a/src/java/org/mxchange/pizzaapplication/tags/basket/MiniBasketTag.java +++ /dev/null @@ -1,181 +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 . - */ -package org.mxchange.pizzaapplication.tags.basket; - -import java.io.IOException; -import java.rmi.RemoteException; -import java.text.MessageFormat; -import javax.servlet.ServletException; -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.tagext.BodyTagSupport; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.mxchange.jshop.beans.basket.BasketBean; -import org.mxchange.jshop.item.AddableBasketItem; -import org.mxchange.jshop.product.Product; -import org.mxchange.pizzaapplication.beans.controller.PizzaBean; - -/** - * A basket tag that outputs a small basket and a link to the full basket website. - * - * @author Roland Haeder - */ -public class MiniBasketTag extends BodyTagSupport implements BasketTag { - /** - * Serial number - */ - private static final long serialVersionUID = 457415727452384L; - - /** - * Basket instance - */ - private BasketBean basket; - - /** - * Logger instance - */ - private final Logger LOG; - - /** - * Initializer - */ - { - this.LOG = LogManager.getLogger(this); - } - - /** - * Outputs a div container with last added item + a link to the basket - * web page. - * - * @return No need to process the body - * @throws JspException If anything happens - */ - @Override - public int doStartTag () throws JspException { - // Trace message - this.LOG.trace("CALLED!"); //NOI18N - - // Init output - StringBuilder out = new StringBuilder("
\n"); //NOI18N - - // basket should not be null - if (this.getBasket() == null) { - // Not set - throw new NullPointerException("basket instance is null"); //NOI18N - } - - try { - // Some entries found? - if (this.getBasket().isEmpty()) { - // Empty basket - out.append("
\n"); //NOI18N - out.append(this.getBasket().getMessageStringFromKey("MiniBasketTag.basket_is_empty")).append("\n"); //NOI18N - out.append("
\n"); //NOI18N - } else { - // Get all items - AddableBasketItem item = this.getBasket().getLast(); - - // item cannot be null here - if (null == item) { - // Abort here - throw new NullPointerException("item is null"); //NOI18N - } - - // Get application bean from session - PizzaBean bean = (PizzaBean) this.getBasket().getSession().getAttribute("controller"); //NOI18N - - // Debug log - this.LOG.debug(MessageFormat.format("bean={0}", bean)); //NOI18N - - // Should not be null - if (null == bean) { - // Abort here - throw new NullPointerException("bean is null"); //NOI18N - } - - // Get product instance - Product product = bean.getProduct(item); - - // Debug message - this.LOG.debug(MessageFormat.format("product={0}", product)); //NOI18N - - // Get last num rows - int lastNumRows = this.getBasket().getLastNumRows(); - - // Debug message - this.LOG.debug(MessageFormat.format("lastNumRows={0}", lastNumRows)); //NOI18N - - // Output all - out.append("
\n"); //NOI18N - out.append("
\n"); //NOI18N - out.append(" ").append(this.getBasket().getMessageStringFromKey("MiniBasketTag.header")).append("\n"); //NOI18N - out.append("
\n"); //NOI18N - out.append("
\n"); //NOI18N - out.append(" ").append(MessageFormat.format(this.getBasket().getMessageStringFromKey("MiniBasketTag.last_item"), product.getTitle())); //NOI18N - out.append("
\n"); //NOI18N - out.append("
\n"); //NOI18N - out.append(" ").append(MessageFormat.format(this.getBasket().getMessageStringFromKey("MiniBasketTag.additional_items"), (lastNumRows - 1))); //NOI18N - out.append("
\n"); //NOI18N - out.append("
\n"); //NOI18N - out.append(" ").append(this.getBasket().getMessageStringFromKey("MiniBasketTag.to_basket")).append("\n"); //NOI18N - out.append("
\n"); //NOI18N - out.append("
\n"); //NOI18N - } - } catch (final RemoteException ex) { - // Continue to throw - throw new JspException(ex); - } - - try { - // Get output instance and write it - this.pageContext.getOut().print(out.toString()); - } catch (final IOException ex) { - // Continue to throw - throw new JspException(ex); - } - - // Trace message - this.LOG.trace(MessageFormat.format("Returning {0} ... - EXIT!", SKIP_BODY)); //NOI18N - - // Don't process any body - return SKIP_BODY; - } - - /** - * @return the basket - */ - @Override - public BasketBean getBasket () { - // Trace message - //* NOISY-DEBUG: */ this.LOG.trace("basket=" + this.basket + " - EXIT!"); - - // Return it - return this.basket; - } - - /** - * @param basket the basket to set - */ - @Override - public void setBasket (final BasketBean basket) { - // Trace message - //* NOISY-DEBUG: */ this.LOG.trace("basked=" + basket + " - CALLED!"); - - // Set it here - this.basket = basket; - } -} -- 2.39.5