Class AbstractXMLConfiguration

java.lang.Object
net.simplace.ui.customize.AbstractXMLConfiguration

public abstract class AbstractXMLConfiguration extends Object
Abstract config file with important functions for parsing and writing Data to XML Configfiles
Author:
Andreas Enders
  • Field Details

    • iDocument

      protected org.jdom2.Document iDocument
      the XML document of the file, null if the file does not exist
    • iFile

      protected File iFile
      the configuration file
    • iConfiguration

      protected org.jdom2.Element iConfiguration
      the XML configuration of this file
  • Constructor Details

    • AbstractXMLConfiguration

      public AbstractXMLConfiguration(File aConfigFile, org.jdom2.Element aConfiguration)
      Reads the file without parameters, see AbstractXMLConfiguration(File, Element, Map).
      Parameters:
      aConfigFile - the XML configuration file
      aConfiguration - the XML configuration of this file
    • AbstractXMLConfiguration

      public AbstractXMLConfiguration(File aConfigFile, org.jdom2.Element aConfiguration, Map<String,Object> aParameterMap)
      Reads the file, if it exists (errors are logged), and initializes the values.

      Note: the result of replacing the parameters is not used, so tokens stay in the document.

      Parameters:
      aConfigFile - the XML configuration file
      aConfiguration - the XML configuration of this file
      aParameterMap - parameters for the tokens in the file
    • AbstractXMLConfiguration

      protected AbstractXMLConfiguration()
      Creates an empty configuration (for subclasses).
  • Method Details

    • initializeFileValues

      protected abstract void initializeFileValues()
      Reads the values from the document; has to be implemented by FileFields.
    • commitValues

      protected abstract void commitValues()
      Writes the values into the document; has to be implemented by FileFields.
    • commit

      public void commit()
      if is setModified() new Values will be written to config file.
    • readValue

      protected String readValue(String aXPath)
      Parameters:
      aXPath - XPath expression
      Returns:
      the trimmed text of the first element found, or the result list as text
    • writeValue

      protected void writeValue(String aValue, int aLineNumber, int aBeginColumnNumber, int aEndColumnNumber)
      Not supported for XML files (does nothing).
      Parameters:
      aValue - not used
      aLineNumber - not used
      aBeginColumnNumber - not used
      aEndColumnNumber - not used
    • replaceParametersFromMap

      public void replaceParametersFromMap(Map<String,Object> aParamMap)
      Not supported for XML files (does nothing).
      Parameters:
      aParamMap - not used
    • getConfigurationParmeterValue

      public String getConfigurationParmeterValue(String aKey)
      Parameters:
      aKey - the key
      Returns:
      the value of the XML configuration for the key, or null
    • setModified

      public void setModified()
      Marks the document as modified; only then commit() writes it.
    • setUnModified

      public void setUnModified()
      Marks the document as unmodified, so commit() does not write it.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      XMLConfigFile: file