Source Code Cross Referenced for NavigationState.java in  » Portal » stringbeans-3.5 » com » nabhinc » portal » core » 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 » Portal » stringbeans 3.5 » com.nabhinc.portal.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * (C) Copyright 2006 Nabh Information Systems, Inc. 
003:         * 
004:         * This program is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU General Public License 
006:         * as published by the Free Software Foundation; either version 2
007:         * of the License, or (at your option) any later version.
008:         * 
009:         * This program is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of 
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
012:         * GNU General Public License for more details.
013:         * 
014:         * You should have received a copy of the GNU General Public License
015:         * along with this program; if not, write to the Free Software 
016:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
017:         * 
018:         */
019:        package com.nabhinc.portal.core;
020:
021:        import java.io.ByteArrayInputStream;
022:        import java.io.ByteArrayOutputStream;
023:        import java.io.IOException;
024:        import java.io.ObjectInputStream;
025:        import java.io.ObjectOutputStream;
026:        import java.io.PrintStream;
027:        import java.io.Serializable;
028:        import java.util.HashMap;
029:        import java.util.Iterator;
030:        import java.util.Map;
031:
032:        import javax.portlet.PortletMode;
033:        import javax.servlet.http.HttpServletRequest;
034:        import javax.servlet.http.HttpSession;
035:
036:        /**
037:         *  
038:         *
039:         * @author Padmanabh Dabke
040:         * (c) 2006 Nabh Information Systems, Inc. All Rights Reserved.
041:         */
042:        public class NavigationState implements  Serializable {
043:            private static final long serialVersionUID = -4210812290562144236L;
044:            public transient PortletMode portletMode = PortletMode.VIEW;
045:            public String portletModeStr = "view";
046:
047:            public HashMap<String, String[]> paramMap = new HashMap<String, String[]>(
048:                    10);
049:
050:            public NavigationState copy() {
051:                NavigationState copy = new NavigationState();
052:                copy.portletMode = this .portletMode;
053:                copy.paramMap.putAll(this .paramMap);
054:                return copy;
055:            }
056:
057:            @SuppressWarnings("unchecked")
058:            public void setParams(HttpServletRequest request) {
059:                Map<String, String[]> paramMap = request.getParameterMap();
060:                this .paramMap.clear();
061:                this .paramMap.putAll(paramMap);
062:            }
063:
064:            public static NavigationState getNavigationState(
065:                    HttpSession session, String windowId, boolean isDetached) {
066:                if (isDetached)
067:                    return (NavigationState) session
068:                            .getAttribute(PortalConstants.DETACHED_NAV_STATE_ATTRIBUTE
069:                                    + windowId);
070:                else
071:                    return (NavigationState) session
072:                            .getAttribute(PortalConstants.NAV_STATE_ATTRIBUTE_PREFIX
073:                                    + windowId);
074:            }
075:
076:            public static void setNavigationState(HttpSession session,
077:                    String windowId, boolean isDetached, NavigationState ns) {
078:                if (isDetached)
079:                    session.setAttribute(
080:                            PortalConstants.DETACHED_NAV_STATE_ATTRIBUTE
081:                                    + windowId, ns);
082:                else
083:                    session.setAttribute(
084:                            PortalConstants.NAV_STATE_ATTRIBUTE_PREFIX
085:                                    + windowId, ns);
086:            }
087:
088:            public static void removeNavigationState(HttpSession session,
089:                    String windowId, boolean isDetached) {
090:                if (isDetached)
091:                    session
092:                            .removeAttribute(PortalConstants.DETACHED_NAV_STATE_ATTRIBUTE
093:                                    + windowId);
094:                else
095:                    session
096:                            .removeAttribute(PortalConstants.NAV_STATE_ATTRIBUTE_PREFIX
097:                                    + windowId);
098:            }
099:
100:            public void setPortletMode(String pMode) {
101:                this .portletModeStr = pMode;
102:                this .portletMode = new PortletMode(pMode);
103:            }
104:
105:            private void readObject(ObjectInputStream in) throws IOException,
106:                    ClassNotFoundException {
107:                in.defaultReadObject();
108:                this .portletMode = new PortletMode(this .portletModeStr);
109:            }
110:
111:            public void print(PrintStream w) {
112:                w.println("Portlet Window Mode = " + this .portletModeStr);
113:                w.println("Parameters");
114:                Iterator<Map.Entry<String, String[]>> iter = this .paramMap
115:                        .entrySet().iterator();
116:                while (iter.hasNext()) {
117:                    Map.Entry<String, String[]> entry = iter.next();
118:                    w.print(entry.getKey());
119:                    w.print("=");
120:                    String[] values = entry.getValue();
121:                    for (int i = 0; i < values.length; i++) {
122:                        w.print(values[i]);
123:                        w.print(" ");
124:                    }
125:                }
126:            }
127:
128:            public static void main(String[] args) {
129:                try {
130:                    NavigationState ns = new NavigationState();
131:                    ns.setPortletMode("edit");
132:                    ns.paramMap.put("param1",
133:                            new String[] { "value1", "value2" });
134:                    ns.print(System.out);
135:                    System.out.println("*******************");
136:                    ByteArrayOutputStream os = new ByteArrayOutputStream();
137:                    ObjectOutputStream oos = new ObjectOutputStream(os);
138:                    oos.writeObject(ns);
139:                    oos.flush();
140:                    oos.reset();
141:                    ByteArrayInputStream is = new ByteArrayInputStream(os
142:                            .toByteArray());
143:                    ObjectInputStream ois = new ObjectInputStream(is);
144:                    NavigationState ns2 = (NavigationState) ois.readObject();
145:                    ns2.print(System.out);
146:                } catch (Exception e) {
147:                    e.printStackTrace();
148:                }
149:            }
150:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.