Source Code Cross Referenced for Object2DProperties.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 Object2D objects.
030:         * A Object2D object is one with an encolosing area and title.
031:         * Pass this to any number of Object2D objects.
032:         */
033:        public final class Object2DProperties extends Properties {
034:
035:            /**
036:             * Signifies left.
037:             */
038:            public static final int LEFT = 0;
039:
040:            /**
041:             * Signifies right.
042:             */
043:            public static final int RIGHT = 1;
044:
045:            /**
046:             * Signifies top.
047:             */
048:            public static final int TOP = 2;
049:
050:            /**
051:             * Signifies bottom.
052:             */
053:            public static final int BOTTOM = 3;
054:
055:            /**
056:             * Signifies none.
057:             */
058:            public static final int NONE = 6;
059:
060:            /**
061:             * The default is true.
062:             */
063:            public static final boolean OBJECT_MAGNIFY_WHEN_RESIZE_DEFAULT = true;
064:
065:            /**
066:             * The default is true.
067:             */
068:            public final static boolean OBJECT_BORDER_EXISTENCE_DEFAULT = true;
069:
070:            /**
071:             * The default is 2.
072:             */
073:            public final static int OBJECT_BORDER_THICKNESS_MODEL_DEFAULT = 2;
074:
075:            /**
076:             * The default is Color.black.
077:             */
078:            public final static Color OBJECT_BORDER_COLOR_DEFAULT = Color.black;
079:
080:            /**
081:             * The default is true.
082:             */
083:            public final static boolean OBJECT_GAP_EXISTENCE_DEFAULT = true;
084:
085:            /**
086:             * The default is 5.
087:             */
088:            public final static int OBJECT_GAP_THICKNESS_MODEL_DEFAULT = 5;
089:
090:            /**
091:             * The default is true.
092:             */
093:            public final static boolean OBJECT_BACKGROUND_EXISTENCE_DEFAULT = true;
094:
095:            /**
096:             * The default is new Color (215, 215, 215).
097:             */
098:            public final static Color OBJECT_BACKGROUND_COLOR_DEFAULT = new Color(
099:                    215, 215, 255);
100:
101:            /**
102:             * The default is TOP.
103:             */
104:            public final static int OBJECT_BACKGROUND_LIGHT_SOURCE_DEFAULT = TOP;
105:
106:            /**
107:             * The default is true.
108:             */
109:            public final static boolean OBJECT_TITLE_EXISTENCE_DEFAULT = true;
110:
111:            /**
112:             * The default is "".
113:             */
114:            public final static String OBJECT_TITLE_TEXT_DEFAULT = "";
115:
116:            /**
117:             * The default is 12.
118:             */
119:            public final static int OBJECT_TITLE_FONT_POINT_MODEL_DEFAULT = 12;
120:
121:            /**
122:             * The default is "SansSerif".
123:             */
124:            public final static String OBJECT_TITLE_FONT_NAME_DEFAULT = "SansSerif";
125:
126:            /**
127:             * The default is Color.black.
128:             */
129:            public final static Color OBJECT_TITLE_FONT_COLOR_DEFAULT = Color.black;
130:
131:            /**
132:             * The default is Font.PLAIN.
133:             */
134:            public final static int OBJECT_TITLE_FONT_STYLE_DEFAULT = Font.PLAIN;
135:
136:            /**
137:             * The default is true.
138:             */
139:            public final static boolean OBJECT_TITLE_BETWEEN_REST_GAP_EXISTENCE_DEFAULT = true;
140:
141:            /**
142:             * The default is 3.
143:             */
144:            public final static int OBJECT_TITLE_BETWEEN_REST_GAP_THICKNESS_MODEL_DEFAULT = 3;
145:
146:            private boolean objectMagnifyWhenResize;
147:            private boolean objectBorderExistence;
148:            private int objectBorderThicknessModel;
149:            private Color objectBorderColor;
150:            private boolean objectGapExistence;
151:            private int objectGapThicknessModel;
152:            private boolean objectBackgroundExistence;
153:            private Color objectBackgroundColor;
154:            private int objectBackgroundLightSource;
155:            private boolean objectTitleExistence;
156:            private String objectTitleText;
157:            private int objectTitleFontPointModel;
158:            private String objectTitleFontName;
159:            private Color objectTitleFontColor;
160:            private int objectTitleFontStyle;
161:            private boolean objectTitleBetweenRestGapExistence;
162:            private int objectTitleBetweenRestGapThicknessModel;
163:
164:            private boolean needsUpdate = true;
165:            private final Vector object2DVector = new Vector(5, 5);
166:            private final Vector needsUpdateVector = new Vector(5, 5);
167:
168:            /**
169:             * Creates a Object2DProperties object with the documented default values.
170:             */
171:            public Object2DProperties() {
172:
173:                needsUpdate = true;
174:                setObject2DPropertiesToDefaults();
175:            }
176:
177:            /**
178:             * Creates a Object2DProperties object with property values copied from another object.
179:             * The copying is a deep copy.
180:             * @param object2DProps The properties to copy.
181:             */
182:            public Object2DProperties(Object2DProperties object2DProps) {
183:
184:                needsUpdate = true;
185:                setObject2DProperties(object2DProps);
186:            }
187:
188:            /**
189:             * Sets all properties to their default values.
190:             */
191:            public final void setObject2DPropertiesToDefaults() {
192:
193:                needsUpdate = true;
194:                setObjectMagnifyWhenResize(OBJECT_MAGNIFY_WHEN_RESIZE_DEFAULT);
195:                setObjectBorderExistence(OBJECT_BORDER_EXISTENCE_DEFAULT);
196:                setObjectBorderThicknessModel(OBJECT_BORDER_THICKNESS_MODEL_DEFAULT);
197:                setObjectBorderColor(OBJECT_BORDER_COLOR_DEFAULT);
198:                setObjectGapExistence(OBJECT_GAP_EXISTENCE_DEFAULT);
199:                setObjectGapThicknessModel(OBJECT_GAP_THICKNESS_MODEL_DEFAULT);
200:                setObjectBackgroundExistence(OBJECT_BACKGROUND_EXISTENCE_DEFAULT);
201:                setObjectBackgroundColor(OBJECT_BACKGROUND_COLOR_DEFAULT);
202:                setObjectBackgroundLightSource(OBJECT_BACKGROUND_LIGHT_SOURCE_DEFAULT);
203:                setObjectTitleExistence(OBJECT_TITLE_EXISTENCE_DEFAULT);
204:                setObjectTitleText(OBJECT_TITLE_TEXT_DEFAULT);
205:                setObjectTitleFontPointModel(OBJECT_TITLE_FONT_POINT_MODEL_DEFAULT);
206:                setObjectTitleFontName(OBJECT_TITLE_FONT_NAME_DEFAULT);
207:                setObjectTitleFontColor(OBJECT_TITLE_FONT_COLOR_DEFAULT);
208:                setObjectTitleFontStyle(OBJECT_TITLE_FONT_STYLE_DEFAULT);
209:                setObjectTitleBetweenRestGapExistence(OBJECT_TITLE_BETWEEN_REST_GAP_EXISTENCE_DEFAULT);
210:                setObjectTitleBetweenRestGapThicknessModel(OBJECT_TITLE_BETWEEN_REST_GAP_THICKNESS_MODEL_DEFAULT);
211:            }
212:
213:            /**
214:             * Sets all properties to be the values of another Object2DProperties object.
215:             * The copying is a deep copy.
216:             * @param object2DProps The properties to copy.
217:             */
218:            public final void setObject2DProperties(
219:                    Object2DProperties object2DProps) {
220:
221:                needsUpdate = true;
222:                setObjectMagnifyWhenResize(object2DProps
223:                        .getObjectMagnifyWhenResize());
224:                setObjectBorderExistence(object2DProps
225:                        .getObjectBorderExistence());
226:                setObjectBorderThicknessModel(object2DProps
227:                        .getObjectBorderThicknessModel());
228:                setObjectBorderColor(object2DProps.getObjectBorderColor());
229:                setObjectGapExistence(object2DProps.getObjectGapExistence());
230:                setObjectGapThicknessModel(object2DProps
231:                        .getObjectGapThicknessModel());
232:                setObjectBackgroundExistence(object2DProps
233:                        .getObjectBackgroundExistence());
234:                setObjectBackgroundColor(object2DProps
235:                        .getObjectBackgroundColor());
236:                setObjectBackgroundLightSource(object2DProps
237:                        .getObjectBackgroundLightSource());
238:                setObjectTitleExistence(object2DProps.getObjectTitleExistence());
239:                setObjectTitleText(object2DProps.getObjectTitleText());
240:                setObjectTitleFontPointModel(object2DProps
241:                        .getObjectTitleFontPointModel());
242:                setObjectTitleFontName(object2DProps.getObjectTitleFontName());
243:                setObjectTitleFontColor(object2DProps.getObjectTitleFontColor());
244:                setObjectTitleFontStyle(object2DProps.getObjectTitleFontStyle());
245:                setObjectTitleBetweenRestGapExistence(object2DProps
246:                        .getObjectTitleBetweenRestGapExistence());
247:                setObjectTitleBetweenRestGapThicknessModel(object2DProps
248:                        .getObjectTitleBetweenRestGapThicknessModel());
249:            }
250:
251:            /**
252:             * Sets whether a object's components will grow or shrink as the size of
253:             * the space allocated to the object grows or shrinks.
254:             * The Object's preferred size will be the model size (i.e. the size at which it isn't magnified).
255:             * @param magnify If true, the object will be magnified on resize.
256:             */
257:            public final void setObjectMagnifyWhenResize(boolean magnify) {
258:
259:                needsUpdate = true;
260:                objectMagnifyWhenResize = magnify;
261:            }
262:
263:            /**
264:             * Sets whether a border around the object will exist.
265:             * @param existence If true, then a object border exists.
266:             */
267:            public final void setObjectBorderExistence(boolean existence) {
268:
269:                needsUpdate = true;
270:                objectBorderExistence = existence;
271:            }
272:
273:            /**
274:             * Sets the thickness of the border for the model size of the object.
275:             * @param thickness The model thickness of the object's border.
276:             */
277:            public final void setObjectBorderThicknessModel(int thickness) {
278:
279:                needsUpdate = true;
280:                objectBorderThicknessModel = thickness;
281:            }
282:
283:            /**
284:             * Sets the color of the object's border.
285:             * @param color The color of the border.
286:             */
287:            public final void setObjectBorderColor(Color color) {
288:
289:                needsUpdate = true;
290:                objectBorderColor = color;
291:            }
292:
293:            /**
294:             * Sets whether a gap between the border or edge of the object and the object's interior
295:             * components exists.
296:             * @param existence If true, then a gap exists.
297:             */
298:            public final void setObjectGapExistence(boolean existence) {
299:
300:                needsUpdate = true;
301:                objectGapExistence = existence;
302:            }
303:
304:            /**
305:             * Sets the thickness of the object's gap for the model size of the object.
306:             * @param thickness The model thickness of the object's gap.
307:             */
308:            public final void setObjectGapThicknessModel(int thickness) {
309:
310:                needsUpdate = true;
311:                objectGapThicknessModel = thickness;
312:            }
313:
314:            /**
315:             * Sets whether the object will have a painted background or not.
316:             * If not, then the background of the content pane to which the object was
317:             * added will show through which by default is gray, or if the object was not
318:             * added to a content pane but only a BufferedImage of the object is obtained,
319:             * then the background will be the default background of BufferedImage which
320:             * is black.  The existence of a background can improve performance considerably.
321:             * @param existence If true, a background for the object will be painted.
322:             */
323:            public final void setObjectBackgroundExistence(boolean existence) {
324:
325:                needsUpdate = true;
326:                objectBackgroundExistence = existence;
327:            }
328:
329:            /**
330:             * Sets the color of the background for the object.
331:             * @param color The color of the object's background.
332:             */
333:            public final void setObjectBackgroundColor(Color color) {
334:
335:                needsUpdate = true;
336:                objectBackgroundColor = color;
337:            }
338:
339:            /**
340:             * Sets the light source of the object's background.
341:             * If there is a light source, the side of the source will be one shade brighter than the
342:             * specified background color.  Use the TOP, BOTTOM, LEFT, RIGHT, and NONE fields.
343:             * @param source The source of the light.
344:             */
345:            public final void setObjectBackgroundLightSource(int source) {
346:
347:                needsUpdate = true;
348:                objectBackgroundLightSource = source;
349:            }
350:
351:            /**
352:             * Sets whether the object is to have a title.
353:             * @param existence If true, then the object will have a title.
354:             */
355:            public final void setObjectTitleExistence(boolean existence) {
356:
357:                needsUpdate = true;
358:                objectTitleExistence = existence;
359:            }
360:
361:            /**
362:             * Sets the text for the object's title.
363:             * @param text The text for the object's title.
364:             */
365:            public final void setObjectTitleText(String text) {
366:
367:                needsUpdate = true;
368:                objectTitleText = text;
369:            }
370:
371:            /**
372:             * Sets the point of the font of the title for the object at its model size.
373:             * @param point The model font point for the object's title.
374:             */
375:            public final void setObjectTitleFontPointModel(int point) {
376:
377:                needsUpdate = true;
378:                objectTitleFontPointModel = point;
379:            }
380:
381:            /**
382:             * Sets the name of the font for the object's title.
383:             * Accepts all values accepted by java.awt.Font.
384:             * @param name The name of the font for the object's title.
385:             */
386:            public final void setObjectTitleFontName(String name) {
387:
388:                needsUpdate = true;
389:                objectTitleFontName = name;
390:            }
391:
392:            /**
393:             * Sets the color of the font for the object's title.
394:             * @param color The color of the font for the object's title.
395:             */
396:            public final void setObjectTitleFontColor(Color color) {
397:
398:                needsUpdate = true;
399:                objectTitleFontColor = color;
400:            }
401:
402:            /**
403:             * Sets the style of the font for the object's title.
404:             * Accepts all values that java.awt.Font accepts.
405:             * @param style The style of the font for the object's title.
406:             */
407:            public final void setObjectTitleFontStyle(int style) {
408:
409:                needsUpdate = true;
410:                objectTitleFontStyle = style;
411:            }
412:
413:            /**
414:             * Sets whether a gap below the title and the rest of the object's components exists.
415:             * @param existence If true, then a gap exists.
416:             */
417:            public final void setObjectTitleBetweenRestGapExistence(
418:                    boolean existence) {
419:
420:                needsUpdate = true;
421:                objectTitleBetweenRestGapExistence = existence;
422:            }
423:
424:            /**
425:             * Sets the thickness of the gap below the title and the rest of the object's components for
426:             * the object's model size.
427:             * @param thickness The model thickness of the gap.
428:             */
429:            public final void setObjectTitleBetweenRestGapThicknessModel(
430:                    int thickness) {
431:
432:                needsUpdate = true;
433:                objectTitleBetweenRestGapThicknessModel = thickness;
434:            }
435:
436:            /**
437:             * Gets whether a object's components will grow or shrink as the size of the space allocated to
438:             * the object grows or shrinks.
439:             * @return If true, the object will be magnified on resize.
440:             */
441:            public final boolean getObjectMagnifyWhenResize() {
442:                return objectMagnifyWhenResize;
443:            }
444:
445:            /**
446:             * Gets whether a border around the object will exist.
447:             * @return If true, then a object border exists.
448:             */
449:            public final boolean getObjectBorderExistence() {
450:                return objectBorderExistence;
451:            }
452:
453:            /**
454:             * Gets the thickness of the border for the model size of the object.
455:             * @return The model thickness of the object's border.
456:             */
457:            public final int getObjectBorderThicknessModel() {
458:                return objectBorderThicknessModel;
459:            }
460:
461:            /**
462:             * Gets the color of the object's border.
463:             * @return The color of the border.
464:             */
465:            public final Color getObjectBorderColor() {
466:                return objectBorderColor;
467:            }
468:
469:            /**
470:             * Gets whether a gap between the border or edge of the object and the object's interior components
471:             * exists.
472:             * @return If true, then a gap exists.
473:             */
474:            public final boolean getObjectGapExistence() {
475:                return objectGapExistence;
476:            }
477:
478:            /**
479:             * Gets the thickness of the object's gap for the model size of the object.
480:             * @return The model thickness of the object's gap.
481:             */
482:            public final int getObjectGapThicknessModel() {
483:                return objectGapThicknessModel;
484:            }
485:
486:            /**
487:             * Gets whether the object will have a painted background or not.
488:             * If not, then the background of the content pane to which the object was
489:             * added will show through which by default is gray, or if the object was not
490:             * added to a content pane but only a BufferedImage of the object is obtained,
491:             * then the background will be the default background of BufferedImage which
492:             * is black.  Painting the background improves performance considerably.
493:             * @return If true, a background for the object will be painted.
494:             */
495:            public final boolean getObjectBackgroundExistence() {
496:                return objectBackgroundExistence;
497:            }
498:
499:            /**
500:             * Gets the color of the background for the object.
501:             * @return The color of the object's background.
502:             */
503:            public final Color getObjectBackgroundColor() {
504:                return objectBackgroundColor;
505:            }
506:
507:            /**
508:             * Gets the light source of the object's background.
509:             * If there is a light source, the side of the source will be one shade brighter than the
510:             * specified background color.  Use the TOP, BOTTOM, LEFT, RIGHT, and NONE fields.
511:             * @return The source of the light.
512:             */
513:            public final int getObjectBackgroundLightSource() {
514:                return objectBackgroundLightSource;
515:            }
516:
517:            /**
518:             * Gets whether the object is to have a title.
519:             * @return If true, then the object will have a title.
520:             */
521:            public final boolean getObjectTitleExistence() {
522:                return objectTitleExistence;
523:            }
524:
525:            /**
526:             * Gets the text for the object's title.
527:             * @return The text for the object's title.
528:             */
529:            public final String getObjectTitleText() {
530:                return objectTitleText;
531:            }
532:
533:            /**
534:             * Gets the point of the font of the title for the object at its model size.
535:             * @return The model font point for the object's title.
536:             */
537:            public final int getObjectTitleFontPointModel() {
538:                return objectTitleFontPointModel;
539:            }
540:
541:            /**
542:             * Gets the name of the font for the object's title.
543:             * Accepts all values accepted by java.awt.Font.
544:             * @return The name of the font for the object's title.
545:             */
546:            public final String getObjectTitleFontName() {
547:                return objectTitleFontName;
548:            }
549:
550:            /**
551:             * Gets the color of the font for the object's title.
552:             * @return The color of the font for the object's title.
553:             */
554:            public final Color getObjectTitleFontColor() {
555:                return objectTitleFontColor;
556:            }
557:
558:            /**
559:             * Gets the style of the font for the object's title.
560:             * Accepts all values that java.awt.Font accepts.
561:             * @return The style of the font for the object's title.
562:             */
563:            public final int getObjectTitleFontStyle() {
564:                return objectTitleFontStyle;
565:            }
566:
567:            /**
568:             * Gets whether a gap below the title and the rest of the object's components exists.
569:             * @return If true, then a gap exists.
570:             */
571:            public final boolean getObjectTitleBetweenRestGapExistence() {
572:                return objectTitleBetweenRestGapExistence;
573:            }
574:
575:            /**
576:             * Gets the thickness of the gap below the title and the rest of the object's components for
577:             * the object's model size.
578:             * @return The model thickness of the gap.
579:             */
580:            public final int getObjectTitleBetweenRestGapThicknessModel() {
581:                return objectTitleBetweenRestGapThicknessModel;
582:            }
583:
584:            /**
585:             * Gets whether this object needs to be updated with new properties.
586:             * @param object2D The object that may need to be updated.
587:             * @return If true then needs update.
588:             */
589:            final boolean getObject2DNeedsUpdate(Object2D object2D) {
590:
591:                if (needsUpdate)
592:                    return true;
593:
594:                int index = -1;
595:                if ((index = object2DVector.indexOf(object2D)) != -1) {
596:                    return ((Boolean) needsUpdateVector.get(index))
597:                            .booleanValue();
598:                }
599:
600:                return false;
601:            }
602:
603:            /**
604:             * Adds an Object2D to the set of objects using these properties.
605:             * @param object2D The Object2D to add.
606:             */
607:            final void addObject2D(Object2D object2D) {
608:
609:                if (!object2DVector.contains(object2D)) {
610:                    object2DVector.add(object2D);
611:                    needsUpdateVector.add(new Boolean(true));
612:                }
613:            }
614:
615:            /**
616:             * Removes a Object2D from the set of objects using these properties.
617:             * @param object2D The Object2D to remove.
618:             */
619:            final void removeObject2D(Object2D object2D) {
620:
621:                int index = -1;
622:                if ((index = object2DVector.indexOf(object2D)) != -1) {
623:                    object2DVector.remove(index);
624:                    needsUpdateVector.remove(index);
625:                }
626:            }
627:
628:            /**
629:             * Validates the properties of this object.
630:             * If debug is true then prints a messages indicating whether each property is valid.
631:             * Returns true if all the properties were valid and false otherwise.
632:             * @param debug If true then will print status messages.
633:             * @return If true then valid.
634:             */
635:            final boolean validate(boolean debug) {
636:
637:                if (debug)
638:                    System.out.println("Validating Object2DProperties");
639:
640:                boolean valid = true;
641:
642:                if (objectBorderThicknessModel < 0) {
643:                    valid = false;
644:                    if (debug)
645:                        System.out.println("ObjectBorderThicknessModel < 0");
646:                }
647:                if (objectBorderColor == null) {
648:                    valid = false;
649:                    if (debug)
650:                        System.out.println("ObjectBorderColor == null");
651:                }
652:                if (objectGapThicknessModel < 0) {
653:                    valid = false;
654:                    if (debug)
655:                        System.out.println("ObjectGapThicknessModel < 0");
656:                }
657:                if (objectBackgroundColor == null) {
658:                    valid = false;
659:                    if (debug)
660:                        System.out.println("ObjectBackgroundColor == null");
661:                }
662:                if (objectBackgroundLightSource != TOP
663:                        && objectBackgroundLightSource != BOTTOM
664:                        && objectBackgroundLightSource != LEFT
665:                        && objectBackgroundLightSource != RIGHT
666:                        && objectBackgroundLightSource != NONE) {
667:                    valid = false;
668:                    if (debug)
669:                        System.out
670:                                .println("Problem with ObjectBackgroundLightSource");
671:                }
672:                if (objectTitleText == null) {
673:                    valid = false;
674:                    if (debug)
675:                        System.out.println("ObjectTitleText == null");
676:                }
677:                if (objectTitleFontPointModel < 0) {
678:                    valid = false;
679:                    if (debug)
680:                        System.out.println("ObjectTitleFontPointModel < 0");
681:                }
682:                if (objectTitleFontName == null
683:                        || !isFontNameExists(objectTitleFontName)) {
684:                    valid = false;
685:                    if (debug)
686:                        System.out.println("Problem with ObjectTitleFontName");
687:                }
688:                if (objectTitleFontColor == null) {
689:                    valid = false;
690:                    if (debug)
691:                        System.out.println("ObjectTitleFontColor == null");
692:                }
693:                if (objectTitleFontStyle != Font.PLAIN
694:                        && objectTitleFontStyle != Font.ITALIC
695:                        && objectTitleFontStyle != Font.BOLD
696:                        && objectTitleFontStyle != (Font.ITALIC | Font.BOLD)) {
697:                    valid = false;
698:                    if (debug)
699:                        System.out.println("Problem with ObjectTitleFontStyle");
700:                }
701:                if (objectTitleBetweenRestGapThicknessModel < 0) {
702:                    valid = false;
703:                    if (debug)
704:                        System.out
705:                                .println("ObjectTitleBetweenRestGapThicknessModel < 0");
706:                }
707:
708:                if (debug) {
709:                    if (valid)
710:                        System.out.println("Object2DProperties was valid");
711:                    else
712:                        System.out.println("Object2DProperties was invalid");
713:                }
714:
715:                return valid;
716:            }
717:
718:            /**
719:             * Updates the properties of this Object2D.
720:             * @param object2D The object to update.
721:             */
722:            final void updateObject2D(Object2D object2D) {
723:
724:                if (getObject2DNeedsUpdate(object2D)) {
725:
726:                    if (needsUpdate) {
727:                        for (int i = 0; i < needsUpdateVector.size(); ++i) {
728:                            needsUpdateVector.set(i, new Boolean(true));
729:                        }
730:                        needsUpdate = false;
731:                    }
732:
733:                    int index = -1;
734:                    if ((index = object2DVector.indexOf(object2D)) != -1) {
735:                        needsUpdateVector.set(index, new Boolean(false));
736:                    }
737:                }
738:            }
739:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.