Source Code Cross Referenced for ProgressBarImageTag.java in  » Project-Management » XPlanner-0.7b7 » com » technoetic » xplanner » 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 » Project Management » XPlanner 0.7b7 » com.technoetic.xplanner.tags 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.technoetic.xplanner.tags;
002:
003:        import com.technoetic.xplanner.format.DecimalFormat;
004:        import de.laures.cewolf.CewolfException;
005:        import de.laures.cewolf.ChartImage;
006:        import de.laures.cewolf.Configuration;
007:        import de.laures.cewolf.Storage;
008:        import de.laures.cewolf.storage.SerializableChartImage;
009:        import de.laures.cewolf.taglib.tags.ChartImgTag;
010:
011:        import javax.servlet.http.HttpServletRequest;
012:        import javax.servlet.jsp.JspException;
013:        import java.awt.*;
014:
015:        public class ProgressBarImageTag extends ChartImgTag implements 
016:                ProgressBarTag {
017:            private float quality = 0.75F;
018:            private double actual;
019:            private double estimate;
020:            private boolean complete;
021:
022:            public static final Color UNCOMPLETED_COLOR = new Color(0x80, 0x80,
023:                    0xFF);
024:            public static final Color COMPLETED_COLOR = new Color(0xA0, 0xFF,
025:                    0xA0);
026:            public static final Color EXCEEDED_COLOR = new Color(0xFF, 0xA0,
027:                    0xA0);
028:            public static final Color UNWORKED_COLOR = new Color(0xC0, 0xC0,
029:                    0xC0);
030:
031:            public int doStartTag() throws JspException {
032:                setRenderer("/cewolf");
033:                setChartid(getId());
034:                Storage storage = Configuration.getInstance(
035:                        pageContext.getServletContext()).getStorage();
036:                try {
037:                    this .sessionKey = storage.storeChartImage(getChartImage(),
038:                            pageContext);
039:                } catch (CewolfException cwex) {
040:                    throw new JspException(cwex.getMessage());
041:                }
042:                return SKIP_BODY;
043:            }
044:
045:            private ChartImage getChartImage() throws CewolfException {
046:                ProgressBarImage image = new ProgressBarImage(createModel());
047:                return new SerializableChartImage(
048:                        new CewolfProgressBarChartImage(image));
049:            }
050:
051:            public void setActual(double actual) {
052:                this .actual = actual;
053:            }
054:
055:            public void setEstimate(double estimate) {
056:                this .estimate = estimate;
057:            }
058:
059:            public void setComplete(boolean complete) {
060:                this .complete = complete;
061:            }
062:
063:            public void setHeight(int height) {
064:                super .setHeight(13);
065:            }
066:
067:            public void setQuality(String quality) {
068:                this .quality = Float.parseFloat(quality);
069:                if ((this .quality < 0.0F) || (this .quality > 1.0F)) {
070:                    throw new IllegalArgumentException("quality \"" + quality
071:                            + "\" out of range");
072:                }
073:            }
074:
075:            public String getQuality() {
076:                return Float.toString(quality);
077:            }
078:
079:            private double getCaptionValue() {
080:                return Math.min(actual, estimate);
081:            }
082:
083:            private boolean isComplete() {
084:                return complete;
085:            }
086:
087:            public Color getForegroundColor() {
088:                if (isComplete()) {
089:                    return PrintLinkTag.isInPrintMode(pageContext) ? Color.GRAY
090:                            : COMPLETED_COLOR;
091:                } else {
092:                    return PrintLinkTag.isInPrintMode(pageContext) ? Color.DARK_GRAY
093:                            : UNCOMPLETED_COLOR;
094:                }
095:            }
096:
097:            public Color getBackgroundColor() {
098:
099:                if (actual > estimate) {
100:                    return PrintLinkTag.isInPrintMode(pageContext) ? Color.BLACK
101:                            : EXCEEDED_COLOR;
102:                } else {
103:                    return UNWORKED_COLOR;
104:                }
105:            }
106:
107:            public double getBarValue() {
108:                if (actual == 0 && estimate == 0 && complete) {
109:                    return width;
110:                }
111:                return Math.min(actual, estimate);
112:            }
113:
114:            public double getMaxValue() {
115:                if (actual == 0 && estimate == 0 && complete) {
116:                    return width;
117:                }
118:                return Math.max(actual, estimate);
119:            }
120:
121:            public ProgressBarImage.Model createModel() {
122:                return new ProgressBarImage.Model(width, height, getBarValue(),
123:                        getForegroundColor(), getMaxValue(),
124:                        getBackgroundColor(), new DecimalFormat(
125:                                (HttpServletRequest) pageContext.getRequest()),
126:                        getCaptionValue());
127:            }
128:
129:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.