Source Code Cross Referenced for ShapeElement.java in  » Report » pentaho-report » org » jfree » report » 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 » Report » pentaho report » org.jfree.report 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * ===========================================
003:         * JFreeReport : a free Java reporting library
004:         * ===========================================
005:         *
006:         * Project Info:  http://reporting.pentaho.org/
007:         *
008:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
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 the License, or (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
015:         * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016:         * See the GNU Lesser General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU Lesser General Public License along with this
019:         * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020:         * Boston, MA 02111-1307, USA.
021:         *
022:         * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
023:         * in the United States and other countries.]
024:         *
025:         * ------------
026:         * ShapeElement.java
027:         * ------------
028:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029:         */package org.jfree.report;
030:
031:        import java.awt.BasicStroke;
032:        import java.awt.Stroke;
033:
034:        import org.jfree.report.style.ElementDefaultStyleSheet;
035:        import org.jfree.report.style.ElementStyleKeys;
036:        import org.jfree.report.style.StyleKey;
037:
038:        /**
039:         * Used to draw shapes (typically lines and boxes) on a report band. The drawing style of
040:         * the shapes contained in that element can be controled by using the StyleKeys FILL_SHAPE
041:         * and DRAW_SHAPE.
042:         *
043:         * @author David Gilbert
044:         * @author Thomas Morgner
045:         */
046:        public class ShapeElement extends Element {
047:            /**
048:             * The default stroke.
049:             */
050:            public static final BasicStroke DEFAULT_STROKE = new BasicStroke(
051:                    0.5f);
052:
053:            /**
054:             * A key for the 'fill-shape' style.
055:             */
056:            public static final StyleKey FILL_SHAPE = ElementStyleKeys.FILL_SHAPE;
057:
058:            /**
059:             * A key for the 'draw-shape' style.
060:             */
061:            public static final StyleKey DRAW_SHAPE = ElementStyleKeys.DRAW_SHAPE;
062:
063:            /**
064:             * A default style sheet for shape elements. This defined a default stroke for all
065:             * shapes.
066:             */
067:            private static class ShapeElementDefaultStyleSheet extends
068:                    ElementDefaultStyleSheet {
069:                /**
070:                 * Creates a new style-sheet. The stylesheet is not modifiable
071:                 */
072:                protected ShapeElementDefaultStyleSheet() {
073:                    super ("GlobalShapeElementDefault");
074:                    // unlock the write protection
075:                    setLocked(false);
076:                    setStyleProperty(ElementStyleKeys.STROKE,
077:                            ShapeElement.DEFAULT_STROKE);
078:                    setBooleanStyleProperty(ElementStyleKeys.FILL_SHAPE, false);
079:                    setBooleanStyleProperty(ElementStyleKeys.DRAW_SHAPE, false);
080:                    // and lock the stylesheet again...
081:                    setLocked(true);
082:                }
083:            }
084:
085:            /**
086:             * A shared default style sheet for shape elements.
087:             */
088:            private static ElementDefaultStyleSheet defaultShapeStyle;
089:
090:            /**
091:             * Returns the default style-sheet for shape elements.
092:             *
093:             * @return a default style sheet that can be shared among shape elements.
094:             */
095:            public static synchronized ElementDefaultStyleSheet getDefaultStyle() {
096:                if (defaultShapeStyle == null) {
097:                    defaultShapeStyle = new ShapeElementDefaultStyleSheet();
098:                }
099:                return defaultShapeStyle;
100:            }
101:
102:            /**
103:             * Constructs a shape element.
104:             */
105:            public ShapeElement() {
106:            }
107:
108:            /**
109:             * Returns the ShapeElement specific global stylesheet.
110:             *
111:             * @return the global stylesheet.
112:             */
113:            protected ElementDefaultStyleSheet createGlobalDefaultStyle() {
114:                return ShapeElement.getDefaultStyle();
115:            }
116:
117:            /**
118:             * Returns a string describing the element.  Useful for debugging.
119:             *
120:             * @return the string.
121:             */
122:            public String toString() {
123:                final StringBuffer b = new StringBuffer();
124:                b.append("Shape={ name=");
125:                b.append(getName());
126:                b.append('}');
127:
128:                return b.toString();
129:            }
130:
131:            /**
132:             * Returns true if the element outline should be drawn, and false otherwise.
133:             * <p/>
134:             * This is determined by the element's style-sheet.
135:             *
136:             * @return true or false.
137:             */
138:            public boolean isShouldDraw() {
139:                return getStyle().getBooleanStyleProperty(
140:                        ElementStyleKeys.DRAW_SHAPE);
141:            }
142:
143:            /**
144:             * Returns true of the element should be filled, and false otherwise.
145:             * <p/>
146:             * This is determined by the element's style-sheet.
147:             *
148:             * @return true or false.
149:             */
150:            public boolean isShouldFill() {
151:                return getStyle().getBooleanStyleProperty(
152:                        ElementStyleKeys.FILL_SHAPE);
153:            }
154:
155:            /**
156:             * Sets a flag that controls whether or not the outline of the shape is drawn.
157:             *
158:             * @param shouldDraw the flag.
159:             */
160:            public void setShouldDraw(final boolean shouldDraw) {
161:                getStyle().setStyleProperty(ElementStyleKeys.DRAW_SHAPE,
162:                        shouldDraw ? Boolean.TRUE : Boolean.FALSE);
163:            }
164:
165:            /**
166:             * Sets a flag that controls whether or not the area of the shape is filled.
167:             *
168:             * @param shouldFill the flag.
169:             */
170:            public void setShouldFill(final boolean shouldFill) {
171:                getStyle().setStyleProperty(ElementStyleKeys.FILL_SHAPE,
172:                        shouldFill ? Boolean.TRUE : Boolean.FALSE);
173:            }
174:
175:            /**
176:             * Returns true if the shape should be scaled, and false otherwise.
177:             * <p/>
178:             * This is determined by the element's style-sheet.
179:             *
180:             * @return true or false.
181:             */
182:            public boolean isScale() {
183:                return getStyle().getBooleanStyleProperty(
184:                        ElementStyleKeys.SCALE);
185:            }
186:
187:            /**
188:             * Sets a flag that controls whether the shape should be scaled to fit the element
189:             * bounds.
190:             *
191:             * @param scale the flag.
192:             */
193:            public void setScale(final boolean scale) {
194:                getStyle().setStyleProperty(ElementStyleKeys.SCALE,
195:                        scale ? Boolean.TRUE : Boolean.FALSE);
196:            }
197:
198:            /**
199:             * Returns true if the shape's aspect ratio should be preserved, and false otherwise.
200:             * <p/>
201:             * This is determined by the element's style-sheet.
202:             *
203:             * @return true or false.
204:             */
205:            public boolean isKeepAspectRatio() {
206:                return getStyle().getBooleanStyleProperty(
207:                        ElementStyleKeys.KEEP_ASPECT_RATIO);
208:            }
209:
210:            /**
211:             * Sets a flag that controls whether the shape should be scaled to fit the element
212:             * bounds.
213:             *
214:             * @param kar the flag.
215:             */
216:            public void setKeepAspectRatio(final boolean kar) {
217:                getStyle().setStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO,
218:                        kar ? Boolean.TRUE : Boolean.FALSE);
219:            }
220:
221:            /**
222:             * A string for the content type.
223:             */
224:            public static final String CONTENT_TYPE = "shape/generic";
225:
226:            /**
227:             * Returns the content type, in this case 'shape/generic'.
228:             *
229:             * @return the content type.
230:             */
231:            public String getContentType() {
232:                return ShapeElement.CONTENT_TYPE;
233:            }
234:
235:            /**
236:             * Returns the stroke.
237:             *
238:             * @return the stroke.
239:             */
240:            public Stroke getStroke() {
241:                return (Stroke) getStyle().getStyleProperty(
242:                        ElementStyleKeys.STROKE);
243:            }
244:
245:            /**
246:             * Sets the stroke.
247:             *
248:             * @param stroke the stroke.
249:             */
250:            public void setStroke(final Stroke stroke) {
251:                getStyle().setStyleProperty(ElementStyleKeys.STROKE, stroke);
252:            }
253:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.