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_abstractIs the skin abstractprotected I18nizableText_descriptionThe skin descriptionprotected String_idThe skin id (e.g.protected I18nizableText_labelThe skin nameprotected String_largeImageThe skin thumbnail 48x48protected long_lastConfUpdateThe last time the file was loadedprivate static org.slf4j.Logger_loggerprotected String_mediumImageThe skin thumbnail 32x32protected boolean_modifiableIs the skin modifiableprotected List<String>_parentsParents of the skin in the inheritance processprotected Path_pathThe skin root pathprotected SkinsManager_skinsManagerThe skins manager to access componentsprotected String_smallImageThe skin thumbnail 16x16protected Map<String,SkinTemplate>_templatesThe map of templates id and associated templates(package private) static StringCONF_PATH(package private) static StringTEMPLATES_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)voiddispose()Dispose skin componentI18nizableTextgetDescription()The skin descriptionStringgetId()The skin idI18nizableTextgetLabel()The skin labelStringgetLargeImage()The large image file uriStringgetMediumImage()The medium image file uriList<String>getParents()Get the parent skins from the inheritance point of view.PathgetRawPath()Get the skin's path.StringgetSmallImage()The small image file uriSkinTemplategetTemplate(String id)Get a templateSet<String>getTemplates()Get the list of existing templatesbooleanisAbstract()Is the skin abstract?booleanisConfigurable()Is the skin modifiable?booleanisModifiable()Is the skin modifiable?voidrefreshValues()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
-
-