fi.hut.tml.xsmiles
Class XMLConfigurer

java.lang.Object
  extended byfi.hut.tml.xsmiles.XMLConfigurer

public class XMLConfigurer
extends java.lang.Object

Stores general browser configuration and provides access to read values.

Version:
$Revision: 6512 $
Author:
Mikko Honkala

Field Summary
protected  boolean changed
           
protected  org.w3c.dom.Document doc
           
protected  java.net.URL fileurl
           
protected  XMLParser parser
           
protected  java.lang.String parserName
           
protected  org.w3c.dom.Element root
           
 
Constructor Summary
XMLConfigurer()
          A XML tree based configuration handler which gives back properties to XPath queries
 
Method Summary
 void configChanged()
          Config has chaged, change global options
 org.w3c.dom.Element createNode(java.lang.String path)
          Creates the node represented by path
 org.w3c.dom.Element findElement(java.lang.String path)
           
 boolean getBooleanProperty(java.lang.String path)
           
 org.w3c.dom.Document getConfigDocument()
           
 java.lang.String getGUIProperty(BrowserWindow browser, java.lang.String prop)
           
 java.lang.String getGUIProperty(java.lang.String guiName, java.lang.String prop)
           
 int getIntProperty(java.lang.String path)
           
 java.lang.String getProperty(java.lang.String path)
           
 void readConfig(java.net.URL m_url)
          Read the config file specified by the url
 void setGUIProperty(BrowserWindow browser, java.lang.String prop, java.lang.String value)
          Set a GUI property
 void setProperty(java.lang.String path, java.lang.String value)
          Set a config property
 void writeConfig()
          Write the config file specified by the url
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

changed

protected boolean changed

root

protected org.w3c.dom.Element root

doc

protected org.w3c.dom.Document doc

fileurl

protected java.net.URL fileurl

parser

protected XMLParser parser

parserName

protected java.lang.String parserName
Constructor Detail

XMLConfigurer

public XMLConfigurer()
A XML tree based configuration handler which gives back properties to XPath queries

See Also:
cfg/config.xml
Method Detail

configChanged

public void configChanged()
Config has chaged, change global options


readConfig

public void readConfig(java.net.URL m_url)
                throws java.net.MalformedURLException,
                       java.io.IOException,
                       org.xml.sax.SAXException,
                       java.lang.ClassNotFoundException
Read the config file specified by the url

Throws:
java.net.MalformedURLException
java.io.IOException
org.xml.sax.SAXException
java.lang.ClassNotFoundException

writeConfig

public void writeConfig()
Write the config file specified by the url


setProperty

public void setProperty(java.lang.String path,
                        java.lang.String value)
Set a config property


getIntProperty

public int getIntProperty(java.lang.String path)
Parameters:
path - Get an integer value config property (e.g "gui/screendepth")
Returns:
the value

getBooleanProperty

public boolean getBooleanProperty(java.lang.String path)
Parameters:
path - Get an boolean value config property (e.g "gui/screendepth")
Returns:
the value

getGUIProperty

public java.lang.String getGUIProperty(BrowserWindow browser,
                                       java.lang.String prop)
Parameters:
prop - The gui property found under gui/properties// Minimizes the need of doing extensive hunting for the name of the current GUI every time a property is requested.
Returns:
The value. e.g., if screenDepth is requested, and the current GUI is desktop, then, the property is translated into into the full xpath: gui/properties/desktop/screenDepth

getGUIProperty

public java.lang.String getGUIProperty(java.lang.String guiName,
                                       java.lang.String prop)
Parameters:
guiName - The title of the GUI
prop - The gui property found under gui/properties// Minimizes the need of doing extensive hunting for the name of the current GUI every time a property is requested.
Returns:
The value. e.g., if screenDepth is requested, and the current GUI is desktop, then, the property is translated into into the full xpath: gui/properties/desktop/screenDepth

setGUIProperty

public void setGUIProperty(BrowserWindow browser,
                           java.lang.String prop,
                           java.lang.String value)
Set a GUI property


getProperty

public java.lang.String getProperty(java.lang.String path)
Parameters:
path - Get a config property (e.g "main/homepage")
Returns:
the value

createNode

public org.w3c.dom.Element createNode(java.lang.String path)
Creates the node represented by path


findElement

public org.w3c.dom.Element findElement(java.lang.String path)

getConfigDocument

public org.w3c.dom.Document getConfigDocument()


X-Smiles 1.2