001/***************************************************************************** 002 * Copyright by The HDF Group. * 003 * Copyright by the Board of Trustees of the University of Illinois. * 004 * All rights reserved. * 005 * * 006 * This file is part of the HDF Java Products distribution. * 007 * The full copyright notice, including terms governing use, modification, * 008 * and redistribution, is contained in the COPYING file, which can be found * 009 * at the root of the source code distribution tree, * 010 * or in https://www.hdfgroup.org/licenses. * 011 * If you do not have access to either file, you may request a copy from * 012 * help@hdfgroup.org. * 013 ****************************************************************************/ 014 015package hdf.view; 016 017import java.io.File; 018import java.io.IOException; 019import java.io.InputStream; 020import java.net.MalformedURLException; 021import java.net.URL; 022import java.net.URLClassLoader; 023import java.util.ArrayList; 024import java.util.Arrays; 025import java.util.Enumeration; 026import java.util.List; 027import java.util.jar.JarEntry; 028import java.util.jar.JarFile; 029 030import hdf.HDFVersions; 031import hdf.object.FileFormat; 032import hdf.object.h5.H5Plugins; 033import hdf.view.ImageView.ImageViewFactory; 034import hdf.view.MetaDataView.MetaDataViewFactory; 035import hdf.view.PaletteView.PaletteViewFactory; 036import hdf.view.TableView.TableViewFactory; 037import hdf.view.TreeView.TreeViewFactory; 038 039import org.slf4j.Logger; 040import org.slf4j.LoggerFactory; 041 042import org.eclipse.jface.preference.PreferenceStore; 043import org.eclipse.swt.graphics.Image; 044 045/** A class to maintain the list of preferences for data and display */ 046public class ViewProperties extends PreferenceStore { 047 private static final long serialVersionUID = -6411465283887959066L; 048 049 private static final Logger log = LoggerFactory.getLogger(ViewProperties.class); 050 051 /** the version of the HDFViewer */ 052 public static final String VERSION = HDFVersions.getPropertyVersionView(); 053 054 /** the local property file name */ 055 private static final String USER_PROPERTY_FILE = ".hdfview" + VERSION; 056 057 /** the maximum number of most recent files */ 058 public static final int MAX_RECENT_FILES = 15; 059 060 /** name of the tab delimiter */ 061 public static final String DELIMITER_TAB = "Tab"; 062 063 /** name of the tab delimiter */ 064 public static final String DELIMITER_COMMA = "Comma"; 065 066 /** name of the tab delimiter */ 067 public static final String DELIMITER_SPACE = "Space"; 068 069 /** name of the tab delimiter */ 070 public static final String DELIMITER_COLON = "Colon"; 071 072 /** image origin: UpperLeft */ 073 public static final String ORIGIN_UL = "UpperLeft"; 074 075 /** image origin: LowerLeft */ 076 public static final String ORIGIN_LL = "LowerLeft"; 077 078 /** image origin: UpperRight */ 079 public static final String ORIGIN_UR = "UpperRight"; 080 081 /** image origin: LowerRight */ 082 public static final String ORIGIN_LR = "LowerRight"; 083 084 /** name of the tab delimiter */ 085 public static final String DELIMITER_SEMI_COLON = "Semi-Colon"; 086 087 /** 088 * The names of the various default classes for each HDFView module interface 089 */ 090 091 /** Text for default selection of modules */ 092 public static final String DEFAULT_MODULE_TEXT = "Default"; 093 094 /** Default TreeView class names */ 095 public static final String DEFAULT_TREEVIEW_NAME = "hdf.view.TreeView.DefaultTreeView"; 096 097 /** Default Scalar TableView class names */ 098 public static final String DEFAULT_SCALAR_DATASET_TABLEVIEW_NAME = 099 "hdf.view.TableView.DefaultScalarDSTableView"; 100 /** Default Compound TableView class names */ 101 public static final String DEFAULT_COMPOUND_DATASET_TABLEVIEW_NAME = 102 "hdf.view.TableView.DefaultCompoundDSTableView"; 103 104 /** Default Group MetaDataView class names */ 105 public static final String DEFAULT_GROUP_METADATAVIEW_NAME = 106 "hdf.view.MetaDataView.DefaultGroupMetaDataView"; 107 /** Default Dataset MetaDataView class names */ 108 public static final String DEFAULT_DATASET_METADATAVIEW_NAME = 109 "hdf.view.MetaDataView.DefaultDatasetMetaDataView"; 110 /** Default Datatype MetaDataView class names */ 111 public static final String DEFAULT_DATATYPE_METADATAVIEW_NAME = 112 "hdf.view.MetaDataView.DefaultDatatypeMetaDataView"; 113 /** Default Link MetaDataView class names */ 114 public static final String DEFAULT_LINK_METADATAVIEW_NAME = 115 "hdf.view.MetaDataView.DefaultLinkMetaDataView"; 116 117 /** Default ImageView class names */ 118 public static final String DEFAULT_IMAGEVIEW_NAME = "hdf.view.ImageView.DefaultImageView"; 119 120 /** Default PaletteView class names */ 121 public static final String DEFAULT_PALETTEVIEW_NAME = "hdf.view.PaletteView.DefaultPaletteView"; 122 123 /** 124 * Used to create different DataViews for a given HObject. 125 */ 126 public static enum DataViewType { 127 /** table type */ 128 TABLE, 129 /** image type */ 130 IMAGE, 131 /** palette type */ 132 PALETTE, 133 /** metadata type */ 134 METADATA, 135 /** treeview type */ 136 TREEVIEW 137 } 138 139 /** 140 * Property keys control how the data is displayed. 141 */ 142 public static enum DATA_VIEW_KEY { 143 /** data is char */ 144 CHAR, 145 /** data is converted to byte */ 146 CONVERTBYTE, 147 /** data is transposed */ 148 TRANSPOSED, 149 /** data is read only */ 150 READONLY, 151 /** data is object */ 152 OBJECT, 153 /** data is bitmask */ 154 BITMASK, 155 /** data is bitmask op */ 156 BITMASKOP, 157 /** data is border */ 158 BORDER, 159 /** data is info */ 160 INFO, 161 /** data is index based 1 */ 162 INDEXBASE1, 163 /** data is view name */ 164 VIEW_NAME 165 } 166 167 /** 168 * Property keys control how the data is displayed. 169 */ 170 public static enum BITMASK_OP { 171 /** use bitmask and */ 172 AND, 173 /** use bitmask extract */ 174 EXTRACT 175 } 176 177 /** the root directory of the HDFView */ 178 private static String rootDir = System.getProperty("user.dir"); 179 180 /** user's guide */ 181 private static String usersGuide = "/share/doc/UsersGuide/index.html"; 182 183 /** the font size */ 184 private static int fontSize = 12; 185 186 /** the font type */ 187 private static String fontType = "Serif"; 188 189 /** the full path of H4toH5 converter */ 190 private static String h4toh5 = ""; 191 192 /** data delimiter */ 193 private static String delimiter = DELIMITER_TAB; 194 195 /** image origin */ 196 private static String origin = ORIGIN_UL; 197 198 /** default index type */ 199 private static String indexType = "H5_INDEX_NAME"; 200 201 /** default index order */ 202 private static String indexOrder = "H5_ITER_INC"; 203 204 /** a list of most recent files */ 205 private static ArrayList<String> recentFiles = new ArrayList<>(MAX_RECENT_FILES + 5); 206 207 /** default starting file directory */ 208 private static String workDir = System.getProperty("user.dir"); 209 210 /** default HDF file extensions */ 211 private static String fileExt = "hdf, h4, hdf4, h5, hdf5, he2, he5"; 212 213 private static ClassLoader extClassLoader = null; 214 215 /** a list of srb accounts */ 216 private static ArrayList<String[]> srbAccountList = new ArrayList<>(5); 217 218 /** the timer refreshrate in msec */ 219 private static int timerRefresh = 10000; 220 221 private static boolean isMac = System.getProperty("os.name").toLowerCase().contains("mac"); 222 223 /** 224 * flag to indicate if auto contrast is used in image processing. Do not use 225 * autocontrast by default (2.6 change). 226 */ 227 private static boolean isAutoContrast = false; 228 229 private static boolean showImageValues = false; 230 231 private static boolean showRegRefValues = false; 232 233 /** 234 * flag to indicate if default open file mode is read only. By default, use read 235 * only to prevent accidental modifications to the file. 236 */ 237 private static boolean isReadOnly = true; 238 239 /** 240 * flag to indicate if default open file mode is read SWMR. 241 */ 242 private static boolean isReadSWMR = true; 243 244 private static String EarlyLib = "Latest"; 245 246 private static String LateLib = "Latest"; 247 248 /** a list of palette files */ 249 private static ArrayList<String> paletteList = new ArrayList<>(5); 250 251 /** a list of plugin paths */ 252 private static ArrayList<String> pluginPathList = new ArrayList<>(5); 253 254 /** flag to indicate if enum data is converted to strings */ 255 private static boolean convertEnum = true; 256 257 /** flag to indicate if data is 1-based index */ 258 private static boolean isIndexBase1 = false; 259 260 /** 261 * Current Java applications such as HDFView cannot handle files with a large 262 * number of objects such as 1,000,000 objects. max_members defines the maximum 263 * number of objects that will be loaded into memory. 264 */ 265 private static int maxMembers = Integer.MAX_VALUE; // load all by default 266 /** 267 * Current Java applications such as HDFView cannot handle files with a large 268 * number of objects such 1,000,000 objects. start_members defines the 269 * starting index of objects that will be loaded into memory. 270 */ 271 private static int startMembers = 0; 272 273 private static Image hdfviewIcon, h4Icon, h4IconR, h5Icon, h5IconR, ncIcon, ncIconR, blankIcon, helpIcon, 274 fileopenIcon, filesaveIcon, filenewIcon, filecloseIcon, foldercloseIcon, folderopenIcon, 275 foldercloseIconA, folderopenIconA, datasetIcon, imageIcon, tableIcon, textIcon, datasetIconA, 276 imageIconA, tableIconA, textIconA, zoominIcon, zoomoutIcon, paletteIcon, chartIcon, brightIcon, 277 autocontrastIcon, copyIcon, cutIcon, pasteIcon, previousIcon, nextIcon, firstIcon, lastIcon, 278 animationIcon, datatypeIcon, datatypeIconA, linkIcon, iconAPPS, iconURL, iconVIDEO, iconXLS, iconPDF, 279 iconAUDIO, questionIcon; 280 281 private static Image[] hdfIcons = new Image[6]; 282 283 private static String propertyFile; 284 285 /** a list of treeview modules */ 286 private static ArrayList<String> moduleListTreeView = new ArrayList<>(5); 287 288 /** a list of metaview modules */ 289 private static ArrayList<String> moduleListMetaDataView = new ArrayList<>(5); 290 291 /** a list of tableview modules */ 292 private static ArrayList<String> moduleListTableView = new ArrayList<>(5); 293 294 /** a list of imageview modules */ 295 private static ArrayList<String> moduleListImageView = new ArrayList<>(5); 296 297 /** a list of paletteview modules */ 298 private static ArrayList<String> moduleListPaletteView = new ArrayList<>(5); 299 300 /** a list of helpview modules */ 301 private static ArrayList<String> moduleListHelpView = new ArrayList<>(5); 302 303 /** 304 * Creates a property list with given root directory of the HDFView. 305 * 306 * @param viewRoot 307 * the root directory of the HDFView 308 * @param viewStart 309 * the starting directory for file searches 310 */ 311 public ViewProperties(String viewRoot, String viewStart) 312 { 313 super(); 314 315 // look for the property file in the user's home directory 316 String propertyFileName = USER_PROPERTY_FILE; 317 String userHomeFile = System.getProperty("user.home") + File.separator + propertyFileName; 318 String userDirFile = System.getProperty("user.dir") + File.separator + propertyFileName; 319 320 setFilename(createPropertyFile(userHomeFile, userDirFile)); 321 322 setRootDir(viewRoot); 323 log.trace("rootDir is {}", rootDir); 324 if (viewStart != null) 325 setWorkDir(viewStart); 326 setDefault("work.dir", getWorkDir()); 327 328 setUsersGuide(rootDir + usersGuide); 329 330 setDefault("users.guide", viewRoot + "/UsersGuide/index.html"); 331 setDefault("image.contrast", false); 332 setDefault("image.showvalues", false); 333 setDefault("file.mode", "r"); 334 setDefault("lib.lowversion", "Earliest"); 335 setDefault("lib.highversion", "Latest"); 336 setDefault("enum.conversion", false); 337 setDefault("regref.showvalues", false); 338 setDefault("index.base1", false); 339 setDefault("image.origin", ORIGIN_UL); 340 setDefault("h5file.indexType", "H5_INDEX_NAME"); 341 setDefault("h5file.indexOrder", "H5_ITER_INC"); 342 setDefault("h4toh5.converter", ""); 343 setDefault("file.extension", "hdf, h4, hdf4, h5, hdf5, he2, he5"); 344 setDefault("timer.refresh", 1000); 345 setDefault("font.size", 12); 346 setDefault("font.type", "Serif"); 347 setDefault("max.members", Integer.MAX_VALUE); 348 setDefault("recent.file", ""); 349 setDefault("palette.file", ""); 350 setDefault("data.delimiter", DELIMITER_TAB); 351 } 352 353 /** 354 * Creates a property list file in a directory. 355 * 356 * @param userHomeFile 357 * the user home directory 358 * @param userDirFile 359 * the user directory 360 * 361 * @return property list file 362 */ 363 public static String createPropertyFile(String userHomeFile, String userDirFile) 364 { 365 String propFile = System.getProperty("hdfview.propfile"); 366 367 if ((propFile != null) && ((new File(propFile)).exists())) 368 propertyFile = propFile; 369 else if ((new File(userHomeFile)).exists()) 370 propertyFile = userHomeFile; 371 else if ((new File(userDirFile)).exists()) 372 propertyFile = userDirFile; 373 else { 374 File pFile = null; 375 376 // If the user specified a property file, but it didn't exist, 377 // try to create a new one where specified. 378 if (propFile != null) { 379 pFile = new File(propFile); 380 381 try { 382 pFile.createNewFile(); 383 propertyFile = propFile; 384 } 385 catch (Exception ex) { 386 log.debug("createPropertyFile(): unable to create property file {}", propFile); 387 pFile = null; 388 } 389 } 390 391 if (pFile == null) { 392 // Create new property file at user home directory 393 pFile = new File(userHomeFile); 394 try { 395 pFile.createNewFile(); 396 propertyFile = userHomeFile; 397 } 398 catch (Exception ex) { 399 log.debug("createPropertyFile(): unable to create property file in home directory"); 400 propertyFile = null; 401 } 402 } 403 } 404 405 log.trace("propertyFile is {}", propertyFile); 406 return propertyFile; 407 } 408 409 /** 410 * load module classes 411 * 412 * @return the ClassLoader 413 */ 414 public static ClassLoader loadExtClass() 415 { 416 if (extClassLoader != null) 417 return extClassLoader; 418 else 419 // default classloader 420 extClassLoader = ClassLoader.getSystemClassLoader(); 421 log.trace("loadExtClass: default classloader is {}", extClassLoader); 422 423 String rootPath = System.getProperty("hdfview.root"); 424 if (rootPath == null) { 425 rootPath = rootDir; 426 log.debug("loadExtClass: rootDir rootPath is {}", rootPath); 427 } 428 log.debug("loadExtClass: rootPath is {}", rootPath); 429 430 String dirname = rootPath + File.separator + "lib" + File.separator + "ext" + File.separator; 431 String[] jars = null; 432 File extdir = null; 433 try { 434 extdir = new File(dirname); 435 jars = extdir.list(); 436 } 437 catch (Exception ex0) { 438 log.debug("loadExtClass: load dirname: {}+lib/ext failed", rootPath, ex0); 439 } 440 441 if ((jars == null) || (jars.length <= 0)) 442 return extClassLoader; 443 444 ArrayList<String> jarList = new ArrayList<>(50); 445 ArrayList<String> classList = new ArrayList<>(50); 446 for (int i = 0; i < jars.length; i++) { 447 log.trace("loadExtClass: load jar[{}]", i); 448 if (jars[i].endsWith(".jar")) { 449 jarList.add(jars[i]); 450 // add class names to the list of classes 451 File tmpFile = new File(extdir, jars[i]); 452 try (JarFile jarFile = new JarFile(tmpFile, false, JarFile.OPEN_READ)) { 453 Enumeration<?> emu = jarFile.entries(); 454 while (emu.hasMoreElements()) { 455 JarEntry jarEntry = (JarEntry)emu.nextElement(); 456 String entryName = jarEntry.getName(); 457 log.trace("loadExtClass: reading jar[{}] class={}", i, entryName); 458 int idx = entryName.indexOf(".class"); 459 if ((idx > 0) && (entryName.indexOf('$') <= 0)) { 460 entryName = entryName.replace('/', '.'); 461 classList.add(entryName.substring(0, idx)); 462 } 463 } 464 } 465 catch (Exception ex) { 466 log.debug("loadExtClass: load jar[{}] failed", i, ex); 467 } 468 } // (jars[i].endsWith(".jar")) 469 } // (int i=0; i<jars.length; i++) 470 471 int n = jarList.size(); 472 if (n <= 0) { 473 log.debug("loadExtClass: jarList empty"); 474 return extClassLoader; 475 } 476 477 URL[] urls = new URL[n]; 478 for (int i = 0; i < n; i++) { 479 try { 480 urls[i] = new URL("file:///" + rootPath + "/lib/ext/" + jarList.get(i)); 481 log.trace("loadExtClass: load urls[{}] is {}", i, urls[i]); 482 } 483 catch (MalformedURLException mfu) { 484 log.debug("loadExtClass: load urls[{}] failed", i, mfu); 485 } 486 } 487 488 try { 489 extClassLoader = URLClassLoader.newInstance(urls); 490 } 491 catch (Exception ex) { 492 ex.printStackTrace(); 493 } 494 495 // load user modules into their list 496 n = classList.size(); 497 for (int i = 0; i < n; i++) { 498 String theName = classList.get(i); 499 log.trace("loadExtClass: load classList[{}] is {}", i, theName); 500 try { 501 // enables use of JHDF5 in JNLP (Web Start) applications, the 502 // system class loader with reflection first. 503 Class<?> theClass = null; 504 try { 505 theClass = Class.forName(theName); 506 } 507 catch (Exception ex) { 508 try { 509 theClass = extClassLoader.loadClass(theName); 510 } 511 catch (Exception exc) { 512 log.debug("load: loadClass({}) failed", theName, ex); 513 } 514 } 515 516 if (theClass != null) { 517 if (TableViewFactory.class.isAssignableFrom(theClass)) { 518 if (!moduleListTableView.contains(theName)) 519 moduleListTableView.add(theName); 520 log.trace("loadExtClass: TableViewFactory class {}", theName); 521 } 522 else if (MetaDataViewFactory.class.isAssignableFrom(theClass)) { 523 if (!moduleListMetaDataView.contains(theName)) 524 moduleListMetaDataView.add(theName); 525 log.trace("loadExtClass: MetaDataViewFactory class {}", theName); 526 } 527 else if (ImageViewFactory.class.isAssignableFrom(theClass)) { 528 if (!moduleListImageView.contains(theName)) 529 moduleListImageView.add(theName); 530 log.trace("loadExtClass: ImageViewFactory class {}", theName); 531 } 532 else if (TreeViewFactory.class.isAssignableFrom(theClass)) { 533 if (!moduleListTreeView.contains(theName)) 534 moduleListTreeView.add(theName); 535 log.trace("loadExtClass: TreeViewFactory class {}", theName); 536 } 537 else if (PaletteViewFactory.class.isAssignableFrom(theClass)) { 538 if (!moduleListPaletteView.contains(theName)) 539 moduleListPaletteView.add(theName); 540 log.trace("loadExtClass: PaletteViewFactory class {}", theName); 541 } 542 } 543 } 544 catch (Exception ex) { 545 log.debug("loadExtClass: load classList[{}] of {} failed", i, theName, ex); 546 } 547 } // (int i=0; i<n; i++) 548 549 return extClassLoader; 550 } 551 552 /** 553 * Get the Folder Close Icon 554 * 555 * @return the Folder Close Icon 556 */ 557 public static Image getFoldercloseIcon() { return foldercloseIcon; } 558 559 /** 560 * Get the Folder Close with Attribute Icon 561 * 562 * @return the Folder Close with Attribute Icon 563 */ 564 public static Image getFoldercloseIconA() { return foldercloseIconA; } 565 566 /** 567 * Get the Folder Open Icon 568 * 569 * @return the Folder Open Icon 570 */ 571 public static Image getFolderopenIcon() { return folderopenIcon; } 572 573 /** 574 * Get the Folder Open with Attribute Icon 575 * 576 * @return the Folder Open with Attribute Icon 577 */ 578 public static Image getFolderopenIconA() { return folderopenIconA; } 579 580 /** 581 * Get the HDF Icon 582 * 583 * @return the HDF Icon 584 */ 585 public static Image getHdfIcon() { return hdfIcons[1]; } 586 587 /** 588 * Get the HDF Icons 589 * 590 * @return the HDF Icons 591 */ 592 public static Image[] getHdfIcons() { return hdfIcons; } 593 594 /** 595 * Get the HDF4 Icon 596 * 597 * @return the HDF4 Icon 598 */ 599 public static Image getH4Icon() { return h4Icon; } 600 601 /** 602 * Get the read-only HDF4 Icon 603 * 604 * @return the read-only HDF4 Icon 605 */ 606 public static Image getH4IconR() { return h4IconR; } 607 608 /** 609 * Get the HDF5 Icon 610 * 611 * @return the HDF5 Icon 612 */ 613 public static Image getH5Icon() { return h5Icon; } 614 615 /** 616 * Get the read-only HDF5 Icon 617 * 618 * @return the read-only HDF5 Icon 619 */ 620 public static Image getH5IconR() { return h5IconR; } 621 622 /** 623 * Get the netcdf Icon 624 * 625 * @return the netcdf Icon 626 */ 627 public static Image getNC3Icon() { return ncIcon; } 628 629 /** 630 * Get the read-only netcdf Icon 631 * 632 * @return the read-only netcdf Icon 633 */ 634 public static Image getNC3IconR() { return ncIconR; } 635 636 /** 637 * Get the Dataset Icon 638 * 639 * @return the Dataset Icon 640 */ 641 public static Image getDatasetIcon() { return datasetIcon; } 642 643 /** 644 * Get the Dataset with Attribute Icon 645 * 646 * @return the Dataset with Attribute Icon 647 */ 648 public static Image getDatasetIconA() { return datasetIconA; } 649 650 /** 651 * Get the Datatype Icon 652 * 653 * @return the Datatype Icon 654 */ 655 public static Image getDatatypeIcon() { return datatypeIcon; } 656 657 /** 658 * Get the Datatype with Attribute Icon 659 * 660 * @return the Datatype with Attribute Icon 661 */ 662 public static Image getDatatypeIconA() { return datatypeIconA; } 663 664 /** 665 * Get the Link Icon 666 * 667 * @return the Link Icon 668 */ 669 public static Image getLinkIcon() { return linkIcon; } 670 671 /** 672 * Get the File Open Icon 673 * 674 * @return the File Open Icon 675 */ 676 public static Image getFileopenIcon() { return fileopenIcon; } 677 678 /** 679 * Get the File Save Icon 680 * 681 * @return the File Save Icon 682 */ 683 public static Image getFilesaveIcon() { return filesaveIcon; } 684 685 /** 686 * Get the File New Icon 687 * 688 * @return the File New Icon 689 */ 690 public static Image getFilenewIcon() { return filenewIcon; } 691 692 /** 693 * Get the File Close Icon 694 * 695 * @return the File Close Icon 696 */ 697 public static Image getFilecloseIcon() { return filecloseIcon; } 698 699 /** 700 * Get the Palette Icon 701 * 702 * @return the Palette Icon 703 */ 704 public static Image getPaletteIcon() { return paletteIcon; } 705 706 /** 707 * Get the Bright Icon 708 * 709 * @return the Bright Icon 710 */ 711 public static Image getBrightIcon() { return brightIcon; } 712 713 /** 714 * Get the Autocontrast Icon 715 * 716 * @return the Autocontrast Icon 717 */ 718 public static Image getAutocontrastIcon() { return autocontrastIcon; } 719 720 /** 721 * Get the Image Icon 722 * 723 * @return the Image Icon 724 */ 725 public static Image getImageIcon() { return imageIcon; } 726 727 /** 728 * Get the Table Icon 729 * 730 * @return the Table Icon 731 */ 732 public static Image getTableIcon() { return tableIcon; } 733 734 /** 735 * Get the Text Icon 736 * 737 * @return the Text Icon 738 */ 739 public static Image getTextIcon() { return textIcon; } 740 741 /** 742 * Get the Image with Attribute Icon 743 * 744 * @return the Image with Attribute Icon 745 */ 746 public static Image getImageIconA() { return imageIconA; } 747 748 /** 749 * Get the Table with Attribute Icon 750 * 751 * @return the Table with Attribute Icon 752 */ 753 public static Image getTableIconA() { return tableIconA; } 754 755 /** 756 * Get the Text with Attribute Icon 757 * 758 * @return the Text with Attribute Icon 759 **/ 760 public static Image getTextIconA() { return textIconA; } 761 762 /** 763 * Get the Zoom In Icon 764 * 765 * @return the Zoom In Icon 766 */ 767 public static Image getZoominIcon() { return zoominIcon; } 768 769 /** 770 * Get the Zoom Out Icon 771 * 772 * @return the Zoom Out Icon 773 */ 774 public static Image getZoomoutIcon() { return zoomoutIcon; } 775 776 /** 777 * Get the Blank Icon 778 * 779 * @return the Blank Icon 780 */ 781 public static Image getBlankIcon() { return blankIcon; } 782 783 /** 784 * Get the Help Icon 785 * 786 * @return the Help Icon 787 */ 788 public static Image getHelpIcon() { return helpIcon; } 789 790 /** 791 * Get the Copy Icon 792 * 793 * @return the Copy Icon 794 */ 795 public static Image getCopyIcon() { return copyIcon; } 796 797 /** 798 * Get the Cut Icon 799 * 800 * @return the Cut Icon 801 */ 802 public static Image getCutIcon() { return cutIcon; } 803 804 /** 805 * Getthe Paste Icon 806 * 807 * @return the Paste Icon 808 */ 809 public static Image getPasteIcon() { return pasteIcon; } 810 811 /** 812 * Get the HDFView Icon 813 * 814 * @return the HDFView Icon 815 */ 816 public static Image getHDFViewIcon() { return hdfviewIcon; } 817 818 /** 819 * Get the Large HDF Icon 820 * 821 * @return the Large HDF Icon 822 */ 823 public static Image getLargeHdfIcon() { return hdfIcons[2]; } 824 825 /** 826 * Get the Previous Icon 827 * 828 * @return the Previous Icon 829 */ 830 public static Image getPreviousIcon() { return previousIcon; } 831 832 /** 833 * Get the Next Icon 834 * 835 * @return the Next Icon 836 */ 837 public static Image getNextIcon() { return nextIcon; } 838 839 /** 840 * Get the First Icon 841 * 842 * @return the First Icon 843 */ 844 public static Image getFirstIcon() { return firstIcon; } 845 846 /** 847 * Get the Last Icon 848 * 849 * @return the Last Icon 850 */ 851 public static Image getLastIcon() { return lastIcon; } 852 853 /** 854 * Get the Chart Icon 855 * 856 * @return the Chart Icon 857 */ 858 public static Image getChartIcon() { return chartIcon; } 859 860 /** 861 * Get the Animation Icon 862 * 863 * @return the Animation Icon 864 */ 865 public static Image getAnimationIcon() { return animationIcon; } 866 867 /** 868 * Get the Apps Icon 869 * 870 * @return the Apps Icon 871 */ 872 public static Image getAppsIcon() { return iconAPPS; } 873 874 /** 875 * Get the Url Icon 876 * 877 * @return the Url Icon 878 */ 879 public static Image getUrlIcon() { return iconURL; } 880 881 /** 882 * Get the Video Icon 883 * 884 * @return the Video Icon 885 */ 886 public static Image getVideoIcon() { return iconVIDEO; } 887 888 /** 889 * Get the Xls Icon 890 * 891 * @return the Xls Icon 892 */ 893 public static Image getXlsIcon() { return iconXLS; } 894 895 /** 896 * Get the Pdf Icon 897 * 898 * @return the Pdf Icon 899 */ 900 public static Image getPdfIcon() { return iconPDF; } 901 902 /** 903 * Get the Audio Icon 904 * 905 * @return the Audio Icon 906 */ 907 public static Image getAudioIcon() { return iconAUDIO; } 908 909 /** 910 * Get the Question Icon 911 * 912 * @return the Question Icon 913 */ 914 public static Image getQuestionIcon() { return questionIcon; } 915 916 /** Load the Icons */ 917 public static void loadIcons() 918 { 919 InputStream s = null; 920 // load icon images 921 try { 922 s = ViewProperties.class.getResourceAsStream("icons/hdfview.gif"); 923 hdfviewIcon = new Image(null, s); 924 } 925 catch (Exception ex) { 926 hdfviewIcon = null; 927 log.trace("hdfviewIcon: null"); 928 } 929 930 try { 931 s = ViewProperties.class.getResourceAsStream("icons/hdfview16.png"); 932 hdfIcons[0] = new Image(null, s); 933 } 934 catch (Exception ex) { 935 hdfIcons[0] = null; 936 log.trace("hdfIcons[0]: null"); 937 } 938 939 try { 940 s = ViewProperties.class.getResourceAsStream("icons/hdfview32.png"); 941 hdfIcons[1] = new Image(null, s); 942 } 943 catch (Exception ex) { 944 hdfIcons[1] = null; 945 log.trace("hdfIcons[1]: null"); 946 } 947 948 try { 949 s = ViewProperties.class.getResourceAsStream("icons/hdfview64.png"); 950 hdfIcons[2] = new Image(null, s); 951 } 952 catch (Exception ex) { 953 hdfIcons[2] = null; 954 log.trace("hdfIcons[3]: null"); 955 } 956 957 try { 958 s = ViewProperties.class.getResourceAsStream("icons/hdfview128.png"); 959 hdfIcons[3] = new Image(null, s); 960 } 961 catch (Exception ex) { 962 hdfIcons[3] = null; 963 log.trace("hdfIcons[3]: null"); 964 } 965 966 try { 967 s = ViewProperties.class.getResourceAsStream("icons/hdfview512.png"); 968 hdfIcons[4] = new Image(null, s); 969 } 970 catch (Exception ex) { 971 hdfIcons[4] = null; 972 log.trace("hdfIcons[4]: null"); 973 } 974 975 try { 976 s = ViewProperties.class.getResourceAsStream("icons/hdfview1024.png"); 977 hdfIcons[5] = new Image(null, s); 978 } 979 catch (Exception ex) { 980 hdfIcons[5] = null; 981 log.trace("hdfIcons[5]: null"); 982 } 983 984 try { 985 s = ViewProperties.class.getResourceAsStream("icons/hdf4.gif"); 986 h4Icon = new Image(null, s); 987 } 988 catch (Exception ex) { 989 h4Icon = null; 990 log.trace("h4Icon: null"); 991 } 992 993 try { 994 s = ViewProperties.class.getResourceAsStream("icons/hdf4R.gif"); 995 h4IconR = new Image(null, s); 996 } 997 catch (Exception ex) { 998 h4IconR = null; 999 log.trace("h4IconR: null"); 1000 } 1001 1002 try { 1003 s = ViewProperties.class.getResourceAsStream("icons/hdf5.gif"); 1004 h5Icon = new Image(null, s); 1005 } 1006 catch (Exception ex) { 1007 h5Icon = null; 1008 log.trace("h5Icon: null"); 1009 } 1010 1011 try { 1012 s = ViewProperties.class.getResourceAsStream("icons/hdf5R.gif"); 1013 h5IconR = new Image(null, s); 1014 } 1015 catch (Exception ex) { 1016 h5IconR = null; 1017 log.trace("h5IconR: null"); 1018 } 1019 1020 try { 1021 s = ViewProperties.class.getResourceAsStream("icons/hdfnc.gif"); 1022 ncIcon = new Image(null, s); 1023 } 1024 catch (Exception ex) { 1025 ncIcon = null; 1026 log.trace("ncIcon: null"); 1027 } 1028 1029 try { 1030 s = ViewProperties.class.getResourceAsStream("icons/hdfncR.gif"); 1031 ncIconR = new Image(null, s); 1032 } 1033 catch (Exception ex) { 1034 ncIconR = null; 1035 log.trace("ncIconR: null"); 1036 } 1037 1038 try { 1039 s = ViewProperties.class.getResourceAsStream("icons/folderclose.gif"); 1040 foldercloseIcon = new Image(null, s); 1041 } 1042 catch (Exception ex) { 1043 foldercloseIcon = null; 1044 log.trace("foldercloseIcon: null"); 1045 } 1046 1047 try { 1048 s = ViewProperties.class.getResourceAsStream("icons/foldercloseA.gif"); 1049 foldercloseIconA = new Image(null, s); 1050 } 1051 catch (Exception ex) { 1052 foldercloseIconA = null; 1053 log.trace("foldercloseIconA: null"); 1054 } 1055 1056 try { 1057 s = ViewProperties.class.getResourceAsStream("icons/folderopen.gif"); 1058 folderopenIcon = new Image(null, s); 1059 } 1060 catch (Exception ex) { 1061 folderopenIcon = null; 1062 log.trace("folderopenIcon: null"); 1063 } 1064 1065 try { 1066 s = ViewProperties.class.getResourceAsStream("icons/folderopenA.gif"); 1067 folderopenIconA = new Image(null, s); 1068 } 1069 catch (Exception ex) { 1070 folderopenIconA = null; 1071 log.trace("folderopenIconA: null"); 1072 } 1073 1074 try { 1075 s = ViewProperties.class.getResourceAsStream("icons/dataset.gif"); 1076 datasetIcon = new Image(null, s); 1077 } 1078 catch (Exception ex) { 1079 datasetIcon = null; 1080 log.trace("datasetIcon: null"); 1081 } 1082 1083 try { 1084 s = ViewProperties.class.getResourceAsStream("icons/datasetA.gif"); 1085 datasetIconA = new Image(null, s); 1086 } 1087 catch (Exception ex) { 1088 datasetIconA = null; 1089 log.trace("datasetIconA: null"); 1090 } 1091 1092 try { 1093 s = ViewProperties.class.getResourceAsStream("icons/datatype.gif"); 1094 datatypeIcon = new Image(null, s); 1095 } 1096 catch (Exception ex) { 1097 datatypeIcon = null; 1098 log.trace("datatypeIcon: null"); 1099 } 1100 1101 try { 1102 s = ViewProperties.class.getResourceAsStream("icons/datatypeA.gif"); 1103 datatypeIconA = new Image(null, s); 1104 } 1105 catch (Exception ex) { 1106 datatypeIconA = null; 1107 log.trace("datatypeIconA: null"); 1108 } 1109 1110 try { 1111 s = ViewProperties.class.getResourceAsStream("icons/link.gif"); 1112 linkIcon = new Image(null, s); 1113 } 1114 catch (Exception ex) { 1115 linkIcon = null; 1116 log.trace("linkIcon: null"); 1117 } 1118 1119 try { 1120 s = ViewProperties.class.getResourceAsStream("icons/fileopen.gif"); 1121 fileopenIcon = new Image(null, s); 1122 } 1123 catch (Exception ex) { 1124 fileopenIcon = null; 1125 log.trace("fileopenIcon: null"); 1126 } 1127 1128 try { 1129 s = ViewProperties.class.getResourceAsStream("icons/filesave.gif"); 1130 filesaveIcon = new Image(null, s); 1131 } 1132 catch (Exception ex) { 1133 filesaveIcon = null; 1134 log.trace("filesaveIcon: null"); 1135 } 1136 1137 try { 1138 s = ViewProperties.class.getResourceAsStream("icons/filenew.gif"); 1139 filenewIcon = new Image(null, s); 1140 } 1141 catch (Exception ex) { 1142 filenewIcon = null; 1143 log.trace("filenewIcon: null"); 1144 } 1145 1146 try { 1147 s = ViewProperties.class.getResourceAsStream("icons/fileclose.gif"); 1148 filecloseIcon = new Image(null, s); 1149 } 1150 catch (Exception ex) { 1151 filecloseIcon = null; 1152 log.trace("filecloseIcon: null"); 1153 } 1154 1155 try { 1156 s = ViewProperties.class.getResourceAsStream("icons/palette.gif"); 1157 paletteIcon = new Image(null, s); 1158 } 1159 catch (Exception ex) { 1160 paletteIcon = null; 1161 log.trace("paletteIcon: null"); 1162 } 1163 1164 try { 1165 s = ViewProperties.class.getResourceAsStream("icons/brightness.gif"); 1166 brightIcon = new Image(null, s); 1167 } 1168 catch (Exception ex) { 1169 brightIcon = null; 1170 log.trace("brightIcon: null"); 1171 } 1172 1173 try { 1174 s = ViewProperties.class.getResourceAsStream("icons/autocontrast.gif"); 1175 autocontrastIcon = new Image(null, s); 1176 } 1177 catch (Exception ex) { 1178 autocontrastIcon = null; 1179 log.trace("autocontrastIcon: null"); 1180 } 1181 1182 try { 1183 s = ViewProperties.class.getResourceAsStream("icons/image.gif"); 1184 imageIcon = new Image(null, s); 1185 } 1186 catch (Exception ex) { 1187 imageIcon = null; 1188 log.trace("imageIcon: null"); 1189 } 1190 1191 try { 1192 s = ViewProperties.class.getResourceAsStream("icons/imageA.gif"); 1193 imageIconA = new Image(null, s); 1194 } 1195 catch (Exception ex) { 1196 imageIconA = null; 1197 log.trace("imageIconA: null"); 1198 } 1199 1200 try { 1201 s = ViewProperties.class.getResourceAsStream("icons/table.gif"); 1202 tableIcon = new Image(null, s); 1203 } 1204 catch (Exception ex) { 1205 tableIcon = null; 1206 log.trace("tableIcon: null"); 1207 } 1208 1209 try { 1210 s = ViewProperties.class.getResourceAsStream("icons/tableA.gif"); 1211 tableIconA = new Image(null, s); 1212 } 1213 catch (Exception ex) { 1214 tableIconA = null; 1215 log.trace("tableIconA: null"); 1216 } 1217 1218 try { 1219 s = ViewProperties.class.getResourceAsStream("icons/text.gif"); 1220 textIcon = new Image(null, s); 1221 } 1222 catch (Exception ex) { 1223 textIcon = null; 1224 log.trace("textIcon: null"); 1225 } 1226 1227 try { 1228 s = ViewProperties.class.getResourceAsStream("icons/textA.gif"); 1229 textIconA = new Image(null, s); 1230 } 1231 catch (Exception ex) { 1232 textIconA = null; 1233 log.trace("textIconA: null"); 1234 } 1235 1236 try { 1237 s = ViewProperties.class.getResourceAsStream("icons/zoomin.gif"); 1238 zoominIcon = new Image(null, s); 1239 } 1240 catch (Exception ex) { 1241 zoominIcon = null; 1242 log.trace("iconAUzoominIconDIO: null"); 1243 } 1244 1245 try { 1246 s = ViewProperties.class.getResourceAsStream("icons/zoomout.gif"); 1247 zoomoutIcon = new Image(null, s); 1248 } 1249 catch (Exception ex) { 1250 zoomoutIcon = null; 1251 log.trace("zoomoutIcon: null"); 1252 } 1253 1254 try { 1255 s = ViewProperties.class.getResourceAsStream("icons/blank.gif"); 1256 blankIcon = new Image(null, s); 1257 } 1258 catch (Exception ex) { 1259 blankIcon = null; 1260 log.trace("blankIcon: null"); 1261 } 1262 1263 try { 1264 s = ViewProperties.class.getResourceAsStream("icons/help.gif"); 1265 helpIcon = new Image(null, s); 1266 } 1267 catch (Exception ex) { 1268 helpIcon = null; 1269 log.trace("helpIcon: null"); 1270 } 1271 1272 try { 1273 s = ViewProperties.class.getResourceAsStream("icons/copy.gif"); 1274 copyIcon = new Image(null, s); 1275 } 1276 catch (Exception ex) { 1277 copyIcon = null; 1278 log.trace("copyIcon: null"); 1279 } 1280 1281 try { 1282 s = ViewProperties.class.getResourceAsStream("icons/cut.gif"); 1283 cutIcon = new Image(null, s); 1284 } 1285 catch (Exception ex) { 1286 cutIcon = null; 1287 log.trace("cutIcon: null"); 1288 } 1289 1290 try { 1291 s = ViewProperties.class.getResourceAsStream("icons/paste.gif"); 1292 pasteIcon = new Image(null, s); 1293 } 1294 catch (Exception ex) { 1295 pasteIcon = null; 1296 log.trace("pasteIcon: null"); 1297 } 1298 1299 try { 1300 s = ViewProperties.class.getResourceAsStream("icons/previous.gif"); 1301 previousIcon = new Image(null, s); 1302 } 1303 catch (Exception ex) { 1304 previousIcon = null; 1305 log.trace("previousIcon: null"); 1306 } 1307 1308 try { 1309 s = ViewProperties.class.getResourceAsStream("icons/next.gif"); 1310 nextIcon = new Image(null, s); 1311 } 1312 catch (Exception ex) { 1313 nextIcon = null; 1314 log.trace("nextIcon: null"); 1315 } 1316 1317 try { 1318 s = ViewProperties.class.getResourceAsStream("icons/first.gif"); 1319 firstIcon = new Image(null, s); 1320 } 1321 catch (Exception ex) { 1322 firstIcon = null; 1323 log.trace("firstIcon: null"); 1324 } 1325 1326 try { 1327 s = ViewProperties.class.getResourceAsStream("icons/last.gif"); 1328 lastIcon = new Image(null, s); 1329 } 1330 catch (Exception ex) { 1331 lastIcon = null; 1332 log.trace("lastIcon: null"); 1333 } 1334 1335 try { 1336 s = ViewProperties.class.getResourceAsStream("icons/chart.gif"); 1337 chartIcon = new Image(null, s); 1338 } 1339 catch (Exception ex) { 1340 chartIcon = null; 1341 log.trace("chartIcon: null"); 1342 } 1343 1344 try { 1345 s = ViewProperties.class.getResourceAsStream("icons/animation.gif"); 1346 animationIcon = new Image(null, s); 1347 } 1348 catch (Exception ex) { 1349 animationIcon = null; 1350 log.trace("animationIcon: null"); 1351 } 1352 1353 try { 1354 s = ViewProperties.class.getResourceAsStream("icons/question.gif"); 1355 questionIcon = new Image(null, s); 1356 } 1357 catch (Exception ex) { 1358 questionIcon = null; 1359 log.trace("questionIcon: null"); 1360 } 1361 1362 try { 1363 s = ViewProperties.class.getResourceAsStream("icons/audio.gif"); 1364 iconAUDIO = new Image(null, s); 1365 } 1366 catch (Exception ex) { 1367 iconAUDIO = null; 1368 log.trace("iconAUDIO: null"); 1369 } 1370 1371 try { 1372 s = ViewProperties.class.getResourceAsStream("icons/xls.gif"); 1373 iconXLS = new Image(null, s); 1374 } 1375 catch (Exception ex) { 1376 iconXLS = null; 1377 log.trace("iconXLS: null"); 1378 } 1379 1380 try { 1381 s = ViewProperties.class.getResourceAsStream("icons/pdf.gif"); 1382 iconPDF = new Image(null, s); 1383 } 1384 catch (Exception ex) { 1385 iconPDF = null; 1386 log.trace("iconPDF: null"); 1387 } 1388 1389 try { 1390 s = ViewProperties.class.getResourceAsStream("icons/apps.gif"); 1391 iconAPPS = new Image(null, s); 1392 } 1393 catch (Exception ex) { 1394 iconAPPS = null; 1395 log.trace("iconAPPS: null"); 1396 } 1397 1398 try { 1399 s = ViewProperties.class.getResourceAsStream("icons/url.gif"); 1400 iconURL = new Image(null, s); 1401 } 1402 catch (Exception ex) { 1403 iconURL = null; 1404 log.trace("iconURL: null"); 1405 } 1406 1407 try { 1408 s = ViewProperties.class.getResourceAsStream("icons/video.gif"); 1409 iconVIDEO = new Image(null, s); 1410 } 1411 catch (Exception ex) { 1412 iconVIDEO = null; 1413 log.trace("iconVIDEO: null"); 1414 } 1415 } 1416 1417 /** 1418 * Load user properties from property file 1419 * 1420 * @throws IOException 1421 * if a failure occurred 1422 */ 1423 @Override 1424 @SuppressWarnings({"rawtypes", "unchecked"}) 1425 public void load() throws IOException 1426 { 1427 super.load(); 1428 1429 if (propertyFile == null) 1430 return; 1431 1432 String propVal = null; 1433 1434 // add default module. 1435 log.trace("load user properties: add default modules"); 1436 String[] moduleKeys = {"module.treeview", "module.metadataview", "module.tableview", 1437 "module.imageview", "module.paletteview"}; 1438 ArrayList[] moduleList = {moduleListTreeView, moduleListMetaDataView, moduleListTableView, 1439 moduleListImageView, moduleListPaletteView}; 1440 String[] moduleNames = {DEFAULT_MODULE_TEXT, DEFAULT_MODULE_TEXT, DEFAULT_MODULE_TEXT, 1441 DEFAULT_MODULE_TEXT, DEFAULT_MODULE_TEXT}; 1442 1443 // add default implementation of modules 1444 log.trace("load user properties: modules"); 1445 for (int i = 0; i < moduleNames.length; i++) { 1446 if (!moduleList[i].contains(moduleNames[i])) 1447 moduleList[i].add(moduleNames[i]); 1448 log.trace("load: add default moduleList[{}] is {}", i, moduleNames[i]); 1449 } 1450 log.trace("load Ext Class modules"); 1451 if (extClassLoader == null) 1452 loadExtClass(); 1453 1454 // set default selection of data views 1455 log.trace("load user properties: set default selection of data views"); 1456 for (int i = 0; i < moduleNames.length; i++) { 1457 ArrayList<String> theList = moduleList[i]; 1458 propVal = getString(moduleKeys[i]); 1459 if (log.isTraceEnabled()) { 1460 log.trace("load: default theList is {}", Arrays.toString(theList.toArray())); 1461 } 1462 1463 if ((propVal != null) && (propVal.length() > 0)) { 1464 // set default to the module specified in property file 1465 if (theList.size() > 1) { 1466 if (theList.contains(propVal)) 1467 theList.remove(propVal); 1468 theList.add(0, propVal); 1469 } 1470 log.trace("load user properties: module[{}]={}", i, propVal); 1471 } 1472 else { 1473 // use default module 1474 if (theList.size() > 1) { 1475 if (theList.contains(moduleNames[i])) 1476 theList.remove(moduleNames[i]); 1477 theList.add(0, moduleNames[i]); 1478 } 1479 log.trace("load user properties: default module[{}]={}", i, moduleNames[i]); 1480 } 1481 if (log.isTraceEnabled()) { 1482 log.trace("load: final theList is {}", Arrays.toString(theList.toArray())); 1483 } 1484 } 1485 1486 // add fileformat modules 1487 log.trace("load user properties: fileformat modules"); 1488 String[] localEnum = this.preferenceNames(); 1489 String fExt = null; 1490 for (String theKey : localEnum) { 1491 log.trace("load: add prop {}", theKey); 1492 if (theKey.startsWith("module.fileformat")) { 1493 fExt = theKey.substring(18); 1494 try { 1495 // enables use of JHDF5 in JNLP (Web Start) applications, 1496 // the system class loader with reflection first. 1497 String className = getString(theKey); 1498 Class theClass = null; 1499 try { 1500 theClass = Class.forName(className); 1501 } 1502 catch (Exception ex) { 1503 try { 1504 theClass = extClassLoader.loadClass(className); 1505 } 1506 catch (Exception ex2) { 1507 log.debug("load: extClassLoader.loadClass({}) failed", className, ex2); 1508 } 1509 } 1510 1511 Object theObject = theClass.newInstance(); 1512 if (theObject instanceof FileFormat) { 1513 FileFormat.addFileFormat(fExt, (FileFormat)theObject); 1514 } 1515 } 1516 catch (Exception err) { 1517 log.debug("load: load file format failed", err); 1518 } 1519 } 1520 } 1521 1522 propVal = getString("users.guide"); 1523 if (!isDefault("users.guide")) 1524 setUsersGuide(propVal); 1525 1526 propVal = getString("image.contrast"); 1527 if (!isDefault("image.contrast")) 1528 setAutoContrast("auto".equalsIgnoreCase(propVal)); 1529 1530 setShowImageValue(getBoolean("image.showvalues")); 1531 1532 propVal = getString("file.mode"); 1533 if (!isDefault("file.mode")) 1534 setReadOnly("r".equalsIgnoreCase(propVal)); 1535 1536 setEarlyLib(getString("lib.lowversion")); 1537 1538 setLateLib(getString("lib.highversion")); 1539 1540 setConvertEnum(getBoolean("enum.conversion")); 1541 1542 setShowRegRefValue(getBoolean("regref.showvalues")); 1543 1544 setIndexBase1(getBoolean("index.base1")); 1545 1546 propVal = getString("data.delimiter"); 1547 if (!isDefault("data.delimiter")) 1548 setDataDelimiter(propVal); 1549 1550 propVal = getString("image.origin"); 1551 if (!isDefault("image.origin")) 1552 setImageOrigin(propVal); 1553 1554 propVal = getString("h5file.indexType"); 1555 if (!isDefault("h5file.indexType")) 1556 setIndexType(propVal); 1557 1558 propVal = getString("h5file.indexOrder"); 1559 if (!isDefault("h5file.indexOrder")) 1560 setIndexOrder(propVal); 1561 1562 propVal = getString("h4toh5.converter"); 1563 if (!isDefault("h4toh5.converter")) 1564 setH4toH5(propVal); 1565 1566 propVal = getString("work.dir"); 1567 if (!isDefault("work.dir")) 1568 setWorkDir(propVal); 1569 1570 propVal = getString("file.extension"); 1571 if (!isDefault("file.extension")) { 1572 setFileExtension(propVal); 1573 FileFormat.addFileExtension(fileExt); 1574 } 1575 1576 setTimerRefresh(getInt("timer.refresh")); 1577 1578 setFontSize(getInt("font.size")); 1579 1580 propVal = getString("font.type"); 1581 if (!isDefault("font.type")) 1582 setFontType(propVal.trim()); 1583 1584 setMaxMembers(getInt("max.members")); 1585 1586 // load the most recent file list from the property file 1587 log.trace("load user properties: most recent file list with {}", getWorkDir()); 1588 String theFile = null; 1589 // first entry should be the working dir 1590 recentFiles.add(getWorkDir()); 1591 for (int i = 0; i < MAX_RECENT_FILES; i++) { 1592 theFile = getString("recent.file" + i); 1593 if ((theFile != null) && !recentFiles.contains(theFile)) { 1594 if (theFile.startsWith("http://") || theFile.startsWith("ftp://") || 1595 (new File(theFile)).exists()) { 1596 recentFiles.add(theFile); 1597 } 1598 } 1599 } 1600 1601 // load the most recent palette file list from the property file 1602 log.trace("load user properties: most recent palette file list"); 1603 for (int i = 0; i < MAX_RECENT_FILES; i++) { 1604 theFile = getString("palette.file" + i); 1605 if (theFile != null) 1606 theFile = theFile.trim(); 1607 1608 if ((theFile != null && theFile.length() > 0) && !paletteList.contains(theFile)) { 1609 if ((new File(theFile)).exists()) { 1610 paletteList.add(theFile); 1611 } 1612 } 1613 } 1614 1615 // load srb account 1616 // log.trace("load user properties: srb account"); 1617 // propVal = null; 1618 // String srbaccount[] = new String[7]; 1619 // (int i = 0; i < MAX_RECENT_FILES; i++) { 1620 // (null == (srbaccount[0] = getString("srbaccount" + i + ".host"))) 1621 // continue; 1622 // 1623 // (null == (srbaccount[1] = getString("srbaccount" + i + ".port"))) 1624 // continue; 1625 // 1626 // (null == (srbaccount[2] = getString("srbaccount" + i + ".user"))) 1627 // continue; 1628 // 1629 // (null == (srbaccount[3] = getString("srbaccount" + i + ".password"))) 1630 // continue; 1631 // 1632 // (null == (srbaccount[4] = getString("srbaccount" + i + ".home"))) 1633 // continue; 1634 // 1635 // (null == (srbaccount[5] = getString("srbaccount" + i + ".domain"))) 1636 // continue; 1637 // 1638 // (null == (srbaccount[6] = getString("srbaccount" + i + ".resource"))) 1639 // continue; 1640 // 1641 // srbAccountList.add(srbaccount); 1642 // srbaccount = new String[7]; 1643 // } 1644 } 1645 1646 /** 1647 * Save user properties into property file 1648 * 1649 * @throws IOException 1650 * if a failure occurred 1651 */ 1652 @Override 1653 public void save() throws IOException 1654 { 1655 if (propertyFile == null) 1656 return; 1657 1658 // update data saving options 1659 if (delimiter == null) 1660 setDefault("data.delimiter", DELIMITER_TAB); 1661 else 1662 setValue("data.delimiter", delimiter); 1663 1664 if (origin == null) 1665 setDefault("image.origin", ORIGIN_UL); 1666 else 1667 setValue("image.origin", origin); 1668 1669 if (indexType != null) 1670 setValue("h5file.indexType", indexType); 1671 1672 if (indexOrder != null) 1673 setValue("h5file.indexOrder", indexOrder); 1674 1675 if (usersGuide != null) 1676 setValue("users.guide", usersGuide); 1677 1678 if (workDir != null) 1679 setValue("work.dir", workDir); 1680 1681 if (fileExt != null) 1682 setValue("file.extension", fileExt); 1683 1684 if (h4toh5 != null) 1685 setValue("h4toh5.converter", h4toh5); 1686 1687 setValue("timer.refresh", timerRefresh); 1688 1689 setValue("font.size", fontSize); 1690 1691 if (fontType != null) 1692 setValue("font.type", fontType); 1693 1694 setValue("max.members", maxMembers); 1695 1696 if (isAutoContrast) 1697 setValue("image.contrast", "auto"); 1698 else 1699 setValue("image.contrast", "general"); 1700 1701 setValue("image.showvalues", showImageValues); 1702 1703 if (isReadOnly) 1704 setValue("file.mode", "r"); 1705 else if (isReadSWMR) 1706 setValue("file.mode", "rs"); 1707 else 1708 setValue("file.mode", "rw"); 1709 1710 log.trace("save user properties: lib.lowversion={}", EarlyLib); 1711 setValue("lib.lowversion", EarlyLib); 1712 log.trace("save user properties: lib.highversion={}", LateLib); 1713 setValue("lib.highversion", LateLib); 1714 1715 setValue("enum.conversion", convertEnum); 1716 setValue("regref.showvalues", showRegRefValues); 1717 setValue("index.base1", isIndexBase1); 1718 1719 // save the list of most recent files 1720 log.trace("save user properties: most recent files"); 1721 String theFile; 1722 int size = recentFiles.size(); 1723 int minSize = Math.min(size, MAX_RECENT_FILES); 1724 log.trace("save user properties: most recent files size={}", size); 1725 // The first entry is always the working dir 1726 for (int i = 0; i < minSize - 1; i++) { 1727 theFile = recentFiles.get(i + 1); 1728 log.trace("save user properties: save recent file={}", theFile); 1729 if ((theFile != null) && (theFile.length() > 0)) 1730 setValue("recent.file" + i, theFile); 1731 } 1732 1733 // save the list of most recent palette files 1734 log.trace("save user properties: most recent palette files"); 1735 size = paletteList.size(); 1736 minSize = Math.min(size, MAX_RECENT_FILES); 1737 for (int i = 0; i < minSize; i++) { 1738 theFile = paletteList.get(i); 1739 if ((theFile != null) && (theFile.length() > 0)) 1740 setValue("palette.file" + i, theFile); 1741 } 1742 1743 // save srb account 1744 // log.trace("save user properties: srb account"); 1745 // String srbaccount[] = null; 1746 // size = srbAccountList.size(); 1747 // minSize = Math.min(size, MAX_RECENT_FILES); 1748 // (int i = 0; i < minSize; i++) { 1749 // srbaccount = srbAccountList.get(i); 1750 // ((srbaccount[0] != null) && (srbaccount[1] != null) && (srbaccount[2] != 1751 // null) 1752 // && (srbaccount[3] != null) && (srbaccount[4] != null) && (srbaccount[5] != 1753 // null) 1754 // && (srbaccount[6] != null)) { 1755 // setValue("srbaccount" + i + ".host", srbaccount[0]); 1756 // setValue("srbaccount" + i + ".port", srbaccount[1]); 1757 // setValue("srbaccount" + i + ".user", srbaccount[2]); 1758 // setValue("srbaccount" + i + ".password", srbaccount[3]); 1759 // setValue("srbaccount" + i + ".home", srbaccount[4]); 1760 // setValue("srbaccount" + i + ".domain", srbaccount[5]); 1761 // setValue("srbaccount" + i + ".resource", srbaccount[6]); 1762 // } 1763 // } 1764 1765 // save default modules 1766 log.trace("save user properties: default modules"); 1767 String moduleName = moduleListTreeView.get(0); 1768 if ((moduleName != null) && (moduleName.length() > 0)) 1769 setValue("module.treeview", moduleName); 1770 log.trace("save user properties: module.treeview={}", moduleName); 1771 1772 moduleName = moduleListMetaDataView.get(0); 1773 if ((moduleName != null) && (moduleName.length() > 0)) 1774 setValue("module.metadataview", moduleName); 1775 log.trace("save user properties: module.metadataview={}", moduleName); 1776 1777 moduleName = moduleListTableView.get(0); 1778 if ((moduleName != null) && (moduleName.length() > 0)) 1779 setValue("module.tableview", moduleName); 1780 log.trace("save user properties: module.tableview={}", moduleName); 1781 1782 moduleName = moduleListImageView.get(0); 1783 if ((moduleName != null) && (moduleName.length() > 0)) 1784 setValue("module.imageview", moduleName); 1785 log.trace("save user properties: module.imageview={}", moduleName); 1786 1787 moduleName = moduleListPaletteView.get(0); 1788 if ((moduleName != null) && (moduleName.length() > 0)) 1789 setValue("module.paletteview", moduleName); 1790 log.trace("save user properties: module.paletteview={}", moduleName); 1791 1792 // save the current supported fileformat 1793 log.trace("save user properties: supported fileformat"); 1794 Enumeration<?> keys = FileFormat.getFileFormatKeys(); 1795 String theKey = null; 1796 while (keys.hasMoreElements()) { 1797 theKey = (String)keys.nextElement(); 1798 FileFormat theformat = FileFormat.getFileFormat(theKey); 1799 setValue("module.fileformat." + theKey, theformat.getClass().getName()); 1800 } 1801 1802 super.save(); 1803 } 1804 1805 /** 1806 * Get the name of the user property file 1807 * 1808 * @return the name of the user property file 1809 */ 1810 public static String getPropertyFile() { return propertyFile; } 1811 1812 /** 1813 * Get the root directory where the HDFView is installed. 1814 * 1815 * @return the root directory where the HDFView is installed. 1816 */ 1817 public static String getViewRoot() { return rootDir; } 1818 1819 /** 1820 * Get the default work directory, where the open file starts. 1821 * 1822 * @return the default work directory, where the open file starts. 1823 */ 1824 public static String getWorkDir() 1825 { 1826 String workPath = workDir; 1827 log.trace("getWorkDir: workDir={}", workDir); 1828 if (workPath == null) { 1829 workPath = System.getProperty("hdfview.workdir"); 1830 log.trace("getWorkDir: hdfview.workdir={}", workPath); 1831 if (workPath == null) { 1832 workPath = System.getProperty("user.dir"); 1833 } 1834 } 1835 log.trace("getWorkDir: final workPath={}", workPath); 1836 return workPath; 1837 } 1838 1839 /** 1840 * Get the maximum number of the most recent file 1841 * 1842 * @return the maximum number of the most recent file 1843 */ 1844 public static int getMaxRecentFiles() { return MAX_RECENT_FILES; } 1845 1846 /** 1847 * Get the path of the HDFView users guide 1848 * 1849 * @return the path of the HDFView users guide 1850 */ 1851 public static String getUsersGuide() { return usersGuide; }; 1852 1853 /** 1854 * Get the delimiter of data values 1855 * 1856 * @return the delimiter of data values 1857 */ 1858 public static String getDataDelimiter() { return delimiter; } 1859 1860 /** 1861 * Get the image origin 1862 * 1863 * @return the image origin 1864 */ 1865 public static String getImageOrigin() { return origin; } 1866 1867 /** 1868 * Get the default index type for display 1869 * 1870 * @return the default index type for display 1871 */ 1872 public static String getIndexType() { return indexType; } 1873 1874 /** 1875 * Get the default index order for display 1876 * 1877 * @return the default index order for display 1878 */ 1879 public static String getIndexOrder() { return indexOrder; } 1880 1881 /** 1882 * Get the timer refresh size 1883 * 1884 * @return the timer refresh size 1885 */ 1886 public static int getTimerRefresh() { return timerRefresh; } 1887 1888 /** 1889 * sets the timer refresh 1890 * 1891 * @param trefresh 1892 * the timer refresh 1893 */ 1894 public static void setTimerRefresh(int trefresh) { timerRefresh = trefresh; } 1895 1896 /** 1897 * Get the font size 1898 * 1899 * @return the font size 1900 */ 1901 public static int getFontSize() { return fontSize; } 1902 1903 /** 1904 * Get the font type 1905 * 1906 * @return the font type 1907 */ 1908 public static String getFontType() { return fontType; } 1909 1910 /** 1911 * Get the file extensions of supported file formats 1912 * 1913 * @return the file extensions of supported file formats 1914 */ 1915 public static String getFileExtension() { return fileExt; } 1916 1917 /** 1918 * sets the font size 1919 * 1920 * @param fsize 1921 * the font size 1922 */ 1923 public static void setFontSize(int fsize) 1924 { 1925 fontSize = (fsize / 2) * 2; 1926 1927 if (fontSize < 8) { 1928 fontSize = 8; 1929 } 1930 } 1931 1932 /** 1933 * sets the font type 1934 * 1935 * @param ftype 1936 * the font type 1937 */ 1938 public static void setFontType(String ftype) 1939 { 1940 if (ftype != null) { 1941 fontType = ftype.trim(); 1942 } 1943 } 1944 1945 /** 1946 * Get the path of the H5toH5 converter 1947 * 1948 * @return the path of the H5toH5 converter 1949 */ 1950 public static String getH4toH5() { return h4toh5; } 1951 1952 /** 1953 * Get the list of most recent files 1954 * 1955 * @return the list of most recent files 1956 */ 1957 public static List<String> getMRF() { return recentFiles; } 1958 1959 /** 1960 * Get the list of palette files 1961 * 1962 * @return the list of palette files 1963 */ 1964 public static List<String> getPaletteList() { return paletteList; } 1965 1966 /** 1967 * Get the plugin path list 1968 * 1969 * @return the plugin path list 1970 */ 1971 public static String[] getPluginPaths() { return pluginPathList.toArray(new String[0]); } 1972 1973 /** 1974 * Get the SRB account list 1975 * 1976 * @return the SRB account list 1977 */ 1978 public static List<String[]> getSrbAccount() { return srbAccountList; } 1979 1980 /** 1981 * Get a list of treeview modules 1982 * 1983 * @return a list of treeview modules 1984 */ 1985 public static List<String> getTreeViewList() { return moduleListTreeView; } 1986 1987 /** 1988 * Get a list of metadataview modules 1989 * 1990 * @return a list of metadataview modules 1991 */ 1992 public static List<String> getMetaDataViewList() { return moduleListMetaDataView; } 1993 1994 /** 1995 * Get a list of tableview modules 1996 * 1997 * @return a list of tableview modules 1998 */ 1999 public static List<String> getTableViewList() { return moduleListTableView; } 2000 2001 /** 2002 * Get a list of imageview modules 2003 * 2004 * @return a list of imageview modules 2005 */ 2006 public static List<String> getImageViewList() { return moduleListImageView; } 2007 2008 /** 2009 * Get a list of paletteview modules 2010 * 2011 * @return a list of paletteview modules 2012 */ 2013 public static List<String> getPaletteViewList() { return moduleListPaletteView; } 2014 2015 /** 2016 * Get a list of helpview modules 2017 * 2018 * @return a list of helpview modules 2019 */ 2020 public static List<String> getHelpViewList() { return moduleListHelpView; } 2021 2022 /** 2023 * set the path of H5View User's guide 2024 * 2025 * @param str 2026 * the path 2027 */ 2028 public static void setUsersGuide(String str) 2029 { 2030 if ((str == null) || (str.length() <= 0)) { 2031 return; 2032 } 2033 usersGuide = str; 2034 } 2035 2036 /** 2037 * set the path of the H4 to H5 converter 2038 * 2039 * @param tool 2040 * the path of the H4 to H5 converter 2041 */ 2042 public static void setH4toH5(String tool) { h4toh5 = tool; } 2043 2044 /** 2045 * set the path of the default root directory 2046 * 2047 * @param rDir 2048 * the default root directory 2049 */ 2050 public static void setRootDir(String rDir) 2051 { 2052 log.trace("ViewProperties:setRootDir rDir={}", rDir); 2053 rootDir = rDir; 2054 } 2055 2056 /** 2057 * set the path of the default work directory 2058 * 2059 * @param wDir 2060 * the default work directory 2061 */ 2062 public static void setWorkDir(String wDir) 2063 { 2064 log.trace("ViewProperties:setWorkDir wDir={}", wDir); 2065 workDir = wDir; 2066 } 2067 2068 /** 2069 * Load the paths of the default plugin directories 2070 * 2071 * @return the array of paths 2072 */ 2073 public static String[] loadPluginPaths() 2074 { 2075 try { 2076 log.trace("ViewProperties:loadPluginPaths"); 2077 pluginPathList = H5Plugins.getPluginPaths(); 2078 } 2079 catch (Exception err) { 2080 } 2081 return getPluginPaths(); 2082 } 2083 2084 /** 2085 * Inserts the plugin path. 2086 * 2087 * @param pluginPath The plugin path. 2088 * @param pathIndex The index to insert the plugin path. 2089 */ 2090 public static void insertPluginPath(String pluginPath, int pathIndex) 2091 { 2092 try { 2093 H5Plugins.insertPluginPath(pluginPath, pathIndex); 2094 pluginPathList = H5Plugins.getPluginPaths(); 2095 } 2096 catch (Exception err) { 2097 } 2098 } 2099 2100 /** 2101 * Prepends the plugin path. 2102 * 2103 * @param pluginPath The plugin path. 2104 */ 2105 public static void prependPluginPath(String pluginPath) 2106 { 2107 try { 2108 H5Plugins.prependPluginPath(pluginPath); 2109 pluginPathList = H5Plugins.getPluginPaths(); 2110 } 2111 catch (Exception err) { 2112 } 2113 } 2114 2115 /** 2116 * Appends the plugin path. 2117 * 2118 * @param pluginPath The plugin path. 2119 */ 2120 public static void appendPluginPath(String pluginPath) 2121 { 2122 try { 2123 H5Plugins.appendPluginPath(pluginPath); 2124 pluginPathList = H5Plugins.getPluginPaths(); 2125 } 2126 catch (Exception err) { 2127 } 2128 } 2129 2130 /** 2131 * Removes the plugin path. 2132 * 2133 * @param pathIndex The index to remove the plugin path. 2134 */ 2135 public static void deletePluginPath(int pathIndex) 2136 { 2137 try { 2138 H5Plugins.deletePluginPath(pathIndex); 2139 pluginPathList = H5Plugins.getPluginPaths(); 2140 } 2141 catch (Exception err) { 2142 } 2143 } 2144 2145 /** 2146 * set the file extension 2147 * 2148 * @param ext 2149 * the file extension 2150 */ 2151 public static void setFileExtension(String ext) { fileExt = ext; } 2152 2153 /** 2154 * set the delimiter of data values 2155 * 2156 * @param delim 2157 * the delimiter of data values 2158 */ 2159 public static void setDataDelimiter(String delim) { delimiter = delim; } 2160 2161 /** 2162 * set the image origin 2163 * 2164 * @param o 2165 * the image origin 2166 */ 2167 public static void setImageOrigin(String o) { origin = o; } 2168 2169 /** 2170 * set the index type 2171 * 2172 * @param idxType 2173 * the index type 2174 */ 2175 public static void setIndexType(String idxType) { indexType = idxType; } 2176 2177 /** 2178 * set the index order 2179 * 2180 * @param idxOrder 2181 * the index order 2182 */ 2183 public static void setIndexOrder(String idxOrder) { indexOrder = idxOrder; } 2184 2185 /** 2186 * Current Java applications such as HDFView cannot handle files with large 2187 * number of objects such as 1,000,000 objects. setMaxMembers() sets the 2188 * maximum number of objects that will be loaded into memory. 2189 * 2190 * @param n 2191 * the maximum number of objects to load into memory 2192 */ 2193 public static void setMaxMembers(int n) { maxMembers = n; } 2194 2195 /** 2196 * Current Java applications such as HDFView cannot handle files with large 2197 * number of objects such as 1,000,000 objects. setStartMember() sets the 2198 * starting index of objects that will be loaded into memory. 2199 * 2200 * @param idx 2201 * the maximum number of objects to load into memory 2202 */ 2203 public static void setStartMembers(int idx) 2204 { 2205 if (idx < 0) { 2206 idx = 0; 2207 } 2208 2209 startMembers = idx; 2210 } 2211 2212 /** 2213 * Current Java applications such as HDFView cannot handle files with large 2214 * number of objects such as 1,000,000 objects. getMaxMembers() returns the 2215 * maximum number of objects that will be loaded into memory. 2216 * 2217 * @return the maximum members 2218 */ 2219 public static int getMaxMembers() 2220 { 2221 if (maxMembers < 0) 2222 return Integer.MAX_VALUE; // load the whole file 2223 2224 return maxMembers; 2225 } 2226 2227 /** 2228 * Current Java applications such as HDFView cannot handle files with large 2229 * number of objects such as 1,000,000 objects. getStartMembers() returns the 2230 * starting index of objects that will be loaded into memory. 2231 * 2232 * @return the start members 2233 */ 2234 public static int getStartMembers() { return startMembers; } 2235 2236 /** 2237 * Returns true if auto contrast is used in image processing. 2238 * 2239 * @return true if auto contrast is used in image processing; otherwise, 2240 * returns false. 2241 */ 2242 public static boolean isAutoContrast() { return isAutoContrast; } 2243 2244 /** 2245 * Returns true if "show image values" is set. 2246 * 2247 * @return true if "show image values" is set; otherwise, returns false. 2248 */ 2249 public static boolean showImageValues() { return showImageValues; } 2250 2251 /** 2252 * Set the flag to indicate if auto contrast is used in image process. 2253 * 2254 * @param b 2255 * the flag to indicate if auto contrast is used in image 2256 * process. 2257 */ 2258 public static void setAutoContrast(boolean b) { isAutoContrast = b; } 2259 2260 /** 2261 * Set the flag to indicate if "show image values" is set. 2262 * 2263 * @param b 2264 * the flag to indicate if if "show image values" is set. 2265 */ 2266 public static void setShowImageValue(boolean b) { showImageValues = b; } 2267 2268 /** 2269 * Returns true if default file access is read only. 2270 * 2271 * @return true if default file access is read only; otherwise, returns 2272 * false. 2273 */ 2274 public static boolean isReadOnly() { return isReadOnly; } 2275 2276 /** 2277 * Set the flag to indicate if default file access is read only. 2278 * 2279 * @param b 2280 * the flag to indicate if default file access is read only. 2281 */ 2282 public static void setReadOnly(boolean b) { isReadOnly = b; } 2283 2284 /** 2285 * Returns true if default file access is read SWMR. 2286 * 2287 * @return true if default file access is read SWMR; otherwise, returns 2288 * false. 2289 */ 2290 public static boolean isReadSWMR() { return isReadSWMR; } 2291 2292 /** 2293 * Set the flag to indicate if default file access is read SWMR. 2294 * 2295 * @param b 2296 * the flag to indicate if default file access is read SWMR. 2297 */ 2298 public static void setReadSWMR(boolean b) { isReadSWMR = b; } 2299 2300 /** 2301 * Returns value of default lib version for the earliest. 2302 * 2303 * @return value of default lib version for the earliest. 2304 */ 2305 public static String getEarlyLib() { return EarlyLib; } 2306 2307 /** 2308 * Set the value of default lib version for the earliest. 2309 * 2310 * @param vers 2311 * the value of default lib version for the earliest. 2312 */ 2313 public static void setEarlyLib(String vers) { EarlyLib = vers; } 2314 2315 /** 2316 * Returns value of default lib version for the latest. 2317 * 2318 * @return value of default lib version for the latest. 2319 */ 2320 public static String getLateLib() { return LateLib; } 2321 2322 /** 2323 * Set the value of default lib version for the latest. 2324 * 2325 * @param vers 2326 * the value of default lib version for the latest. 2327 */ 2328 public static void setLateLib(String vers) { LateLib = vers; } 2329 2330 /** 2331 * Check if the enum value is to be converted 2332 * 2333 * @return true if the enum value is to be converted 2334 */ 2335 public static boolean isConvertEnum() { return convertEnum; } 2336 2337 /** 2338 * Returns true if "show regref values" is set. 2339 * 2340 * @return true if "show regref values" is set; otherwise, returns false. 2341 */ 2342 public static boolean showRegRefValues() { return showRegRefValues; } 2343 2344 /** 2345 * Check if the data index starts at 1 2346 * 2347 * @return true if the data index starts at 1 2348 */ 2349 public static boolean isIndexBase1() { return isIndexBase1; } 2350 2351 /** 2352 * Set enum data to be converted 2353 * 2354 * @param convertEnum true to set enum data conversion 2355 */ 2356 public static void setConvertEnum(boolean convertEnum) { ViewProperties.convertEnum = convertEnum; } 2357 2358 /** 2359 * Set the flag to indicate if "show RegRef values" is set. 2360 * 2361 * @param b 2362 * the flag to indicate if if "show RegRef values" is set. 2363 */ 2364 public static void setShowRegRefValue(boolean b) { showRegRefValues = b; } 2365 2366 /** 2367 * Set the flag to indicate if IndexBase should start at 1. 2368 * 2369 * @param b 2370 * the flag to indicate if IndexBase should start at 1. 2371 */ 2372 public static void setIndexBase1(boolean b) { ViewProperties.isIndexBase1 = b; } 2373 2374 /** 2375 * Sets the list of most recently accessed files. 2376 * 2377 * @param recentFilesList 2378 * The list of most recently accessed files. 2379 */ 2380 public static void setRecentFiles(ArrayList<String> recentFilesList) { recentFiles = recentFilesList; } 2381}