Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*****************************************************************************
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of the HDF Java Products distribution. *
* The full copyright notice, including terms governing use, modification, *
* and redistribution, is contained in the files COPYING and Copyright.html. *
* COPYING can be found at the root of the source code distribution tree. *
* Or, see http://hdfgroup.org/products/hdf-java/doc/Copyright.html. *
* If you do not have access to either file, you may request a copy from *
* [email protected]. *
****************************************************************************/
package ncsa.hdf.view;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Properties;
import java.util.Vector;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import ncsa.hdf.object.FileFormat;
/**
* The ViewProperties holds all the HDFView static information.
*
* @author Peter X. Cao
* @version 2.4 9/6/2007
*/
public class ViewProperties extends Properties {
private static final long serialVersionUID = -6411465283887959066L;
/** the version of the HDFViewer */
public static final String VERSION = "2.9";
/** the local property file name */
private static final String USER_PROPERTY_FILE = ".hdfview" + VERSION.substring(0, 3);
/** the maximum number of most recent files */
public static final int MAX_RECENT_FILES = 15;
/** name of the tab delimiter */
public static final String DELIMITER_TAB = "Tab";
/** name of the tab delimiter */
public static final String DELIMITER_COMMA = "Comma";
/** name of the tab delimiter */
public static final String DELIMITER_SPACE = "Space";
/** name of the tab delimiter */
public static final String DELIMITER_COLON = "Colon";
/** image origin: UpperLeft */
public static final String ORIGIN_UL = "UpperLeft";
/** image origin: LowerLeft */
public static final String ORIGIN_LL = "LowerLeft";
/** image origin: UpperRight */
public static final String ORIGIN_UR = "UpperRight";
/** image origin: LowerRight */
public static final String ORIGIN_LR = "LowerRight";
/** name of the tab delimiter */
public static final String DELIMITER_SEMI_COLON = "Semi-Colon";
/**
* Property keys how how the data is displayed.
*/
public static enum DATA_VIEW_KEY {
CHAR, CONVERTBYTE, TRANSPOSED, READONLY, OBJECT, BITMASK, BITMASKOP, BORDER, INFO, INDEXBASE1
}
/**
* Property keys how how the data is displayed.
*/
public static enum BITMASK_OP {
AND, EXTRACT
}
/** user's guide */
private static String usersGuide = System.getProperty("user.dir") + "/UsersGuide/index.html";
/** the font size */
private static int fontSize = 12;
/** the font type */
private static String fontType = null;
/** the full path of H4toH5 converter */
private static String h4toh5 = "";
/** data delimiter */
private static String delimiter = DELIMITER_TAB;
/** image origin */
private static String origin = ORIGIN_UL;
/** default index type */
private static String indexType = "H5_INDEX_NAME";
/** default index order */
private static String indexOrder = "H5_ITER_INC";
/** a list of most recent files */
private static Vector mrf;
/** the root directory of the HDFView */
private static String rootDir;
/** default starting file directory */
private static String workDir = "user.dir";
/** default HDF4 file extension */
private static String fileExt = "hdf, h4, hdf4, h5, hdf5, he4, he5";
private static ClassLoader extClassLoader = null;
/** a list of srb accounts */
private static Vector srbAccountList = new Vector(5);
/**
* flag to indicate if auto contrast is used in image process. Do not use
* autocontrast by default (2.6 change).
*/
private static boolean isAutoContrast = false;
private static boolean showImageValues = false;
/**
* flag to indicate if default open file is read only. By default, use
* read/write.
*/
private static boolean isReadOnly = false;
private static boolean isEarlyLib = true;
/** a list of palette files */
private static Vector paletteList = new Vector(5);
/** flag to indicate if enum data is converted to strings */
private static boolean convertEnum = true;
/** flag to indicate if data is 1-based index */
private static boolean isIndexBase1 = false;
/**
* Current Java application such as HDFView cannot handle files with large
* number of objects such 1,000,000 objects. max_members defines the maximum
* number of objects will be loaded into memory.
*/
private static int max_members = Integer.MAX_VALUE; // load all by default // 1,000
// by
// default
/**
* Current Java application such as HDFView cannot handle files with large
* number of objects such 1,000,000 objects. start_members defines the
* starting index of objects will be loaded into memory.
*/
private static int start_members = 0; // 0
// by
// default
private static ImageIcon hdfIcon, h4Icon, h5Icon, largeHdfIcon, blankIcon, helpIcon, fileopenIcon,
filesaveIcon, filenewIcon, filecloseIcon, foldercloseIcon, folderopenIcon, foldercloseIconA,
folderopenIconA, datasetIcon, imageIcon, tableIcon, textIcon, datasetIconA, imageIconA, tableIconA,
textIconA, zoominIcon, zoomoutIcon, paletteIcon, chartIcon, brightIcon, autocontrastIcon, copyIcon,
cutIcon, pasteIcon, previousIcon, nextIcon, firstIcon, lastIcon, animationIcon, datatypeIcon,
datatypeIconA, linkIcon, iconAPPS, iconURL, iconVIDEO, iconXLS, iconPDF, iconAUDIO, questionIcon;
private static String propertyFile;
/** a list of treeview module */
private static Vector moduleListTreeView = new Vector(5);
/** a list of metaview module */
private static Vector moduleListMetaDataView = new Vector(5);
/** a list of textview module */
private static Vector moduleListTextView = new Vector(5);
/** a list of tableview module */
private static Vector moduleListTableView = new Vector(5);
/** a list of imageview module */
private static Vector moduleListImageView = new Vector(5);
/** a list of paletteview module */
private static Vector moduleListPaletteView = new Vector(5);
/** a list of helpview module */
private static Vector moduleListHelpView = new Vector(5);
/**
* Creates a property list with given root directory of the HDFView.
*/
public ViewProperties(String viewRoot) {
super();
rootDir = viewRoot;
mrf = new Vector(MAX_RECENT_FILES + 5);
// find the property file
String uh = "", ud = "", h5v = "", fn;
// look for the property file at the use home directory
fn = USER_PROPERTY_FILE;
uh = System.getProperty("user.home") + File.separator + fn;
ud = System.getProperty("user.dir") + File.separator + fn;
h5v = viewRoot + File.separator + "lib" + File.separator + fn;
if ((new File(uh)).exists()) {
propertyFile = uh;
}
else if ((new File(ud)).exists()) {
propertyFile = ud;
}
else // create new property file at user home directory
{
propertyFile = uh;
File pFile = new File(uh);
try {
pFile.createNewFile();
}
catch (Exception ex) {
propertyFile = null;
}
}
}
/* the properties are sorted by keys */
@SuppressWarnings("unchecked")
public synchronized Enumeration