Source Code Cross Referenced for PortletTagHandler.java in  » Portal » jboss-portal-2.6.4 » org » jboss » portal » theme » tag » 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.tag 
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:         ******************************************************************************/package org.jboss.portal.theme.tag;
023:
024:        import org.jboss.logging.Logger;
025:        import org.jboss.portal.common.NotYetImplemented;
026:        import org.jboss.portal.theme.LayoutConstants;
027:        import org.jboss.portal.theme.render.renderer.PageRendererContext;
028:
029:        import javax.servlet.http.HttpServletRequest;
030:        import javax.servlet.jsp.JspException;
031:        import javax.servlet.jsp.JspWriter;
032:        import javax.servlet.jsp.PageContext;
033:        import javax.servlet.jsp.tagext.SimpleTagSupport;
034:        import java.io.IOException;
035:
036:        /**
037:         * Tag handler for the portlet tag. <p>This tag adds the created markup of a Portlet to a page. The portlet tag utilizes
038:         * a render set to create the markup around the portlet. The render set takes care of the portlet window, hence it
039:         * creates the markup for the title, and the mode and state links. This tag does not initiate the call to the portlet
040:         * container, but rather is ment to assist in laying out the rendered markup, after it is generated by the portlet.
041:         * (place the already rendered markup of portlet x here....)</p>
042:         *
043:         * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>.
044:         * @version <tt>$Revision: 8784 $</tt>
045:         * @see org.jboss.portal.theme.PortalRenderSet
046:         */
047:        public class PortletTagHandler extends SimpleTagSupport {
048:            private static Logger log = Logger
049:                    .getLogger(PortletTagHandler.class);
050:            private String windowName = null;
051:
052:            /**
053:             * create the markup of this tag <p>Get a render set from the renderer factory, and call the window renderer to
054:             * generate the root container for this Portlet's markup. The window renderer then delegates to the decoration
055:             * renderer and the portlet renderer to create the markup for the title and the mode and state links, and to add the
056:             * Portlet's markup.</p>
057:             *
058:             * @throws javax.servlet.jsp.JspException
059:             * @throws java.io.IOException
060:             * @see org.jboss.portal.theme.PortalRenderSet#getWindowRenderer
061:             * @see org.jboss.portal.theme.render.renderer.WindowRenderer#render
062:             * @see org.jboss.portal.theme.render.renderer.PortletRenderer#render
063:             * @see org.jboss.portal.theme.render.renderer.DecorationRenderer#render
064:             */
065:            public void doTag() throws JspException, IOException {
066:                log.debug("rendering portlet " + windowName);
067:
068:                JspWriter out = this .getJspContext().getOut();
069:
070:                if (getWindowName() == null) {
071:                    out.write("<p bgcolor='red'>No Portlet to render!</p>");
072:                    out
073:                            .write("<p bgcolor='red'>The Portlet to render must be set in the tag attribute '"
074:                                    + LayoutConstants.ATTR_PORTLET_WINDOW_NAME
075:                                    + "'</p>");
076:                    out.flush();
077:                    return;
078:                }
079:
080:                PageContext app = (PageContext) getJspContext();
081:                HttpServletRequest request = (HttpServletRequest) app
082:                        .getRequest();
083:
084:                PageRendererContext page = (PageRendererContext) request
085:                        .getAttribute(LayoutConstants.ATTR_PAGE);
086:                if (page == null) {
087:                    out.write("<p bgcolor='red'>No page to render!</p>");
088:                    out
089:                            .write("<p bgcolor='red'>The page to render (PageResult) must be set in the request attribute '"
090:                                    + LayoutConstants.ATTR_PAGE + "'</p>");
091:                    out.flush();
092:                    return;
093:                }
094:
095:                //      String windowID = null;
096:                //      boolean wIdFound = false;
097:                //      //    we have the windowName (which is the window name), but we need the
098:                //      //    window id
099:                //      Map portletContexts = page.getWindowContextMap();
100:                //      for (Iterator i = portletContexts.keySet().iterator(); i.hasNext();) {
101:                //    	  windowID = (String) i.next();
102:                //    	  WindowContext portletContext = (WindowContext) portletContexts
103:                //    	  .get(windowID);
104:                //    	  if (windowName.equals(portletContext.getWindowName())) {
105:                //    		  wIdFound = true;
106:                //    		  if (log.isDebugEnabled()) {
107:                //    			  log.debug("found the portlet to render: " + windowName);
108:                //    		  }
109:                //    		  break;
110:                //    	  }
111:                //      }
112:                //
113:                //      if (!wIdFound) {
114:                //    	  log
115:                //    	  .warn("can't find the window id of the window name on this page. Page=["
116:                //    			  + page.getPageName()
117:                //    			  + "] and Window=["
118:                //    			  + windowName
119:                //    			  + "]. This window won't be shown in page.");
120:                //    	  return;
121:                //      }
122:                //      if (page.getWindowContext(windowID) == null) {
123:                //    	  log.warn("no such window on this page. Page [" + page.getPageName()
124:                //    			  + "] Window name [" + windowName + "]" + "] Window Id ["
125:                //    			  + windowID + "]");
126:                //    	  return;
127:                //      }
128:                //
129:                //      WindowContext windowContext = page.getWindowContext(windowID);
130:                //      RenderContext renderContext = (RenderContext)request.getAttribute(LayoutConstants.ATTR_RENDERCONTEXT);
131:                //
132:                //      PageRenderContextImpl prc = new PageRenderContextImpl(page);
133:                //      String regionName = windowContext.getRegionName();
134:                //      Region region = page.getRegion(regionName);
135:                //      RegionRenderContext rrc = new RegionRenderContextImpl(prc, region, null, null);
136:                //      for (Iterator i = rrc.getWindowRenderContexts().iterator();i.hasNext();)
137:                //      {
138:                //         WindowRenderContext wrc = (WindowRenderContext)i.next();
139:                //         if (wrc.getId().equals(windowContext.getId()))
140:                //         {
141:                //            try {
142:                //               renderContext.render(wrc);
143:                //               out.write(renderContext.getMarkupFragment().toString());
144:                //               out.flush();
145:                //            } catch (RenderException e) {
146:                //               throw new JspException(e);
147:                //            }
148:                //            break;
149:                //         }
150:                //      }
151:
152:                throw new NotYetImplemented();
153:            }
154:
155:            public String getWindowName() {
156:                return windowName;
157:            }
158:
159:            public void setWindowName(String portletWindowName) {
160:                if (log.isDebugEnabled()) {
161:                    log.debug("setting window name: " + portletWindowName);
162:                }
163:                this.windowName = portletWindowName;
164:            }
165:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.