public class CommonsSettings
extends java.lang.Object
log4j
that comes with the great VFS library is disabled here
since the Leisenfels modules uses java.util.logging
.
Modifier and Type | Field and Description |
---|---|
protected javax.swing.JMenuItem[] |
acceleratorItems
The items holding the global accelerators like "F1" (help) also used for dialogs.
|
static java.lang.String |
LOG_PREFIX
Prefix used for the log messages created by this module.
|
static java.lang.String |
MSG_PREFIX
Prefix used for the log messages like "COMMONS-0001".
|
static java.lang.String |
PACKAGE_PREFIX
This base package.
|
protected static CommonsSettings |
sharedInstance
Shared
CommonsSettings instance. |
protected static com.lf.vfslib.net.VFSFileSystemManager |
vfsManagerClasspath
Shared
FileSystemManager instance to load resources from the classpath. |
Constructor and Description |
---|
CommonsSettings()
Constructor method.
|
Modifier and Type | Method and Description |
---|---|
void |
check()
Performs some simple tests for the caches and configurations and creates log messages.
|
static int |
extractLocalization(java.lang.Object target)
Searches for localization patterns and reads the object texts into the configuration.
|
DeployProps |
getDeployProps()
Gets the global version information.
|
static java.lang.String |
getEnglishMessage(java.lang.String code)
Convenience method to get a localized official message for the user.
|
static java.lang.String |
getEnglishText(java.lang.Class clazz,
java.lang.String variable)
Convenience method to get the original (English) text.
|
static java.lang.String |
getEnglishText(java.lang.Class clazz,
java.lang.String variable,
java.lang.String[] regex,
java.lang.String[] replacement)
Convenience method to get the original (English) text.
|
I18NConfiguration |
getEnglishTexts()
Provides the English texts for the GUI (labels, tooltips etc.).
|
HelpDelegate |
getHelpDelegate()
Gets the global help delegate (optional).
|
static java.lang.String |
getHelpID(java.lang.String id)
Convenience method for utilizing the help delegate.
|
java.lang.String |
getI18NBase()
Provides the global resource path for internationalization resources.
|
I18NConfiguration |
getI18NTexts()
Provides the global localized texts for the user.
|
java.util.logging.Logger |
getLogger()
Gets the global logging instance.
|
Locale |
getLogLocale()
Gets the global locale used for logging.
|
static com.lf.vfslib.net.VFSFileSystemManager |
getManagerClasspath()
Convenience method to get a shared instance of the Commons
FileSystemManager . |
MessageCodes |
getMessageCodes()
Provides the global message codes handlers.
|
ModelDelegate |
getModelDelegate()
Gets the global model delegate (optional).
|
static java.lang.Object |
getObjectDelegated(java.lang.String id,
java.lang.Object fallback)
Convenience method to get an expected value from an application's model.
|
ReleaseNotes |
getReleaseNotes()
Provides the locale specific release notes (
core package). |
org.apache.commons.vfs2.FileObject |
getReleaseNotesURL()
Provides the locale specific release notes (
core package). |
static CommonsSettings |
getSharedInstance()
Convenience method to get a shared instance.
|
static java.lang.String |
getSQLStatement(java.lang.Class clazz,
java.lang.String id,
DatabaseConnector connector)
Convenience method to get an SQL statement from the 'resource/sql.conf' file.
|
static java.lang.String |
getSQLStatement(java.lang.Class clazz,
java.lang.String id,
DatabaseConnector connector,
boolean replace)
Convenience method to get an SQL statement from the 'resource/sql.conf' file.
|
SQLConfiguration |
getSQLStatements()
Provides the locale specific texts for the GUI (labels, tooltips etc.).
|
java.util.Vector<Locale> |
getSupportedLocales(boolean synonyms)
Returns the locales currently supported by the package.
|
Locale |
getUserLocale()
Gets the global user locale.
|
static java.lang.String |
getUserMessage(java.lang.String code)
Convenience method to get a localized official message for the user.
|
static java.lang.String |
getUserMessage(java.lang.String code,
boolean prefix)
Convenience method to get a localized official message for the user.
|
static java.lang.String |
getUserMessage(java.lang.String code,
java.lang.String[] regex,
java.lang.String[] replacement,
boolean prefix)
Convenience method to log a localized official message.
|
static java.lang.String |
getUserText(java.lang.Class clazz,
java.lang.String variable)
Convenience method to get a localized text for the user.
|
static java.lang.String |
getUserText(java.lang.Class clazz,
java.lang.String variable,
java.lang.String[] regex,
java.lang.String[] replacement)
Convenience method to get a localized text for the user.
|
void |
installGlobalAccelerators(javax.swing.JDialog dialog)
Convenience to add the global accelerators like "F1" (help) for a specific dialog.
|
void |
installGlobalAccelerators(javax.swing.JFrame frame)
Convenience to add the global accelerators like "F1" (help) for a specific window.
|
static void |
localize(java.lang.Object target,
java.lang.Class targetclazz)
Provides the info whether to enable object localization or not.
|
static void |
log(java.util.logging.Level level,
java.lang.String message)
Convenience method to log a message.
|
static void |
logMessage(java.util.logging.Level level,
java.lang.String message)
Convenience method to log a message.
|
static void |
logMessage(java.lang.String code,
java.util.logging.Level level)
Convenience method to log a localized official message.
|
static void |
logMessage(java.lang.String code,
java.util.logging.Level level,
java.lang.String[] regex,
java.lang.String[] replacement)
Convenience method to log a localized official message.
|
static void |
logMessage(java.lang.String code,
java.util.logging.Level level,
java.lang.String regex,
java.lang.String replacement)
Convenience method to log a localized official message.
|
static void |
registerConfigurableDelegated(java.lang.String id,
ConfigurableUnit unit)
Convenience method to allow for simple registration of a Commons configurable unit.
|
void |
setGlobalAccelerators(javax.swing.JMenuItem[] accelitems)
Provides the items holding the global accelerators like "F1" (help) also used for dialogs.
|
void |
setHelpDelegate(HelpDelegate delegate)
Sets the global help delegate (optional).
|
void |
setLogger(java.util.logging.Logger logger)
Sets the global logging instance.
|
void |
setModelDelegate(ModelDelegate delegate)
Sets the global model delegate (optional).
|
static void |
setObjectDelegated(java.lang.String id,
java.lang.Object value)
Convenience method to set an expected value from an application's model.
|
void |
setUserLocale(Locale locale)
Sets the global user locale.
|
static void |
showHelpDelegated(java.lang.String link)
Calls the application specific help system for context sensitive help information.
|
static void |
unregisterConfigurableDelegated(ConfigurableUnit unit)
Convenience method to allow for simple unregistration of a Commons configurable unit.
|
static void |
unregisterConfigurableDelegated(java.lang.String id)
Convenience method to allow for simple unregistration of a Commons configurable unit.
|
protected static CommonsSettings sharedInstance
CommonsSettings
instance.public static final java.lang.String MSG_PREFIX
public static final java.lang.String LOG_PREFIX
public static final java.lang.String PACKAGE_PREFIX
protected javax.swing.JMenuItem[] acceleratorItems
protected static com.lf.vfslib.net.VFSFileSystemManager vfsManagerClasspath
FileSystemManager
instance to load resources from the classpath.public static com.lf.vfslib.net.VFSFileSystemManager getManagerClasspath()
FileSystemManager
.
Remember that this instance is global, the network connections provided by the VFSSessionWindow
are managed by the manager which can be accessed using VFSSettings.getManagerNetwork()
.
Use this instance for internal resource loading from the classpath.
public void check()
public java.lang.String getI18NBase()
public I18NConfiguration getI18NTexts()
public I18NConfiguration getEnglishTexts()
public static void localize(java.lang.Object target, java.lang.Class targetclazz)
target
- The target object to be localizedtargetclazz
- The target clazz, maybe a superclasspublic static int extractLocalization(java.lang.Object target)
target
- The target object to be localizedpublic MessageCodes getMessageCodes()
public java.util.logging.Logger getLogger()
public void setLogger(java.util.logging.Logger logger)
logger
- Logging instancejava.lang.NullPointerException
- Error indicationpublic Locale getUserLocale()
public void setUserLocale(Locale locale) throws java.lang.IllegalArgumentException
locale
- Locale instancejava.lang.IllegalArgumentException
- Error indicationpublic java.util.Vector<Locale> getSupportedLocales(boolean synonyms)
synonyms
- Also add the ISO 639-1/2 synonyms like "deu_DE" for "ger_DE"?public Locale getLogLocale()
public DeployProps getDeployProps()
public static CommonsSettings getSharedInstance()
public static void log(java.util.logging.Level level, java.lang.String message)
level
- The log levelmessage
- The log messagepublic static void logMessage(java.util.logging.Level level, java.lang.String message)
level
- The log levelmessage
- The log messagepublic static void logMessage(java.lang.String code, java.util.logging.Level level)
code
- The log message id like "COMMONS-0006"level
- The log levelpublic static void logMessage(java.lang.String code, java.util.logging.Level level, java.lang.String regex, java.lang.String replacement)
code
- The log message id like "COMMONS-0006"level
- The log levelregex
- The regular expressionreplacement
- The replacement stringpublic static void logMessage(java.lang.String code, java.util.logging.Level level, java.lang.String[] regex, java.lang.String[] replacement)
code
- The log message id like "COMMONS-0006"level
- The log levelregex
- The regular expressionsreplacement
- The replacement stringspublic static java.lang.String getUserMessage(java.lang.String code)
code
- The message code of interest, don't pass null
valuesnull
if code does not existpublic static java.lang.String getEnglishMessage(java.lang.String code)
code
- The message code of interest, don't pass null
valuesnull
if code does not existpublic static java.lang.String getUserMessage(java.lang.String code, boolean prefix)
code
- The message code of interest, don't pass null
valuesprefix
- Prepend the prefix?null
if code does not existpublic static java.lang.String getUserMessage(java.lang.String code, java.lang.String[] regex, java.lang.String[] replacement, boolean prefix)
code
- The log message id like "COMMONS-0006"regex
- The regular expressionreplacement
- The replacement stringprefix
- Prepend the prefix?null
if code does not existpublic static java.lang.String getUserText(java.lang.Class clazz, java.lang.String variable)
clazz
- The class for getting the class prefixvariable
- The variable without class prefix, don't pass null
valuespublic static java.lang.String getEnglishText(java.lang.Class clazz, java.lang.String variable)
clazz
- The class for getting the class prefixvariable
- The variable without class prefix, don't pass null
valuesnull
if variable does not existpublic static java.lang.String getEnglishText(java.lang.Class clazz, java.lang.String variable, java.lang.String[] regex, java.lang.String[] replacement)
clazz
- The class for getting the class prefixvariable
- The variable without class prefix, don't pass null
valuesregex
- The regular expressionreplacement
- The replacement stringpublic static java.lang.String getUserText(java.lang.Class clazz, java.lang.String variable, java.lang.String[] regex, java.lang.String[] replacement)
clazz
- The class for getting the class prefixvariable
- The variable without class prefix, don't pass null
valuesregex
- The regular expressionreplacement
- The replacement stringpublic ModelDelegate getModelDelegate()
null
public void setModelDelegate(ModelDelegate delegate)
delegate
- Delegate, maybe null
public static void registerConfigurableDelegated(java.lang.String id, ConfigurableUnit unit)
id
- The unique id defined byunit
- The configurable unit to be addedjava.lang.NullPointerException
- If parameters are null
public static void unregisterConfigurableDelegated(ConfigurableUnit unit)
unit
- The unit to be removedjava.lang.NullPointerException
- If parameters are null
public static void unregisterConfigurableDelegated(java.lang.String id)
id
- The unique identifierjava.lang.NullPointerException
- If parameters are null
public static java.lang.Object getObjectDelegated(java.lang.String id, java.lang.Object fallback)
id
- The unique identifier (ModelDelegate.ID_PGP_HEADER_VERSION
|...)fallback
- The default valuenull
java.lang.NullPointerException
- If parameters are null
public static void setObjectDelegated(java.lang.String id, java.lang.Object value)
id
- The unique identifier (ModelDelegate.ID_PGP_HEADER_VERSION
|...)value
- The value to setjava.lang.NullPointerException
- If parameters are null
public HelpDelegate getHelpDelegate()
null
public void setHelpDelegate(HelpDelegate delegate)
delegate
- Delegate, maybe null
public static void showHelpDelegated(java.lang.String link)
link
- The help system linkjava.lang.NullPointerException
- If parameters are null
public static java.lang.String getHelpID(java.lang.String id)
id
- One of the declared static fields of HelpDelegate
null
public SQLConfiguration getSQLStatements()
public static java.lang.String getSQLStatement(java.lang.Class clazz, java.lang.String id, DatabaseConnector connector)
clazz
- The class for getting the class prefixid
- The statement ID without class prefix, don't pass null
valuesconnector
- The connector for the target databasenull
if ID does not existpublic static java.lang.String getSQLStatement(java.lang.Class clazz, java.lang.String id, DatabaseConnector connector, boolean replace)
clazz
- The class for getting the class prefixid
- The statement ID without class prefix, don't pass null
valuesconnector
- The connector for the target databasereplace
- Apply connector replacements?null
if ID does not existpublic void setGlobalAccelerators(javax.swing.JMenuItem[] accelitems)
accelitems
- The acceleratorspublic void installGlobalAccelerators(javax.swing.JDialog dialog)
dialog
- The dialogpublic void installGlobalAccelerators(javax.swing.JFrame frame)
frame
- The windowpublic org.apache.commons.vfs2.FileObject getReleaseNotesURL()
core
package).
public ReleaseNotes getReleaseNotes()
core
package).
Copyright © 2005-2023 Leisenfels GmbH. All rights reserved.