Package org.compiere.util
Class Ini
- java.lang.Object
-
- org.compiere.util.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
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_LOAD_TAB_META_DATA_BG
static boolean
DEFAULT_OPEN_WINDOW_MAXIMIZED
static boolean
DEFAULT_SINGLE_INSTANCE_PER_WINDOW
static String
ENV_PREFIX
System environment prefixstatic String
IDEMPIERE_HOME
System Property Value of IDEMPIERE_HOMEstatic String
IDEMPIERE_PROPERTY_FILE
Property file namestatic String
P_A_COMMIT
Auto Savestatic String
P_A_LOGIN
Auto Loginstatic String
P_A_NEW
Auto New Recordstatic String
P_ADEMPIERESYS
Dictionary Maintenancestatic String
P_CACHE_WINDOW
Cache Windowsstatic String
P_CHARSET
Charsetstatic String
P_CLIENT
Client Namestatic String
P_CONNECTION
Connection Detailsstatic String
P_CONTEXT
Data Sourcestatic String
P_INI
Ini File Namestatic String
P_LANGUAGE
Languagestatic String
P_LOAD_TAB_META_DATA_BG
Load tab fields meta data using background threadstatic String
P_LOGMIGRATIONSCRIPT
Log Migration Scriptstatic String
P_OPEN_WINDOW_MAXIMIZED
Open new windows as maximizedstatic String
P_ORG
Org Namestatic String
P_PRINTER
Printer Namestatic String
P_PRINTPREVIEW
Print Previewstatic String
P_PWD
Apps Passwordstatic String
P_ROLE
Rolestatic String
P_SHOW_ACCT
Show Acct Tabsstatic String
P_SHOW_TRL
Show Translation Tabsstatic String
P_SINGLE_INSTANCE_PER_WINDOW
Single instance per window idstatic String
P_STORE_PWD
Store Passwordstatic String
P_TEMP_DIR
Temp Directorystatic String
P_TODAY
Current Datestatic String
P_TRACEFILE
Trace to Filestatic String
P_TRACELEVEL
Trace Levelstatic String
P_UI_LOOK
Look and Feelstatic String
P_UI_THEME
UI Themestatic String
P_UID
Apps User IDstatic String
P_VALIDATE_CONNECTION_ON_STARTUP
Validate connection on startupstatic String
P_WAREHOUSE
Warehouse Name
-
Constructor Summary
Constructors Constructor Description Ini()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
deletePropertyFile()
Delete Property filestatic String
findAdempiereHome()
Find Idempiere Homestatic String
getAdempiereHome()
Get Idempiere Home from Environmentstatic String
getAsString()
toStringstatic Charset[]
getAvailableCharsets()
Get Available Encoding Charsetsstatic Charset
getCharset()
Get current charsetstatic int
getDividerLocation()
Get Divider Locationstatic String
getFileName(boolean tryUserHome)
Return File Name of INI filestatic Properties
getProperties()
Get Propertiesstatic String
getProperty(String key)
Get Propertystatic String
getPropertyFileName()
static String
getVar(String secretVar)
static Dimension
getWindowDimension(int AD_Window_ID)
Get Window Dimensionstatic Point
getWindowLocation(int AD_Window_ID)
Get Window Locationstatic boolean
isCacheWindow()
Cache Windowsstatic boolean
isClient()
Are we in Client Mode ?static boolean
isLoaded()
Are the properties loaded?static boolean
isPropertyBool(String key)
Get Property as Booleanstatic boolean
isShowLicenseDialog()
Is show license dialog for new setupstatic void
loadProperties(boolean reload)
Load INI parameters from diskstatic boolean
loadProperties(String filename)
Load INI parameters from filename.static String
runCommand(String[] command)
static void
saveProperties(boolean tryUserHome)
Save INI parameters to diskstatic void
setAdempiereHome(String idempiereHome)
Set Idempiere Homestatic void
setClient(boolean client)
Set Client Modestatic void
setDividerLocation(int dividerLocation)
Set Divider Locationstatic void
setProperty(String key, boolean value)
Set Propertystatic void
setProperty(String key, int value)
Set Propertystatic void
setProperty(String key, String value)
Set Propertystatic void
setShowLicenseDialog(boolean b)
Set show license dialog for new setupstatic void
setVar(String secretVar, String secretValue)
static void
setWindowDimension(int AD_Window_ID, Dimension windowDimension)
Set Window Dimensionstatic void
setWindowLocation(int AD_Window_ID, Point windowLocation)
Set Window Location
-
-
-
Field Detail
-
IDEMPIERE_PROPERTY_FILE
public static final String IDEMPIERE_PROPERTY_FILE
Property file name- See Also:
- Constant Field Values
-
P_UID
public static final String P_UID
Apps User ID- See Also:
- Constant Field Values
-
P_PWD
public static final String P_PWD
Apps Password- See Also:
- Constant Field Values
-
P_STORE_PWD
public static final String P_STORE_PWD
Store Password- See Also:
- Constant Field Values
-
P_TRACELEVEL
public static final String P_TRACELEVEL
Trace Level- See Also:
- Constant Field Values
-
P_TRACEFILE
public static final String P_TRACEFILE
Trace to File- See Also:
- Constant Field Values
-
P_LANGUAGE
public static final String P_LANGUAGE
Language- See Also:
- Constant Field Values
-
P_INI
public static final String P_INI
Ini File Name- See Also:
- Constant Field Values
-
P_CONNECTION
public static final String P_CONNECTION
Connection Details- See Also:
- Constant Field Values
-
P_CONTEXT
public static final String P_CONTEXT
Data Source- See Also:
- Constant Field Values
-
P_UI_LOOK
public static final String P_UI_LOOK
Look and Feel- See Also:
- Constant Field Values
-
P_UI_THEME
public static final String P_UI_THEME
UI Theme- See Also:
- Constant Field Values
-
P_A_COMMIT
public static final String P_A_COMMIT
Auto Save- See Also:
- Constant Field Values
-
P_A_LOGIN
public static final String P_A_LOGIN
Auto Login- See Also:
- Constant Field Values
-
P_A_NEW
public static final String P_A_NEW
Auto New Record- See Also:
- Constant Field Values
-
P_ADEMPIERESYS
public static final String P_ADEMPIERESYS
Dictionary Maintenance- See Also:
- Constant Field Values
-
P_LOGMIGRATIONSCRIPT
public static final String P_LOGMIGRATIONSCRIPT
Log Migration Script- See Also:
- Constant Field Values
-
P_SHOW_ACCT
public static final String P_SHOW_ACCT
Show Acct Tabs- See Also:
- Constant Field Values
-
P_SHOW_TRL
public static final String P_SHOW_TRL
Show Translation Tabs- See Also:
- Constant Field Values
-
P_CACHE_WINDOW
public static final String P_CACHE_WINDOW
Cache Windows- See Also:
- Constant Field Values
-
P_TEMP_DIR
public static final String P_TEMP_DIR
Temp Directory- See Also:
- Constant Field Values
-
P_ROLE
public static final String P_ROLE
Role- See Also:
- Constant Field Values
-
P_CLIENT
public static final String P_CLIENT
Client Name- See Also:
- Constant Field Values
-
P_ORG
public static final String P_ORG
Org Name- See Also:
- Constant Field Values
-
P_PRINTER
public static final String P_PRINTER
Printer Name- See Also:
- Constant Field Values
-
P_WAREHOUSE
public static final String P_WAREHOUSE
Warehouse Name- See Also:
- Constant Field Values
-
P_TODAY
public static final String P_TODAY
Current Date- See Also:
- Constant Field Values
-
P_PRINTPREVIEW
public static final String P_PRINTPREVIEW
Print Preview- See Also:
- Constant Field Values
-
P_VALIDATE_CONNECTION_ON_STARTUP
public static final String P_VALIDATE_CONNECTION_ON_STARTUP
Validate connection on startup- See Also:
- Constant Field Values
-
P_SINGLE_INSTANCE_PER_WINDOW
public static final String P_SINGLE_INSTANCE_PER_WINDOW
Single instance per window id- See Also:
- Constant Field Values
-
DEFAULT_SINGLE_INSTANCE_PER_WINDOW
public static final boolean DEFAULT_SINGLE_INSTANCE_PER_WINDOW
- See Also:
- Constant Field Values
-
P_OPEN_WINDOW_MAXIMIZED
public static final String P_OPEN_WINDOW_MAXIMIZED
Open new windows as maximized- See Also:
- Constant Field Values
-
DEFAULT_OPEN_WINDOW_MAXIMIZED
public static final boolean DEFAULT_OPEN_WINDOW_MAXIMIZED
- See Also:
- Constant Field Values
-
P_CHARSET
public static final String P_CHARSET
Charset- See Also:
- Constant Field Values
-
P_LOAD_TAB_META_DATA_BG
public static final String P_LOAD_TAB_META_DATA_BG
Load tab fields meta data using background thread- See Also:
- Constant Field Values
-
DEFAULT_LOAD_TAB_META_DATA_BG
public static final String DEFAULT_LOAD_TAB_META_DATA_BG
- See Also:
- Constant Field Values
-
ENV_PREFIX
public static final String ENV_PREFIX
System environment prefix- See Also:
- Constant Field Values
-
IDEMPIERE_HOME
public static final String IDEMPIERE_HOME
System Property Value of IDEMPIERE_HOME- See Also:
- Constant Field Values
-
-
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 fileExamples: 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
- Keyvalue
- Value
-
setProperty
public static void setProperty(String key, boolean value)
Set Property- Parameters:
key
- Keyvalue
- Value
-
setProperty
public static void setProperty(String key, int value)
Set Property- Parameters:
key
- Keyvalue
- 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
- windowwindowDimension
- 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
- windowwindowLocation
- 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()
-
-