Package org.ametys.web.skin
Class SkinTemplateZone
- java.lang.Object
-
- org.ametys.web.skin.SkinTemplateZone
-
public class SkinTemplateZone extends Object
A zone definition in a template
-
-
Field Summary
Fields Modifier and Type Field Description protected I18nizableText
_description
Zone descriptionprotected String
_id
Template id (e.g.protected Map<String,String>
_inheritance
The zone inheritance description.protected I18nizableText
_label
Zone labelprotected String
_largeImage
Zone thumbnail 48pxprivate static org.slf4j.Logger
_logger
protected String
_mediumImage
Zone thumbnail 32pxprotected String
_skinId
The skin idprotected String
_smallImage
Zone thumbnail 16pxprotected String
_templateId
The template idprotected String
_type
Zone type (primary or secondary)protected Optional<ViewParametersModel>
_viewParameters
The zone view parameters modelprotected Optional<ViewParametersModel>
_zoneItemViewParameters
The zone item view parameters modelstatic String
TYPE_PRIMARY
The type of a primary zonestatic String
TYPE_SECONDARY
The type of a secondary zone
-
Constructor Summary
Constructors Constructor Description SkinTemplateZone(String skinId, String templateId, String id, String type, I18nizableText label, I18nizableText description, String smallImage, String mediumImage, String largeImage, String inheritanceString, Optional<ViewParametersModel> viewParameters, Optional<ViewParametersModel> zoneItemViewParameters)
Create a zone
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Map<String,String>
_parseInheritance(String inheritanceString)
Parse the inheritance argument for the constructorI18nizableText
getDescription()
The template descriptionString
getId()
The template idString
getInheritance(String templateName)
Get the name of the zone to inherit in the given templateI18nizableText
getLabel()
The template labelString
getLargeImage()
The large image file uriString
getMediumImage()
The medium image file uriString
getSmallImage()
The small image file uriString
getType()
Get the zone type (primary or secondary)Optional<ViewParametersModel>
getViewParameters()
Get the view parameters model for this zoneOptional<ViewParametersModel>
getZoneItemViewParameters()
Get the view parameters model for zone item in this zoneboolean
hasInheritance()
Determine if this zone inherits another one
-
-
-
Field Detail
-
TYPE_PRIMARY
public static final String TYPE_PRIMARY
The type of a primary zone- See Also:
- Constant Field Values
-
TYPE_SECONDARY
public static final String TYPE_SECONDARY
The type of a secondary zone- See Also:
- Constant Field Values
-
_logger
private static org.slf4j.Logger _logger
-
_templateId
protected String _templateId
The template id
-
_label
protected I18nizableText _label
Zone label
-
_description
protected I18nizableText _description
Zone description
-
_smallImage
protected String _smallImage
Zone thumbnail 16px
-
_mediumImage
protected String _mediumImage
Zone thumbnail 32px
-
_largeImage
protected String _largeImage
Zone thumbnail 48px
-
_inheritance
protected Map<String,String> _inheritance
The zone inheritance description. The key is the name of a template and the value is the name of the zone in that template. This means that this zone will inherit the zone given as value in the parent page if it uses the template given as key
-
_viewParameters
protected Optional<ViewParametersModel> _viewParameters
The zone view parameters model
-
_zoneItemViewParameters
protected Optional<ViewParametersModel> _zoneItemViewParameters
The zone item view parameters model
-
-
Constructor Detail
-
SkinTemplateZone
public SkinTemplateZone(String skinId, String templateId, String id, String type, I18nizableText label, I18nizableText description, String smallImage, String mediumImage, String largeImage, String inheritanceString, Optional<ViewParametersModel> viewParameters, Optional<ViewParametersModel> zoneItemViewParameters)
Create a zone- Parameters:
skinId
- The id of the skin owning the template owning the zonetemplateId
- The id of the template owning the zoneid
- The id of the zonetype
- The zone type between primary and secondary.label
- The label of the zonedescription
- The description of the zonesmallImage
- The small image to represent the zonemediumImage
- The medium image to represent the zonelargeImage
- The large image to represent the zoneinheritanceString
- The inheritance scheme following the pattern "TemplateName->,ZoneNameInThatTemplate,..." where TemplateName can be "*" or "". A completely empty string is equals to "*->CurrentZoneName". A blank string after the arrow means "no inheritance for this template".viewParameters
- the zone view parameters modelzoneItemViewParameters
- the zone item view parameters model
-
-
Method Detail
-
_parseInheritance
private Map<String,String> _parseInheritance(String inheritanceString)
Parse the inheritance argument for the constructor- Parameters:
inheritanceString
- the representation of the zone inheritance for the templates- Returns:
- the inheritance mapping between templates and zones
-
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
-
hasInheritance
public boolean hasInheritance()
Determine if this zone inherits another one- Returns:
- true if a inheritance is declared.
-
getInheritance
public String getInheritance(String templateName)
Get the name of the zone to inherit in the given template- Parameters:
templateName
- The name of the template. Cannot be empty, null or a joker.- Returns:
- The name of a zone in that template, or null is not applicable for this template.
-
getViewParameters
public Optional<ViewParametersModel> getViewParameters()
Get the view parameters model for this zone- Returns:
- the view parameters
-
getZoneItemViewParameters
public Optional<ViewParametersModel> getZoneItemViewParameters()
Get the view parameters model for zone item in this zone- Returns:
- the view parameters
-
-