1 22 23 24 package net.sourceforge.chart2d; 25 26 27 import java.awt.Color ; 28 import java.util.Vector ; 29 import java.awt.AlphaComposite ; 30 31 32 38 public final class GraphProperties { 39 40 41 45 public static float[] CONTINUOUS = {10.0f, 0.0f}; 46 47 51 public static float[] DASHED = {7.0f, 3.0f}; 52 53 57 public static float[] DOTTED = {3.0f, 3.0f}; 58 59 62 public static int LEFT = 0; 63 64 65 68 public static int RIGHT = 1; 69 70 71 74 public static int TOP = 2; 75 76 77 80 public static int BOTTOM = 3; 81 82 83 86 public static int NONE = 6; 87 88 89 92 public static int COMPONENT = 0; 93 94 95 98 public static int GRAPH = 1; 99 100 101 104 public static AlphaComposite ALPHA_COMPOSITE_NONE = 105 AlphaComposite.getInstance (AlphaComposite.SRC_OVER, 1f); 106 107 110 public static AlphaComposite ALPHA_COMPOSITE_MILD = 111 AlphaComposite.getInstance (AlphaComposite.SRC_OVER, .9f); 112 113 116 public static AlphaComposite ALPHA_COMPOSITE_MEDIUM = 117 AlphaComposite.getInstance (AlphaComposite.SRC_OVER, .75f); 118 119 122 public static final boolean GRAPH_BACKGROUND_EXISTENCE_DEFAULT = false; 123 124 127 public static final Color GRAPH_BACKGROUND_COLOR_DEFAULT = Color.white; 128 129 132 public static final boolean GRAPH_BORDER_EXISTENCE_DEFAULT = true; 133 134 137 public static final int GRAPH_BORDER_THICKNESS_MODEL_DEFAULT = 2; 138 139 142 public static final Color GRAPH_BORDER_LEFT_BOTTOM_COLOR_DEFAULT = Color.black; 143 144 147 public static final Color GRAPH_BORDER_RIGHT_TOP_COLOR_DEFAULT = Color.gray; 148 149 152 public static final boolean GRAPH_ALLOW_COMPONENT_ALIGNMENT_DEFAULT = false; 153 154 157 public static final boolean GRAPH_OUTLINE_COMPONENTS_EXISTENCE_DEFAULT = false; 158 159 162 public static final Color GRAPH_OUTLINE_COMPONENTS_COLOR_DEFAULT = Color.black; 163 164 167 public static final boolean GRAPH_BETWEEN_COMPONENTS_GAP_EXISTENCE_DEFAULT = true; 168 169 172 public static final int GRAPH_BETWEEN_COMPONENTS_GAP_THICKNESS_MODEL_DEFAULT = 2; 173 174 177 public static final boolean GRAPH_BARS_EXISTENCE_DEFAULT = true; 178 179 182 public static final int GRAPH_BARS_THICKNESS_MODEL_DEFAULT = 10; 183 184 187 public static final float GRAPH_BARS_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT = 1f; 188 189 192 public static final float GRAPH_BARS_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT = .535f; 193 194 197 public static final boolean GRAPH_LINES_EXISTENCE_DEFAULT = false; 198 199 202 public static final int GRAPH_LINES_THICKNESS_MODEL_DEFAULT = 5; 203 204 207 public static final boolean GRAPH_LINES_FILL_INTERIOR_DEFAULT = false; 208 209 212 public static final float GRAPH_LINES_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT = 0f; 213 214 217 public static final float GRAPH_LINES_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT = 0f; 218 219 222 public static final boolean GRAPH_DOTS_EXISTENCE_DEFAULT = false; 223 224 227 public static final int GRAPH_DOTS_THICKNESS_MODEL_DEFAULT = 8; 228 229 232 public static final float GRAPH_DOTS_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT = 0f; 233 234 237 public static final float GRAPH_DOTS_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT = .40f; 238 239 242 public static final boolean GRAPH_NUMBERS_LINES_EXISTENCE_DEFAULT = true; 243 244 247 public static final int GRAPH_NUMBERS_LINES_THICKNESS_MODEL_DEFAULT = 2; 248 249 252 public static final float[] GRAPH_NUMBERS_LINES_STYLE_DEFAULT = CONTINUOUS; 253 254 257 public static final Color GRAPH_NUMBERS_LINES_COLOR_DEFAULT = Color.gray; 258 259 262 public static final boolean GRAPH_LABELS_LINES_EXISTENCE_DEFAULT = false; 263 264 267 public static final int GRAPH_LABELS_LINES_THICKNESS_MODEL_DEFAULT = 2; 268 269 272 public static final float[] GRAPH_LABELS_LINES_STYLE_DEFAULT = CONTINUOUS; 273 274 277 public static final Color GRAPH_LABELS_LINES_COLOR_DEFAULT = Color.gray; 278 279 282 public static final boolean GRAPH_LINES_THICKNESS_ASSOCIATION_DEFAULT = true; 283 284 287 public static int GRAPH_COMPONENTS_LIGHT_SOURCE_DEFAULT = TOP; 288 289 292 public static int GRAPH_COMPONENTS_LIGHT_TYPE_DEFAULT = COMPONENT; 293 294 297 public static float GRAPH_BARS_ROUNDING_RATIO_DEFAULT = .75f; 298 299 302 public static final boolean GRAPH_COMPONENTS_OVERFLOW_CLIP_DEFAULT = true; 303 304 307 public static AlphaComposite GRAPH_COMPONENTS_ALPHA_COMPOSITE_DEFAULT = ALPHA_COMPOSITE_NONE; 308 309 310 private boolean graphBackgroundExistence; 311 private Color graphBackgroundColor; 312 private boolean graphBorderExistence; 313 private int graphBorderThicknessModel; 314 private Color graphBorderLeftBottomColor; 315 private Color graphBorderRightTopColor; 316 private boolean graphAllowComponentAlignment; 317 private boolean graphOutlineComponentsExistence; 318 private Color graphOutlineComponentsColor; 319 private boolean graphBetweenComponentsGapExistence; 320 private int graphBetweenComponentsGapThicknessModel; 321 private boolean graphBarsExistence; 322 private int graphBarsThicknessModel; 323 private float graphBarsExcessSpaceFeedbackRatio; 324 private float graphBarsWithinCategoryOverlapRatio; 325 private boolean graphLinesExistence; 326 private int graphLinesThicknessModel; 327 private boolean graphLinesFillInterior; 328 private float graphLinesExcessSpaceFeedbackRatio; 329 private float graphLinesWithinCategoryOverlapRatio; 330 private boolean graphDotsExistence; 331 private int graphDotsThicknessModel; 332 private float graphDotsWithinCategoryOverlapRatio; 333 private float graphDotsExcessSpaceFeedbackRatio; 334 private boolean graphNumbersLinesExistence; 335 private int graphNumbersLinesThicknessModel; 336 private float[] graphNumbersLinesStyle; 337 private Color graphNumbersLinesColor; 338 private boolean graphLabelsLinesExistence; 339 private int graphLabelsLinesThicknessModel; 340 private float[] graphLabelsLinesStyle; 341 private Color graphLabelsLinesColor; 342 private boolean graphLinesThicknessAssociation; 343 private int graphComponentsLightSource; 344 private int graphComponentsLightType; 345 private float graphBarsRoundingRatio; 346 private boolean graphComponentsOverflowClip; 347 private AlphaComposite graphComponentsAlphaComposite; 348 349 private boolean needsUpdate = true; 350 private final Vector needsUpdateVector = new Vector (5, 5); 351 private final Vector graphChart2DVector = new Vector (5, 5); 352 353 354 357 public GraphProperties() { 358 359 needsUpdate = true; 360 setGraphPropertiesToDefaults(); 361 } 362 363 364 369 public GraphProperties (GraphProperties graphProps) { 370 371 needsUpdate = true; 372 setGraphProperties (graphProps); 373 } 374 375 376 379 public final void setGraphPropertiesToDefaults() { 380 381 needsUpdate = true; 382 setGraphBackgroundExistence (GRAPH_BACKGROUND_EXISTENCE_DEFAULT); 383 setGraphBackgroundColor (GRAPH_BACKGROUND_COLOR_DEFAULT); 384 setGraphBorderExistence (GRAPH_BORDER_EXISTENCE_DEFAULT); 385 setGraphBorderThicknessModel (GRAPH_BORDER_THICKNESS_MODEL_DEFAULT); 386 setGraphBorderLeftBottomColor (GRAPH_BORDER_LEFT_BOTTOM_COLOR_DEFAULT); 387 setGraphBorderRightTopColor (GRAPH_BORDER_RIGHT_TOP_COLOR_DEFAULT); 388 setGraphAllowComponentAlignment (GRAPH_ALLOW_COMPONENT_ALIGNMENT_DEFAULT); 389 setGraphOutlineComponentsExistence (GRAPH_OUTLINE_COMPONENTS_EXISTENCE_DEFAULT); 390 setGraphOutlineComponentsColor (GRAPH_OUTLINE_COMPONENTS_COLOR_DEFAULT); 391 setGraphBetweenComponentsGapExistence (GRAPH_BETWEEN_COMPONENTS_GAP_EXISTENCE_DEFAULT); 392 setGraphBetweenComponentsGapThicknessModel ( 393 GRAPH_BETWEEN_COMPONENTS_GAP_THICKNESS_MODEL_DEFAULT); 394 setGraphBarsExistence (GRAPH_BARS_EXISTENCE_DEFAULT); 395 setGraphBarsThicknessModel (GRAPH_BARS_THICKNESS_MODEL_DEFAULT); 396 setGraphBarsExcessSpaceFeedbackRatio (GRAPH_BARS_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT); 397 setGraphBarsWithinCategoryOverlapRatio (GRAPH_BARS_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT); 398 setGraphLinesExistence (GRAPH_LINES_EXISTENCE_DEFAULT); 399 setGraphLinesThicknessModel (GRAPH_LINES_THICKNESS_MODEL_DEFAULT); 400 setGraphLinesFillInterior (GRAPH_LINES_FILL_INTERIOR_DEFAULT); 401 setGraphLinesExcessSpaceFeedbackRatio (GRAPH_LINES_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT); 402 setGraphLinesWithinCategoryOverlapRatio (GRAPH_LINES_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT); 403 setGraphDotsExistence (GRAPH_DOTS_EXISTENCE_DEFAULT); 404 setGraphDotsThicknessModel (GRAPH_DOTS_THICKNESS_MODEL_DEFAULT); 405 setGraphDotsExcessSpaceFeedbackRatio (GRAPH_DOTS_EXCESS_SPACE_FEEDBACK_RATIO_DEFAULT); 406 setGraphDotsWithinCategoryOverlapRatio (GRAPH_DOTS_WITHIN_CATEGORY_OVERLAP_RATIO_DEFAULT); 407 setGraphNumbersLinesExistence (GRAPH_NUMBERS_LINES_EXISTENCE_DEFAULT); 408 setGraphNumbersLinesThicknessModel (GRAPH_NUMBERS_LINES_THICKNESS_MODEL_DEFAULT); 409 setGraphNumbersLinesStyle (GRAPH_NUMBERS_LINES_STYLE_DEFAULT); 410 setGraphNumbersLinesColor (GRAPH_NUMBERS_LINES_COLOR_DEFAULT); 411 setGraphLabelsLinesExistence (GRAPH_LABELS_LINES_EXISTENCE_DEFAULT); 412 setGraphLabelsLinesThicknessModel (GRAPH_LABELS_LINES_THICKNESS_MODEL_DEFAULT); 413 setGraphLabelsLinesStyle (GRAPH_LABELS_LINES_STYLE_DEFAULT); 414 setGraphLabelsLinesColor (GRAPH_LABELS_LINES_COLOR_DEFAULT); 415 setGraphLinesThicknessAssociation (GRAPH_LINES_THICKNESS_ASSOCIATION_DEFAULT); 416 setGraphComponentsLightSource (GRAPH_COMPONENTS_LIGHT_SOURCE_DEFAULT); 417 setGraphComponentsLightType (GRAPH_COMPONENTS_LIGHT_TYPE_DEFAULT); 418 setGraphBarsRoundingRatio (GRAPH_BARS_ROUNDING_RATIO_DEFAULT); 419 setGraphComponentsOverflowClip (GRAPH_COMPONENTS_OVERFLOW_CLIP_DEFAULT); 420 setGraphComponentsAlphaComposite (GRAPH_COMPONENTS_ALPHA_COMPOSITE_DEFAULT); 421 } 422 423 424 429 public final void setGraphProperties (GraphProperties graphProps) { 430 431 needsUpdate = true; 432 setGraphBackgroundExistence (graphProps.getGraphBackgroundExistence()); 433 setGraphBackgroundColor (graphProps.getGraphBackgroundColor()); 434 setGraphBorderExistence (graphProps.getGraphBorderExistence()); 435 setGraphBorderThicknessModel (graphProps.getGraphBorderThicknessModel()); 436 setGraphBorderLeftBottomColor (graphProps.getGraphBorderLeftBottomColor()); 437 setGraphBorderRightTopColor (graphProps.getGraphBorderRightTopColor()); 438 setGraphAllowComponentAlignment (graphProps.getGraphAllowComponentAlignment()); 439 setGraphOutlineComponentsExistence (graphProps.getGraphOutlineComponentsExistence()); 440 setGraphOutlineComponentsColor (graphProps.getGraphOutlineComponentsColor()); 441 setGraphBetweenComponentsGapExistence (graphProps.getGraphBetweenComponentsGapExistence()); 442 setGraphBetweenComponentsGapThicknessModel (graphProps.getGraphBetweenComponentsGapThicknessModel()); 443 setGraphBarsExistence (graphProps.getGraphBarsExistence()); 444 setGraphBarsThicknessModel (graphProps.getGraphBarsThicknessModel()); 445 setGraphBarsExcessSpaceFeedbackRatio (graphProps.getGraphBarsExcessSpaceFeedbackRatio()); 446 setGraphBarsWithinCategoryOverlapRatio (graphProps.getGraphBarsWithinCategoryOverlapRatio()); 447 setGraphLinesExistence (graphProps.getGraphLinesExistence()); 448 setGraphLinesThicknessModel (graphProps.getGraphLinesThicknessModel()); 449 setGraphLinesFillInterior (graphProps.getGraphLinesFillInterior()); 450 setGraphLinesExcessSpaceFeedbackRatio (graphProps.getGraphLinesExcessSpaceFeedbackRatio()); 451 setGraphLinesWithinCategoryOverlapRatio (graphProps.getGraphLinesWithinCategoryOverlapRatio()); 452 setGraphDotsExistence (graphProps.getGraphDotsExistence()); 453 setGraphDotsThicknessModel (graphProps.getGraphDotsThicknessModel()); 454 setGraphDotsExcessSpaceFeedbackRatio (graphProps.getGraphDotsExcessSpaceFeedbackRatio()); 455 setGraphDotsWithinCategoryOverlapRatio (graphProps.getGraphDotsWithinCategoryOverlapRatio()); 456 setGraphNumbersLinesExistence (graphProps.getGraphNumbersLinesExistence()); 457 setGraphNumbersLinesThicknessModel (graphProps.getGraphNumbersLinesThicknessModel()); 458 setGraphNumbersLinesStyle (graphProps.getGraphNumbersLinesStyle()); 459 setGraphNumbersLinesColor (graphProps.getGraphNumbersLinesColor()); 460 setGraphLabelsLinesExistence (graphProps.getGraphLabelsLinesExistence()); 461 setGraphLabelsLinesThicknessModel (graphProps.getGraphLabelsLinesThicknessModel()); 462 setGraphLabelsLinesStyle (graphProps.getGraphLabelsLinesStyle()); 463 setGraphLabelsLinesColor (graphProps.getGraphLabelsLinesColor()); 464 setGraphLinesThicknessAssociation (graphProps.getGraphLinesThicknessAssociation()); 465 setGraphComponentsLightSource (graphProps.getGraphComponentsLightSource()); 466 setGraphComponentsLightType (graphProps.getGraphComponentsLightType()); 467 setGraphBarsRoundingRatio (graphProps.getGraphBarsRoundingRatio()); 468 setGraphComponentsOverflowClip (graphProps.getGraphComponentsOverflowClip()); 469 setGraphComponentsAlphaComposite (graphProps.getGraphComponentsAlphaComposite()); 470 } 471 472 473 480 public final void setGraphBackgroundExistence (boolean existence) { 481 482 needsUpdate = true; 483 graphBackgroundExistence = existence; 484 } 485 486 487 494 public final void setGraphBackgroundColor (Color color) { 495 496 needsUpdate = true; 497 graphBackgroundColor = color; 498 } 499 500 501 505 public final void setGraphBorderExistence (boolean existence) { 506 507 needsUpdate = true; 508 graphBorderExistence = existence; 509 } 510 511 512 517 public final void setGraphBorderThicknessModel (int thickness) { 518 519 needsUpdate = true; 520 graphBorderThicknessModel = thickness; 521 } 522 523 524 528 public final void setGraphBorderLeftBottomColor (Color color) { 529 530 needsUpdate = true; 531 graphBorderLeftBottomColor = color; 532 } 533 534 535 539 public final void setGraphBorderRightTopColor (Color color) { 540 541 needsUpdate = true; 542 graphBorderRightTopColor = color; 543 } 544 545 546 554 public final void setGraphAllowComponentAlignment (boolean alignment) { 555 556 needsUpdate = true; 557 graphAllowComponentAlignment = alignment; 558 } 559 560 561 566 public final void setGraphOutlineComponentsExistence (boolean existence) { 567 568 needsUpdate = true; 569 graphOutlineComponentsExistence = existence; 570 } 571 572 573 578 public final void setGraphOutlineComponentsColor (Color color) { 579 580 needsUpdate = true; 581 graphOutlineComponentsColor = color; 582 } 583 584 585 590 public final void setGraphBetweenComponentsGapExistence (boolean existence) { 591 592 needsUpdate = true; 593 graphBetweenComponentsGapExistence = existence; 594 } 595 596 597 602 public final void setGraphBetweenComponentsGapThicknessModel (int thickness) { 603 604 needsUpdate = true; 605 graphBetweenComponentsGapThicknessModel = thickness; 606 } 607 608 609 613 public final void setGraphBarsExistence (boolean existence) { 614 615 needsUpdate = true; 616 graphBarsExistence = existence; 617 } 618 619 620 624 public final void setGraphBarsThicknessModel (int thickness) { 625 626 needsUpdate = true; 627 graphBarsThicknessModel = thickness; 628 } 629 630 631 638 public final void setGraphBarsExcessSpaceFeedbackRatio (float ratio) { 639 640 needsUpdate = true; 641 graphBarsExcessSpaceFeedbackRatio = ratio; 642 } 643 644 645 650 public final void setGraphBarsWithinCategoryOverlapRatio (float ratio) { 651 652 needsUpdate = true; 653 graphBarsWithinCategoryOverlapRatio = ratio; 654 } 655 656 657 661 public final void setGraphLinesExistence (boolean existence) { 662 663 needsUpdate = true; 664 graphLinesExistence = existence; 665 } 666 667 668 672 public final void setGraphLinesThicknessModel (int thickness) { 673 674 needsUpdate = true; 675 graphLinesThicknessModel = thickness; 676 } 677 678 679 684 public final void setGraphLinesFillInterior (boolean fill) { 685 686 needsUpdate = true; 687 graphLinesFillInterior = fill; 688 } 689 690 691 698 public final void setGraphLinesExcessSpaceFeedbackRatio (float ratio) { 699 700 needsUpdate = true; 701 graphLinesExcessSpaceFeedbackRatio = ratio; 702 } 703 704 705 710 public final void setGraphLinesWithinCategoryOverlapRatio (float ratio) { 711 712 needsUpdate = true; 713 graphLinesWithinCategoryOverlapRatio = ratio; 714 } 715 716 717 721 public final void setGraphDotsExistence (boolean existence) { 722 723 needsUpdate = true; 724 graphDotsExistence = existence; 725 } 726 727 728 732 public final void setGraphDotsThicknessModel (int thickness) { 733 734 needsUpdate = true; 735 graphDotsThicknessModel = thickness; 736 } 737 738 739 746 public final void setGraphDotsExcessSpaceFeedbackRatio (float ratio) { 747 748 needsUpdate = true; 749 graphDotsExcessSpaceFeedbackRatio = ratio; 750 } 751 752 753 758 public final void setGraphDotsWithinCategoryOverlapRatio (float ratio) { 759 760 needsUpdate = true; 761 graphDotsWithinCategoryOverlapRatio = ratio; 762 } 763 764 765 773 public final void setGraphNumbersLinesExistence (boolean existence) { 774 775 needsUpdate = true; 776 graphNumbersLinesExistence = existence; 777 } 778 779 780 788 public final void setGraphNumbersLinesThicknessModel (int thickness) { 789 790 needsUpdate = true; 791 graphNumbersLinesThicknessModel = thickness; 792 } 793 794 795 804 public final void setGraphNumbersLinesStyle (float[] style) { 805 806 needsUpdate = true; 807 graphNumbersLinesStyle = style; 808 } 809 810 811 819 public final void setGraphNumbersLinesColor (Color color) { 820 821 needsUpdate = true; 822 graphNumbersLinesColor = color; 823 } 824 825 826 834 public final void setGraphLabelsLinesExistence (boolean existence) { 835 836 needsUpdate = true; 837 graphLabelsLinesExistence = existence; 838 } 839 840 841 849 public final void setGraphLabelsLinesThicknessModel (int thickness) { 850 851 needsUpdate = true; 852 graphLabelsLinesThicknessModel = thickness; 853 } 854 855 856 865 public final void setGraphLabelsLinesStyle (float[] style) { 866 867 needsUpdate = true; 868 graphLabelsLinesStyle = style; 869 } 870 871 872 880 public final void setGraphLabelsLinesColor (Color color) { 881 882 needsUpdate = true; 883 graphLabelsLinesColor = color; 884 } 885 886 887 893 public final void setGraphLinesThicknessAssociation (boolean association) { 894 895 needsUpdate = true; 896 graphLinesThicknessAssociation = association; 897 } 898 899 900 905 public final void setGraphComponentsLightSource (int s) { 906 907 needsUpdate = true; 908 graphComponentsLightSource = s; 909 } 910 911 912 921 public final void setGraphComponentsLightType (int t) { 922 923 needsUpdate = true; 924 graphComponentsLightType = t; 925 } 926 927 928 937 public final void setGraphBarsRoundingRatio (float r) { 938 939 needsUpdate = true; 940 graphBarsRoundingRatio = r; 941 } 942 943 944 951 public final void setGraphComponentsOverflowClip (boolean c) { 952 953 needsUpdate = true; 954 graphComponentsOverflowClip = c; 955 } 956 957 958 967 public final void setGraphComponentsAlphaComposite (AlphaComposite a) { 968 969 graphComponentsAlphaComposite = a; 970 needsUpdate = true; 971 } 972 973 974 981 public final boolean getGraphBackgroundExistence() { 982 return graphBackgroundExistence; 983 } 984 985 986 993 public final Color getGraphBackgroundColor() { 994 return graphBackgroundColor; 995 } 996 997 998 1002 public final boolean getGraphBorderExistence() { 1003 return graphBorderExistence; 1004 } 1005 1006 1007 1012 public final int getGraphBorderThicknessModel() { 1013 return graphBorderThicknessModel; 1014 } 1015 1016 1017 1021 public final Color getGraphBorderLeftBottomColor() { 1022 return graphBorderLeftBottomColor; 1023 } 1024 1025 1026 1030 public final Color getGraphBorderRightTopColor() { 1031 return graphBorderRightTopColor; 1032 } 1033 1034 1035 1043 public final boolean getGraphAllowComponentAlignment() { 1044 return graphAllowComponentAlignment; 1045 } 1046 1047 1048 1053 public final boolean getGraphOutlineComponentsExistence() { 1054 return graphOutlineComponentsExistence; 1055 } 1056 1057 1058 1063 public final Color getGraphOutlineComponentsColor() { 1064 return graphOutlineComponentsColor; 1065 } 1066 1067 1068 1073 public final boolean getGraphBetweenComponentsGapExistence() { 1074 return graphBetweenComponentsGapExistence; 1075 } 1076 1077 1078 1083 public final int getGraphBetweenComponentsGapThicknessModel() { 1084 return graphBetweenComponentsGapThicknessModel; 1085 } 1086 1087 1088 1092 public final boolean getGraphBarsExistence() { 1093 return graphBarsExistence; 1094 } 1095 1096 1097 1101 public final int getGraphBarsThicknessModel() { 1102 return graphBarsThicknessModel; 1103 } 1104 1105 1106 1113 public final float getGraphBarsExcessSpaceFeedbackRatio() { 1114 return graphBarsExcessSpaceFeedbackRatio; 1115 } 1116 1117 1118 1123 public final float getGraphBarsWithinCategoryOverlapRatio() { 1124 return graphBarsWithinCategoryOverlapRatio; 1125 } 1126 1127 1128 1132 public final boolean getGraphLinesExistence() { 1133 return graphLinesExistence; 1134 } 1135 1136 1137 1141 public final int getGraphLinesThicknessModel() { 1142 return graphLinesThicknessModel; 1143 } 1144 1145 1146 1151 public final boolean getGraphLinesFillInterior() { 1152 return graphLinesFillInterior; 1153 } 1154 1155 1156 1163 public final float getGraphLinesExcessSpaceFeedbackRatio() { 1164 return graphLinesExcessSpaceFeedbackRatio; 1165 } 1166 1167 1168 1173 public final float getGraphLinesWithinCategoryOverlapRatio() { 1174 return graphLinesWithinCategoryOverlapRatio; 1175 } 1176 1177 1178 1182 public final boolean getGraphDotsExistence() { 1183 return graphDotsExistence; 1184 } 1185 1186 1187 1191 public final int getGraphDotsThicknessModel() { 1192 return graphDotsThicknessModel; 1193 } 1194 1195 1196 1203 public final float getGraphDotsExcessSpaceFeedbackRatio() { 1204 return graphDotsExcessSpaceFeedbackRatio; 1205 } 1206 1207 1208 1213 public final float getGraphDotsWithinCategoryOverlapRatio() { 1214 return graphDotsWithinCategoryOverlapRatio; 1215 } 1216 1217 1218 1226 public final boolean getGraphNumbersLinesExistence() { 1227 return graphNumbersLinesExistence; 1228 } 1229 1230 1231 1239 public final int getGraphNumbersLinesThicknessModel() { 1240 return graphNumbersLinesThicknessModel; 1241 } 1242 1243 1244 1253 public final float[] getGraphNumbersLinesStyle() { 1254 return graphNumbersLinesStyle; 1255 } 1256 1257 1258 1266 public final Color getGraphNumbersLinesColor() { 1267 return graphNumbersLinesColor; 1268 } 1269 1270 1271 1279 public final boolean getGraphLabelsLinesExistence() { 1280 return graphLabelsLinesExistence; 1281 } 1282 1283 1284 1292 public final int getGraphLabelsLinesThicknessModel() { 1293 return graphLabelsLinesThicknessModel; 1294 } 1295 1296 1297 1306 public final float[] getGraphLabelsLinesStyle() { 1307 return graphLabelsLinesStyle; 1308 } 1309 1310 1311 1319 public final Color getGraphLabelsLinesColor() { 1320 return graphLabelsLinesColor; 1321 } 1322 1323 1324 1330 public final boolean getGraphLinesThicknessAssociation() { 1331 return graphLinesThicknessAssociation; 1332 } 1333 1334 1335 1340 public final int getGraphComponentsLightSource() { 1341 return graphComponentsLightSource; 1342 } 1343 1344 1345 1354 public final int getGraphComponentsLightType() { 1355 return graphComponentsLightType; 1356 } 1357 1358 1359 1368 public final float getGraphBarsRoundingRatio() { 1369 return graphBarsRoundingRatio; 1370 } 1371 1372 1373 1380 public final boolean getGraphComponentsOverflowClip() { 1381 return graphComponentsOverflowClip; 1382 } 1383 1384 1385 1390 final boolean getGraphChart2DNeedsUpdate (GraphChart2D graphChart2D) { 1391 1392 if (needsUpdate) return true; 1393 1394 int index = -1; 1395 if ((index = graphChart2DVector.indexOf (graphChart2D)) != -1) { 1396 return ((Boolean )needsUpdateVector.get (index)).booleanValue(); 1397 } 1398 1399 return false; 1400 } 1401 1402 1403 1412 public final AlphaComposite getGraphComponentsAlphaComposite() { 1413 return graphComponentsAlphaComposite; 1414 } 1415 1416 1417 1421 final void addGraphChart2D (GraphChart2D graphChart2D) { 1422 1423 if (!graphChart2DVector.contains (graphChart2D)) { 1424 graphChart2DVector.add (graphChart2D); 1425 needsUpdateVector.add (new Boolean (true)); 1426 } 1427 } 1428 1429 1430 1434 final void removeGraphChart2D (GraphChart2D graphChart2D) { 1435 1436 int index = -1; 1437 if ((index = graphChart2DVector.indexOf (graphChart2D)) != -1) { 1438 graphChart2DVector.remove (index); 1439 needsUpdateVector.remove (index); 1440 } 1441 } 1442 1443 1444 1451 final boolean validate (boolean debug) { 1452 1453 if (debug) System.out.println ("Validating GraphProperties"); 1454 1455 boolean valid = true; 1456 1457 if (graphBackgroundColor == null) { 1458 valid = false; 1459 if (debug) System.out.println ("GraphBackgroundColor == null"); 1460 } 1461 if (graphBorderThicknessModel < 0) { 1462 valid = false; 1463 if (debug) System.out.println ("GraphBorderThicknessModel < 0"); 1464 } 1465 if (graphBorderLeftBottomColor == null) { 1466 valid = false; 1467 if (debug) System.out.println ("GraphBorderLeftBottomColor == null"); 1468 } 1469 if (graphBorderRightTopColor == null) { 1470 valid = false; 1471 if (debug) System.out.println ("GraphBorderRightTopColor == null"); 1472 } 1473 if (graphOutlineComponentsColor == null) { 1474 valid = false; 1475 if (debug) System.out.println ("GraphOutlineComponentsColor == null"); 1476 } 1477 if (graphBetweenComponentsGapThicknessModel < 0) { 1478 valid = false; 1479 if (debug) System.out.println ("GraphBetweenComponentsGapThicknessModel < 0"); 1480 } 1481 if (graphBarsThicknessModel < 0) { 1482 valid = false; 1483 if (debug) System.out.println ("GraphBarsThicknessModel < 0"); 1484 } 1485 if (graphBarsExcessSpaceFeedbackRatio < 0f || graphBarsExcessSpaceFeedbackRatio > 1f) { 1486 valid = false; 1487 if (debug) System.out.println ("Problem with graphBarsExcessSpaceFeedbackRatio"); 1488 } 1489 if (graphBarsWithinCategoryOverlapRatio < 0f || graphBarsWithinCategoryOverlapRatio > 1f) { 1490 valid = false; 1491 if (debug) System.out.println ("Problem with graphBarsWithinCategoryOverlapRatio"); 1492 } 1493 if (graphLinesThicknessModel < 0) { 1494 valid = false; 1495 if (debug) System.out.println ("GraphLinesThicknessModel < 0"); 1496 } 1497 if (graphLinesExcessSpaceFeedbackRatio < 0f || graphLinesExcessSpaceFeedbackRatio > 1f) { 1498 valid = false; 1499 if (debug) System.out.println ("Problem with graphLinesExcessSpaceFeedbackRatio"); 1500 } 1501 if (graphLinesWithinCategoryOverlapRatio < 0f || graphLinesWithinCategoryOverlapRatio > 1f) { 1502 valid = false; 1503 if (debug) System.out.println ("Problem with graphLinesWithinCategoryOverlapRatio"); 1504 } 1505 if (graphDotsThicknessModel < 0) { 1506 valid = false; 1507 if (debug) System.out.println ("GraphDotsThicknessModel < 0"); 1508 } 1509 if (graphDotsExcessSpaceFeedbackRatio < 0f || graphDotsExcessSpaceFeedbackRatio > 1f) { 1510 valid = false; 1511 if (debug) System.out.println ("Problem with graphDotsExcessSpaceFeedbackRatio"); 1512 } 1513 if (graphDotsWithinCategoryOverlapRatio < 0f || graphDotsWithinCategoryOverlapRatio > 1f) { 1514 valid = false; 1515 if (debug) System.out.println ("Problem with graphDotsWithinCategoryOverlapRatio"); 1516 } 1517 if (graphNumbersLinesThicknessModel < 0) { 1518 valid = false; 1519 if (debug) System.out.println ("GraphNumbersLinesThicknessModel < 0"); 1520 } 1521 if (graphNumbersLinesStyle != CONTINUOUS && 1522 graphNumbersLinesStyle != DASHED && 1523 graphNumbersLinesStyle != DOTTED) { 1524 valid = false; 1525 if (debug) System.out.println ("Problem with graphNumbersLinesStyle"); 1526 } 1527 if (graphNumbersLinesColor == null) { 1528 valid = false; 1529 if (debug) System.out.println ("GraphNumbersLinesColor == null"); 1530 } 1531 if (graphLabelsLinesThicknessModel < 0) { 1532 valid = false; 1533 if (debug) System.out.println ("GraphLabelsLinesThicknessModel < 0"); 1534 } 1535 if (graphLabelsLinesStyle != CONTINUOUS && 1536 graphLabelsLinesStyle != DASHED && 1537 graphLabelsLinesStyle != DOTTED) { 1538 valid = false; 1539 if (debug) System.out.println ("problem with graphLabelsLinesStyle"); 1540 } 1541 if (graphLabelsLinesColor == null) { 1542 valid = false; 1543 if (debug) System.out.println ("GraphLabelsLinesColor == null"); 1544 } 1545 if (graphComponentsLightSource != NONE && 1546 graphComponentsLightSource != TOP && 1547 graphComponentsLightSource != BOTTOM && 1548 graphComponentsLightSource != LEFT && 1549 graphComponentsLightSource != RIGHT) { 1550 valid = false; 1551 if (debug) System.out.println ("Problem with GraphComponentsLightSource"); 1552 } 1553 if (graphComponentsLightType != COMPONENT && graphComponentsLightType != GRAPH) { 1554 valid = false; 1555 if (debug) System.out.println ("Problem with GraphComponentsLightType"); 1556 } 1557 if (graphBarsRoundingRatio < 0f || graphBarsRoundingRatio > 1f) { 1558 valid = false; 1559 if (debug) System.out.println ("Problem with GraphBarsRoundingRatio"); 1560 } 1561 if (graphComponentsAlphaComposite == null) { 1562 valid = false; 1563 if (debug) System.out.println ("graphComponentsAlphaComposite == null"); 1564 } 1565 1566 if (debug) { 1567 if (valid) System.out.println ("GraphProperties was valid"); 1568 else System.out.println ("GraphProperties was invalid"); 1569 } 1570 1571 return valid; 1572 } 1573 1574 1575 1579 final void updateGraphChart2D (GraphChart2D graphChart2D) { 1580 1581 if (getGraphChart2DNeedsUpdate (graphChart2D)) { 1582 1583 if (needsUpdate) { 1584 for (int i = 0; i < needsUpdateVector.size(); ++i) { 1585 needsUpdateVector.set (i, new Boolean (true)); 1586 } 1587 needsUpdate = false; 1588 } 1589 1590 int index = -1; 1591 if ((index = graphChart2DVector.indexOf (graphChart2D)) != -1) { 1592 needsUpdateVector.set (index, new Boolean (false)); 1593 } 1594 } 1595 } 1596 1597 1598 1603 final void configureGraphArea (int type, GraphArea graph) { 1604 1605 graph.setBackgroundExistence (getGraphBackgroundExistence()); 1606 graph.setBackgroundColor (getGraphBackgroundColor()); 1607 graph.setBorderExistence (getGraphBorderExistence()); 1608 graph.setBorderThicknessModel (getGraphBorderThicknessModel()); 1609 graph.setBorderColors ( 1610 getGraphBorderLeftBottomColor(), getGraphBorderRightTopColor(), 1611 getGraphBorderRightTopColor(), getGraphBorderLeftBottomColor()); 1612 graph.setAllowComponentAlignment (getGraphAllowComponentAlignment()); 1613 graph.setOutlineComponents (getGraphOutlineComponentsExistence()); 1614 graph.setOutlineComponentsColor (getGraphOutlineComponentsColor()); 1615 graph.setBetweenComponentsGapExistence (getGraphBetweenComponentsGapExistence()); 1616 graph.setBetweenComponentsGapThicknessModel (getGraphBetweenComponentsGapThicknessModel()); 1617 graph.setBarsExistence (getGraphBarsExistence()); 1618 graph.setBarsThicknessModel (getGraphBarsThicknessModel()); 1619 graph.setBarsExcessSpaceFeedbackRatio (getGraphBarsExcessSpaceFeedbackRatio()); 1620 graph.setBarsWithinCategoryOverlapRatio (getGraphBarsWithinCategoryOverlapRatio()); 1621 graph.setLinesExistence (getGraphLinesExistence()); 1622 graph.setLinesThicknessModel (getGraphLinesThicknessModel()); 1623 graph.setLinesFillInterior (getGraphLinesFillInterior()); 1624 graph.setLinesExcessSpaceFeedbackRatio (getGraphLinesExcessSpaceFeedbackRatio()); 1625 graph.setLinesWithinCategoryOverlapRatio (getGraphLinesWithinCategoryOverlapRatio()); 1626 graph.setDotsExistence (getGraphDotsExistence()); 1627 graph.setDotsThicknessModel (getGraphDotsThicknessModel()); 1628 graph.setDotsExcessSpaceFeedbackRatio (getGraphDotsExcessSpaceFeedbackRatio()); 1629 graph.setDotsWithinCategoryOverlapRatio (getGraphDotsWithinCategoryOverlapRatio()); 1630 graph.setBarRoundingRatio (getGraphBarsRoundingRatio()); 1631 1632 if (type == GraphChart2D.LABELS_BOTTOM) { 1633 1634 graph.setHorizontalLinesExistence (getGraphNumbersLinesExistence()); 1635 graph.setHorizontalLinesThicknessModel (getGraphNumbersLinesThicknessModel()); 1636 graph.setHorizontalLinesStyle (getGraphNumbersLinesStyle()); 1637 graph.setHorizontalLinesColor (getGraphNumbersLinesColor()); 1638 graph.setVerticalLinesExistence (getGraphLabelsLinesExistence()); 1639 graph.setVerticalLinesThicknessModel (getGraphLabelsLinesThicknessModel()); 1640 graph.setVerticalLinesStyle (getGraphLabelsLinesStyle()); 1641 graph.setVerticalLinesColor (getGraphLabelsLinesColor()); 1642 } 1643 else { 1644 1645 graph.setVerticalLinesExistence (getGraphNumbersLinesExistence()); 1646 graph.setVerticalLinesThicknessModel (getGraphNumbersLinesThicknessModel()); 1647 graph.setVerticalLinesStyle (getGraphNumbersLinesStyle()); 1648 graph.setVerticalLinesColor (getGraphNumbersLinesColor()); 1649 graph.setHorizontalLinesExistence (getGraphLabelsLinesExistence()); 1650 graph.setHorizontalLinesThicknessModel (getGraphLabelsLinesThicknessModel()); 1651 graph.setHorizontalLinesStyle (getGraphLabelsLinesStyle()); 1652 graph.setHorizontalLinesColor (getGraphLabelsLinesColor()); 1653 } 1654 1655 graph.setLinesThicknessAssociation (getGraphLinesThicknessAssociation()); 1656 graph.setComponentsLightSource (getGraphComponentsLightSource()); 1657 graph.setComponentsLightType (getGraphComponentsLightType()); 1658 graph.setClip (getGraphComponentsOverflowClip()); 1659 graph.setComponentsAlphaComposite (getGraphComponentsAlphaComposite()); 1660 } 1661 1662 1663 1670 final void configureGraphArea (GraphProperties backgroundGraphProps, int type, GraphArea graph) { 1671 1672 graph.setBackgroundExistence (false); 1673 graph.setBorderExistence (backgroundGraphProps.getGraphBorderExistence()); 1674 graph.setBorderThicknessModel (backgroundGraphProps.getGraphBorderThicknessModel()); 1675 graph.setBorderColors ( 1676 backgroundGraphProps.getGraphBorderLeftBottomColor(), 1677 backgroundGraphProps.getGraphBorderRightTopColor(), 1678 backgroundGraphProps.getGraphBorderRightTopColor(), 1679 backgroundGraphProps.getGraphBorderLeftBottomColor()); 1680 graph.setAllowComponentAlignment (getGraphAllowComponentAlignment()); 1681 graph.setOutlineComponents (getGraphOutlineComponentsExistence()); 1682 graph.setOutlineComponentsColor (getGraphOutlineComponentsColor()); 1683 graph.setBetweenComponentsGapExistence (getGraphBetweenComponentsGapExistence()); 1684 graph.setBetweenComponentsGapThicknessModel (getGraphBetweenComponentsGapThicknessModel()); 1685 graph.setBarsExistence (getGraphBarsExistence()); 1686 graph.setBarsThicknessModel (getGraphBarsThicknessModel()); 1687 graph.setBarsExcessSpaceFeedbackRatio (getGraphBarsExcessSpaceFeedbackRatio()); 1688 graph.setBarsWithinCategoryOverlapRatio (getGraphBarsWithinCategoryOverlapRatio()); 1689 graph.setLinesExistence (getGraphLinesExistence()); 1690 graph.setLinesThicknessModel (getGraphLinesThicknessModel()); 1691 graph.setLinesFillInterior (getGraphLinesFillInterior()); 1692 graph.setLinesExcessSpaceFeedbackRatio (getGraphLinesExcessSpaceFeedbackRatio()); 1693 graph.setLinesWithinCategoryOverlapRatio (getGraphLinesWithinCategoryOverlapRatio()); 1694 graph.setDotsExistence (getGraphDotsExistence()); 1695 graph.setDotsThicknessModel (getGraphDotsThicknessModel()); 1696 graph.setDotsExcessSpaceFeedbackRatio (getGraphDotsExcessSpaceFeedbackRatio()); 1697 graph.setDotsWithinCategoryOverlapRatio (getGraphDotsWithinCategoryOverlapRatio()); 1698 1699 graph.setHorizontalLinesExistence (false); 1700 graph.setVerticalLinesExistence (false); 1701 graph.setBarRoundingRatio (getGraphBarsRoundingRatio()); 1702 1703 graph.setComponentsLightSource (getGraphComponentsLightSource()); 1704 graph.setComponentsLightType (getGraphComponentsLightType()); 1705 graph.setClip (getGraphComponentsOverflowClip()); 1706 graph.setComponentsAlphaComposite (getGraphComponentsAlphaComposite()); 1707 } 1708} | Popular Tags |