public class UtilGlobals
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
UtilGlobals.GUI |
Modifier and Type | Field and Description |
---|---|
static AFDateFormat |
c_afDateFormat |
static java.text.DecimalFormat |
c_decimalFormat |
static java.text.NumberFormat |
c_defaultCurrencyFormat |
static java.text.NumberFormat |
c_defaultDecimalFormat |
static java.util.Locale |
c_defaultLocale |
static java.text.DateFormat |
c_defaultTWDateFormat |
static java.text.DateFormatSymbols |
c_localizedDateFormatSymbols |
static AFDateFormat.TaiwanDateFormat |
c_twDateFormat |
static boolean |
DEBUG |
static int |
LOG_MODE_DEFAULT |
static int |
LOG_MODE_NONE |
static java.util.Locale |
m_currentLocale |
static java.util.ResourceBundle |
m_formLabels |
Constructor and Description |
---|
UtilGlobals() |
Modifier and Type | Method and Description |
---|---|
static void |
applyComponentOrientation(java.awt.Component jcmp) |
static void |
changeFont(java.awt.Container container,
java.awt.Font font) |
static void |
changeFont(javax.swing.JDialog dlg,
java.awt.Font font) |
static void |
changeMenuFont(javax.swing.MenuElement menuElement,
java.awt.Font font) |
static java.util.ResourceBundle |
getBundle(java.lang.String bundleNamePrefix) |
static java.lang.String |
getCurrentTime() |
static java.util.Locale |
getLocale() |
static java.util.PropertyResourceBundle |
getPropertyResourceBundle(java.lang.String name) |
static java.lang.String |
getString(java.lang.String key) |
static boolean |
isLeftToRight() |
static java.util.Locale |
parseLocale(java.lang.String localeString) |
static void |
setEnabledRecursively(java.awt.Component comp,
boolean b)
other UI updating utilities (Functions to set...
|
static void |
setLanguage(java.lang.String lang) |
static void |
setLocale(java.util.Locale locale) |
static byte[] |
simpleCipherDecrypt(byte[] b) |
static java.lang.String |
simpleCipherDecryptWithBase64(java.lang.String s,
java.lang.String nameOfTheItem)
Gets the the original string from the string result of
simpleCipherEncryptWithBase64(..) |
static java.lang.String |
simpleCipherDecryptWithBase64(java.lang.String s,
java.lang.String messageForException,
int logMode,
boolean isToReturnInputIfBase64NotDecoded)
Gets the the original string from the result of
simpleCipherEncryptWithBase64(..) |
static byte[] |
simpleCipherEncrypt(byte[] b) |
static java.lang.String |
simpleCipherEncryptWithBase64(java.lang.String s)
Encrypts a string by a specific simple way, and then return it encoded with Base64.
|
public static final boolean DEBUG
public static final java.util.Locale c_defaultLocale
public static java.util.Locale m_currentLocale
public static java.util.ResourceBundle m_formLabels
public static java.text.DecimalFormat c_decimalFormat
public static java.text.NumberFormat c_defaultDecimalFormat
public static java.text.NumberFormat c_defaultCurrencyFormat
public static java.text.DateFormatSymbols c_localizedDateFormatSymbols
public static AFDateFormat c_afDateFormat
public static AFDateFormat.TaiwanDateFormat c_twDateFormat
public static java.text.DateFormat c_defaultTWDateFormat
public static final int LOG_MODE_NONE
public static final int LOG_MODE_DEFAULT
public static void setLanguage(java.lang.String lang)
lang
- String - locale name; null
will be interpretted as the JVM default localepublic static java.util.Locale parseLocale(java.lang.String localeString)
public static java.util.Locale getLocale()
public static void setLocale(java.util.Locale locale)
public static java.util.ResourceBundle getBundle(java.lang.String bundleNamePrefix)
public static java.util.PropertyResourceBundle getPropertyResourceBundle(java.lang.String name)
public static java.lang.String getString(java.lang.String key)
public static void changeFont(java.awt.Container container, java.awt.Font font)
public static void changeFont(javax.swing.JDialog dlg, java.awt.Font font)
public static void changeMenuFont(javax.swing.MenuElement menuElement, java.awt.Font font)
public static void setEnabledRecursively(java.awt.Component comp, boolean b)
public static java.lang.String getCurrentTime()
public static final byte[] simpleCipherEncrypt(byte[] b) throws java.lang.Exception
java.lang.Exception
public static final byte[] simpleCipherDecrypt(byte[] b) throws java.lang.Exception
java.lang.Exception
public static java.lang.String simpleCipherEncryptWithBase64(java.lang.String s)
s
- String the original string. (s.length >= 0) must be true.public static java.lang.String simpleCipherDecryptWithBase64(java.lang.String s, java.lang.String nameOfTheItem)
simpleCipherEncryptWithBase64(..)
,
with some exception handling/reporting extensions.
It's a specific usage of simpleCipherDecryptWithBase64(String, String)
,
suitable for most cases for a password property stored in a .properties file;
In this usage the backward-compatibility for a password property
(stored as plain text in older versions and as Encypted/Encoded string in newer ones)
is achieved for it will return the exact string as the input if it's not Base64-encoded.public static java.lang.String simpleCipherDecryptWithBase64(java.lang.String s, java.lang.String messageForException, int logMode, boolean isToReturnInputIfBase64NotDecoded)
simpleCipherEncryptWithBase64(..)
,
with some exception handling/reporting extensions.
Examples:
simpleCipherDecryptWithBase64(anUserPasswordStoredWhichIsNotEncryptedAndEncoded, "Oh My God!\nThe property 'UserPassword'", LOG_MODE_DEFAULT, true); will produce a message reporting exception as follows: Oh My God! The property 'userPasswordStored' can't be decoded by Base64, use its original value
s
- String (A) the result of the original string encrypted by simpleCipherEncrypt
,
and then encoded with Base64; (s.length > 0) must be true.
(B) ""(empty string)
(C) a string which is not encrypted in simpleCipherEncrypt
,
and then encoded with Base64; (s.length > 0) must be true.
(D) none of above (non-empty and not encoded with Base64)nameOfTheItem
- the name of the item being decrypted, it's to be inserted in the front of the exception warning message
to aware the user which string is unable to be decrypted - if it's not null
...;
"The-string-being-decrypted" is used if it's null
.logMode
- LOG_MODE_NONE
to cause it to produce no warning message;
LOG_MODE_DEFAULT
to cause it to warn about
(B),(C),(D) cases, and print the stack trace for any exception during the Cipher
invocation.isToReturnInputIfBase64NotDecoded
is true
...
In this option the backward-compatibility for a password property
(stored as plain text in older versions and as Encypted/Encoded string in newer ones)
is achieved for it will return the exact string as the input if it's not Base64-encoded.
same as (B) otherwise;
(C) same as (D) (sometimes the un-encoded plain text can be decoded by Base64,
so we probably need (C) be the same as (D))public static boolean isLeftToRight()
public static void applyComponentOrientation(java.awt.Component jcmp)