Author: ppoddar Date: Thu May 27 17:41:43 2010 New Revision: 948925 URL: http://svn.apache.org/viewvc?rev=948925&view=rev Log: JSP Page cosmetic changes: tables with known column width, Graphic buttons Modified: openjpa/trunk/openjpa-examples/openbooks/web/cart.jsp openjpa/trunk/openjpa-examples/openbooks/web/checkout.jsp openjpa/trunk/openjpa-examples/openbooks/web/footer.jsp openjpa/trunk/openjpa-examples/openbooks/web/header.jsp openjpa/trunk/openjpa-examples/openbooks/web/intro.jsp openjpa/trunk/openjpa-examples/openbooks/web/openbooks.css openjpa/trunk/openjpa-examples/openbooks/web/orders.jsp openjpa/trunk/openjpa-examples/openbooks/web/query.jsp openjpa/trunk/openjpa-examples/openbooks/web/search.jsp Modified: openjpa/trunk/openjpa-examples/openbooks/web/cart.jsp URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/web/cart.jsp?rev=948925&r1=948924&r2=948925&view=diff ============================================================================== --- openjpa/trunk/openjpa-examples/openbooks/web/cart.jsp (original) +++ openjpa/trunk/openjpa-examples/openbooks/web/cart.jsp Thu May 27 17:41:43 2010 @@ -67,17 +67,22 @@ - - + + + - + Modified: openjpa/trunk/openjpa-examples/openbooks/web/checkout.jsp URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/web/checkout.jsp?rev=948925&r1=948924&r2=948925&view=diff ============================================================================== --- openjpa/trunk/openjpa-examples/openbooks/web/checkout.jsp (original) +++ openjpa/trunk/openjpa-examples/openbooks/web/checkout.jsp Thu May 27 17:41:43 2010 @@ -31,7 +31,7 @@ <%@include file="header.jsp"%>
-

Composite Pattern and Derived Identity

+

Composite Relation and Derived Identity

You have just created a new Purchase Order @@ -78,17 +78,26 @@ <% OpenBookService service = (OpenBookService)session.getAttribute(KEY_SERVICE); ShoppingCart cart = (ShoppingCart)session.getAttribute(KEY_CART); - PurchaseOrder order = service.placeOrder(cart); - + PurchaseOrder order = null; + if (cart.isEmpty()) { %> -Purchase Order ID : <%= order.getId() %>
-Placed on : <%= JSPUtility.format(order.getPlacedOn()) %>
- + +<% + } else { + order = service.placeOrder(cart); + } +%> +

Thank you for ordering from OpenBooks

+

<%= cart.getTotalCount() %> book <%= cart.getTotalCount() == 1 ? "" : "s" %> in + <%= cart.getTotalCount() %> Book<%= cart.getTotalCount() == 1 ? "" : "s" %> in <%= customer.getName() %>'s Shopping Cart
Title Price QuantityTitlePriceQuantity
Continue ShoppingProceed to CheckOut + +
- + - + + + Modified: openjpa/trunk/openjpa-examples/openbooks/web/footer.jsp URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/web/footer.jsp?rev=948925&r1=948924&r2=948925&view=diff ============================================================================== --- openjpa/trunk/openjpa-examples/openbooks/web/footer.jsp (original) +++ openjpa/trunk/openjpa-examples/openbooks/web/footer.jsp Thu May 27 17:41:43 2010 @@ -22,11 +22,12 @@ <%@page import="org.apache.openjpa.conf.OpenJPAVersion"%> Modified: openjpa/trunk/openjpa-examples/openbooks/web/header.jsp URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/web/header.jsp?rev=948925&r1=948924&r2=948925&view=diff ============================================================================== --- openjpa/trunk/openjpa-examples/openbooks/web/header.jsp (original) +++ openjpa/trunk/openjpa-examples/openbooks/web/header.jsp Thu May 27 17:41:43 2010 @@ -68,13 +68,19 @@ public static String ROW_STYLE_EVEN = "even"; public static String ROW_STYLE_ODD = "odd"; + +%> + %> Modified: openjpa/trunk/openjpa-examples/openbooks/web/intro.jsp URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/web/intro.jsp?rev=948925&r1=948924&r2=948925&view=diff ============================================================================== --- openjpa/trunk/openjpa-examples/openbooks/web/intro.jsp (original) +++ openjpa/trunk/openjpa-examples/openbooks/web/intro.jsp Thu May 27 17:41:43 2010 @@ -54,8 +54,14 @@ corresponding Java code executed on %> - Your Name :

