Package org.ametys.web.skin
Class Skin
- java.lang.Object
-
- org.ametys.web.skin.Skin
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
_abstract
Is the skin abstractprotected I18nizableText
_description
The skin descriptionprotected String
_id
The skin id (e.g.protected I18nizableText
_label
The skin nameprotected String
_largeImage
The skin thumbnail 48x48protected long
_lastConfUpdate
The last time the file was loadedprivate static org.slf4j.Logger
_logger
protected String
_mediumImage
The skin thumbnail 32x32protected boolean
_modifiable
Is the skin modifiableprotected List<String>
_parents
Parents of the skin in the inheritance processprotected Path
_path
The skin root pathprotected SkinsManager
_skinsManager
The skins manager to access componentsprotected String
_smallImage
The skin thumbnail 16x16protected Map<String,SkinTemplate>
_templates
The map of templates id and associated templates(package private) static String
CONF_PATH
(package private) static String
TEMPLATES_PATH
-
Constructor Summary
Constructors Constructor Description Skin(String id, Path skinPath, boolean modifiable, SkinsManager skinsManager)
Creates a skin
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private I18nizableText
_configureI18n(Configuration child, I18nizableText defaultValue)
private String
_configureThumbnail(String value, String defaultImage)
protected void
_defaultValues()
The configuration default values (if configuration file does not exist or is unreadable)private boolean
_isATemplate(TraversableSource path)
private List<String>
_parseParents(String parents)
void
dispose()
Dispose skin componentI18nizableText
getDescription()
The skin descriptionString
getId()
The skin idI18nizableText
getLabel()
The skin labelString
getLargeImage()
The large image file uriString
getMediumImage()
The medium image file uriList<String>
getParents()
Get the parent skins from the inheritance point of view.Path
getRawPath()
Get the skin's path.String
getSmallImage()
The small image file uriSkinTemplate
getTemplate(String id)
Get a templateSet<String>
getTemplates()
Get the list of existing templatesboolean
isAbstract()
Is the skin abstract?boolean
isConfigurable()
Is the skin modifiable?boolean
isModifiable()
Is the skin modifiable?void
refreshValues()
Refresh the configuration values
-
-
-
Field Detail
-
CONF_PATH
static final String CONF_PATH
- See Also:
- Constant Field Values
-
TEMPLATES_PATH
static final String TEMPLATES_PATH
- See Also:
- Constant Field Values
-
_logger
private static org.slf4j.Logger _logger
-
_label
protected I18nizableText _label
The skin name
-
_description
protected I18nizableText _description
The skin description
-
_smallImage
protected String _smallImage
The skin thumbnail 16x16
-
_mediumImage
protected String _mediumImage
The skin thumbnail 32x32
-
_largeImage
protected String _largeImage
The skin thumbnail 48x48
-
_templates
protected Map<String,SkinTemplate> _templates
The map of templates id and associated templates
-
_lastConfUpdate
protected long _lastConfUpdate
The last time the file was loaded
-
_modifiable
protected boolean _modifiable
Is the skin modifiable
-
_abstract
protected boolean _abstract
Is the skin abstract
-
_skinsManager
protected SkinsManager _skinsManager
The skins manager to access components
-
-
Constructor Detail
-
Skin
public Skin(String id, Path skinPath, boolean modifiable, SkinsManager skinsManager)
Creates a skin- Parameters:
id
- The id of the skin (e.g. the directory name)skinPath
- The skin root pathmodifiable
- Is this skin modifiable?skinsManager
- The skins manager
-
-
Method Detail
-
dispose
public void dispose()
Dispose skin component
-
isModifiable
public boolean isModifiable()
Is the skin modifiable?- Returns:
- true if modifiable
-
isAbstract
public boolean isAbstract()
Is the skin abstract?- Returns:
- true if abstract
-
isConfigurable
public boolean isConfigurable()
Is the skin modifiable?- Returns:
- true if modifiable
-
getParents
public List<String> getParents()
Get the parent skins from the inheritance point of view. Consider usingSkinsManager.getSkinAndParents(org.ametys.web.skin.Skin)
- Returns:
- The non null list of parents. The sooner a parent appears in the list, the stronger it is.
-
getTemplates
public Set<String> getTemplates()
Get the list of existing templates- Returns:
- A set of skin names. Can be null if there is an error.
-
getTemplate
public SkinTemplate getTemplate(String id)
Get a template- Parameters:
id
- The id of the template- Returns:
- The template or null if the template doesn't exists
-
_isATemplate
private boolean _isATemplate(TraversableSource path) throws SourceException
- Throws:
SourceException
-
_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
-
_parseParents
private List<String> _parseParents(String parents)
-
_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 skin label- Returns:
- The label
-
getDescription
public I18nizableText getDescription()
The skin 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
-
getRawPath
public Path getRawPath()
Get the skin's path. Should not be used. Use the skin:// protocol.- Returns:
- the skin's path
-
-