Package org.ametys.skinfactory
Class SkinFactoryComponent
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.skinfactory.SkinFactoryComponent
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
,ThreadSafe
public class SkinFactoryComponent
extends AbstractLogEnabled
implements Component, ThreadSafe, Serviceable
Manager for skin parameters
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyColorTheme
(String modelName, Path skinDir) Apply new color themevoid
applyModelParameters
(String modelName, Path skinDir) Apply model parameters in given skinvoid
Apply model parameters in given skinvoid
applyParameter
(AbstractSkinParameter parameter, Path skinDir, String modelName, Object value, String lang) Apply parametervoid
Remove all model parameters from cachegetColorTheme
(Path skinDir) Get the current themegetModelParamater
(String modelName, String paramId) Get the skin parameter of the given modelgetModelParameters
(String modelName) Get the skin parameters of a modelgetParameterValue
(Path skinDir, String modelName, String id) Get the parameter's valuegetParameterValues
(Path skinDir, String modelName) Get all parameters' valuesgetParameterValues
(Path skinDir, String modelName, List<String> ids) Get the parameters' valuesboolean
isModelUpToDate
(String modelName) Determines if the model was changedboolean
saveColorTheme
(Path skinDir, String themeId) Modify the color themeboolean
saveParameter
(Path skinDir, String id, Object value) Modify a skin parameter's valueboolean
saveParameters
(Path skinDir, Map<String, Object> parameters) Save skin parametersvoid
service
(ServiceManager smanager) void
updateHash
(Path xmlFile, String hash) Update hashMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
Avalon role -
CSS_PARAM_PATTERN
Pattern for CSS parameters. E.g: color: #EEEEEE /* AMETYS("myuniqueid", "Label", DESCRIPTION_I18N_KEY) *\/; -
I18N_PARAM_PATTERN
Pattern for i18n text parameters. E.g: <message key="SKIN_TITLE">Ametys, Web Java Open Source CMS<!-- Ametys("text.i18n.site.title", "Titre du site") --></message> -
TXT_PARAM_PATTERN
Pattern for text parameters. E.g: <xsl:variable name="foo">test<!-- Ametys("variable.foo", "Foo", "Foo") --></xsl:variable>
-
-
Constructor Details
-
SkinFactoryComponent
public SkinFactoryComponent()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
clearModelsParametersCache
Remove all model parameters from cache -
getModelParamater
Get the skin parameter of the given model- Parameters:
modelName
- The model nameparamId
- The id of the parameter- Returns:
- The skin parameter or
null
if it doesn't exist
-
isModelUpToDate
Determines if the model was changed- Parameters:
modelName
- The model name- Returns:
true
if the model was changed
-
getModelParameters
Get the skin parameters of a model- Parameters:
modelName
- the model name- Returns:
- skin parameters in a List
-
getParameterValue
Get the parameter's value- Parameters:
skinDir
- The skin directory (could be in temp, work or skin)modelName
- The model nameid
- The parameter id- Returns:
- The parameter's value
-
getParameterValues
Get the parameters' values- Parameters:
skinDir
- The skin directory (could be in temp, work or skin)modelName
- The model nameids
- The parameters' id- Returns:
- The parameters' values
-
getColorTheme
Get the current theme- Parameters:
skinDir
- The skin directory (could be in temp, work or skin)- Returns:
- The current theme id
-
getParameterValues
Get all parameters' values- Parameters:
skinDir
- The skin directory (could be in temp, work or skin)modelName
- The model name- Returns:
- The all parameters' values
-
saveColorTheme
Modify the color theme- Parameters:
skinDir
- The skin directory (could be in temp, work or skin)themeId
- The id of the theme. Can be null to clear theme.- Returns:
true
is modification success
-
saveParameter
Modify a skin parameter's value- Parameters:
skinDir
- The skin directory (could be in temp, work or skin)id
- the id of the parametervalue
- the new value- Returns:
true
is modification success
-
saveParameters
Save skin parameters- Parameters:
skinDir
- The skin directory (could be in temp, work or skin)parameters
- The skins parameters to save- Returns:
true
is modification success
-
applyModelParameters
Apply model parameters in given skin- Parameters:
modelName
- The model nameskinDir
- The skin directory (could be temp, work or skins)
-
applyModelParameters
Apply model parameters in given skin- Parameters:
modelName
- The model nameskinDir
- The skin directoryvalues
- The values to set
-
updateHash
Update hash- Parameters:
xmlFile
- the xmlFile
hash
- the new hash of the file- Throws:
IOException
- if an error occurs while manipulating the file
-
applyParameter
public void applyParameter(AbstractSkinParameter parameter, Path skinDir, String modelName, Object value, String lang) Apply parameter- Parameters:
parameter
- the skin parameterskinDir
- the skin directory (could be temp, work or skins)modelName
- the model namevalue
- the parameter valuelang
- The language
-
applyColorTheme
Apply new color theme- Parameters:
skinDir
- the skin directory (could be temp, work or skins)modelName
- the model name
-