Source Code Cross Referenced for LegendTag.java in  » Chart » cewolf-1.0 » de » laures » cewolf » taglib » tags » 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 » Chart » cewolf 1.0 » de.laures.cewolf.taglib.tags 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ================================================================
002:         * Cewolf : Chart enabling Web Objects Framework
003:         * ================================================================
004:         *
005:         * Project Info:  http://cewolf.sourceforge.net
006:         * Project Lead:  Guido Laures (guido@laures.de);
007:         *
008:         * (C) Copyright 2002, by Guido Laures
009:         *
010:         * This library is free software; you can redistribute it and/or modify it under the terms
011:         * of the GNU Lesser General Public License as published by the Free Software Foundation;
012:         * either version 2.1 of
013:         * the License, or (at your option) any later version.
014:         *
015:         * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
016:         * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
017:         * See the GNU Lesser General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public License along with this
020:         * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
021:         * Boston, MA 02111-1307, USA.
022:         */
023:
024:        package de.laures.cewolf.taglib.tags;
025:
026:        import java.io.IOException;
027:
028:        import javax.servlet.jsp.JspException;
029:
030:        import de.laures.cewolf.CewolfException;
031:        import de.laures.cewolf.ChartHolder;
032:        import de.laures.cewolf.ChartImage;
033:        import de.laures.cewolf.Configuration;
034:        import de.laures.cewolf.Storage;
035:        import de.laures.cewolf.WebConstants;
036:        import de.laures.cewolf.taglib.ChartImageDefinition;
037:        import de.laures.cewolf.taglib.TaglibConstants;
038:        import de.laures.cewolf.taglib.html.HTMLImgTag;
039:        import de.laures.cewolf.taglib.util.PageUtils;
040:
041:        /**
042:         * Tag <legend> which can be used to render a chart's legend
043:         * separately somewhere in the page.
044:         * @author  Guido Laures
045:         */
046:        public class LegendTag extends HTMLImgTag implements  CewolfRootTag,
047:                TaglibConstants, WebConstants {
048:
049:            private static final String DEFAULT_MIME_TYPE = MIME_PNG;
050:            private static final int DEFAULT_TIMEOUT = 300;
051:            private int timeout = DEFAULT_TIMEOUT;
052:            private transient String sessionKey;
053:            private transient String renderer;
054:            private String mimeType = DEFAULT_MIME_TYPE;
055:
056:            public int doStartTag() throws JspException {
057:                ChartHolder cd = PageUtils.getChartHolder(getChartId(),
058:                        pageContext);
059:                ChartImage cid = new ChartImageDefinition(cd, width, height,
060:                        ChartImage.IMG_TYPE_LEGEND, mimeType, timeout);
061:                Storage storage = Configuration.getInstance(
062:                        pageContext.getServletContext()).getStorage();
063:                try {
064:                    this .sessionKey = storage.storeChartImage(cid, pageContext);
065:                } catch (CewolfException cwex) {
066:                    log.error(cwex);
067:                    throw new JspException(cwex.getMessage());
068:                }
069:                return SKIP_BODY;
070:            }
071:
072:            public int doEndTag() throws JspException {
073:                super .doStartTag();
074:                final StringBuffer buffer = new StringBuffer(" src=\"");
075:                buffer.append(getImgURL());
076:                buffer.append("\"");
077:                try {
078:                    pageContext.getOut().write(buffer.toString());
079:                } catch (IOException ioex) {
080:                    reset();
081:                    log.error(ioex);
082:                    throw new JspException(ioex.getMessage());
083:                }
084:                return super .doEndTag();
085:            }
086:
087:            /**
088:             * To enable further server side scriptings on JSP output the session ID is always
089:             * encoded into the image URL even if cookies are enabled on the client side.
090:             */
091:            protected String getImgURL() {
092:                return ChartImgTag.buildImgURL(renderer, pageContext,
093:                        sessionKey, width, height, mimeType, forceSessionId,
094:                        removeAfterRender);
095:            }
096:
097:            protected void reset() {
098:                // as of a weird JSP compiler in resin
099:                // a reused tag's attribute is only set if 
100:                // it changes. So width an height may not
101:                // be unset to ensure correct values.
102:                int lHeight = this .height;
103:                int lWidth = this .width;
104:                int lTimeout = this .timeout;
105:                super .reset();
106:                this .height = lHeight;
107:                this .width = lWidth;
108:                this .timeout = lTimeout;
109:            }
110:
111:            public String getChartId() {
112:                return getId();
113:            }
114:
115:            public void setRenderer(String rend) {
116:                this .renderer = rend;
117:            }
118:
119:            /**
120:             * Sets the mimeType.
121:             * @param mimeType The mimeType to set
122:             */
123:            public void setMime(String mimeType) {
124:                this .mimeType = mimeType;
125:            }
126:
127:            /**
128:             * @return Returns the timeout.
129:             */
130:            public int getTimeout() {
131:                return timeout;
132:            }
133:
134:            /**
135:             * @param timeout The timeout to set.
136:             */
137:            public void setTimeout(int timeout) {
138:                this.timeout = timeout;
139:            }
140:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.