Package org.ametys.web.skin
Class SkinTemplate
- java.lang.Object
-
- org.ametys.web.skin.SkinTemplate
-
public class SkinTemplate extends Object
Represent a skin template.
-
-
Field Summary
Fields Modifier and Type Field Description private List<ThreadSafeComponentManager>
_components
protected I18nizableText
_description
Template descriptionprotected String
_id
Template id (e.g.protected I18nizableText
_label
Template labelprotected String
_largeImage
Template thumbnail 48pxprotected long
_lastConfUpdate
The last time the file was loadedprivate static org.slf4j.Logger
_logger
protected String
_mediumImage
Template thumbnail 32pxprotected String
_skinId
The skin idprotected SkinsManager
_skinsManager
The skins managerprotected String
_smallImage
Template thumbnail 16pxprotected Optional<ViewParametersModel>
_viewParameters
The template view parametersprotected Map<String,SkinTemplateZone>
_zones
Template zones.
-
Constructor Summary
Constructors Constructor Description SkinTemplate(String skinId, String templateId, SkinsManager skinsManager)
Creates a template
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private I18nizableText
_configureI18n(Configuration child, I18nizableText defaultValue)
protected Optional<ViewParametersModel>
_configureTemplateViewParameters(String skinId, String templateId, Configuration templateConfiguration)
Parse template view parametersprivate String
_configureThumbnail(String value, String defaultImage)
protected Optional<ViewParametersModel>
_configureViewParameters(Configuration paramConfiguration, String viewParametersId)
Parse view parameters from configurationprotected Optional<ViewParametersModel>
_configureZoneItemViewParameters(String skinId, String templateId, String zoneId, Configuration zoneConfiguration)
Parse zone item view parametersprotected Optional<ViewParametersModel>
_configureZoneViewParameters(String skinId, String templateId, String zoneId, Configuration zoneConfiguration)
Parse zone view parametersprotected void
_defaultValues()
The configuration default values (if configuration file does not exist or is unreadable)void
dispose()
Dispose skin template componentString
getDefaultZoneId()
Get the primary default zone.I18nizableText
getDescription()
The template descriptionString
getId()
The template idI18nizableText
getLabel()
The template labelString
getLargeImage()
The large image file uriString
getMediumImage()
The medium image file uriString
getSmallImage()
The small image file uriOptional<ViewParametersModel>
getViewParameters()
Get the view parameters modelSkinTemplateZone
getZone(String zoneId)
The zone identifier by its idMap<String,SkinTemplateZone>
getZones()
The zones defined in by the template defvoid
refreshValues()
Refresh the configuration values
-
-
-
Field Detail
-
_logger
private static org.slf4j.Logger _logger
-
_label
protected I18nizableText _label
Template label
-
_description
protected I18nizableText _description
Template description
-
_smallImage
protected String _smallImage
Template thumbnail 16px
-
_mediumImage
protected String _mediumImage
Template thumbnail 32px
-
_largeImage
protected String _largeImage
Template thumbnail 48px
-
_zones
protected Map<String,SkinTemplateZone> _zones
Template zones. the key is the zone id
-
_viewParameters
protected Optional<ViewParametersModel> _viewParameters
The template view parameters
-
_lastConfUpdate
protected long _lastConfUpdate
The last time the file was loaded
-
_skinsManager
protected SkinsManager _skinsManager
The skins manager
-
_components
private List<ThreadSafeComponentManager> _components
-
-
Constructor Detail
-
SkinTemplate
public SkinTemplate(String skinId, String templateId, SkinsManager skinsManager)
Creates a template- Parameters:
skinId
- The skin idtemplateId
- The template idskinsManager
- The skins manager
-
-
Method Detail
-
_defaultValues
protected void _defaultValues()
The configuration default values (if configuration file does not exist or is unreadable)
-
refreshValues
public void refreshValues()
Refresh the configuration values
-
_configureTemplateViewParameters
protected Optional<ViewParametersModel> _configureTemplateViewParameters(String skinId, String templateId, Configuration templateConfiguration) throws ConfigurationException
Parse template view parameters- Parameters:
skinId
- the skin idtemplateId
- the template idtemplateConfiguration
- the template configuration- Returns:
- the zone item view parameters
- Throws:
ConfigurationException
- if a configuration error occurred
-
_configureZoneViewParameters
protected Optional<ViewParametersModel> _configureZoneViewParameters(String skinId, String templateId, String zoneId, Configuration zoneConfiguration) throws ConfigurationException
Parse zone view parameters- Parameters:
skinId
- the skin idtemplateId
- the template idzoneId
- the zone idzoneConfiguration
- the zone configuration- Returns:
- the zone view parameters
- Throws:
ConfigurationException
- if a configuration error occurred
-
_configureZoneItemViewParameters
protected Optional<ViewParametersModel> _configureZoneItemViewParameters(String skinId, String templateId, String zoneId, Configuration zoneConfiguration) throws ConfigurationException
Parse zone item view parameters- Parameters:
skinId
- the skin idtemplateId
- the template idzoneId
- the zone idzoneConfiguration
- the zone configuration- Returns:
- the zone item view parameters
- Throws:
ConfigurationException
- if a configuration error occurred
-
_configureViewParameters
protected Optional<ViewParametersModel> _configureViewParameters(Configuration paramConfiguration, String viewParametersId) throws ConfigurationException
Parse view parameters from configuration- Parameters:
paramConfiguration
- the configurationviewParametersId
- the view parameters id- Returns:
- the view parameters
- Throws:
ConfigurationException
- if a configuration error occurred
-
dispose
public void dispose()
Dispose skin template component
-
_configureThumbnail
private String _configureThumbnail(String value, String defaultImage)
-
_configureI18n
private I18nizableText _configureI18n(Configuration child, I18nizableText defaultValue) throws ConfigurationException
- Throws:
ConfigurationException
-
getLabel
public I18nizableText getLabel()
The template label- Returns:
- The label
-
getDescription
public I18nizableText getDescription()
The template description- Returns:
- The description. Can not be null but can be empty
-
getSmallImage
public String getSmallImage()
The small image file uri- Returns:
- The small image file uri
-
getMediumImage
public String getMediumImage()
The medium image file uri- Returns:
- The medium image file uri
-
getLargeImage
public String getLargeImage()
The large image file uri- Returns:
- The large image file uri
-
getZones
public Map<String,SkinTemplateZone> getZones()
The zones defined in by the template def- Returns:
- The zones
-
getZone
public SkinTemplateZone getZone(String zoneId)
The zone identifier by its id- Parameters:
zoneId
- The id of the zone definition to get- Returns:
- The zone or null if no zone has this name
-
getDefaultZoneId
public String getDefaultZoneId()
Get the primary default zone. That is the first primary zone, or the 'default' zone if it exists and is primary- Returns:
- The default zone or null if there is no primary zone
-
getViewParameters
public Optional<ViewParametersModel> getViewParameters()
Get the view parameters model- Returns:
- the view parameters
-
-