- + Your Name :
+ +

+ <% } Modified: openjpa/trunk/openjpa-examples/openbooks/web/openbooks.css URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/web/openbooks.css?rev=948925&r1=948924&r2=948925&view=diff ============================================================================== --- openjpa/trunk/openjpa-examples/openbooks/web/openbooks.css (original) +++ openjpa/trunk/openjpa-examples/openbooks/web/openbooks.css Thu May 27 17:41:43 2010 @@ -34,13 +34,16 @@ body { #header { position:fixed; + top:0; + width: 100%; height: 1.5em; margin: 0.0em; padding: 0.0em; - background: #fff; + background: #FFFFFF; + z-index: 100; border-bottom: 1px solid #999; @@ -52,18 +55,20 @@ body { #left { position: fixed; - width: 10em; top: 5em; + + width: 10em; margin-left:0.5em; text-align: left; float:left; } #content { -/* top: 0; */ + top: 5em; - width:30em; + width:60em; height:20em; + margin-left: 10em; margin-right: 15em; margin-top:1.5em; @@ -101,13 +106,22 @@ body { table { border-spacing:0; + font-size:14pt; +} + +caption { + background-color:#006295; + color:#FFFFFF; + font-weight:bold; } th { background-color:#BD2031; text-align:center; + color:#FFFFFF; } + tr.even { background-color:#9BE1FB; } Modified: openjpa/trunk/openjpa-examples/openbooks/web/orders.jsp URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/web/orders.jsp?rev=948925&r1=948924&r2=948925&view=diff ============================================================================== --- openjpa/trunk/openjpa-examples/openbooks/web/orders.jsp (original) +++ openjpa/trunk/openjpa-examples/openbooks/web/orders.jsp Thu May 27 17:41:43 2010 @@ -28,9 +28,11 @@ <%@page import="openbook.util.JSPUtility"%> <%@page import="java.util.Map"%> <%@page import="java.util.List"%> +<%@page import="java.util.ArrayList"%> <%@include file="header.jsp"%> +

Optimistic semantics and Orphan Delete

@@ -56,6 +58,7 @@ are no more available.
+
<% @@ -72,7 +75,10 @@ are no more available. } Customer customer = (Customer)session.getAttribute(KEY_USER); - List orders = service.getOrders(null, customer); + List pendingOrders = service.getOrders(PurchaseOrder.Status.DELIVERED, customer); + List deliveredOrders = service.getOrders(PurchaseOrder.Status.PENDING, customer); + List orders = new ArrayList(pendingOrders); + orders.addAll(deliveredOrders); if (orders.isEmpty()) { %> <%= customer.getName() %>, you have not placed any order yet.
@@ -80,12 +86,22 @@ are no more available. return; } %> + +
<%= order.getItems().size() %> itemsOrder : <%= order.getId() %> on <%= JSPUtility.format(order.getPlacedOn()) %> + for <%= order.getItems().size() %> Book<%= order.getItems().size() == 0 ? "" : "s" %> +
Title QuantityPriceTitleQuantityPrice
- + - + + + + + + @@ -97,10 +113,10 @@ are no more available. session.setAttribute(""+order.getId(), order); %> - + KEY_OID, + order.getId()) %>"> <%= order.getId() %> @@ -114,7 +130,8 @@ are no more available. %> + KEY_OID, order.getId()) %>"> + <% } %> @@ -124,31 +141,36 @@ are no more available. %>
<%= customer.getName() %>, you have placed <%= orders.size() %> orders<%= customer.getName() %>, you have placed <%= orders.size() %> ( + <%= pendingOrders.size() == 0 ? "none" : "" + pendingOrders.size()%> pending, + <%= deliveredOrders.size() == 0 ? " none" : " " + deliveredOrders.size()%> delivered) orders +
ID Total Placed On Status Delivered On IDTotalPlaced OnStatusDelivered OnDeliver
"> <%= order.getId() %> <%= order.getTotal() %> <%= JSPUtility.format(order.getPlacedOn()) %> <%= order.getStatus() %> Deliver
- +

