Source Code Cross Referenced for Buy.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.appserver.server.httpPresentation.*;
026:        import java.io.*;
027:        import java.net.URLEncoder;
028:        import org.w3c.dom.*;
029:        import org.w3c.dom.html.*;
030:        import golfShop.presentation.xmlc.utilities.*;
031:
032:        /**
033:         * This presentation object that dynamically creates the buy (and
034:         * other actions) button menu.
035:         *
036:         * Parameters:
037:         * <UL>
038:         * <LI> add - If specified, this identifies the item on the screen to associate
039:         *      with the add button.
040:         * </UL>
041:         */
042:        public class Buy implements  HttpPresentation {
043:            /**
044:             * Active and inactive button images and alt text.
045:             */
046:            private static final String ADD_INACTIVE_GIF = "../media/AddItem_d.gif";
047:            private static final String ADD_INACTIVE_TEXT = "You Must Select An Item First";
048:            private static final String ADD_ACTIVE_GIF = "../media/AddItem_n.gif";
049:            private static final String ADD_ACTIVE_GIF_MOUSEOVER = "../media/AddItem_b.gif";
050:            private static final String ADD_ACTIVE_GIF_MOUSEOUT = "../media/AddItem_n.gif";
051:            private static final String ADD_ACTIVE_TEXT = "Click To Add Item to Your Shopping Cart";
052:
053:            /**
054:             * URL to reference the item presentation object.
055:             */
056:            private static final String ITEM_URL = "Item.po";
057:
058:            /**
059:             * Item identifier for adding to the cart.  Maybe null.
060:             */
061:            private String add;
062:
063:            /**
064:             * Output the page, setting dynamic values.
065:             */
066:            private void outputPage(HttpPresentationComms comms)
067:                    throws HttpPresentationException {
068:                BuyHTML htmlObj = (BuyHTML) comms.xmlcFactory
069:                        .create(BuyHTML.class);
070:                HTMLImageElement img = htmlObj.getElementAddImage();
071:                HTMLAnchorElement anchor = htmlObj.getElementAddAnchor();
072:
073:                if (add == null) {
074:                    img.setSrc(ADD_INACTIVE_GIF);
075:                    img.setAlt(ADD_INACTIVE_TEXT);
076:                    anchor.removeAttribute("href");
077:                } else {
078:                    img.setSrc(ADD_ACTIVE_GIF);
079:                    img.setAlt(ADD_ACTIVE_TEXT);
080:
081:                    // When the add button is pressed, it goes back to Item.po, without
082:                    // the add parameter, but with the page being referenced as
083:                    // the shopping cart.
084:                    anchor.setHref(ITEM_URL + "?newItem=" + add);
085:                    anchor.setTarget("item");
086:
087:                    // Set on/out javascript.; must URL encode the contents due to quoting.
088:                    anchor.setAttribute("onmouseover", "add.src='"
089:                            + ADD_ACTIVE_GIF_MOUSEOVER + "'");
090:                    anchor.setAttribute("onmouseout", "add.src='"
091:                            + ADD_ACTIVE_GIF_MOUSEOUT + "'");
092:                }
093:                comms.response.writeDOM(htmlObj);
094:            }
095:
096:            /**
097:             * Parse CGI arguments into fields.
098:             */
099:            private void parseArgs(HttpPresentationRequest request)
100:                    throws HttpPresentationException {
101:
102:                add = request.getParameter("add");
103:            }
104:
105:            /**
106:             * Entry.
107:             */
108:            public void run(HttpPresentationComms comms)
109:                    throws HttpPresentationException {
110:
111:                parseArgs(comms.request);
112:                outputPage(comms);
113:            }
114:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.