1 10 11 package org.enhydra.jawe; 12 13 import java.util.*; 14 import java.awt.*; 15 import javax.swing.*; 16 import java.io.*; 17 import org.enhydra.jawe.xml.XMLInterface; 18 import org.enhydra.jawe.xml.XML; 19 20 28 public final class JaWEConfig { 29 private static final int MIN_PROCESS_WIDTH=75; 31 private static final int MIN_PROCESS_HEIGHT=45; 32 private static final int MIN_MIN_PARTICIPANT_WIDTH=150; 33 private static final int MIN_MIN_PARTICIPANT_HEIGHT=50; 34 private static final int MIN_PARTICIPANT_NAME_WIDTH=25; 35 private static final int MIN_ACTIVITY_WIDTH=50; 36 private static final int MIN_ACTIVITY_HEIGHT=30; 37 private static final int MIN_GRID_SIZE=4; 38 private static final float MIN_FONT_SIZE=4; 39 private static final float MAX_FONT_SIZE=36; 40 41 public static final String ON_STATUS="ON"; 42 public static final String OFF_STATUS="OFF"; 43 44 public static final String CURRENT_VERSION="1.2"; 46 public static final String DEFAULT_STARTING_LOCALE=""; 47 public static final String DEFAULT_MANDATORY_CONFORMANCE_CLASS_SETTING_STATUS="ON"; 48 public static final String DEFAULT_MANDATORY_CONFORMANCE_CLASS=""; 49 public static final String DEFAULT_VALIDATION_STATUS=ON_STATUS; 50 public static final String DEFAULT_USE_BUBBLES_STATUS=ON_STATUS; 51 public static final String DEFAULT_ALLOW_UNDEFINED_START=OFF_STATUS; 52 public static final String DEFAULT_ALLOW_UNDEFINED_END=OFF_STATUS; 53 public static final String DEFAULT_LOOK_AND_FEEL_CLASS_NAME=""; 54 public static final String DEFAULT_RECENT_FILE_LIST_SIZE="10"; 55 public static final String DEFAULT_ENCODING="UTF-8"; 56 public static final String DEFAULT_FILE_LOCKING_STATUS=ON_STATUS; 57 public static final String DEFAULT_TOOLTIP_STATUS=ON_STATUS; 58 public static final String DEFAULT_GRID_STATUS=ON_STATUS; 59 public static final String DEFAULT_STATUS_BAR_STATUS=ON_STATUS; 60 public static final String DEFAULT_NAME_WRAPPING_STATUS=ON_STATUS; 61 public static final String DEFAULT_WRAPPING_STYLE_WORD_STATUS=ON_STATUS; 62 public static final String DEFAULT_LDAP_COUNT_LIMIT="0"; 63 public static final String DEFAULT_LDAP_TIME_LIMIT="0"; 64 public static final String DEFAULT_GRID_SIZE="10"; 65 public static final String DEFAULT_FONT_SIZE="12"; 66 public static final String DEFAULT_PROCESS_WIDTH="135"; 67 public static final String DEFAULT_PROCESS_HEIGHT="65"; 68 public static final String DEFAULT_MIN_PARTICIPANT_WIDTH="800"; 69 public static final String DEFAULT_MIN_PARTICIPANT_HEIGHT="150"; 70 public static final String DEFAULT_PARTICIPANT_NAME_WIDTH="50"; 71 public static final String DEFAULT_ACTIVITY_WIDTH="75"; 72 public static final String DEFAULT_ACTIVITY_HEIGHT="45"; 73 public static final String DEFAULT_BACKGROUND_COLOR="SystemColor.menu"; 74 public static final String DEFAULT_HIGHLIGHT_COLOR="SystemColor.inactiveCaptionText"; 75 public static final String DEFAULT_HANDLE_COLOR="Color.pink"; 76 public static final String DEFAULT_MARQUEE_COLOR="SystemColor.textHighlight"; 77 public static final String DEFAULT_GRID_COLOR="SystemColor.textHighlight"; 78 public static final String DEFAULT_PROCESS_COLOR="R=58,G=110,B=165"; 79 public static final String DEFAULT_TRANSITION_COLOR="SystemColor.textHighlight"; 80 public static final String DEFAULT_OTHERWISE_TRANSITION_COLOR="R=255,G=153,B=0"; 81 public static final String DEFAULT_EXCEPTION_TRANSITION_COLOR="Color.pink"; 82 public static final String DEFAULT_DEFAULT_EXCEPTION_TRANSITION_COLOR="R=204,G=0,B=0"; 83 public static final String DEFAULT_PARTICIPANT_TEXT_COLOR="SystemColor.textText"; 84 public static final String DEFAULT_PARTICIPANT_BORDER_COLOR="SystemColor.textText"; 85 public static final String DEFAULT_RESOURCE_SET_PARTICIPANT_COLOR="R=146,G=146,B=180"; 86 public static final String DEFAULT_RESOURCE_PARTICIPANT_COLOR="R=146,G=146,B=160"; 87 public static final String DEFAULT_ROLE_PARTICIPANT_COLOR="R=146,G=180,B=146"; 88 public static final String DEFAULT_ORGANIZATIONAL_UNIT_PARTICIPANT_COLOR="R=180,G=146,B=146"; 89 public static final String DEFAULT_HUMAN_PARTICIPANT_COLOR="R=160,G=146,B=146"; 90 public static final String DEFAULT_SYSTEM_PARTICIPANT_COLOR="R=146,G=160,B=146"; 91 public static final String DEFAULT_FREE_TEXT_EXPRESSION_PARTICIPANT_COLOR="SystemColor.text"; 92 public static final String DEFAULT_SELECTED_ACTIVITY__COLOR="Color.orange"; 93 public static final String DEFAULT_START_COLOR="R=0,G=128,B=255"; 94 public static final String DEFAULT_END_COLOR="Color.yellow"; 95 public static final String DEFAULT_START_END_COLOR="Color.green"; 96 public static final String DEFAULT_GENERIC_ACTIVITY_COLOR="SystemColor.textInactiveText"; 97 public static final String DEFAULT_ROUTE_ACTIVITY_COLOR="R=216,G=230,B=216"; 98 public static final String DEFAULT_SUBFLOW_ACTIVITY_COLOR="R=230,G=216,B=216"; 99 public static final String DEFAULT_BLOCK_ACTIVITY_COLOR="R=216,G=216,B=230"; 100 103 private static JaWEConfig jaweConfig; 105 106 110 111 public static JaWEConfig getInstance () { 112 if (jaweConfig==null) { 113 jaweConfig=new JaWEConfig(); 114 } 115 return jaweConfig; 116 } 117 118 private String cfn; 119 120 private Properties properties=new Properties(); 121 122 private JaWEConfig () { 123 setDefaultValues(); 124 properties.remove("Version"); 127 cfn=JaWEConstants.JAWE_USER_HOME + JaWEConstants.JAWE_CONF_FILENAME; 130 131 try { 133 InputStream is=new FileInputStream(cfn); 134 properties.load(is); 135 initialize(); 136 String ver=properties.getProperty("Version"); 137 if (ver==null || !ver.equals(CURRENT_VERSION)) { 139 properties.setProperty("Version",CURRENT_VERSION); 140 saveConf(); 141 } 142 } catch (Exception ex) { 144 properties.setProperty("Version",CURRENT_VERSION); 146 initialize(); 147 saveConf(); 148 } 149 } 150 151 private void setDefaultValues () { 152 properties.setProperty("Version",CURRENT_VERSION); 154 properties.setProperty("StartingLocale",DEFAULT_STARTING_LOCALE); 155 properties.setProperty("MandatoryConformanceClassSettingStatus",DEFAULT_MANDATORY_CONFORMANCE_CLASS_SETTING_STATUS); 156 properties.setProperty("MandatoryConformanceClass",DEFAULT_MANDATORY_CONFORMANCE_CLASS); 157 properties.setProperty("ValidationStatus",DEFAULT_VALIDATION_STATUS); 158 properties.setProperty("UseBubblesStatus",DEFAULT_USE_BUBBLES_STATUS); 159 properties.setProperty("AllowUndefinedStartActivity",DEFAULT_ALLOW_UNDEFINED_START); 160 properties.setProperty("AllowUndefinedEndActivity",DEFAULT_ALLOW_UNDEFINED_END); 161 properties.setProperty("LookAndFeelClassName",DEFAULT_LOOK_AND_FEEL_CLASS_NAME); 162 properties.setProperty("RecentFileListSize",DEFAULT_RECENT_FILE_LIST_SIZE); 163 properties.setProperty("Encoding",DEFAULT_ENCODING); 164 properties.setProperty("FileLockingStatus",DEFAULT_FILE_LOCKING_STATUS); 165 properties.setProperty("TooltipStatus",DEFAULT_TOOLTIP_STATUS); 166 properties.setProperty("NameWrappingStatus",DEFAULT_NAME_WRAPPING_STATUS); 167 properties.setProperty("WrappingStyleWordStatus",DEFAULT_WRAPPING_STYLE_WORD_STATUS); 168 properties.setProperty("GridStatus",DEFAULT_GRID_STATUS); 169 properties.setProperty("StatusBarStatus",DEFAULT_STATUS_BAR_STATUS); 170 properties.setProperty("GridSize",DEFAULT_GRID_SIZE); 171 properties.setProperty("FontSize",DEFAULT_FONT_SIZE); 172 properties.setProperty("LDAPCountLimit",DEFAULT_LDAP_COUNT_LIMIT); 173 properties.setProperty("LDAPTimeLimit",DEFAULT_LDAP_TIME_LIMIT); 174 properties.setProperty("ProcessWidth",DEFAULT_PROCESS_WIDTH); 175 properties.setProperty("ProcessHeight",DEFAULT_PROCESS_HEIGHT); 176 properties.setProperty("MinParticipantWidth",DEFAULT_MIN_PARTICIPANT_WIDTH); 177 properties.setProperty("MinParticipantHeight",DEFAULT_MIN_PARTICIPANT_HEIGHT); 178 properties.setProperty("ParticipantNameWidth",DEFAULT_PARTICIPANT_NAME_WIDTH); 179 properties.setProperty("ActivityWidth",DEFAULT_ACTIVITY_WIDTH); 180 properties.setProperty("ActivityHeight",DEFAULT_ACTIVITY_HEIGHT); 181 properties.setProperty("BackgroundColor",DEFAULT_BACKGROUND_COLOR); 182 properties.setProperty("HighlightColor",DEFAULT_HIGHLIGHT_COLOR); 183 properties.setProperty("HandleColor",DEFAULT_HANDLE_COLOR); 184 properties.setProperty("MarqueeColor",DEFAULT_MARQUEE_COLOR); 185 properties.setProperty("GridColor",DEFAULT_GRID_COLOR); 186 properties.setProperty("ProcessColor",DEFAULT_PROCESS_COLOR); 187 properties.setProperty("TransitionColor",DEFAULT_TRANSITION_COLOR); 188 properties.setProperty("OtherwiseTransitionColor",DEFAULT_OTHERWISE_TRANSITION_COLOR); 189 properties.setProperty("ExceptionTransitionColor",DEFAULT_EXCEPTION_TRANSITION_COLOR); 190 properties.setProperty("DefaultExceptionTransitionColor",DEFAULT_DEFAULT_EXCEPTION_TRANSITION_COLOR); 191 properties.setProperty("ParticipantTextColor",DEFAULT_PARTICIPANT_TEXT_COLOR); 192 properties.setProperty("ParticipantBorderColor",DEFAULT_PARTICIPANT_BORDER_COLOR); 193 properties.setProperty("ResourceSetParticipantColor",DEFAULT_RESOURCE_SET_PARTICIPANT_COLOR); 194 properties.setProperty("ResourceParticipantColor",DEFAULT_RESOURCE_PARTICIPANT_COLOR); 195 properties.setProperty("RoleParticipantColor",DEFAULT_ROLE_PARTICIPANT_COLOR); 196 properties.setProperty("OrganizationalUnitParticipantColor",DEFAULT_ORGANIZATIONAL_UNIT_PARTICIPANT_COLOR); 197 properties.setProperty("HumanParticipantColor",DEFAULT_HUMAN_PARTICIPANT_COLOR); 198 properties.setProperty("SystemParticipantColor",DEFAULT_SYSTEM_PARTICIPANT_COLOR); 199 properties.setProperty("FreeTextExpressionParticipantColor",DEFAULT_FREE_TEXT_EXPRESSION_PARTICIPANT_COLOR); 200 properties.setProperty("StartColor",DEFAULT_START_COLOR); 201 properties.setProperty("EndColor",DEFAULT_END_COLOR); 202 properties.setProperty("StartEndColor",DEFAULT_START_END_COLOR); 203 properties.setProperty("SelectedActivityColor",DEFAULT_SELECTED_ACTIVITY__COLOR); 204 properties.setProperty("GenericActivityColor",DEFAULT_GENERIC_ACTIVITY_COLOR); 205 properties.setProperty("RouteActivityColor",DEFAULT_ROUTE_ACTIVITY_COLOR); 206 properties.setProperty("SubFlowActivityColor",DEFAULT_SUBFLOW_ACTIVITY_COLOR); 207 properties.setProperty("BlockActivityColor",DEFAULT_BLOCK_ACTIVITY_COLOR); 208 } 211 212 private void initialize () { 213 setStartingLocale(properties.getProperty("StartingLocale")); 215 216 boolean mccst; 218 try { 219 String mccsts=properties.getProperty("MandatoryConformanceClassSettingStatus"); 220 if (mccsts.equalsIgnoreCase(OFF_STATUS)) { 221 mccst=false; 222 } else { 223 mccst=true; 224 } 225 } catch (Exception ex) { 226 if (DEFAULT_MANDATORY_CONFORMANCE_CLASS_SETTING_STATUS.equalsIgnoreCase(ON_STATUS)) { 227 mccst=true; 228 } else { 229 mccst=false; 230 } 231 } 232 setMandatoryConformanceClassSettingStatus(mccst); 233 234 setMandatoryConformanceClass(properties.getProperty("MandatoryConformanceClass")); 236 237 setEncoding(properties.getProperty("Encoding")); 239 240 boolean vst; 242 try { 243 String vsts=properties.getProperty("ValidationStatus"); 244 if (vsts.equalsIgnoreCase(OFF_STATUS)) { 245 vst=false; 246 } else { 247 vst=true; 248 } 249 } catch (Exception ex) { 250 if (DEFAULT_VALIDATION_STATUS.equalsIgnoreCase(ON_STATUS)) { 251 vst=true; 252 } else { 253 vst=false; 254 } 255 } 256 setValidationStatus(vst); 257 258 boolean ubst; 260 try { 261 String ubsts=properties.getProperty("UseBubblesStatus"); 262 if (ubsts.equalsIgnoreCase(OFF_STATUS)) { 263 ubst=false; 264 } else { 265 ubst=true; 266 } 267 } catch (Exception ex) { 268 if (DEFAULT_USE_BUBBLES_STATUS.equalsIgnoreCase(ON_STATUS)) { 269 ubst=true; 270 } else { 271 ubst=false; 272 } 273 } 274 setUseBubblesStatus(ubst); 275 276 boolean ais; 278 try { 279 String aiss=properties.getProperty("AllowUndefinedStartActivity"); 280 if (aiss.equalsIgnoreCase(OFF_STATUS)) { 281 ais=false; 282 } else { 283 ais=true; 284 } 285 } catch (Exception ex) { 286 if (DEFAULT_ALLOW_UNDEFINED_START.equalsIgnoreCase(ON_STATUS)) { 287 ais=true; 288 } else { 289 ais=false; 290 } 291 } 292 setAllowUndefinedStartActivity(ais); 293 294 boolean aie; 296 try { 297 String aies=properties.getProperty("AllowUndefinedEndActivity"); 298 if (aies.equalsIgnoreCase(OFF_STATUS)) { 299 aie=false; 300 } else { 301 aie=true; 302 } 303 } catch (Exception ex) { 304 if (DEFAULT_ALLOW_UNDEFINED_END.equalsIgnoreCase(ON_STATUS)) { 305 aie=true; 306 } else { 307 aie=false; 308 } 309 } 310 setAllowUndefinedStartActivity(aie); 311 312 setLookAndFeelClassName(properties.getProperty("LookAndFeelClassName")); 314 315 int rfls; 317 try { 318 rfls=Integer.parseInt(properties.getProperty("RecentFileListSize")); 319 } catch (Exception ex) { 320 rfls=Integer.parseInt(DEFAULT_RECENT_FILE_LIST_SIZE); 321 } 322 setRecentFileListSize(rfls); 323 324 boolean flst; 326 try { 327 String flss=properties.getProperty("FileLockingStatus"); 328 if (flss.equalsIgnoreCase(OFF_STATUS)) { 329 flst=false; 330 } else { 331 flst=true; 332 } 333 } catch (Exception ex) { 334 if (DEFAULT_FILE_LOCKING_STATUS.equalsIgnoreCase(ON_STATUS)) { 335 flst=true; 336 } else { 337 flst=false; 338 } 339 } 340 setFileLockingStatus(flst); 341 342 boolean tst; 344 try { 345 String tss=properties.getProperty("TooltipStatus"); 346 if (tss.equalsIgnoreCase(OFF_STATUS)) { 347 tst=false; 348 } else { 349 tst=true; 350 } 351 } catch (Exception ex) { 352 if (DEFAULT_TOOLTIP_STATUS.equalsIgnoreCase(ON_STATUS)) { 353 tst=true; 354 } else { 355 tst=false; 356 } 357 } 358 setTooltipStatus(tst); 359 360 boolean nmwst; 362 try { 363 String nmwsst=properties.getProperty("NameWrappingStatus"); 364 if (nmwsst.equalsIgnoreCase(OFF_STATUS)) { 365 nmwst=false; 366 } else { 367 nmwst=true; 368 } 369 } catch (Exception ex) { 370 if (DEFAULT_NAME_WRAPPING_STATUS.equalsIgnoreCase(ON_STATUS)) { 371 nmwst=true; 372 } else { 373 nmwst=false; 374 } 375 } 376 setNameWrappingStatus(nmwst); 377 378 boolean wswst; 380 try { 381 String wswsts=properties.getProperty("WrappingStyleWordStatus"); 382 if (wswsts.equalsIgnoreCase(OFF_STATUS)) { 383 wswst=false; 384 } else { 385 wswst=true; 386 } 387 } catch (Exception ex) { 388 if (DEFAULT_WRAPPING_STYLE_WORD_STATUS.equalsIgnoreCase(ON_STATUS)) { 389 wswst=true; 390 } else { 391 wswst=false; 392 } 393 } 394 setWrappingStyleWordStatus(wswst); 395 396 boolean gst; 398 try { 399 String gss=properties.getProperty("GridStatus"); 400 if (gss.equalsIgnoreCase(OFF_STATUS)) { 401 gst=false; 402 } else { 403 gst=true; 404 } 405 } catch (Exception ex) { 406 if (DEFAULT_GRID_STATUS.equalsIgnoreCase(ON_STATUS)) { 407 gst=true; 408 } else { 409 gst=false; 410 } 411 } 412 setGridStatus(gst); 413 414 boolean sbst; 416 try { 417 String sbss=properties.getProperty("StatusBarStatus"); 418 if (sbss.equalsIgnoreCase(OFF_STATUS)) { 419 sbst=false; 420 } else { 421 sbst=true; 422 } 423 } catch (Exception ex) { 424 if (DEFAULT_STATUS_BAR_STATUS.equalsIgnoreCase(ON_STATUS)) { 425 sbst=true; 426 } else { 427 sbst=false; 428 } 429 } 430 setStatusBarStatus(sbst); 431 432 int lcl; 434 try { 435 lcl=Integer.parseInt(properties.getProperty("LDAPCountLimit")); 436 } catch (Exception ex) { 437 lcl=Integer.parseInt(DEFAULT_LDAP_COUNT_LIMIT); 438 } 439 setLDAPCountLimit(lcl); 440 441 int ltl; 442 try { 443 ltl=Integer.parseInt(properties.getProperty("LDAPTimeLimit")); 444 } catch (Exception ex) { 445 ltl=Integer.parseInt(DEFAULT_LDAP_TIME_LIMIT); 446 } 447 setLDAPTimeLimit(ltl); 448 449 int gs; 451 try { 452 gs=Integer.parseInt(properties.getProperty("GridSize")); 453 } catch (Exception ex) { 454 gs=Integer.parseInt(DEFAULT_GRID_SIZE); 455 } 456 setGridSize(gs); 457 458 float fs; 460 try { 461 fs=Float.parseFloat(properties.getProperty("FontSize")); 462 } catch (Exception ex) { 463 fs=Float.parseFloat(DEFAULT_FONT_SIZE); 464 } 465 setFontSize(fs); 466 467 int pWidth, pHeight; 469 try { 470 pWidth=Integer.parseInt(properties.getProperty("ProcessWidth")); 471 } catch (Exception ex) { 472 pWidth=Integer.parseInt(DEFAULT_PROCESS_WIDTH); 473 } 474 setProcessWidth(pWidth); 475 try { 476 pHeight=Integer.parseInt(properties.getProperty("ProcessHeight")); 477 } catch (Exception ex) { 478 pHeight=Integer.parseInt(DEFAULT_PROCESS_HEIGHT); 479 } 480 setProcessHeight(pHeight); 481 482 int mpWidth, mpHeight, pnWidth; 484 try { 485 mpWidth=Integer.parseInt(properties.getProperty("MinParticipantWidth")); 486 } catch (Exception ex) { 487 mpWidth=Integer.parseInt(DEFAULT_MIN_PARTICIPANT_WIDTH); 488 } 489 setMinParticipantWidth(mpWidth); 490 try { 491 mpHeight=Integer.parseInt(properties.getProperty("MinParticipantHeight")); 492 } catch (Exception ex) { 493 mpHeight=Integer.parseInt(DEFAULT_MIN_PARTICIPANT_HEIGHT); 494 } 495 setMinParticipantHeight(mpHeight); 496 try { 497 pnWidth=Integer.parseInt(properties.getProperty("ParticipantNameWidth")); 498 } catch (Exception ex) { 499 pnWidth=Integer.parseInt(DEFAULT_PARTICIPANT_NAME_WIDTH); 500 } 501 setParticipantNameWidth(pnWidth); 502 503 int aWidth, aHeight; 505 try { 506 aWidth=Integer.parseInt(properties.getProperty("ActivityWidth")); 507 } catch (Exception ex) { 508 aWidth=Integer.parseInt(DEFAULT_ACTIVITY_WIDTH); 509 } 510 setActivityWidth(aWidth); 511 try { 512 aHeight=Integer.parseInt(properties.getProperty("ActivityHeight")); 513 } catch (Exception ex) { 514 aHeight=Integer.parseInt(DEFAULT_ACTIVITY_HEIGHT); 515 } 516 setActivityHeight(aHeight); 517 518 setBackgroundColor(properties.getProperty("BackgroundColor")); 520 setHighlightColor(properties.getProperty("HighlightColor")); 521 setHandleColor(properties.getProperty("HandleColor")); 522 setMarqueeColor(properties.getProperty("MarqueeColor")); 523 setGridColor(properties.getProperty("GridColor")); 524 setProcessColor(properties.getProperty("ProcessColor")); 525 setTransitionColor(properties.getProperty("TransitionColor")); 526 setOtherwiseTransitionColor(properties.getProperty("OtherwiseTransitionColor")); 527 setExceptionTransitionColor(properties.getProperty("ExceptionTransitionColor")); 528 setDefaultExceptionTransitionColor(properties.getProperty("DefaultExceptionTransitionColor")); 529 setParticipantTextColor(properties.getProperty("ParticipantTextColor")); 530 setParticipantBorderColor(properties.getProperty("ParticipantBorderColor")); 531 setResourceSetParticipantColor(properties.getProperty("ResourceSetParticipantColor")); 532 setResourceParticipantColor(properties.getProperty("ResourceParticipantColor")); 533 setRoleParticipantColor(properties.getProperty("RoleParticipantColor")); 534 setOrganizationalUnitParticipantColor(properties.getProperty("OrganizationalUnitParticipantColor")); 535 setHumanParticipantColor(properties.getProperty("HumanParticipantColor")); 536 setSystemParticipantColor(properties.getProperty("SystemParticipantColor")); 537 setFreeTextExpressionParticipantColor(properties.getProperty("FreeTextExpressionParticipantColor")); 538 setStartColor(properties.getProperty("StartColor")); 539 setEndColor(properties.getProperty("EndColor")); 540 setStartEndColor(properties.getProperty("StartEndColor")); 541 setSelectedActivityColor(properties.getProperty("SelectedActivityColor")); 542 setGenericActivityColor(properties.getProperty("GenericActivityColor")); 543 setRouteActivityColor(properties.getProperty("RouteActivityColor")); 544 setSubFlowActivityColor(properties.getProperty("SubFlowActivityColor")); 545 setBlockActivityColor(properties.getProperty("BlockActivityColor")); 546 } 549 550 public String getStartingLocale () { 551 return properties.getProperty("StartingLocale"); 552 } 553 554 public void setStartingLocale (String sl) { 555 if (sl!=null) { 556 properties.setProperty("StartingLocale",sl); 557 } else { 558 properties.setProperty("StartingLocale",DEFAULT_STARTING_LOCALE); 559 } 560 } 561 562 public boolean getMandatoryConformanceClassSettingStatus () { 563 if (properties.getProperty("MandatoryConformanceClassSettingStatus").equalsIgnoreCase(ON_STATUS)) { 564 return true; 565 } else { 566 return false; 567 } 568 } 569 570 public void setMandatoryConformanceClassSettingStatus (boolean status) { 571 if (status) { 572 properties.setProperty("MandatoryConformanceClassSettingStatus",ON_STATUS); 573 } else { 574 properties.setProperty("MandatoryConformanceClassSettingStatus",OFF_STATUS); 575 } 576 } 577 578 579 public String getMandatoryConformanceClass () { 580 return properties.getProperty("MandatoryConformanceClass"); 581 } 582 583 public void setMandatoryConformanceClass (String mcl) { 584 if (mcl!=null) { 585 properties.setProperty("MandatoryConformanceClass",mcl); 586 } else { 587 properties.setProperty("MandatoryConformanceClass",DEFAULT_MANDATORY_CONFORMANCE_CLASS); 588 } 589 } 590 591 public String getEncoding () { 592 return properties.getProperty("Encoding"); 593 } 594 595 public void setEncoding (String enc) { 596 if (enc!=null) { 597 properties.setProperty("Encoding",enc); 598 } else { 599 properties.setProperty("Encoding",DEFAULT_ENCODING); 600 } 601 } 602 603 public boolean getValidationStatus () { 604 if (properties.getProperty("ValidationStatus").equalsIgnoreCase(ON_STATUS)) { 605 return true; 606 } else { 607 return false; 608 } 609 } 610 611 public void setValidationStatus (boolean status) { 612 if (status) { 613 properties.setProperty("ValidationStatus",ON_STATUS); 614 } else { 615 properties.setProperty("ValidationStatus",OFF_STATUS); 616 } 617 JaWE.getXMLInterface().setValidation(status); 619 } 620 621 public boolean getUseBubblesStatus () { 622 if (properties.getProperty("UseBubblesStatus").equalsIgnoreCase(ON_STATUS)) { 623 return true; 624 } else { 625 return false; 626 } 627 } 628 629 public void setUseBubblesStatus (boolean status) { 630 if (status) { 631 properties.setProperty("UseBubblesStatus",ON_STATUS); 632 } else { 633 properties.setProperty("UseBubblesStatus",OFF_STATUS); 634 } 635 } 636 637 public boolean getAllowUndefinedStartActivity () { 638 if (properties.getProperty("AllowUndefinedStartActivity").equalsIgnoreCase(ON_STATUS)) { 639 return true; 640 } else { 641 return false; 642 } 643 } 644 645 public void setAllowUndefinedStartActivity (boolean allow) { 646 if (allow) { 647 properties.setProperty("AllowUndefinedStartActivity",ON_STATUS); 648 } else { 649 properties.setProperty("AllowUndefinedStartActivity",OFF_STATUS); 650 } 651 } 652 653 public boolean getAllowUndefinedEndActivity () { 654 if (properties.getProperty("AllowUndefinedEndActivity").equalsIgnoreCase(ON_STATUS)) { 655 return true; 656 } else { 657 return false; 658 } 659 } 660 661 public void setAllowUndefinedEndActivity (boolean allow) { 662 if (allow) { 663 properties.setProperty("AllowUndefinedEndActivity",ON_STATUS); 664 } else { 665 properties.setProperty("AllowUndefinedEndActivity",OFF_STATUS); 666 } 667 } 668 669 public String getLookAndFeelClassName () { 670 return properties.getProperty("LookAndFeelClassName"); 671 } 672 673 public void setLookAndFeelClassName (String lafCN) { 674 if (lafCN!=null) { 675 try { 676 if (lafCN.length()==0) { 677 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 678 properties.setProperty("LookAndFeelClassName",DEFAULT_LOOK_AND_FEEL_CLASS_NAME); 679 } else { 680 UIManager.setLookAndFeel(lafCN); 681 properties.setProperty("LookAndFeelClassName",lafCN); 682 } 683 } catch (Exception ex) {} 684 } else { 685 properties.setProperty("LookAndFeelClassName",DEFAULT_LOOK_AND_FEEL_CLASS_NAME); 686 try { 687 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 688 } catch (Exception ex) {} 689 } 690 } 691 692 public int getRecentFileListSize () { 693 return Integer.valueOf(properties.getProperty("RecentFileListSize")).intValue(); 694 } 695 696 public void setRecentFileListSize (int rfls) { 697 if (rfls<1) { 698 rfls=1; 699 } 700 if (rfls>16) { 701 rfls=16; 702 } 703 properties.setProperty("RecentFileListSize",String.valueOf(rfls)); 704 } 705 706 public boolean getFileLockingStatus () { 707 if (properties.getProperty("FileLockingStatus").equalsIgnoreCase(ON_STATUS)) { 708 return true; 709 } else { 710 return false; 711 } 712 } 713 714 public void setFileLockingStatus (boolean status) { 715 if (status) { 716 properties.setProperty("FileLockingStatus",ON_STATUS); 717 } else { 718 properties.setProperty("FileLockingStatus",OFF_STATUS); 719 } 720 XMLInterface xmlI=JaWE.getXMLInterface(); 722 if (xmlI instanceof XML) { 723 ((XML)xmlI).setFileLockingStatus(status); 724 if (status) { 725 ((XML)xmlI).lockAllFiles(); 726 } else { 727 ((XML)xmlI).unlockAllFiles(); 728 } 729 } 730 731 } 732 733 734 public boolean getTooltipStatus () { 735 if (properties.getProperty("TooltipStatus").equalsIgnoreCase(ON_STATUS)) { 736 return true; 737 } else { 738 return false; 739 } 740 } 741 742 public void setTooltipStatus (boolean status) { 743 if (status) { 744 properties.setProperty("TooltipStatus",ON_STATUS); 745 } else { 746 properties.setProperty("TooltipStatus",OFF_STATUS); 747 } 748 ToolTipManager.sharedInstance().setEnabled(status); 750 } 751 752 public boolean getNameWrappingStatus () { 753 if (properties.getProperty("NameWrappingStatus").equalsIgnoreCase(ON_STATUS)) { 754 return true; 755 } else { 756 return false; 757 } 758 } 759 760 public void setNameWrappingStatus (boolean status) { 761 if (status) { 762 properties.setProperty("NameWrappingStatus",ON_STATUS); 763 } else { 764 properties.setProperty("NameWrappingStatus",OFF_STATUS); 765 } 766 } 767 768 public boolean getWrappingStyleWordStatus () { 769 if (properties.getProperty("WrappingStyleWordStatus").equalsIgnoreCase(ON_STATUS)) { 770 return true; 771 } else { 772 return false; 773 } 774 } 775 776 public void setWrappingStyleWordStatus (boolean status) { 777 if (status) { 778 properties.setProperty("WrappingStyleWordStatus",ON_STATUS); 779 } else { 780 properties.setProperty("WrappingStyleWordStatus",OFF_STATUS); 781 } 782 } 783 784 public boolean getGridStatus () { 785 if (properties.getProperty("GridStatus").equalsIgnoreCase(ON_STATUS)) { 786 return true; 787 } else { 788 return false; 789 } 790 } 791 792 public void setGridStatus (boolean status) { 793 if (status) { 794 properties.setProperty("GridStatus",ON_STATUS); 795 } else { 796 properties.setProperty("GridStatus",OFF_STATUS); 797 } 798 } 799 800 public boolean getStatusBarStatus () { 801 if (properties.getProperty("StatusBarStatus").equalsIgnoreCase(ON_STATUS)) { 802 return true; 803 } else { 804 return false; 805 } 806 } 807 808 public void setStatusBarStatus (boolean status) { 809 if (status) { 810 properties.setProperty("StatusBarStatus",ON_STATUS); 811 } else { 812 properties.setProperty("StatusBarStatus",OFF_STATUS); 813 } 814 } 815 816 817 public int getLDAPCountLimit () { 818 return Integer.valueOf(properties.getProperty("LDAPCountLimit")).intValue(); 819 } 820 821 public void setLDAPCountLimit (int lcl) { 822 if (lcl<0) { 823 lcl=0; 824 } 825 properties.setProperty("LDAPCountLimit",String.valueOf(lcl)); 826 } 827 828 public int getLDAPTimeLimit () { 829 return Integer.valueOf(properties.getProperty("LDAPTimeLimit")).intValue(); 830 } 831 832 public void setLDAPTimeLimit (int ltl) { 833 if (ltl<0) { 834 ltl=0; 835 } 836 properties.setProperty("LDAPTimeLimit",String.valueOf(ltl)); 837 } 838 839 public int getGridSize () { 840 return Integer.valueOf(properties.getProperty("GridSize")).intValue(); 841 } 842 843 public void setGridSize (int gs) { 844 if (gs<MIN_GRID_SIZE) { 845 gs=MIN_GRID_SIZE; 846 } 847 properties.setProperty("GridSize",String.valueOf(gs)); 848 } 849 850 public float getFontSize () { 851 return Float.valueOf(properties.getProperty("FontSize")).floatValue(); 852 } 853 854 public void setFontSize (float fs) { 855 if (fs<MIN_FONT_SIZE) { 856 fs=MIN_FONT_SIZE; 857 } 858 if (fs>MAX_FONT_SIZE) { 859 fs=MAX_FONT_SIZE; 860 } 861 properties.setProperty("FontSize",String.valueOf(fs)); 862 } 863 864 public int getProcessWidth () { 865 return Integer.valueOf(properties.getProperty("ProcessWidth")).intValue(); 866 } 867 868 public void setProcessWidth (int pw) { 869 if (pw<MIN_PROCESS_WIDTH) { 870 pw=MIN_PROCESS_WIDTH; 871 } 872 properties.setProperty("ProcessWidth",String.valueOf(pw)); 873 } 874 875 public int getProcessHeight () { 876 return Integer.valueOf(properties.getProperty("ProcessHeight")).intValue(); 877 } 878 879 public void setProcessHeight (int ph) { 880 if (ph<MIN_PROCESS_HEIGHT) { 881 ph=MIN_PROCESS_HEIGHT; 882 } 883 properties.setProperty("ProcessHeight",String.valueOf(ph)); 884 } 885 886 public int getMinParticipantWidth () { 887 return Integer.valueOf(properties.getProperty("MinParticipantWidth")).intValue(); 888 } 889 890 public void setMinParticipantWidth (int mpw) { 891 if (mpw<MIN_MIN_PARTICIPANT_WIDTH) { 892 mpw=MIN_MIN_PARTICIPANT_WIDTH; 893 } 894 properties.setProperty("MinParticipantWidth",String.valueOf(mpw)); 895 } 896 897 public int getMinParticipantHeight () { 898 return Integer.valueOf(properties.getProperty("MinParticipantHeight")).intValue(); 899 } 900 901 public void setMinParticipantHeight (int mph) { 902 if (mph<MIN_MIN_PARTICIPANT_HEIGHT) { 903 mph=MIN_MIN_PARTICIPANT_HEIGHT; 904 } 905 properties.setProperty("MinParticipantHeight",String.valueOf(mph)); 906 } 907 908 public int getParticipantNameWidth () { 909 return Integer.valueOf(properties.getProperty("ParticipantNameWidth")).intValue(); 910 } 911 912 public void setParticipantNameWidth (int pnw) { 913 if (pnw<MIN_PARTICIPANT_NAME_WIDTH) { 914 pnw=MIN_PARTICIPANT_NAME_WIDTH; 915 } 916 properties.setProperty("ParticipantNameWidth",String.valueOf(pnw)); 917 } 918 919 public int getActivityWidth () { 920 return Integer.valueOf(properties.getProperty("ActivityWidth")).intValue(); 921 } 922 923 public void setActivityWidth (int aw) { 924 if (aw<MIN_ACTIVITY_WIDTH) { 925 aw=MIN_ACTIVITY_WIDTH; 926 } 927 properties.setProperty("ActivityWidth",String.valueOf(aw)); 928 } 929 930 public int getActivityHeight () { 931 return Integer.valueOf(properties.getProperty("ActivityHeight")).intValue(); 932 } 933 934 public void setActivityHeight (int ah) { 935 if (ah<MIN_ACTIVITY_HEIGHT) { 936 ah=MIN_ACTIVITY_HEIGHT; 937 } 938 properties.setProperty("ActivityHeight",String.valueOf(ah)); 939 } 940 941 public int getInnerActivityWidth () { 942 return (int)(getActivityWidth()*0.8); 944 } 945 946 public int getInnerActivityHeight () { 947 return (int)(getActivityHeight()*0.8); 949 } 950 951 public String getBackgroundColor () { 952 return properties.getProperty("BackgroundColor"); 953 } 954 955 public void setBackgroundColor (String col) { 956 properties.setProperty("BackgroundColor",createColorString(col,getBackgroundColor())); 957 } 958 959 public String getHighlightColor () { 960 return properties.getProperty("HighlightColor"); 961 } 962 963 public void setHighlightColor (String col) { 964 properties.setProperty("HighlightColor",createColorString(col,getHighlightColor())); 965 } 966 967 public String getHandleColor () { 968 return properties.getProperty("HandleColor"); 969 } 970 971 public void setHandleColor (String col) { 972 properties.setProperty("HandleColor",createColorString(col,getHandleColor())); 973 } 974 975 public String getMarqueeColor () { 976 return properties.getProperty("MarqueeColor"); 977 } 978 979 public void setMarqueeColor (String col) { 980 properties.setProperty("MarqueeColor",createColorString(col,getMarqueeColor() )); 981 } 982 983 public String getGridColor () { 984 return properties.getProperty("GridColor"); 985 } 986 987 public void setGridColor (String col) { 988 properties.setProperty("GridColor",createColorString(col,getGridColor())); 989 } 990 991 public String getProcessColor () { 992 return properties.getProperty("ProcessColor"); 993 } 994 995 public void setProcessColor (String col) { 996 properties.setProperty("ProcessColor",createColorString(col,getProcessColor())); 997 } 998 999 public String getTransitionColor () { 1000 return properties.getProperty("TransitionColor"); 1001 } 1002 1003 public void setTransitionColor (String col) { 1004 properties.setProperty("TransitionColor",createColorString(col,getTransitionColor())); 1005 } 1006 1007 public String getOtherwiseTransitionColor () { 1008 return properties.getProperty("OtherwiseTransitionColor"); 1009 } 1010 1011 public void setOtherwiseTransitionColor (String col) { 1012 properties.setProperty("OtherwiseTransitionColor",createColorString(col,getOtherwiseTransitionColor())); 1013 } 1014 1015 public String getExceptionTransitionColor () { 1016 return properties.getProperty("ExceptionTransitionColor"); 1017 } 1018 1019 public void setExceptionTransitionColor (String col) { 1020 properties.setProperty("ExceptionTransitionColor",createColorString(col,getExceptionTransitionColor())); 1021 } 1022 1023 public String getDefaultExceptionTransitionColor () { 1024 return properties.getProperty("DefaultExceptionTransitionColor"); 1025 } 1026 1027 public void setDefaultExceptionTransitionColor (String col) { 1028 properties.setProperty("DefaultExceptionTransitionColor",createColorString(col,getDefaultExceptionTransitionColor())); 1029 } 1030 1031 public String getParticipantTextColor () { 1032 return properties.getProperty("ParticipantTextColor"); 1033 } 1034 1035 public void setParticipantTextColor (String col) { 1036 properties.setProperty("ParticipantTextColor",createColorString(col,getParticipantTextColor())); 1037 } 1038 1039 public String getParticipantBorderColor () { 1040 return properties.getProperty("ParticipantBorderColor"); 1041 } 1042 1043 public void setParticipantBorderColor (String col) { 1044 properties.setProperty("ParticipantBorderColor",createColorString(col,getParticipantBorderColor())); 1045 } 1046 1047 public String getResourceSetParticipantColor () { 1048 return properties.getProperty("ResourceSetParticipantColor"); 1049 } 1050 1051 public void setResourceSetParticipantColor (String col) { 1052 properties.setProperty("ResourceSetParticipantColor",createColorString(col,getResourceSetParticipantColor())); 1053 } 1054 1055 public String getResourceParticipantColor () { 1056 return properties.getProperty("ResourceParticipantColor"); 1057 } 1058 1059 public void setResourceParticipantColor (String col) { 1060 properties.setProperty("ResourceParticipantColor",createColorString(col,getResourceParticipantColor())); 1061 } 1062 1063 public String getRoleParticipantColor () { 1064 return properties.getProperty("RoleParticipantColor"); 1065 } 1066 1067 public void setRoleParticipantColor (String col) { 1068 properties.setProperty("RoleParticipantColor",createColorString(col,getRoleParticipantColor())); 1069 } 1070 1071 public String getOrganizationalUnitParticipantColor () { 1072 return properties.getProperty("OrganizationalUnitParticipantColor"); 1073 } 1074 1075 public void setOrganizationalUnitParticipantColor (String col) { 1076 properties.setProperty("OrganizationalUnitParticipantColor",createColorString(col,getOrganizationalUnitParticipantColor())); 1077 } 1078 1079 public String getHumanParticipantColor () { 1080 return properties.getProperty("HumanParticipantColor"); 1081 } 1082 1083 public void setHumanParticipantColor (String col) { 1084 properties.setProperty("HumanParticipantColor",createColorString(col,getHumanParticipantColor())); 1085 } 1086 1087 public String getSystemParticipantColor () { 1088 return properties.getProperty("SystemParticipantColor"); 1089 } 1090 1091 public void setSystemParticipantColor (String col) { 1092 properties.setProperty("SystemParticipantColor",createColorString(col,getSystemParticipantColor())); 1093 } 1094 1095 public String getFreeTextExpressionParticipantColor () { 1096 return properties.getProperty("FreeTextExpressionParticipantColor"); 1097 } 1098 1099 public void setFreeTextExpressionParticipantColor (String col) { 1100 properties.setProperty("FreeTextExpressionParticipantColor",createColorString(col,getFreeTextExpressionParticipantColor())); 1101 } 1102 1103 public String getStartColor () { 1104 return properties.getProperty("StartColor"); 1105 } 1106 1107 public void setStartColor (String col) { 1108 properties.setProperty("StartColor",createColorString(col,getStartColor())); 1109 } 1110 1111 public String getEndColor () { 1112 return properties.getProperty("EndColor"); 1113 } 1114 1115 public void setEndColor (String col) { 1116 properties.setProperty("EndColor",createColorString(col,getEndColor())); 1117 } 1118 1119 public String getStartEndColor () { 1120 return properties.getProperty("StartEndColor"); 1121 } 1122 1123 public void setStartEndColor (String col) { 1124 properties.setProperty("StartEndColor",createColorString(col,getStartEndColor())); 1125 } 1126 1127 public String getSelectedActivityColor () { 1128 return properties.getProperty("SelectedActivityColor"); 1129 } 1130 1131 public void setSelectedActivityColor (String col) { 1132 properties.setProperty("SelectedActivityColor",createColorString(col,getSelectedActivityColor())); 1133 } 1134 1135 public String getGenericActivityColor () { 1136 return properties.getProperty("GenericActivityColor"); 1137 } 1138 1139 public void setGenericActivityColor (String col) { 1140 properties.setProperty("GenericActivityColor",createColorString(col,getGenericActivityColor())); 1141 } 1142 1143 public String getRouteActivityColor () { 1144 return properties.getProperty("RouteActivityColor"); 1145 } 1146 1147 public void setRouteActivityColor (String col) { 1148 properties.setProperty("RouteActivityColor",createColorString(col,getRouteActivityColor())); 1149 } 1150 1151 public String getSubFlowActivityColor () { 1152 return properties.getProperty("SubFlowActivityColor"); 1153 } 1154 1155 public void setSubFlowActivityColor (String col) { 1156 properties.setProperty("SubFlowActivityColor",createColorString(col,getSubFlowActivityColor())); 1157 } 1158 1159 public String getBlockActivityColor () { 1160 return properties.getProperty("BlockActivityColor"); 1161 } 1162 1163 public void setBlockActivityColor (String col) { 1164 properties.setProperty("BlockActivityColor",createColorString(col,getBlockActivityColor())); 1165 } 1166 1167 1182 1183 private String createColorString (String col,String defaultColor) { 1184 if (col==null) return defaultColor; 1185 Color c=Utils.getColor(col); 1186 if (c==null) { 1187 return defaultColor; 1188 } 1189 return col; 1190 } 1191 1192 public void restoreDefaultSettings () { 1193 setDefaultValues(); 1194 initialize(); 1195 } 1196 1197 public void saveConf(){ 1198 File ujdir=new File(JaWEConstants.JAWE_USER_HOME); 1200 if (!ujdir.exists()) { 1201 try { 1202 ujdir.mkdir(); 1203 } catch (Exception exc) {}; 1204 } 1205 try{ 1206 OutputStream out = new FileOutputStream(cfn); 1207 properties.store(out,"#\n# JaWE configuration\n#\n"); 1208 out.close(); 1209 } catch (IOException io) { } 1210 } 1211 1212} 1213 | Popular Tags |