<% if (ACTION_DETAILS.equals(request.getParameter(KEY_ACTION))) { String oid = request.getParameter(KEY_OID); PurchaseOrder order = (PurchaseOrder)session.getAttribute(oid); List items = order.getItems(); - if (items == null) { - if (order.isDelivered()) { + if (order.isDelivered()) { + if (items != null && items.isEmpty()) { %> Order <%= order.getId() %> has been delivered. Line items of delivered orders are automatically deleted due to orphan delete nature of Master-Details relationship. <% } else { %> - Order <%= order.getId() %> has no line items. This is an implementation error because - pending orders must have at least one line item by design. + Order <%= order.getId() %> has been delivered but still contains line items. + This is an implementation error because delivered orders must have at least one line item by design. <% } } else { %> - + - + + + + @@ -166,7 +188,8 @@ are no more available. } %> - + +
<%= items.size() %> line items of Order <%= order.getId() %>Total of <%= items.size() %> Book<%= items.size() == 0 ? "" : "s" %> + in Order <%= order.getId() %> +
Title Price Quantity CostTitlePriceQuantityCost
Total<%= JSPUtility.format(order.getTotal()) %>Total<%= JSPUtility.format(order.getTotal()) %>
Modified: openjpa/trunk/openjpa-examples/openbooks/web/query.jsp URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/web/query.jsp?rev=948925&r1=948924&r2=948925&view=diff ============================================================================== --- openjpa/trunk/openjpa-examples/openbooks/web/query.jsp (original) +++ openjpa/trunk/openjpa-examples/openbooks/web/query.jsp Thu May 27 17:41:43 2010 @@ -32,14 +32,15 @@

Query Result

- This page is displaying the result of the query specified in the previous Search page. + This page is displaying the result of the Criteria query specified in the previous Search page.
<%@include file="footer.jsp"%> Modified: openjpa/trunk/openjpa-examples/openbooks/web/search.jsp URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-examples/openbooks/web/search.jsp?rev=948925&r1=948924&r2=948925&view=diff ============================================================================== --- openjpa/trunk/openjpa-examples/openbooks/web/search.jsp (original) +++ openjpa/trunk/openjpa-examples/openbooks/web/search.jsp Thu May 27 17:41:43 2010 @@ -21,7 +21,7 @@ <%@page import="openbook.server.OpenBookService"%> <%@page import="openbook.domain.Book"%> - +<%@page import="javax.servlet.http.HttpServletRequest"%> <%@include file="header.jsp"%>
@@ -60,6 +60,15 @@
+<%! + public static String getParameter(HttpServletRequest request, String param) { + return getParameter(request, param, true); + } + public static String getParameter(HttpServletRequest request, String param, boolean replaceNull) { + String value = request.getParameter(param); + return replaceNull ? (value == null ? "" : value) : value; + } +%> <% OpenBookService service = (OpenBookService)session.getAttribute(KEY_SERVICE); @@ -74,24 +83,27 @@ Fill in the details for a book you are searching for.
- Title :

- Author:

- Price :
from to -
+ Title :

+ Author:

+ Price from : to +

- +
-

+

Search Tips:
  1. You can leave one, more or all fields empty.
  2. OpenBooks database currently contains <%= service.count(Book.class) %> books.
  3. Book titles are Book-1, Book-2, Book-3,...
  4. Author names are Author-1, Author-2, Author-3,...
  5. -
  6. Both Book and Author names accept wildcard characters. For example, Book-3_ - will return Book-31, Book-32, Book-33 ... -
  7. A Book is written by one or more Author(s). -
  8. An Author may have written zero or more Book(s). +
  9. Both Book and Author names accept wildcard characters.
    + For example, an underscore like Book-3_ will match any single character to return + Book-31, Book-32, Book-33 ...