Source Code Cross Referenced for Item.java in  » J2EE » Enhydra-Demos » golfShop » presentation » xmlc » main » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » Enhydra Demos » golfShop.presentation.xmlc.main 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Enhydra Java Application Server 
003:         * The Initial Developer of the Original Code is Lutris Technologies Inc. 
004:         * Portions created by Lutris are Copyright (C) 1997-2000 Lutris Technologies
005:         * Inc. 
006:         * All Rights Reserved. 
007:         *
008:         * The contents of this file are subject to the Enhydra Public License Version
009:         * 1.0 (the "License"); you may not use this file except in compliance with the
010:         * License. You may obtain a copy of the License at
011:         * http://www.enhydra.org/software/license/epl.html 
012:         *
013:         * Software distributed under the License is distributed on an "AS IS" basis,
014:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
015:         * License for the specific language governing rights and limitations under the
016:         * License. 
017:         *
018:         * 
019:         */
020:
021:        package golfShop.presentation.xmlc.main;
022:
023:        import org.enhydra.xml.xmlc.*;
024:        import org.enhydra.xml.xmlc.html.*;
025:        import com.lutris.util.*;
026:        import com.lutris.appserver.server.httpPresentation.*;
027:        import java.io.*;
028:        import java.net.URLEncoder;
029:        import org.w3c.dom.*;
030:        import org.w3c.dom.html.*;
031:        import golfShop.presentation.xmlc.utilities.*;
032:        import golfShop.spec.LoginException;
033:
034:        /**
035:         * This presentation object dynamically creates an HTML page with two frames,
036:         * consisting of the Buy presentation object and the URL of the item
037:         * in question.  <P>
038:         *
039:         * Parameters:
040:         * <UL>
041:         * <LI> add - If specified, the Buy presentation object is passed this value,
042:         *      identifying the item on the screen.
043:         * <LI> ref - The value is the URL used for the lower frame, otherwise a default
044:         *      HTML file is loaded.
045:         * <LI> newItem - If specified, this item is added to the cart and the cart
046:         *      object displayed.
047:         * </UL>
048:         */
049:        public class Item implements  HttpPresentation {
050:            /**
051:             * Buy presentation object.
052:             */
053:            private static final String buyPO = "Buy.po";
054:
055:            /**
056:             * Cart contents PO.
057:             */
058:            private static final String CART_CONTENTS_URL = "../cart/Contents.po";
059:
060:            /**
061:             * Default item html page.
062:             */
063:            private static final String defaultItem = "noItem.html";
064:
065:            /**
066:             * Item identifier for adding to the cart.  Maybe null.
067:             */
068:            private String add;
069:
070:            /**
071:             * URL of page for the item.  Maybe null.
072:             */
073:            private String ref;
074:
075:            /**
076:             * Item to add to the cart.  Maybe null.
077:             */
078:            private Long newItem;
079:
080:            /**
081:             * Output the page, setting dynamic values.
082:             */
083:            private void outputPage(HttpPresentationComms comms)
084:                    throws HttpPresentationException {
085:                ItemHTML htmlObj = (ItemHTML) comms.xmlcFactory
086:                        .create(ItemHTML.class);
087:
088:                HTMLFrameElement buyFrame = htmlObj.getElementBuy();
089:                String buyUrl = buyPO;
090:                if (add != null) {
091:                    buyUrl += "?add=" + URLEncoder.encode(add);
092:                }
093:                buyFrame.setSrc(buyUrl);
094:
095:                htmlObj.getElementItem().setSrc(ref);
096:
097:                comms.response.writeDOM(htmlObj);
098:            }
099:
100:            /**
101:             * Parse CGI arguments into fields.
102:             */
103:            private void parseArgs(HttpPresentationRequest request)
104:                    throws HttpPresentationException {
105:
106:                add = request.getParameter("add");
107:                ref = request.getParameter("ref");
108:                if (ref == null) {
109:                    ref = defaultItem;
110:                }
111:                String newItemStr = request.getParameter("newItem");
112:                if (newItemStr != null) {
113:                    newItem = new Long(newItemStr);
114:                }
115:            }
116:
117:            /**
118:             * Entry.
119:             */
120:            public void run(HttpPresentationComms comms)
121:                    throws HttpPresentationException {
122:
123:                parseArgs(comms.request);
124:                if (newItem != null) {
125:                    CartUtils.addItem(comms.session, newItem.longValue());
126:                    ref = CART_CONTENTS_URL;
127:                }
128:                outputPage(comms);
129:            }
130:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.