Source Code Cross Referenced for ScrollableAreaRenderer.java in  » ERP-CRM-Financial » sakai » org » theospi » jsf » renderer » 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 » ERP CRM Financial » sakai » org.theospi.jsf.renderer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/osp/tags/sakai_2-4-1/jsf/widgets/src/java/org/theospi/jsf/renderer/ScrollableAreaRenderer.java $
003:         * $Id: ScrollableAreaRenderer.java 10835 2006-06-17 03:25:03Z lance@indiana.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2005, 2006 The Sakai Foundation.
007:         *
008:         * Licensed under the Educational Community License, Version 1.0 (the "License");
009:         * you may not use this file except in compliance with the License.
010:         * You may obtain a copy of the License at
011:         *
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         *
014:         * Unless required by applicable law or agreed to in writing, software
015:         * distributed under the License is distributed on an "AS IS" BASIS,
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:         * See the License for the specific language governing permissions and
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.theospi.jsf.renderer;
021:
022:        import java.io.IOException;
023:
024:        import javax.faces.component.UIComponent;
025:        import javax.faces.component.UIOutput;
026:        import javax.faces.context.FacesContext;
027:        import javax.faces.context.ResponseWriter;
028:        import javax.faces.render.Renderer;
029:
030:        import org.sakaiproject.jsf.util.RendererUtil;
031:
032:        /**
033:         * This class renders a scrollable area.  It does this by
034:         * making a div and then making it "auto" overflow which places
035:         * scroll bars at the right and/or bottom.  If the content is 
036:         * small enough to fit into the div then no scroll bars are rendered.
037:         * <br><br>
038:         * There must be a height defined in this tag or by a surrounding tag.
039:         * If there is not then there must be a parent tag that has a height defined.
040:         * If there is not either, then the div will resize the height to 
041:         * the total size of the content thus making this tag moot.
042:         * 
043:         * @author andersjb
044:         * 
045:         */
046:        public class ScrollableAreaRenderer extends Renderer {
047:            public static final String SCROLL_VISIBLE = "visible";
048:            public static final String SCROLL_SCROLL = "scroll";
049:            public static final String SCROLL_HIDDEN = "hidden";
050:            public static final String SCROLL_AUTO = "auto";
051:
052:            public boolean supportsComponentType(UIComponent component) {
053:                return (component instanceof  UIOutput);
054:            }
055:
056:            /**
057:             * This renders html for the beginning of the tag.
058:             * 
059:             * @param context
060:             * @param component
061:             * @throws IOException
062:             */
063:            public void encodeBegin(FacesContext context, UIComponent component)
064:                    throws IOException {
065:                ResponseWriter writer = context.getResponseWriter();
066:
067:                String cssclass = (String) RendererUtil.getAttribute(context,
068:                        component, "cssclass");
069:                String id = (String) RendererUtil.getAttribute(context,
070:                        component, "id");
071:                String width = (String) RendererUtil.getAttribute(context,
072:                        component, "width");
073:                String height = (String) RendererUtil.getAttribute(context,
074:                        component, "height");
075:                String scrollXStyle = (String) RendererUtil.getAttribute(
076:                        context, component, "scrollXStyle");
077:                String scrollYStyle = (String) RendererUtil.getAttribute(
078:                        context, component, "scrollYStyle");
079:
080:                writer.startElement("div", component);
081:
082:                if (cssclass != null)
083:                    writer.writeAttribute("class", cssclass, "class");
084:
085:                if (id != null)
086:                    writer.writeAttribute("id", id, "id");
087:
088:                String style = "";
089:
090:                if (scrollXStyle == null && scrollYStyle == null) {
091:                    //	set the div tag to have scroll bars when the innerHTML is larger than the div size
092:                    style += "overflow:auto;";
093:                } else if (scrollYStyle == null) {
094:                    if (scrollXStyle.equals(SCROLL_SCROLL)
095:                            || scrollXStyle.equals(SCROLL_AUTO))
096:                        scrollYStyle = SCROLL_HIDDEN;
097:                } else if (scrollXStyle == null) {
098:                    if (scrollYStyle.equals(SCROLL_SCROLL)
099:                            || scrollYStyle.equals(SCROLL_AUTO))
100:                        scrollXStyle = SCROLL_HIDDEN;
101:                }
102:                if (scrollXStyle != null)
103:                    style += "overflow-x:" + scrollXStyle + ";";
104:
105:                if (scrollYStyle != null)
106:                    style += "overflow-y:" + scrollYStyle + ";";
107:
108:                if (width != null) {
109:                    style += "width:" + width + ";";
110:                }
111:                if (height != null) {
112:                    style += "height:" + height + ";";
113:                }
114:
115:                if (style.length() > 0)
116:                    writer.writeAttribute("style", style, "style");
117:            }
118:
119:            /**
120:             * @param context FacesContext for the request we are processing
121:             * @param component UIComponent to be rendered
122:             * @exception IOException if an input/output error occurs while rendering
123:             * @exception NullPointerException if <code>context</code> or <code>component</code> is null
124:             */
125:            public void encodeEnd(FacesContext context, UIComponent component)
126:                    throws IOException {
127:                ResponseWriter writer = context.getResponseWriter();
128:
129:                writer.endElement("div");
130:            }
131:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.