Class Ini

  • All Implemented Interfaces:
    Serializable

    public final class Ini
    extends Object
    implements Serializable
    Load and Save INI Settings from property file Initiated in Adempiere.startup Settings activated in ALogin.getIni
    Version:
    $Id$
    Author:
    Jorg Janke, Teo Sarca, www.arhipac.ro
  • FR [ 1658127 ] Select charset encoding on import
  • FR [ 2406123 ] Ini.saveProperties fails if target directory does not exist
  • See Also:
    Serialized Form
    • Constructor Detail

      • Ini

        public Ini()
    • Method Detail

      • saveProperties

        public static void saveProperties​(boolean tryUserHome)
        Save INI parameters to disk
        Parameters:
        tryUserHome - get user home first
      • loadProperties

        public static void loadProperties​(boolean reload)
        Load INI parameters from disk
        Parameters:
        reload - reload
      • loadProperties

        public static boolean loadProperties​(String filename)
        Load INI parameters from filename. Logger is on default level (INFO)
        Parameters:
        filename - to load
        Returns:
        true if first time
      • deletePropertyFile

        public static void deletePropertyFile()
        Delete Property file
      • getFileName

        public static String getFileName​(boolean tryUserHome)
        Return File Name of INI file
          Examples:
                    C:\WinNT\Profiles\jjanke\idempiere.properties
              D:\idempiere\idempiere.properties
              idempiere.properties
          
        Can be overwritten by -DPropertyFile=myFile allowing multiple configurations / property files.
        Parameters:
        tryUserHome - get user home first
        Returns:
        file name
      • setProperty

        public static void setProperty​(String key,
                                       String value)
        Set Property
        Parameters:
        key - Key
        value - Value
      • setProperty

        public static void setProperty​(String key,
                                       boolean value)
        Set Property
        Parameters:
        key - Key
        value - Value
      • setProperty

        public static void setProperty​(String key,
                                       int value)
        Set Property
        Parameters:
        key - Key
        value - Value
      • getProperty

        public static String getProperty​(String key)
        Get Property
        Parameters:
        key - Key
        Returns:
        Value
      • isPropertyBool

        public static boolean isPropertyBool​(String key)
        Get Property as Boolean
        Parameters:
        key - Key
        Returns:
        Value
      • isCacheWindow

        public static boolean isCacheWindow()
        Cache Windows
        Returns:
        true if windows are cached
      • getProperties

        public static Properties getProperties()
        Get Properties
        Returns:
        Ini properties
      • getAsString

        public static String getAsString()
        toString
        Returns:
        String representation
      • isClient

        public static boolean isClient()
        Are we in Client Mode ?
        Returns:
        true if client
      • setClient

        public static void setClient​(boolean client)
        Set Client Mode
        Parameters:
        client - client
      • setShowLicenseDialog

        public static void setShowLicenseDialog​(boolean b)
        Set show license dialog for new setup
        Parameters:
        b -
      • isShowLicenseDialog

        public static boolean isShowLicenseDialog()
        Is show license dialog for new setup
        Returns:
        boolean
      • isLoaded

        public static boolean isLoaded()
        Are the properties loaded?
        Returns:
        true if properties loaded.
      • getAdempiereHome

        public static String getAdempiereHome()
        Get Idempiere Home from Environment
        Returns:
        idempiereHome or null
      • setAdempiereHome

        public static void setAdempiereHome​(String idempiereHome)
        Set Idempiere Home
        Parameters:
        idempiereHome - IDEMPIERE_HOME
      • findAdempiereHome

        public static String findAdempiereHome()
        Find Idempiere Home
        Returns:
        idempiere home or null
      • getWindowDimension

        public static Dimension getWindowDimension​(int AD_Window_ID)
        Get Window Dimension
        Parameters:
        AD_Window_ID - window no
        Returns:
        dimension or null
      • setWindowDimension

        public static void setWindowDimension​(int AD_Window_ID,
                                              Dimension windowDimension)
        Set Window Dimension
        Parameters:
        AD_Window_ID - window
        windowDimension - dimension - null to remove
      • getWindowLocation

        public static Point getWindowLocation​(int AD_Window_ID)
        Get Window Location
        Parameters:
        AD_Window_ID - window id
        Returns:
        location or null
      • setWindowLocation

        public static void setWindowLocation​(int AD_Window_ID,
                                             Point windowLocation)
        Set Window Location
        Parameters:
        AD_Window_ID - window
        windowLocation - location - null to remove
      • getDividerLocation

        public static int getDividerLocation()
        Get Divider Location
        Returns:
        location
      • setDividerLocation

        public static void setDividerLocation​(int dividerLocation)
        Set Divider Location
        Parameters:
        dividerLocation - location
      • getAvailableCharsets

        public static Charset[] getAvailableCharsets()
        Get Available Encoding Charsets
        Returns:
        array of available encoding charsets
        Since:
        3.1.4
      • getCharset

        public static Charset getCharset()
        Get current charset
        Returns:
        current charset
        Since:
        3.1.4
      • getPropertyFileName

        public static String getPropertyFileName()
      • getVar

        public static String getVar​(String secretVar)
      • setVar

        public static void setVar​(String secretVar,
                                  String secretValue)
      • runCommand

        public static String runCommand​(String[] command)