rero.config
Class ClientState

java.lang.Object
  extended byrero.config.ClientState

public class ClientState
extends Object


Field Summary
protected  Properties backup
           
protected static File baseDirectory
           
protected  Set changes
           
protected static ClientState clientState
           
protected static HashMap listeners
           
protected  Properties state
           
 
Constructor Summary
ClientState()
           
 
Method Summary
 void addClientStateListener(String property, ClientStateListener l)
           
 void backup()
          performs a backup of the properties before making changes, it is the responsability of the changing class to call this function
 void fireChange(String property)
           
 void fireChange(String property, String parameter)
           
static File getBaseDirectory()
           
 Rectangle getBounds(String key, Dimension areaSize, Dimension mySize)
           
static ClientState getClientState()
           
 Color getColor(String key, Color defaultColor)
           
static File getFile(String filename)
           
 float getFloat(String key, float defaultValue)
           
 Font getFont(String key, Font defaultValue)
           
 String getHelpString(String topic)
           
 ImageIcon getIcon(String key, String defaultResource)
           
 int getInteger(String key, int defaultValue)
           
 URL getPackagedResource(String fileName, String subDir)
           
static InputStreamReader getProperInputStream(InputStream stream)
           
static PrintStream getProperPrintStream(OutputStream stream)
           
 Properties getProperties()
           
 URL getResource(String fileName)
           
 InputStream getResourceAsStream(String fileName)
           
 String getString(String key, String defaultValue)
           
 StringList getStringList(String key)
           
 boolean isOption(String key, boolean defaultBoolean)
           
 boolean isValue(String key, String item)
           
 void restore()
          performs a restore of the properties effectively undoing everything since the last backup, it is the responsability of the changing class to call this function
static void setBaseDirectory(String directory)
           
 void setBounds(String key, Rectangle value)
           
 void setColor(String key, Color color)
           
 void setFloat(String key, float value)
           
 void setFont(String key, Font value)
           
 void setInteger(String key, int value)
           
 void setOption(String key, boolean value)
           
 void setString(String key, String value)
           
 void sync()
          sync the file system config file with the current client state
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected static HashMap listeners

changes

protected Set changes

backup

protected Properties backup

baseDirectory

protected static File baseDirectory

state

protected Properties state

clientState

protected static ClientState clientState
Constructor Detail

ClientState

public ClientState()
Method Detail

setBaseDirectory

public static void setBaseDirectory(String directory)

fireChange

public void fireChange(String property)

addClientStateListener

public void addClientStateListener(String property,
                                   ClientStateListener l)

fireChange

public void fireChange(String property,
                       String parameter)

getProperInputStream

public static InputStreamReader getProperInputStream(InputStream stream)

getProperPrintStream

public static PrintStream getProperPrintStream(OutputStream stream)

getBaseDirectory

public static File getBaseDirectory()

getClientState

public static ClientState getClientState()

backup

public void backup()
performs a backup of the properties before making changes, it is the responsability of the changing class to call this function


restore

public void restore()
performs a restore of the properties effectively undoing everything since the last backup, it is the responsability of the changing class to call this function


sync

public void sync()
sync the file system config file with the current client state


getProperties

public Properties getProperties()

setString

public void setString(String key,
                      String value)

getString

public String getString(String key,
                        String defaultValue)

getBounds

public Rectangle getBounds(String key,
                           Dimension areaSize,
                           Dimension mySize)

getFloat

public float getFloat(String key,
                      float defaultValue)

setFloat

public void setFloat(String key,
                     float value)

getInteger

public int getInteger(String key,
                      int defaultValue)

setInteger

public void setInteger(String key,
                       int value)

setOption

public void setOption(String key,
                      boolean value)

isOption

public boolean isOption(String key,
                        boolean defaultBoolean)

getColor

public Color getColor(String key,
                      Color defaultColor)

setColor

public void setColor(String key,
                     Color color)

getStringList

public StringList getStringList(String key)

isValue

public boolean isValue(String key,
                       String item)

getFile

public static File getFile(String filename)

getResource

public URL getResource(String fileName)

getHelpString

public String getHelpString(String topic)

getPackagedResource

public URL getPackagedResource(String fileName,
                               String subDir)

getResourceAsStream

public InputStream getResourceAsStream(String fileName)

getFont

public Font getFont(String key,
                    Font defaultValue)

setFont

public void setFont(String key,
                    Font value)

getIcon

public ImageIcon getIcon(String key,
                         String defaultResource)

setBounds

public void setBounds(String key,
                      Rectangle value)