Persistence
Prev | Chapter 2. Feature Reference | Next

## Persistence

In Java TreeView, some effort was made so that when you set settings once, they stay set even if the application is closed and reopened. Such things as colors, zoom settings, url settings, etc. have settings which are set on a per-document level. There are also presets for these settings which are stored globally. A particular preset can be designated the default, and is used when opening new documents.

The actual Presets and Settings are covered in the section called “Presets” and the section called “Settings” respectively. This section simply tells you where the settings and presets are stored.

### Document Settings

All document settings are stored in a document-specfic .jtv file. These settings always take precendence over the presets. If you want to reset a document so that it uses all presets, just delete the .jtv file. At some point, a menu option to do this might get added.

### Global Settings

Currently, there are two program-wide settings: the presets and the most recently used list of files. Program-wide settings are stored in a global configuration file whose location is platform dependant. To be exact, the following code is run to determine what file to use:

        private String globalConfigName()
        {
            String dir = System.getProperty("user.home");;
            String fsep = System.getProperty("file.separator");;
            String os = System.getProperty("os.name");;
            String file;
            if (os.indexOf("Mac") >= 0)
                file = "JavaTreeView Config";
            else if (fsep.equals("/"))
                file = ".javaTreeViewXmlrc";
            else if (fsep.equals("\\"))
                file = "jtview.xml";
            else
            {
                System.out.println("Could not determine sys type! using name jtview.cfg");
                file = "jtview.xml";
            }
            return dir + fsep + file;
        }

On unix, this resolves to a .javaTreeViewXmlrc file in your home directory. On OSX, it resolves to a JavaTreeView Config in your home directory. On PC, it resolves to a jtview.xml file, although I'm not sure where windows considers your home directory to be.

Prev | Up | Next
Chapter 2. Feature Reference | Home | Presets