Source Code Cross Referenced for DynaRegionRenderer.java in  » Portal » jboss-portal-2.6.4 » org » jboss » portal » theme » impl » render » dynamic » 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 » jboss portal 2.6.4 » org.jboss.portal.theme.impl.render.dynamic 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /******************************************************************************
002:         * JBoss, a division of Red Hat                                               *
003:         * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
004:         * contributors as indicated by the @authors tag. See the                     *
005:         * copyright.txt in the distribution for a full listing of                    *
006:         * individual contributors.                                                   *
007:         *                                                                            *
008:         * This is free software; you can redistribute it and/or modify it            *
009:         * under the terms of the GNU Lesser General Public License as                *
010:         * published by the Free Software Foundation; either version 2.1 of           *
011:         * the License, or (at your option) any later version.                        *
012:         *                                                                            *
013:         * This software is distributed in the hope that it will be useful,           *
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
016:         * Lesser General Public License for more details.                            *
017:         *                                                                            *
018:         * You should have received a copy of the GNU Lesser General Public           *
019:         * License along with this software; if not, write to the Free                *
020:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
021:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
022:         ******************************************************************************/
023:        /****dr**************************************************************************
024:         * JBoss, a division of Red Hat                                               *
025:         * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
026:         * contributors as indicated by the @authors tag. See the                     *
027:         * copyright.txt in the distribution for a full listing of                    *
028:         * individual contributors.                                                   *
029:         *                                                                            *
030:         * This is free software; you can redistribute it and/or modify it            *
031:         * under the terms of the GNU Lesser General Public License as                *
032:         * published by the Free Software Foundation; either version 2.1 of           *
033:         * the License, or (at your option) any later version.                        *
034:         *                                                                            *
035:         * This software is distributed in the hope that it will be useful,           *
036:         * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
037:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
038:         * Lesser General Public License for more details.                            *
039:         *                                                                            *
040:         * You should have received a copy of the GNU Lesser General Public           *
041:         * License along with this software; if not, write to the Free                *
042:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
043:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
044:         ******************************************************************************/package org.jboss.portal.theme.impl.render.dynamic;
045:
046:        import org.jboss.portal.theme.render.AbstractObjectRenderer;
047:        import org.jboss.portal.theme.render.ObjectRendererContext;
048:        import org.jboss.portal.theme.render.PropertyFetch;
049:        import org.jboss.portal.theme.render.RenderException;
050:        import org.jboss.portal.theme.render.RendererContext;
051:        import org.jboss.portal.theme.render.renderer.RegionRenderer;
052:        import org.jboss.portal.theme.render.renderer.RegionRendererContext;
053:
054:        import java.io.PrintWriter;
055:
056:        /**
057:         * Implementation of a drag and drop Region renderer.
058:         *
059:         * @author <a href="mailto:tomasz.szymanski@jboss.com">Tomasz Szymanski</a>
060:         * @author <a href="mailto:roy@jboss.org">Roy Russo</a>
061:         * @see org.jboss.portal.theme.render.renderer.RegionRenderer
062:         */
063:        public class DynaRegionRenderer extends AbstractObjectRenderer
064:                implements  RegionRenderer {
065:
066:            /** . */
067:            private static final PropertyFetch RENDER_OPTIONS_FETCH = new PropertyFetch(
068:                    PropertyFetch.ANCESTORS_SCOPE);
069:
070:            /** . */
071:            private RegionRenderer delegate;
072:
073:            public DynaRegionRenderer(RegionRenderer regionRenderer)
074:                    throws InstantiationException, IllegalAccessException,
075:                    ClassNotFoundException {
076:                super ();
077:                delegate = regionRenderer;
078:            }
079:
080:            public void startContext(RendererContext rendererContext,
081:                    ObjectRendererContext objectRenderContext) {
082:                RegionRendererContext rrc = (RegionRendererContext) objectRenderContext;
083:
084:                //
085:                if ("AJAXScripts".equals(rrc.getId())
086:                        || "AJAXFooter".equals(rrc.getId())) {
087:                    DynaRenderStatus.set(rendererContext, false);
088:                } else {
089:                    // Get ancestors options
090:                    String ancestorsDndValue = rendererContext
091:                            .getProperty(DynaRenderOptions.DND_ENABLED,
092:                                    RENDER_OPTIONS_FETCH);
093:                    String ancestorsPartialRefreshValue = rendererContext
094:                            .getProperty(
095:                                    DynaRenderOptions.PARTIAL_REFRESH_ENABLED,
096:                                    RENDER_OPTIONS_FETCH);
097:                    DynaRenderOptions ancestorsOptions = DynaRenderOptions
098:                            .getOptions(ancestorsDndValue,
099:                                    ancestorsPartialRefreshValue);
100:
101:                    // Get regions options
102:                    String regionDndValue = rendererContext
103:                            .getProperty(DynaRenderOptions.DND_ENABLED);
104:                    String regionPartialRefreshValue = rendererContext
105:                            .getProperty(DynaRenderOptions.PARTIAL_REFRESH_ENABLED);
106:                    DynaRenderOptions regionOptions = DynaRenderOptions
107:                            .getOptions(regionDndValue,
108:                                    regionPartialRefreshValue);
109:
110:                    // Merge options
111:                    DynaRenderOptions options = DynaMergeBehavior
112:                            .mergeForRegion(ancestorsOptions, regionOptions);
113:
114:                    //
115:                    rendererContext.setAttribute(DynaConstants.RENDER_OPTIONS,
116:                            options);
117:                    DynaRenderStatus.set(rendererContext, true);
118:                }
119:            }
120:
121:            public void endContext(RendererContext rendererContext,
122:                    ObjectRendererContext objectRenderContext) {
123:                if (DynaRenderStatus.isActive(rendererContext)) {
124:                    rendererContext.setAttribute(DynaConstants.RENDER_OPTIONS,
125:                            null);
126:                }
127:            }
128:
129:            public void renderHeader(RendererContext rendererContext,
130:                    RegionRendererContext rrc) throws RenderException {
131:                PrintWriter markup = rendererContext.getWriter();
132:                String jsBase = rendererContext
133:                        .getProperty(DynaConstants.RESOURCE_BASE_URL);
134:                String serverBaseURL = rendererContext
135:                        .getProperty(DynaConstants.SERVER_BASE_URL);
136:                String viewState = rendererContext
137:                        .getProperty(DynaConstants.VIEW_STATE);
138:
139:                // Handle special ajax region here
140:                if ("AJAXScripts".equals(rrc.getId())) {
141:                    markup.print("<script type='text/javascript' src='");
142:                    markup.print(jsBase);
143:                    markup.print("/prototype.js'></script>\n");
144:                    markup.print("<script type='text/javascript' src='");
145:                    markup.print(jsBase);
146:                    markup.print("/scriptaculous.js'></script>\n");
147:                    markup.print("<script type='text/javascript' src='");
148:                    markup.print(jsBase);
149:                    markup.print("/effects.js'></script>\n");
150:                    markup.print("<script type='text/javascript' src='");
151:                    markup.print(jsBase);
152:                    markup.print("/dragdrop.js'></script>\n");
153:                    markup.print("<script type='text/javascript' src='");
154:                    markup.print(jsBase);
155:                    markup.print("/dyna.js'></script>\n");
156:                    markup.print("<script type='text/javascript'>\n");
157:
158:                    // Async server URL needed for callbacks
159:                    markup.print("server_base_url=\"");
160:                    markup.print(serverBaseURL);
161:                    markup.print("\";\n");
162:
163:                    // View state if not null
164:                    if (viewState != null) {
165:                        markup.print("view_state = \"");
166:                        markup.print(viewState);
167:                        markup.print("\";\n");
168:                    } else {
169:                        markup.print("view_state = null;");
170:                    }
171:
172:                    //
173:                    markup.print("</script>\n");
174:                } else if ("AJAXFooter".equals(rrc.getId())) {
175:                    markup
176:                            .print("<script type='text/javascript'>footer()</script>\n");
177:                }
178:
179:                //
180:                if (DynaRenderStatus.isActive(rendererContext)) {
181:                    //
182:                    DynaRenderOptions options = (DynaRenderOptions) rendererContext
183:                            .getAttribute(DynaConstants.RENDER_OPTIONS);
184:
185:                    //
186:                    if (!DynaRenderOptions.NO_AJAX.equals(options)) {
187:                        //
188:                        markup.print("<div class=\"dyna-region\">");
189:
190:                        //
191:                        delegate.renderHeader(rendererContext, rrc);
192:
193:                        //
194:                        if (options.isDnDEnabled()) {
195:                            markup.print("<div class=\"dnd-region\" id=\"");
196:                            markup.print(rrc.getId());
197:                            markup.print("\">");
198:                        }
199:                    } else {
200:                        delegate.renderHeader(rendererContext, rrc);
201:                    }
202:                }
203:            }
204:
205:            /** @see org.jboss.portal.theme.render.renderer.RegionRenderer#renderBody */
206:            public void renderBody(RendererContext rendererContext,
207:                    final RegionRendererContext rrc) throws RenderException {
208:                if (DynaRenderStatus.isActive(rendererContext)) {
209:                    delegate.renderBody(rendererContext, rrc);
210:                }
211:            }
212:
213:            public void renderFooter(RendererContext rendererContext,
214:                    RegionRendererContext rrc) throws RenderException {
215:                if (DynaRenderStatus.isActive(rendererContext)) {
216:                    DynaRenderOptions options = (DynaRenderOptions) rendererContext
217:                            .getAttribute(DynaConstants.RENDER_OPTIONS);
218:
219:                    //
220:                    if (!DynaRenderOptions.NO_AJAX.equals(options)) {
221:                        //
222:                        PrintWriter markup = rendererContext.getWriter();
223:
224:                        // Close dnd-region
225:                        if (options.isDnDEnabled()) {
226:                            markup.print("</div>");
227:                        }
228:
229:                        // Close dyna-region
230:                        markup.print("</div>");
231:                    }
232:
233:                    //
234:                    delegate.renderFooter(rendererContext, rrc);
235:                }
236:            }
237:        }
ww___w.ja__va_2___s___.__c__o_m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.