cz.polous.andaria
Class Settings

java.lang.Object
  extended by cz.polous.andaria.Settings

 class Settings
extends java.lang.Object

Settings: Trida se statickyma metodama pro pristup k nastaveni a ukladani nastaveni.

Author:
Martin Polehla (andaria_patcher@polous.cz)

Nested Class Summary
(package private)  class Settings.VALUES
           
 
Field Summary
private  java.lang.String about_url
           
private  java.lang.String counter_url
           
private  java.lang.String debug_log
           
private  org.jdom.Document doc
           
private  java.lang.String filelist_url
           
private static Settings INSTANCE
           
private  java.lang.String local_storage
          Adresy URL
private static Log log
           
private  java.lang.String news_url
           
private  OperatingSystem os
           
private  org.jdom.Element patches
           
private  java.lang.String remote_storage
           
private  org.jdom.Element root
           
private static java.lang.String[] settingList
           
private  org.jdom.Element settings
           
 
Constructor Summary
private Settings()
           
 
Method Summary
 boolean debugMode()
          Determinate if program is in debug mode.
 java.lang.String getAbout_url()
           
 java.lang.String getCounter_url()
           
 java.lang.String getDebug_log()
           
private  java.lang.String getDefaultValue(int item)
           
private  org.jdom.Element getExistingElement(org.jdom.Element el, java.lang.String item)
           
 java.lang.String getFilelist_url()
           
static Settings getInstance()
           
 java.lang.String getLocal_storage()
           
 java.lang.String getNews_url()
           
 OperatingSystem getOs()
           
 org.jdom.Element getPatchData(java.lang.String item)
           
 java.lang.String getRemote_storage()
           
static java.lang.String getSettingName(int val)
           
 java.lang.String getValue(int item)
          Get configuration value specified by config name.
 void load()
          Load settings, doc, and paches objects from XML file
 java.lang.String openFile(java.lang.String title, java.lang.String defPath, int ft)
          Open file dialog openner.
static void removeRarFiles()
          Deprecated. 
 boolean RenewWindowsRegistry()
           
 void save()
          Save settings and paches objects into XML file
 void savePatchItem(PatchItem p)
          Save a PatchItem object state into XML setting file.
 void setValue(int item, java.lang.String val)
          setValue(String item, String val) wrapper
 void setValue(java.lang.String item, java.lang.String val)
          Set a configuration settings (not save).
 void updateTempSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

private static final Settings INSTANCE

doc

private org.jdom.Document doc

root

private org.jdom.Element root

settings

private org.jdom.Element settings

patches

private org.jdom.Element patches

os

private OperatingSystem os

local_storage

private final java.lang.String local_storage
Adresy URL


remote_storage

private final java.lang.String remote_storage
See Also:
Constant Field Values

about_url

private final java.lang.String about_url
See Also:
Constant Field Values

news_url

private final java.lang.String news_url
See Also:
Constant Field Values

debug_log

private final java.lang.String debug_log
See Also:
Constant Field Values

counter_url

private final java.lang.String counter_url
See Also:
Constant Field Values

filelist_url

private final java.lang.String filelist_url
See Also:
Constant Field Values

log

private static Log log

settingList

private static final java.lang.String[] settingList
Constructor Detail

Settings

private Settings()
Method Detail

getInstance

public static Settings getInstance()

getOs

public OperatingSystem getOs()

getCounter_url

public java.lang.String getCounter_url()

getAbout_url

public java.lang.String getAbout_url()

getDebug_log

public java.lang.String getDebug_log()

getFilelist_url

public java.lang.String getFilelist_url()

getLocal_storage

public java.lang.String getLocal_storage()

getNews_url

public java.lang.String getNews_url()

getRemote_storage

public java.lang.String getRemote_storage()

getValue

public java.lang.String getValue(int item)
Get configuration value specified by config name.

Parameters:
item - requested settings item sub-element
Returns:
Required item (string)

setValue

public void setValue(int item,
                     java.lang.String val)
setValue(String item, String val) wrapper

Parameters:
item - element to set
val - New value of item

setValue

public void setValue(java.lang.String item,
                     java.lang.String val)
Set a configuration settings (not save).

Parameters:
item - Name of element to set
val - New value of item

savePatchItem

public void savePatchItem(PatchItem p)
Save a PatchItem object state into XML setting file.

Parameters:
p - PatchItem to save.

getExistingElement

private org.jdom.Element getExistingElement(org.jdom.Element el,
                                            java.lang.String item)
Parameters:
el - Element where to look for item
item - Name of sub-element
Returns:
Return required element or new empty one.

getPatchData

public org.jdom.Element getPatchData(java.lang.String item)
Returns:
PatchItem data Element

openFile

public java.lang.String openFile(java.lang.String title,
                                 java.lang.String defPath,
                                 int ft)
Open file dialog openner.

Parameters:
title - Title of JFileCooser
defPath - Default path of JFileChooser
ft - Selection mode (ie. JFileCooser.DIRECTORY)

load

public void load()
Load settings, doc, and paches objects from XML file


save

public void save()
Save settings and paches objects into XML file


debugMode

public boolean debugMode()
Determinate if program is in debug mode.

Returns:
true if debug mode, false if not.

getSettingName

public static java.lang.String getSettingName(int val)

getDefaultValue

private java.lang.String getDefaultValue(int item)

RenewWindowsRegistry

public boolean RenewWindowsRegistry()

removeRarFiles

@Deprecated
public static void removeRarFiles()
Deprecated. 


updateTempSize

public void updateTempSize()