com.timjohnstondev.unitconverter.logic
Class ConfigurationLogic

java.lang.Object
  extended by com.timjohnstondev.unitconverter.logic.ConfigurationLogic

public final class ConfigurationLogic
extends Object

Utility class that contains all of the logic for maintaining the user preferences.


Method Summary
static int getFontSizePreference(int defaultFontSize)
          Looks into the JVM preference storage location for the Font size.
static int getPreferenceIndex(ListModel model, String unitSeparator)
          Returns the index of the item provided in the ListModel.
static String getUnitSeparatorPreference()
          Looks into the JVM preference storage location for the unit separator.
static void setFontSizePreference(int fontSize)
          Puts a font size preference into the JVM preference storage location.
static void setUnitSeparatorPreference(String symbol)
          Puts a unit separator symbol preference into the JVM preference storage location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPreferenceIndex

public static int getPreferenceIndex(ListModel model,
                                     String unitSeparator)
Returns the index of the item provided in the ListModel.

Parameters:
model - list
unitSeparator - separator
Returns:
index

getUnitSeparatorPreference

public static String getUnitSeparatorPreference()
Looks into the JVM preference storage location for the unit separator. If the unit separator symbol setting is found, it is used, else the default is used.

Returns:
the unit separator symbol stored in the JVM preference storage or the default

setUnitSeparatorPreference

public static void setUnitSeparatorPreference(String symbol)
Puts a unit separator symbol preference into the JVM preference storage location.

Parameters:
symbol - unit separator symbol

getFontSizePreference

public static int getFontSizePreference(int defaultFontSize)
Looks into the JVM preference storage location for the Font size. If the Font size setting is found, it is used, else the system default is used.

Parameters:
defaultFontSize - the default font size
Returns:
the Font size stored in the JVM preference storage or the system default

setFontSizePreference

public static void setFontSizePreference(int fontSize)
Puts a font size preference into the JVM preference storage location.

Parameters:
fontSize - the font size


Copyright © 2009 Tim Johnston Development, LLC. All Rights Reserved.