Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sshtools.apps
Class PreferencesStore  view PreferencesStore download PreferencesStore.java

java.lang.Object
  extended bycom.sshtools.apps.PreferencesStore

public class PreferencesStore
extends java.lang.Object

Provides a backing store for preferences using a simple properties file. The init method must be called first providing the file to store the preferences in.

Version:
$Id: PreferencesStore.java,v 1.2 2003/01/14 01:04:07 t_magicthize Exp $

Field Summary
private static java.io.File file
           
protected static org.apache.log4j.Logger log
           
private static java.util.Properties preferences
           
private static boolean storeAvailable
           
 
Constructor Summary
PreferencesStore()
           
 
Method Summary
static java.lang.String get(java.lang.String name, java.lang.String def)
          Return a string preference
static boolean getBoolean(java.lang.String name, boolean def)
          Return a boolean preference
static int getInt(java.lang.String name, int def)
          Return a integer preference
static java.awt.Rectangle getRectangle(java.lang.String name, java.awt.Rectangle def)
          Return a Rectangle preference
static void init(java.io.File file)
          Initialise the preferences store.
static boolean isStoreAvailable()
          Return if the preferences store is available.
static boolean preferenceExists(java.lang.String name)
          Determine if a preference exists
static void put(java.lang.String name, java.lang.String val)
          Store a string preference
static void putBoolean(java.lang.String name, boolean val)
          Store a boolean preference
static void putInt(java.lang.String name, int val)
          Store a integer preference
static void putRectangle(java.lang.String name, java.awt.Rectangle val)
          Store a rectangle preference
static void restoreTableMetrics(javax.swing.JTable table, java.lang.String pref, int[] defaultWidths)
          Restore table column positions and sizes.
static void savePreferences()
          Save the preferences, creating the file if required.
static void saveTableMetrics(javax.swing.JTable table, java.lang.String pref)
          Save table column positions and sizes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.log4j.Logger log

file

private static java.io.File file

storeAvailable

private static boolean storeAvailable

preferences

private static java.util.Properties preferences
Constructor Detail

PreferencesStore

public PreferencesStore()
Method Detail

saveTableMetrics

public static void saveTableMetrics(javax.swing.JTable table,
                                    java.lang.String pref)
Save table column positions and sizes. Note, the table must have its auto resize mode set to off, i.e.


restoreTableMetrics

public static void restoreTableMetrics(javax.swing.JTable table,
                                       java.lang.String pref,
                                       int[] defaultWidths)
Restore table column positions and sizes. Note, the table must have its auto resize mode set to off, i.e.


isStoreAvailable

public static boolean isStoreAvailable()
Return if the preferences store is available. This will be false

init

public static void init(java.io.File file)
Initialise the preferences store. The file provided will be created if it doesn't exist (as will any requires parent directories)


savePreferences

public static void savePreferences()
Save the preferences, creating the file if required.


get

public static java.lang.String get(java.lang.String name,
                                   java.lang.String def)
Return a string preference


put

public static void put(java.lang.String name,
                       java.lang.String val)
Store a string preference


getRectangle

public static java.awt.Rectangle getRectangle(java.lang.String name,
                                              java.awt.Rectangle def)
Return a Rectangle preference


putRectangle

public static void putRectangle(java.lang.String name,
                                java.awt.Rectangle val)
Store a rectangle preference


getInt

public static int getInt(java.lang.String name,
                         int def)
Return a integer preference


putInt

public static void putInt(java.lang.String name,
                          int val)
Store a integer preference


getBoolean

public static boolean getBoolean(java.lang.String name,
                                 boolean def)
Return a boolean preference


putBoolean

public static void putBoolean(java.lang.String name,
                              boolean val)
Store a boolean preference


preferenceExists

public static boolean preferenceExists(java.lang.String name)
Determine if a preference exists