Source Code Cross Referenced for LegendProperties.java in  » Chart » Chart2D_1.9.6k » net » sourceforge » chart2d » 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 » Chart2D_1.9.6k » net.sourceforge.chart2d 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Chart2D, a java library for drawing two dimensional charts.
003:         * Copyright (C) 2001 Jason J. Simas
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2.1 of the License, or (at your option) any later version.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:         * Lesser General Public License for more details.
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         *
018:         * The author of this library may be contacted at:
019:         * E-mail:  jjsimas@users.sourceforge.net
020:         * Street Address:  J J Simas, 887 Tico Road, Ojai, CA 93023-3555 USA
021:         */package net.sourceforge.chart2d;
022:
023:        import java.awt.Color;
024:        import java.awt.Dimension;
025:        import java.awt.Font;
026:        import java.util.Vector;
027:
028:        /**
029:         * A data structure for holding the properties common to all legends.
030:         * Pass this to any number of Chart2D objects.
031:         */
032:        public final class LegendProperties extends Properties {
033:
034:            /**
035:             * The default is true.
036:             */
037:            public final static boolean LEGEND_EXISTENCE_DEFAULT = true;
038:
039:            /**
040:             * The default is String[0].
041:             */
042:            public static final String[] LEGEND_LABELS_TEXTS_DEFAULT = new String[0];
043:
044:            /**
045:             * The default is true.
046:             */
047:            public final static boolean LEGEND_BORDER_EXISTENCE_DEFAULT = true;
048:
049:            /**
050:             * The default is 2.
051:             */
052:            public final static int LEGEND_BORDER_THICKNESS_MODEL_DEFAULT = 2;
053:
054:            /**
055:             * The default is Color.gray.
056:             */
057:            public final static Color LEGEND_BORDER_COLOR_DEFAULT = Color.gray;
058:
059:            /**
060:             * The default is true.
061:             */
062:            public final static boolean LEGEND_GAP_EXISTENCE_DEFAULT = true;
063:
064:            /**
065:             * The default is 3.
066:             */
067:            public final static int LEGEND_GAP_THICKNESS_MODEL_DEFAULT = 3;
068:
069:            /**
070:             * The default is false.
071:             */
072:            public final static boolean LEGEND_BACKGROUND_EXISTENCE_DEFAULT = false;
073:
074:            /**
075:             * The default is Color.white.
076:             */
077:            public final static Color LEGEND_BACKGROUND_COLOR_DEFAULT = Color.white;
078:
079:            /**
080:             * The default is 11.
081:             */
082:            public final static int LEGEND_LABELS_FONT_POINT_MODEL_DEFAULT = 11;
083:
084:            /**
085:             * The default is "SansSerif".
086:             */
087:            public final static String LEGEND_LABELS_FONT_NAME_DEFAULT = "SansSerif";
088:
089:            /**
090:             * The default is Color.black.
091:             */
092:            public final static Color LEGEND_LABELS_FONT_COLOR_DEFAULT = Color.black;
093:
094:            /**
095:             * The default is Font.PLAIN.
096:             */
097:            public final static int LEGEND_LABELS_FONT_STYLE_DEFAULT = Font.PLAIN;
098:
099:            /**
100:             * The default is true.
101:             */
102:            public final static boolean LEGEND_BETWEEN_LABELS_OR_BULLETS_GAP_EXISTENCE_DEFAULT = true;
103:
104:            /**
105:             * The default is 5.
106:             */
107:            public final static int LEGEND_BETWEEN_LABELS_OR_BULLETS_GAP_THICKNESS_MODEL_DEFAULT = 5;
108:
109:            /**
110:             * The default is true.
111:             */
112:            public final static boolean LEGEND_BETWEEN_LABELS_AND_BULLETS_GAP_EXISTENCE_DEFAULT = true;
113:
114:            /**
115:             * The default is 3.
116:             */
117:            public final static int LEGEND_BETWEEN_LABELS_AND_BULLETS_GAP_THICKNESS_MODEL_DEFAULT = 3;
118:
119:            /**
120:             * The default is true.
121:             */
122:            public final static boolean LEGEND_BULLETS_OUTLINE_EXISTENCE_DEFAULT = true;
123:
124:            /**
125:             * The default is Color.black.
126:             */
127:            public final static Color LEGEND_BULLETS_OUTLINE_COLOR_DEFAULT = Color.black;
128:
129:            /**
130:             * The default is the Dimension (9, 9).
131:             */
132:            public final static Dimension LEGEND_BULLETS_SIZE_MODEL_DEFAULT = new Dimension(
133:                    9, 9);
134:
135:            private boolean legendExistence;
136:            private String[] legendLabelsTexts;
137:            private boolean legendBorderExistence;
138:            private int legendBorderThicknessModel;
139:            private Color legendBorderColor;
140:            private boolean legendGapExistence;
141:            private int legendGapThicknessModel;
142:            private boolean legendBackgroundExistence;
143:            private Color legendBackgroundColor;
144:            private int legendLabelsFontPointModel;
145:            private String legendLabelsFontName;
146:            private Color legendLabelsFontColor;
147:            private int legendLabelsFontStyle;
148:            private boolean legendBetweenLabelsOrBulletsGapExistence;
149:            private int legendBetweenLabelsOrBulletsGapThicknessModel;
150:            private boolean legendBetweenLabelsAndBulletsGapExistence;
151:            private int legendBetweenLabelsAndBulletsGapThicknessModel;
152:            private boolean legendBulletsOutlineExistence;
153:            private Color legendBulletsOutlineColor;
154:            private Dimension legendBulletsSizeModel;
155:
156:            private boolean needsUpdate = true;
157:            private final Vector chart2DVector = new Vector(5, 5);
158:            private final Vector needsUpdateVector = new Vector(5, 5);
159:
160:            /**
161:             * Creates a LegendProperties object with the documented default values.
162:             */
163:            public LegendProperties() {
164:
165:                needsUpdate = true;
166:                setLegendPropertiesToDefaults();
167:            }
168:
169:            /**
170:             * Creates a LegendProperties object with property values copied from another object.
171:             * The copying is a deep copy.
172:             * @param legendProps The properties to copy.
173:             */
174:            public LegendProperties(LegendProperties legendProps) {
175:
176:                needsUpdate = true;
177:                setLegendProperties(legendProps);
178:            }
179:
180:            /**
181:             * Sets all properties to their default values.
182:             */
183:            public final void setLegendPropertiesToDefaults() {
184:
185:                needsUpdate = true;
186:                setLegendExistence(LEGEND_EXISTENCE_DEFAULT);
187:                setLegendLabelsTexts(LEGEND_LABELS_TEXTS_DEFAULT);
188:                setLegendBorderExistence(LEGEND_BORDER_EXISTENCE_DEFAULT);
189:                setLegendBorderThicknessModel(LEGEND_BORDER_THICKNESS_MODEL_DEFAULT);
190:                setLegendBorderColor(LEGEND_BORDER_COLOR_DEFAULT);
191:                setLegendGapExistence(LEGEND_GAP_EXISTENCE_DEFAULT);
192:                setLegendGapThicknessModel(LEGEND_GAP_THICKNESS_MODEL_DEFAULT);
193:                setLegendBackgroundExistence(LEGEND_BACKGROUND_EXISTENCE_DEFAULT);
194:                setLegendBackgroundColor(LEGEND_BACKGROUND_COLOR_DEFAULT);
195:                setLegendLabelsFontPointModel(LEGEND_LABELS_FONT_POINT_MODEL_DEFAULT);
196:                setLegendLabelsFontName(LEGEND_LABELS_FONT_NAME_DEFAULT);
197:                setLegendLabelsFontColor(LEGEND_LABELS_FONT_COLOR_DEFAULT);
198:                setLegendLabelsFontStyle(LEGEND_LABELS_FONT_STYLE_DEFAULT);
199:                setLegendBetweenLabelsOrBulletsGapExistence(LEGEND_BETWEEN_LABELS_OR_BULLETS_GAP_EXISTENCE_DEFAULT);
200:                setLegendBetweenLabelsOrBulletsGapThicknessModel(LEGEND_BETWEEN_LABELS_OR_BULLETS_GAP_THICKNESS_MODEL_DEFAULT);
201:                setLegendBetweenLabelsAndBulletsGapExistence(LEGEND_BETWEEN_LABELS_AND_BULLETS_GAP_EXISTENCE_DEFAULT);
202:                setLegendBetweenLabelsAndBulletsGapThicknessModel(LEGEND_BETWEEN_LABELS_AND_BULLETS_GAP_THICKNESS_MODEL_DEFAULT);
203:                setLegendBulletsOutlineExistence(LEGEND_BULLETS_OUTLINE_EXISTENCE_DEFAULT);
204:                setLegendBulletsOutlineColor(LEGEND_BULLETS_OUTLINE_COLOR_DEFAULT);
205:                setLegendBulletsSizeModel(LEGEND_BULLETS_SIZE_MODEL_DEFAULT);
206:            }
207:
208:            /**
209:             * Sets all properties to be the values of another LegendProperties object.
210:             * The copying is a deep copy.
211:             * @param legendProps The properties to copy.
212:             */
213:            public final void setLegendProperties(LegendProperties legendProps) {
214:
215:                needsUpdate = true;
216:                setLegendExistence(legendProps.getLegendExistence());
217:                setLegendBorderExistence(legendProps.getLegendBorderExistence());
218:                setLegendBorderThicknessModel(legendProps
219:                        .getLegendBorderThicknessModel());
220:                setLegendBorderColor(legendProps.getLegendBorderColor());
221:                setLegendGapExistence(legendProps.getLegendGapExistence());
222:                String[] legendTexts = legendProps.getLegendLabelsTexts();
223:                String[] copiedLegendTexts = new String[legendTexts.length];
224:                for (int i = 0; i < legendTexts.length; ++i)
225:                    copiedLegendTexts[i] = legendTexts[i];
226:                setLegendLabelsTexts(copiedLegendTexts);
227:                setLegendGapThicknessModel(legendProps
228:                        .getLegendGapThicknessModel());
229:                setLegendBackgroundExistence(legendProps
230:                        .getLegendBackgroundExistence());
231:                setLegendBackgroundColor(legendProps.getLegendBackgroundColor());
232:                setLegendLabelsFontPointModel(legendProps
233:                        .getLegendLabelsFontPointModel());
234:                setLegendLabelsFontName(legendProps.getLegendLabelsFontName());
235:                setLegendLabelsFontColor(legendProps.getLegendLabelsFontColor());
236:                setLegendLabelsFontStyle(legendProps.getLegendLabelsFontStyle());
237:                setLegendBetweenLabelsOrBulletsGapExistence(legendProps
238:                        .getLegendBetweenLabelsOrBulletsGapExistence());
239:                setLegendBetweenLabelsOrBulletsGapThicknessModel(legendProps
240:                        .getLegendBetweenLabelsOrBulletsGapThicknessModel());
241:                setLegendBetweenLabelsAndBulletsGapExistence(legendProps
242:                        .getLegendBetweenLabelsAndBulletsGapExistence());
243:                setLegendBetweenLabelsAndBulletsGapThicknessModel(legendProps
244:                        .getLegendBetweenLabelsAndBulletsGapThicknessModel());
245:                setLegendBulletsOutlineExistence(legendProps
246:                        .getLegendBulletsOutlineExistence());
247:                setLegendBulletsOutlineColor(legendProps
248:                        .getLegendBulletsOutlineColor());
249:                setLegendBulletsSizeModel(new Dimension(legendProps
250:                        .getLegendBulletsSizeModel()));
251:            }
252:
253:            /**
254:             * Sets whether there will exist a legend on the chart.
255:             * @param existence If true, there will be a legend for the chart.
256:             */
257:            public final void setLegendExistence(boolean existence) {
258:
259:                needsUpdate = true;
260:                legendExistence = existence;
261:            }
262:
263:            /**
264:             * Sets the texts of the legend labels.  The number of texts must be
265:             * equal to the total number of data sets of this chart.
266:             * @param texts The texts for the legend labels.
267:             */
268:            public final void setLegendLabelsTexts(String[] texts) {
269:
270:                needsUpdate = true;
271:                legendLabelsTexts = texts;
272:            }
273:
274:            /**
275:             * Sets whether there will exist a border around the legend.
276:             * @param existence If true, there will be a border around the legend.
277:             */
278:            public final void setLegendBorderExistence(boolean existence) {
279:
280:                needsUpdate = true;
281:                legendBorderExistence = existence;
282:            }
283:
284:            /**
285:             * Sets the thickness of the border around the legend for the chart's
286:             * model size.
287:             * @param thickness The model thicknes for the chart.
288:             */
289:            public final void setLegendBorderThicknessModel(int thickness) {
290:
291:                needsUpdate = true;
292:                legendBorderThicknessModel = thickness;
293:            }
294:
295:            /**
296:             * Sets the color of the border around the legend.
297:             * @param color The color of the legend's border.
298:             */
299:            public final void setLegendBorderColor(Color color) {
300:
301:                needsUpdate = true;
302:                legendBorderColor = color;
303:            }
304:
305:            /**
306:             * Sets whether a gap between the legend's border or edge and the
307:             * legend's inner components exists.
308:             * @param existence If true, then a gap exists.
309:             */
310:            public final void setLegendGapExistence(boolean existence) {
311:
312:                needsUpdate = true;
313:                legendGapExistence = existence;
314:            }
315:
316:            /**
317:             * Sets the thickness of the legend's gap for the chart's model size.
318:             * @param thickness The model thickness of the legend's gap.
319:             */
320:            public final void setLegendGapThicknessModel(int thickness) {
321:
322:                needsUpdate = true;
323:                legendGapThicknessModel = thickness;
324:            }
325:
326:            /**
327:             * Sets whether the legend will have a painted background or not.  If not
328:             * whatever is behind the legend will show through the spaces of the legend.
329:             * @param existence If true, the background of the legend will be painted.
330:             */
331:            public final void setLegendBackgroundExistence(boolean existence) {
332:
333:                needsUpdate = true;
334:                legendBackgroundExistence = existence;
335:            }
336:
337:            /**
338:             * Sets the color of the legend's background.
339:             * @param color The color of the legend's background.
340:             */
341:            public final void setLegendBackgroundColor(Color color) {
342:
343:                needsUpdate = true;
344:                legendBackgroundColor = color;
345:            }
346:
347:            /**
348:             * Sets the point of the font of the legend's labels for the chart's
349:             * model size.
350:             * @param point The model font point of the legend's labels.
351:             */
352:            public final void setLegendLabelsFontPointModel(int point) {
353:
354:                needsUpdate = true;
355:                legendLabelsFontPointModel = point;
356:            }
357:
358:            /**
359:             * Sets name of the font of the legend's labels.
360:             * Accepts all values accepted by java.awt.Font.
361:             * @param name The name of the font for the legend's labels.
362:             */
363:            public final void setLegendLabelsFontName(String name) {
364:
365:                needsUpdate = true;
366:                legendLabelsFontName = name;
367:            }
368:
369:            /**
370:             *  Sets the color of the font of the legend's labels.
371:             *  @param color The color of the font of the legend's labels.
372:             */
373:            public final void setLegendLabelsFontColor(Color color) {
374:
375:                needsUpdate = true;
376:                legendLabelsFontColor = color;
377:            }
378:
379:            /**
380:             * Sets the style of the font of the legend's labels.
381:             * Accepts all values that java.awt.Font accepts.
382:             * @param style The style of the font of the legend's labels.
383:             */
384:            public final void setLegendLabelsFontStyle(int style) {
385:
386:                needsUpdate = true;
387:                legendLabelsFontStyle = style;
388:            }
389:
390:            /**
391:             * Sets whether a gap between the legend's bullets or labels exists in
392:             * their vertical placement.
393:             * @param existence If true, a gap exists.
394:             */
395:            public final void setLegendBetweenLabelsOrBulletsGapExistence(
396:                    boolean existence) {
397:
398:                needsUpdate = true;
399:                legendBetweenLabelsOrBulletsGapExistence = existence;
400:            }
401:
402:            /**
403:             * Sets the thickness of the gap between the legend's bullets or labels
404:             * exists in their vertical placement, for the chart's model size.
405:             * @param thickness The model thickness of the gap.
406:             */
407:            public final void setLegendBetweenLabelsOrBulletsGapThicknessModel(
408:                    int thickness) {
409:
410:                needsUpdate = true;
411:                legendBetweenLabelsOrBulletsGapThicknessModel = thickness;
412:            }
413:
414:            /**
415:             * Sets whether the gap between the legend's bullets and labels exists
416:             * in their horizontal placement.
417:             * @param existence If true, a gap exists.
418:             */
419:            public final void setLegendBetweenLabelsAndBulletsGapExistence(
420:                    boolean existence) {
421:
422:                needsUpdate = true;
423:                legendBetweenLabelsAndBulletsGapExistence = existence;
424:            }
425:
426:            /**
427:             * Sets the thickness of the gap between the legend's bullets and labels
428:             * in their horizontal placement, for the chart's model size.
429:             * @param thickness The model thickness of teh gap.
430:             */
431:            public final void setLegendBetweenLabelsAndBulletsGapThicknessModel(
432:                    int thickness) {
433:
434:                needsUpdate = true;
435:                legendBetweenLabelsAndBulletsGapThicknessModel = thickness;
436:            }
437:
438:            /**
439:             * Sets whether a thin line is painted around the legend's bullets.
440:             * @param existence If true, the legend's bullets will be outlined.
441:             */
442:            public final void setLegendBulletsOutlineExistence(boolean existence) {
443:
444:                needsUpdate = true;
445:                legendBulletsOutlineExistence = existence;
446:            }
447:
448:            /**
449:             * Sets the color of the legend's bullets outline.
450:             * @param color The color of the legend's bullets outline.
451:             */
452:            public final void setLegendBulletsOutlineColor(Color color) {
453:
454:                needsUpdate = true;
455:                legendBulletsOutlineColor = color;
456:            }
457:
458:            /**
459:             * Sets the size of the legend's bullets for the chart's model size.
460:             * @param size The size of the legend's bullets.
461:             */
462:            public final void setLegendBulletsSizeModel(Dimension size) {
463:
464:                needsUpdate = true;
465:                legendBulletsSizeModel = size;
466:            }
467:
468:            /**
469:             * Gets whether there will exist a legend on the chart.
470:             * @return boolean If true, there will be a legend for the chart.
471:             */
472:            public final boolean getLegendExistence() {
473:                return legendExistence;
474:            }
475:
476:            /**
477:             * Gets the texts of the legend labels.  The number of texts must be
478:             * equal to the total number of data sets of this chart.
479:             * @return String[] The texts for the legend labels.
480:             */
481:            public final String[] getLegendLabelsTexts() {
482:                return legendLabelsTexts;
483:            }
484:
485:            /**
486:             * Gets whether there will exist a border around the legend.
487:             * @return boolean If true, there will be a border around the legend.
488:             */
489:            public final boolean getLegendBorderExistence() {
490:                return legendBorderExistence;
491:            }
492:
493:            /**
494:             * Gets the thickness of the border around the legend for the chart's
495:             * model size.
496:             * @return int The model thicknes for the chart.
497:             */
498:            public final int getLegendBorderThicknessModel() {
499:                return legendBorderThicknessModel;
500:            }
501:
502:            /**
503:             * Gets the color of the border around the legend.
504:             * @return Color The color of the legend's border.
505:             */
506:            public final Color getLegendBorderColor() {
507:                return legendBorderColor;
508:            }
509:
510:            /**
511:             * Gets whether a gap between the legend's border or edge and the
512:             * legend's inner components exists.
513:             * @return boolean If true, then a gap exists.
514:             */
515:            public final boolean getLegendGapExistence() {
516:                return legendGapExistence;
517:            }
518:
519:            /**
520:             * Gets the thickness of the legend's gap for the chart's model size.
521:             * @return int The model thickness of the legend's gap.
522:             */
523:            public final int getLegendGapThicknessModel() {
524:                return legendGapThicknessModel;
525:            }
526:
527:            /**
528:             * Gets whether the legend will have a painted background or not.  If not
529:             * whatever is behind the legend will show through the spaces of the legend.
530:             * @return boolean If true, the background of the legend will be painted.
531:             */
532:            public final boolean getLegendBackgroundExistence() {
533:                return legendBackgroundExistence;
534:            }
535:
536:            /**
537:             * Gets the color of the legend's background.
538:             * @return Color The color of the legend's background.
539:             */
540:            public final Color getLegendBackgroundColor() {
541:                return legendBackgroundColor;
542:            }
543:
544:            /**
545:             * Gets the point of the font of the legend's labels for the chart's
546:             * model size.
547:             * @return int The model font point of the legend's labels.
548:             */
549:            public final int getLegendLabelsFontPointModel() {
550:                return legendLabelsFontPointModel;
551:            }
552:
553:            /**
554:             * Gets name of the font of the legend's labels.
555:             * Accepts all values accepted by java.awt.Font.
556:             * @return String The name of the font for the legend's labels.
557:             */
558:            public final String getLegendLabelsFontName() {
559:                return legendLabelsFontName;
560:            }
561:
562:            /**
563:             *  Gets the color of the font of the legend's labels.
564:             *  @return Color The color of the font of the legend's labels.
565:             */
566:            public final Color getLegendLabelsFontColor() {
567:                return legendLabelsFontColor;
568:            }
569:
570:            /**
571:             * Gets the style of the font of the legend's labels.
572:             * Accepts all values that java.awt.Font accepts.
573:             * @return int The style of the font of the legend's labels.
574:             */
575:            public final int getLegendLabelsFontStyle() {
576:                return legendLabelsFontStyle;
577:            }
578:
579:            /**
580:             * Gets whether a gap between the legend's bullets or labels exists in
581:             * their vertical placement.
582:             * @return boolean If true, a gap exists.
583:             */
584:            public final boolean getLegendBetweenLabelsOrBulletsGapExistence() {
585:                return legendBetweenLabelsOrBulletsGapExistence;
586:            }
587:
588:            /**
589:             * Gets the thickness of the gap between the legend's bullets or labels
590:             * exists in their vertical placement, for the chart's model size.
591:             * @return int The model thickness of the gap.
592:             */
593:            public final int getLegendBetweenLabelsOrBulletsGapThicknessModel() {
594:                return legendBetweenLabelsOrBulletsGapThicknessModel;
595:            }
596:
597:            /**
598:             * Gets whether the gap between the legend's bullets and labels exists
599:             * in their horizontal placement.
600:             * @return boolean If true, a gap exists.
601:             */
602:            public final boolean getLegendBetweenLabelsAndBulletsGapExistence() {
603:                return legendBetweenLabelsAndBulletsGapExistence;
604:            }
605:
606:            /**
607:             * Gets the thickness of the gap between the legend's bullets and labels
608:             * in their horizontal placement, for the chart's model size.
609:             * @return int The model thickness of teh gap.
610:             */
611:            public final int getLegendBetweenLabelsAndBulletsGapThicknessModel() {
612:                return legendBetweenLabelsAndBulletsGapThicknessModel;
613:            }
614:
615:            /**
616:             * Gets whether a thin line is painted around the legend's bullets.
617:             * @return boolean If true, the legend's bullets will be outlined.
618:             */
619:            public final boolean getLegendBulletsOutlineExistence() {
620:                return legendBulletsOutlineExistence;
621:            }
622:
623:            /**
624:             * Gets the color of the legend's bullets outline.
625:             * @return Color The color of the legend's bullets outline.
626:             */
627:            public final Color getLegendBulletsOutlineColor() {
628:                return legendBulletsOutlineColor;
629:            }
630:
631:            /**
632:             * Gets the size of the legend's bullets for the chart's model size.
633:             * @return Dimension The size of the legend's bullets.
634:             */
635:            public final Dimension getLegendBulletsSizeModel() {
636:                return legendBulletsSizeModel;
637:            }
638:
639:            /**
640:             * Gets whether this object needs to be updated with new properties.
641:             * @param chart2D The object that may need to be updated.
642:             * @return If true then needs update.
643:             */
644:            final boolean getChart2DNeedsUpdate(Chart2D chart2D) {
645:
646:                if (needsUpdate)
647:                    return true;
648:
649:                int index = -1;
650:                if ((index = chart2DVector.indexOf(chart2D)) != -1) {
651:                    return ((Boolean) needsUpdateVector.get(index))
652:                            .booleanValue();
653:                }
654:
655:                return false;
656:            }
657:
658:            /**
659:             * Adds a Chart2D to the set of objects using these properties.
660:             * @param chart2D The Object2D to add.
661:             */
662:            final void addChart2D(Chart2D chart2D) {
663:
664:                if (!chart2DVector.contains(chart2D)) {
665:                    chart2DVector.add(chart2D);
666:                    needsUpdateVector.add(new Boolean(true));
667:                }
668:            }
669:
670:            /**
671:             * Removes a Chart2D from the set of objects using these properties.
672:             * @param chart2D The Object2D to add.
673:             */
674:            final void removeChart2D(Chart2D chart2D) {
675:
676:                int index = -1;
677:                if ((index = chart2DVector.indexOf(chart2D)) != -1) {
678:                    chart2DVector.remove(index);
679:                    needsUpdateVector.remove(index);
680:                }
681:            }
682:
683:            /**
684:             * Validates the properties of this object.
685:             * If debug is true then prints a messages indicating whether each property is valid.
686:             * Returns true if all the properties were valid and false otherwise.
687:             * @param debug If true then will print status messages.
688:             * @return If true then valid.
689:             */
690:            final boolean validate(boolean debug) {
691:
692:                if (debug)
693:                    System.out.println("Validating Chart2DProperties");
694:
695:                boolean valid = true;
696:
697:                if (legendLabelsTexts == null) {
698:                    valid = false;
699:                    if (debug)
700:                        System.out.println("LegendLabelsTexts == null");
701:                }
702:                if (legendBorderThicknessModel < 0) {
703:                    valid = false;
704:                    if (debug)
705:                        System.out.println("LegendBorderThicknessModel < 0");
706:                }
707:                if (legendBorderColor == null) {
708:                    valid = false;
709:                    if (debug)
710:                        System.out.println("LegendBorderColor == null");
711:                }
712:                if (legendGapThicknessModel < 0) {
713:                    valid = false;
714:                    if (debug)
715:                        System.out.println("LegendGapThicknessModel < 0");
716:                }
717:                if (legendBackgroundColor == null) {
718:                    valid = false;
719:                    if (debug)
720:                        System.out.println("LegendBackgroundColor == null");
721:                }
722:                if (legendLabelsFontPointModel < 0) {
723:                    valid = false;
724:                    if (debug)
725:                        System.out.println("LegendLabelsFontPointModel < 0");
726:                }
727:                if (legendLabelsFontName == null
728:                        || !isFontNameExists(legendLabelsFontName)) {
729:                    valid = false;
730:                    if (debug)
731:                        System.out.println("Problem with LegendLabelsFontName");
732:                }
733:                if (legendLabelsFontColor == null) {
734:                    valid = false;
735:                    if (debug)
736:                        System.out.println("LegendLabelsFontColor == null");
737:                }
738:                if (legendLabelsFontStyle != Font.PLAIN
739:                        && legendLabelsFontStyle != Font.ITALIC
740:                        && legendLabelsFontStyle != Font.BOLD
741:                        && legendLabelsFontStyle != (Font.ITALIC | Font.BOLD)) {
742:                    valid = false;
743:                    if (debug)
744:                        System.out
745:                                .println("Problem with LegendLabelsFontStyle");
746:                }
747:                if (legendBetweenLabelsOrBulletsGapThicknessModel < 0) {
748:                    valid = false;
749:                    if (debug)
750:                        System.out
751:                                .println("LegendBetweenLabelsOrBulletsGapThicknessModel < 0");
752:                }
753:                if (legendBetweenLabelsAndBulletsGapThicknessModel < 0) {
754:                    valid = false;
755:                    if (debug)
756:                        System.out
757:                                .println("LegendBetweenLabelsAndBulletsGapThicknessModel < 0");
758:                }
759:                if (legendBulletsOutlineColor == null) {
760:                    valid = false;
761:                    if (debug)
762:                        System.out.println("LegendBulletsOutlineColor == null");
763:                }
764:                if (legendBulletsSizeModel == null
765:                        || legendBulletsSizeModel.width < 0
766:                        || legendBulletsSizeModel.height < 0) {
767:                    valid = false;
768:                    if (debug)
769:                        System.out
770:                                .println("Problem with LegendBulletsSizeModel");
771:                }
772:
773:                if (debug) {
774:                    if (valid)
775:                        System.out.println("LegendProperties was valid");
776:                    else
777:                        System.out.println("LegendProperties was invalid");
778:                }
779:
780:                return valid;
781:            }
782:
783:            /**
784:             * Updates the properties of this Chart2D.
785:             * @param chart2D The object to update.
786:             */
787:            final void updateChart2D(Chart2D chart2D) {
788:
789:                if (getChart2DNeedsUpdate(chart2D)) {
790:
791:                    if (needsUpdate) {
792:                        needsUpdate = false;
793:                        for (int i = 0; i < needsUpdateVector.size(); ++i) {
794:                            needsUpdateVector.set(i, new Boolean(true));
795:                        }
796:                    }
797:
798:                    int index = -1;
799:                    if ((index = chart2DVector.indexOf(chart2D)) != -1) {
800:                        needsUpdateVector.set(index, new Boolean(false));
801:                    }
802:                }
803:            }
804:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.