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


001:        /*
002:         * (C) Copyright 2000 - 2003 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:
020:        package com.nabhinc.portal.model;
021:
022:        import javax.portlet.ActionRequest;
023:        import javax.xml.bind.Unmarshaller;
024:        import javax.xml.bind.annotation.XmlRootElement;
025:
026:        import com.nabhinc.util.StringUtil;
027:
028:        /**
029:         * Represents a Web page layout in which there is a menu of portlets.
030:         *
031:         * @author Padmanabh Dabke
032:         * (c) 2002 Nabh Information Systems, Inc. All Rights Reserved.
033:         */
034:        @XmlRootElement(name="menu")
035:        public class MenuLayout extends NavigationalLayout {
036:
037:            public MenuLayout() {
038:                init();
039:            }
040:
041:            public MenuLayout(PortalPage p) {
042:                super (p);
043:                init();
044:            }
045:
046:            private void init() {
047:                setTemplate("menu.jsp");
048:                this .bprComponentTemplate = "menu_content.jsp";
049:            }
050:
051:            /**
052:             * Modify the contents of this layout based on the form data submitted
053:             * via HttpServletRequest.
054:             * Creation date: (4/8/2002 11:06:14 PM)
055:             * @param req javax.servlet.http.HttpServletRequest
056:             */
057:            @SuppressWarnings("unchecked")
058:            public void modify(ActionRequest req) {
059:
060:                int deleteIndex = -1;
061:                int updownIndex = -1;
062:                NavigationOption[] oldOptions = navOptions;
063:                NavigationOption temp = null;
064:
065:                /*
066:                 * Case 1: User is reordering the menu options.
067:                 */
068:
069:                for (int i = 0; i < navOptions.length; i++) {
070:                    if (req.getParameter("upoption" + i) != null)
071:                        updownIndex = i;
072:                }
073:
074:                if (updownIndex != -1) {
075:                    if (updownIndex == 0 || updownIndex >= navOptions.length)
076:                        return;
077:                    temp = navOptions[updownIndex];
078:                    navOptions[updownIndex] = navOptions[updownIndex - 1];
079:                    navOptions[updownIndex - 1] = temp;
080:                    return;
081:
082:                }
083:
084:                updownIndex = -1;
085:                for (int i = 0; i < navOptions.length; i++) {
086:                    if (req.getParameter("downoption" + i) != null)
087:                        updownIndex = i;
088:                }
089:
090:                if (updownIndex != -1) {
091:                    if (updownIndex > navOptions.length - 2)
092:                        return;
093:                    temp = navOptions[updownIndex];
094:                    navOptions[updownIndex] = navOptions[updownIndex + 1];
095:                    navOptions[updownIndex + 1] = temp;
096:                    return;
097:
098:                }
099:
100:                /*
101:                 * Case 2: User is attempting to delete a menu option.
102:                 */
103:
104:                for (int i = 0; i < navOptions.length; i++) {
105:                    if (req.getParameter("deleteoption" + i) != null)
106:                        deleteIndex = i;
107:                }
108:
109:                if (deleteIndex != -1) {
110:                    try {
111:                        if (deleteIndex > -1 && deleteIndex < navOptions.length) {
112:                            navOptions = new NavigationOption[oldOptions.length - 1];
113:
114:                            for (int i = 0; i < deleteIndex; i++) {
115:                                navOptions[i] = oldOptions[i];
116:                            }
117:
118:                            for (int i = deleteIndex; i < navOptions.length; i++) {
119:                                navOptions[i] = oldOptions[i + 1];
120:                            }
121:                        }
122:                        setRowIndex(this .rowIndex);
123:                    } catch (Exception ex) {
124:                    }
125:
126:                    return;
127:                }
128:
129:                String action = req.getParameter("action");
130:                int portletIndex = -1;
131:                try {
132:                    portletIndex = Integer.parseInt(req
133:                            .getParameter("portletindex"));
134:                } catch (Exception ex) {
135:                }
136:
137:                if ("hidetitle".equals(action)) {
138:                    if (portletIndex != -1)
139:                        navOptions[portletIndex].renderable
140:                                .setTitleShown(false);
141:                    return;
142:                } else if ("showtitle".equals(action)) {
143:                    if (portletIndex != -1)
144:                        navOptions[portletIndex].renderable.setTitleShown(true);
145:                    return;
146:                } else if ("hideborder".equals(action)) {
147:                    if (portletIndex != -1)
148:                        navOptions[portletIndex].renderable.setBorderWidth(0);
149:                    return;
150:                } else if ("showborder".equals(action)) {
151:                    if (portletIndex != -1)
152:                        navOptions[portletIndex].renderable.setBorderWidth(1);
153:                    return;
154:                }
155:                /*
156:                 * Case 3: User is trying to add a menu option.
157:                 */
158:
159:                if (req.getParameter("addoption") != null) {
160:                    NavigationOption newOption = new NavigationOption();
161:                    String pName = req.getParameter("newportlet");
162:                    String label = req.getParameter("newlabel");
163:                    String url = req.getParameter("newurl");
164:
165:                    if (label == null || label.trim().equals(""))
166:                        label = "sb.portal.menu_layout.option.no_label";
167:                    newOption.label = label;
168:
169:                    if (StringUtil.isNullOrEmpty(pName)) {
170:                        if (StringUtil.isNotNullOrEmpty(url)) {
171:                            newOption.url = url;
172:                            newOption.type = NavigationOption.OPTION_TYPE_URL;
173:                        } else {
174:                            return;
175:                        }
176:                    } else if ("com.nabhinc.portal.menu_header".equals(pName)) {
177:                        newOption.type = NavigationOption.OPTION_TYPE_HEADER;
178:                    } else {
179:                        newOption.type = NavigationOption.OPTION_TYPE_PORTLET;
180:                        newOption.renderable = createRenderable(pName, req,
181:                                "main_border", "main_title");
182:                    }
183:
184:                    navOptions = new NavigationOption[oldOptions.length + 1];
185:                    for (int i = 0; i < oldOptions.length; i++) {
186:                        navOptions[i] = oldOptions[i];
187:                    }
188:                    navOptions[oldOptions.length] = newOption;
189:
190:                    return;
191:                }
192:
193:                /*
194:                 * Case 4: User is trying to save
195:                 */
196:                String newPageName = req.getParameter("pagename");
197:                if (newPageName != null && (!newPageName.trim().equals(""))) {
198:                    getPortalPage().setName(newPageName.trim());
199:                }
200:
201:                try {
202:                    int rs = Integer.parseInt(req.getParameter("refresh"));
203:                    setRefreshSeconds(rs);
204:                } catch (Exception ex) {
205:                    setRefreshSeconds(-1);
206:                }
207:
208:                /*
209:                 * Case 4a: User is trying to modify a label
210:                 */
211:
212:                for (int i = 0; i < navOptions.length; i++) {
213:                    String temp2 = req.getParameter("label" + i);
214:                    if (temp2 != null && (!temp2.trim().equals("")))
215:                        navOptions[i].label = temp2;
216:                }
217:
218:            }
219:
220:            public String getLayoutType() {
221:                return "menu";
222:            }
223:
224:            // It seems like Sun's JAXB implementation does not pick up the afterUnmarshal
225:            // method on a superclass. As a result, we have to define it here, even though
226:            // it is not adding anything to the superclass implementation :-(
227:            public void afterUnmarshal(Unmarshaller um, Object parent) {
228:                super.afterUnmarshal(um, parent);
229:            }
230:
231:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.