Class SkinFactoryComponent

java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.skinfactory.SkinFactoryComponent
All Implemented Interfaces:
Component, LogEnabled, Serviceable, ThreadSafe

Manager for skin parameters
  • Field Details

    • ROLE

      public static final String ROLE
      Avalon role
    • CSS_PARAM_PATTERN

      public static final Pattern CSS_PARAM_PATTERN
      Pattern for CSS parameters. E.g: color: #EEEEEE /* AMETYS("myuniqueid", "Label", DESCRIPTION_I18N_KEY) *\/;
    • I18N_PARAM_PATTERN

      public static final Pattern 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

      public static final Pattern TXT_PARAM_PATTERN
      Pattern for text parameters. E.g: <xsl:variable name="foo">test<!-- Ametys("variable.foo", "Foo", "Foo") --></xsl:variable>
  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager smanager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • clearModelsParametersCache

      Remove all model parameters from cache
    • getModelParamater

      public AbstractSkinParameter getModelParamater(String modelName, String paramId)
      Get the skin parameter of the given model
      Parameters:
      modelName - The model name
      paramId - The id of the parameter
      Returns:
      The skin parameter or null if it doesn't exist
    • isModelUpToDate

      public boolean isModelUpToDate(String modelName)
      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

      public Object getParameterValue(Path skinDir, String modelName, String id)
      Get the parameter's value
      Parameters:
      skinDir - The skin directory (could be in temp, work or skin)
      modelName - The model name
      id - The parameter id
      Returns:
      The parameter's value
    • getParameterValues

      public Map<String,Object> getParameterValues(Path skinDir, String modelName, List<String> ids)
      Get the parameters' values
      Parameters:
      skinDir - The skin directory (could be in temp, work or skin)
      modelName - The model name
      ids - The parameters' id
      Returns:
      The parameters' values
    • getColorTheme

      public String getColorTheme(Path skinDir)
      Get the current theme
      Parameters:
      skinDir - The skin directory (could be in temp, work or skin)
      Returns:
      The current theme id
    • getParameterValues

      public Map<String,Object> getParameterValues(Path skinDir, String modelName)
      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

      public boolean saveColorTheme(Path skinDir, String themeId)
      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

      public boolean saveParameter(Path skinDir, String id, Object value)
      Modify a skin parameter's value
      Parameters:
      skinDir - The skin directory (could be in temp, work or skin)
      id - the id of the parameter
      value - the new value
      Returns:
      true is modification success
    • saveParameters

      public boolean saveParameters(Path skinDir, Map<String,Object> parameters)
      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

      public void applyModelParameters(String modelName, Path skinDir)
      Apply model parameters in given skin
      Parameters:
      modelName - The model name
      skinDir - The skin directory (could be temp, work or skins)
    • applyModelParameters

      public void applyModelParameters(String modelName, Path skinDir, Map<String,Object> values)
      Apply model parameters in given skin
      Parameters:
      modelName - The model name
      skinDir - The skin directory
      values - The values to set
    • updateHash

      public void updateHash(Path xmlFile, String hash) throws IOException
      Update hash
      Parameters:
      xmlFile - the xml File
      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 parameter
      skinDir - the skin directory (could be temp, work or skins)
      modelName - the model name
      value - the parameter value
      lang - The language
    • applyColorTheme

      public void applyColorTheme(String modelName, Path skinDir)
      Apply new color theme
      Parameters:
      skinDir - the skin directory (could be temp, work or skins)
      modelName - the model name