public class GEnvironment extends Object
Modifier and Type | Class and Description |
---|---|
static class |
GEnvironment.Format
Format for the entry field.
|
static class |
GEnvironment.UIElementColor
Enumerates describing the list of modifiable GUI elements colors.
|
Modifier and Type | Method and Description |
---|---|
static double[] |
arrayCopy(double[] srcArray)
Create a copy of an double array.
|
static int[] |
arrayCopy(int[] srcArray)
Create a copy of an int array.
|
static <T> T[] |
arrayCopy(T[] srcArray)
Create a copy of an object array.
|
static boolean |
configLangIsCurrent()
Check if the translation system is initialized.
|
static String |
formatDouble(double value)
Sets a specific double format.
|
static String |
formatDouble(double value,
GEnvironment.Format format,
int fracDigits)
Format a double with the specified format and number of fractional digits.
|
static String |
formatDouble(double value,
int fracDigits)
Sets a specific double format.
|
static GIcon |
getApplicationIcon()
Gets application frame icon
|
static String |
getErrorTooltipMessage(String interval)
Gets the ERROR tooltip message given the interval or intervals.
|
static GLogger |
getGLog()
Get the internationalization manager.
|
static GLogEventTablePanel |
getGLogViewer()
Get the GLogEventTablePanel containing the GLogEventTable associated with the log file.
|
static GUncaughtExceptionHandler |
getGUncaughtExceptionHandler()
Get the uncaughtExceptionHandler to be called in case of an exception arising in the event
loop, if null the exception will be ignored.
|
static Locale |
getI18nLocale()
Get Application Lang.
|
static String |
getOkTooltipMessage(String interval)
Gets the OK tooltip message given the interval or intervals.
|
static String |
getWarningTooltipMessage(String interval)
Gets the WARNING tooltip message given the interval or intervals.
|
static boolean |
getWriteLogDataModififiedEvent()
Gets the status of writeLogDataModififiedEvent parameter.
|
static boolean |
getWriteLogDataValidityEvent()
Gets the status of writeLogDataValidityEvent parameter.
|
static void |
initI18n()
Initialize the translation system to the default language: English.
|
static void |
initI18n(Locale locale)
Initialize the translation system.
|
static boolean |
isHeadless()
Return if the environment is headless calling GraphicsEnvironment.isHeadless().
|
static String |
marktr(String string)
Marks text to be translated, but doesn't return the translation but text itself.
|
static String |
removeLeftZeroes(String string)
Remove the zeroes at the left of the string.
|
static String |
removeRightZeroes(String string)
Remove the zeroes at the right of the string.
|
static void |
sendProgress(int value)
Send the progress output mode to the stdout in the form of @value@.
|
static void |
setConfigurationLang(String lang)
Set Configuration Lang.
|
static void |
setGUncaughtExceptionHandler(GUncaughtExceptionHandler uncaughtExceptionHandler)
Set the uncaughtExceptionHandler to be called in case of an exception arising in the event
loop.
|
static void |
setHeadless()
Set the headless property of the environment.
|
static void |
setIcon(GIcon applicationIcon)
Change application icon.
|
static void |
setIcon(String filePath)
Change application icon.
|
static void |
setIcon(URL fileURL)
Change application icon.
|
static void |
setLogFilename(String filename,
boolean createViewer)
Sets the log filename.
|
static void |
setOutputEncoding(String encoding)
Set the stdout and stderr encoding to
|
static void |
setProgressOutputMode(boolean flag)
Sets the progress output mode.
|
static void |
setUIColor(GEnvironment.UIElementColor element,
Color color)
Change the color of an UI item for all the instances.
|
static void |
setWriteLogDataModififiedEvent(boolean flag)
Sets the status of writeLogDataModififiedEvent parameter.
|
static void |
setWriteLogDataValidityEvent(boolean flag)
Sets the status of writeLogDataValidityEvent parameter.
|
static String |
tr(String string)
Translate string using the current locale if the i18n has been initialize with the initI18n
method, else it returns the untranslated string.
|
static String |
trConfToCurrent(String string,
boolean underscoreAsWhitespace)
Translate value read from configuration from configuration locale to application locale
|
static String |
trf(boolean localizeNumbers,
String formatString,
Object... args)
Translate a string doing a String.format.
|
static String |
trf(String formatString,
Object... args)
Translate a string doing a String.format.
|
static String |
trn(String singularString,
String pluralString,
long n)
Translate string using the current locale if the i18n has been initialize with the initI18n
method, else it returns the untranslated string.
|
public static String getErrorTooltipMessage(String interval)
interval
- the interval or intervals to show in the message.public static GIcon getApplicationIcon()
public static String getWarningTooltipMessage(String interval)
interval
- the interval or intervals to show in the message.public static String getOkTooltipMessage(String interval)
interval
- the interval or intervals to show in the message.public static void setIcon(GIcon applicationIcon)
applicationIcon
- GIcon objectpublic static void setIcon(URL fileURL) throws IOException
fileURL
- icon file URLIOException
- thrown if the icon can not be readpublic static void setIcon(String filePath) throws IOException
filePath
- icon file path (absolute or relative from resources)IOException
- thrown if the icon can not be readpublic static void setUIColor(GEnvironment.UIElementColor element, Color color)
element
- type of element to modifycolor
- new color of the element.public static String removeLeftZeroes(String string)
string
- to be treated.public static String removeRightZeroes(String string)
string
- to be treated.public static String formatDouble(double value, GEnvironment.Format format, int fracDigits)
value
- value to format.format
- format SCIENTIFIC or NORMAL.fracDigits
- number of fractional digits.public static void setOutputEncoding(String encoding) throws UnsupportedEncodingException
encoding
- the encoding to use for the stdout and stderr, for example to set them to
UTF-8 use "UTF-8".UnsupportedEncodingException
- in case the encoding is not supported.public static void setProgressOutputMode(boolean flag)
flag
- true the progress output is send to the stdout, false otherwise.public static void sendProgress(int value)
value
- between 0 and 100 to send to the stdout.public static void setGUncaughtExceptionHandler(GUncaughtExceptionHandler uncaughtExceptionHandler)
uncaughtExceptionHandler
- the uncaughtExceptionHandler to be called in case of an
exception arising in the event loop, if null the exception will be ignored.public static GUncaughtExceptionHandler getGUncaughtExceptionHandler()
public static void initI18n() throws GEnvironmentException
GEnvironmentException
- in case that the translation file is not found. The default
language is used (English).public static void initI18n(Locale locale) throws GEnvironmentException
locale
- to be use to translate the strings in the code.new Locale("lang")
to set the "lang" language. Ex:
new Locale("fr")
. A translation file must exist.Locale.getDefault()
to set the default machine locale.GEnvironmentException
- in case that the translation file is not found. The default
language is used (English).public static Locale getI18nLocale()
public static void setConfigurationLang(String lang) throws GEnvironmentException
lang
- language to init lang ressources :( "fr", "en", ... ) read from "locale" element
in configurationGEnvironmentException
- in case that the translation file is not found. The default
language is used (English).public static boolean configLangIsCurrent()
public static String trConfToCurrent(String string, boolean underscoreAsWhitespace)
string
- to be translatedunderscoreAsWhitespace
- True if whitespace has to be replace in values ( for name
attribute the whitesapces are replaced by '_' on configuration write )public static String tr(String string)
string
- to be translated.public static String trn(String singularString, String pluralString, long n)
singularString
- singular form of the string to be translated.pluralString
- plural form of the string to be translated.n
- number to determine if the singular or plural form of the string is used.public static String trf(String formatString, Object... args)
formatString
- a format string.args
- Arguments referenced by the format specifiers in the format string.String.format(String formatString, Object... args).
public static String trf(boolean localizeNumbers, String formatString, Object... args)
localizeNumbers
- true if the numbers being formatted shall be localized, false
otherwise.formatString
- a format string.args
- Arguments referenced by the format specifiers in the format string.String.format(String formatString, Object... args).
public static String marktr(String string)
string
- to be marked for translation.public static void setLogFilename(String filename, boolean createViewer) throws GEnvironmentException
filename
- of the log file.createViewer
- true it the logEventTable shall be created, false otherwise.GEnvironmentException
- in case the log object has already being initialized by a call
to getLog.public static GLogger getGLog()
public static GLogEventTablePanel getGLogViewer()
public static String formatDouble(double value, int fracDigits) throws GEnvironmentException
value
- value to be formated.fracDigits
- the precision.GEnvironmentException
- in case the fracDigits is greater than MAX_FRAC_DIGITS.public static String formatDouble(double value)
value
- value to be formated.public static boolean getWriteLogDataValidityEvent()
public static void setWriteLogDataValidityEvent(boolean flag)
flag
- if false, the events are disabled, otherwise they are written.public static boolean getWriteLogDataModififiedEvent()
public static void setWriteLogDataModififiedEvent(boolean flag)
flag
- if false, the events are disabled, otherwise they are written.public static int[] arrayCopy(int[] srcArray)
srcArray
- the source int array to copy.public static double[] arrayCopy(double[] srcArray)
srcArray
- the source double array to copy.public static <T> T[] arrayCopy(T[] srcArray)
T
- Type of object in the array.srcArray
- the source String array to copy.public static boolean isHeadless()
public static void setHeadless()
Copyright © 2024. All rights reserved.