Class VariantParameter
- java.lang.Object
-
- org.ametys.skinfactory.parameters.AbstractSkinParameter
-
- org.ametys.skinfactory.parameters.VariantParameter
-
public class VariantParameter extends AbstractSkinParameter
Implementation ofAbstractSkinParameterfor a variant
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ametys.skinfactory.parameters.AbstractSkinParameter
AbstractSkinParameter.SkinParameterType, AbstractSkinParameter.Widget
-
-
Constructor Summary
Constructors Constructor Description VariantParameter(String id, I18nizableText label, I18nizableText description, String iconGlyph, String iconSmall, String iconLarge, List<Variant> variants)ConstructorVariantParameter(String id, I18nizableText label, I18nizableText description, List<Variant> variants)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(Path tempDir, Path modelDir, Object value, String lang)Apply parameter to the skinStringgetDefaultValue(SkinModel model)Get the default valueStringgetDefaultValue(SkinModel model, String lang)Get the default valueStringgetIconGlyph()Get the CSS iconStringgetIconLarge()Get the large iconStringgetIconSmall()Get the small iconAbstractSkinParameter.SkinParameterTypegetType()Get typeList<Variant>getVariants()Get the variantsvoidsetIconGlyph(String iconGlyph)Set the CSS iconvoidsetIconLarge(String iconLarge)Set the large icon relative pathvoidsetIconSmall(String iconSmall)Set the small icon relative pathMap<String,Object>toJson(String modelName)Transform the parameter into a JSON objectvoidtoSAX(ContentHandler contentHandler, String modelName)SAX the parameter-
Methods inherited from class org.ametys.skinfactory.parameters.AbstractSkinParameter
getDescription, getId, getLabel, setDescription, setLabel
-
-
-
-
Constructor Detail
-
VariantParameter
public VariantParameter(String id, I18nizableText label, I18nizableText description, List<Variant> variants)
Constructor- Parameters:
id- the unique idlabel- the labeldescription- the descriptionvariants- the list of values for this variant
-
VariantParameter
public VariantParameter(String id, I18nizableText label, I18nizableText description, String iconGlyph, String iconSmall, String iconLarge, List<Variant> variants)
Constructor- Parameters:
id- the unique idlabel- the labeldescription- the descriptioniconGlyph- The CSS classe for icon, to use instead of small and large iconiconSmall- The small iconiconLarge- The large iconvariants- the list of values for this variant
-
-
Method Detail
-
getType
public AbstractSkinParameter.SkinParameterType getType()
Description copied from class:AbstractSkinParameterGet type- Specified by:
getTypein classAbstractSkinParameter- Returns:
- The type
-
getVariants
public List<Variant> getVariants()
Get the variants- Returns:
- The variants
-
setIconGlyph
public void setIconGlyph(String iconGlyph)
Set the CSS icon- Parameters:
iconGlyph- the CSS icon
-
getIconGlyph
public String getIconGlyph()
Get the CSS icon- Returns:
- The CSS icon
-
setIconSmall
public void setIconSmall(String iconSmall)
Set the small icon relative path- Parameters:
iconSmall- the small icon
-
getIconSmall
public String getIconSmall()
Get the small icon- Returns:
- The small icon
-
setIconLarge
public void setIconLarge(String iconLarge)
Set the large icon relative path- Parameters:
iconLarge- the large icon
-
getIconLarge
public String getIconLarge()
Get the large icon- Returns:
- The large icon
-
apply
public void apply(Path tempDir, Path modelDir, Object value, String lang) throws SkinParameterException
Description copied from class:AbstractSkinParameterApply parameter to the skin- Specified by:
applyin classAbstractSkinParameter- Parameters:
tempDir- the work directorymodelDir- the model directoryvalue- the valuelang- The language. Can be null.- Throws:
SkinParameterException
-
toSAX
public void toSAX(ContentHandler contentHandler, String modelName) throws SAXException
Description copied from class:AbstractSkinParameterSAX the parameter- Specified by:
toSAXin classAbstractSkinParameter- Parameters:
contentHandler- The content handler to SAX intomodelName- The model name- Throws:
SAXException- if an error occurred while SAXing
-
toJson
public Map<String,Object> toJson(String modelName)
Description copied from class:AbstractSkinParameterTransform the parameter into a JSON object- Specified by:
toJsonin classAbstractSkinParameter- Parameters:
modelName- The model name- Returns:
- The JSON representation of the parameter
-
getDefaultValue
public String getDefaultValue(SkinModel model)
Description copied from class:AbstractSkinParameterGet the default value- Specified by:
getDefaultValuein classAbstractSkinParameter- Parameters:
model- The model- Returns:
- The default value
-
getDefaultValue
public String getDefaultValue(SkinModel model, String lang)
Description copied from class:AbstractSkinParameterGet the default value- Specified by:
getDefaultValuein classAbstractSkinParameter- Parameters:
model- The modellang- The language- Returns:
- The default value
-
-