public class ConfigLoader extends Object
Dandelion-Datatables configuration loader.
DatatableConfigurator
Modifier and Type | Field and Description |
---|---|
static String |
DANDELION_DT_CONFIGURATION |
static String |
DEFAULT_GROUP_NAME |
static String |
DT_DEFAULT_PROPERTIES |
static String |
DT_USER_PROPERTIES |
static String |
DT_USER_PROPERTIES_LOCATION |
static String |
I18N_LOCALE_RESOLVER |
static String |
I18N_MESSAGE_RESOLVER |
static String |
STANDALONE_BUNDLES_TO_EXCLUDE |
Constructor and Description |
---|
ConfigLoader() |
Modifier and Type | Method and Description |
---|---|
Properties |
getUserProperties()
TODO
|
Properties |
loadDefaultConfiguration()
Load the default configuration from the internal properties file and both:
stores the properties inside a class field
returns the properties if they need to be used outside of the class
|
Properties |
loadUserConfiguration(Locale locale)
Load the user configuration which can be localized thanks to the given
locale.
|
void |
resolveConfigurations(Map<String,Map<com.github.dandelion.core.option.Option<?>,Object>> map,
Locale locale,
javax.servlet.http.HttpServletRequest request)
Resolve configuration groups for the given locale.
|
Set<String> |
resolveGroups(Locale locale)
Return a set containing all configuration groups.
|
public static final String DANDELION_DT_CONFIGURATION
public static final String DT_DEFAULT_PROPERTIES
public static final String DT_USER_PROPERTIES_LOCATION
public static final String DT_USER_PROPERTIES
public static final String DEFAULT_GROUP_NAME
public static final String STANDALONE_BUNDLES_TO_EXCLUDE
public static final String I18N_LOCALE_RESOLVER
public static final String I18N_MESSAGE_RESOLVER
public Properties loadDefaultConfiguration()
Load the default configuration from the internal properties file and both:
public Properties loadUserConfiguration(Locale locale)
Load the user configuration which can be localized thanks to the given locale.
Once the bundle loaded, it is converted into Properties.
locale
- The current locale used to load the right properties file.public Set<String> resolveGroups(Locale locale)
Return a set containing all configuration groups.
Note that the i18n.locale.resolver
is a special property that
must not be taken into account because it is group-independent.
locale
- The current locale.public void resolveConfigurations(Map<String,Map<com.github.dandelion.core.option.Option<?>,Object>> map, Locale locale, javax.servlet.http.HttpServletRequest request)
Resolve configuration groups for the given locale.
The default properties file (datatables-default.properties) already contains the 'global' group: this is the group of configuration that is used for all tables in the application.
Inside the user properties files (datatables_XX.properties), users can:
global.
For example, if the user properties file contains:
group1.i18n.msg.search=My label
group1.i18n.msg.processing=My other label
the ConfigLoader
must create a group called 'group1' containing
all properties present in the 'global' group but where
i18n.msg.search
and i18n.msg.processing
are
overriden with the user's ones.
Note that:
map
- The map to update after the resolution of the configuration
groups.locale
- The current locale used to get the right properties file from
the resource bundle.request
- The request sent by the browser.public Properties getUserProperties()
Copyright © 2013–2015 Dandelion Project. All rights reserved.