Class CSSParameter
- java.lang.Object
-
- org.ametys.skinfactory.parameters.AbstractSkinParameter
-
- org.ametys.skinfactory.parameters.CSSParameter
-
- Direct Known Subclasses:
CSSColorParameter
public class CSSParameter extends AbstractSkinParameter
Implementation ofAbstractSkinParameterfor a CSS property
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ametys.skinfactory.parameters.AbstractSkinParameter
AbstractSkinParameter.SkinParameterType, AbstractSkinParameter.Widget
-
-
Constructor Summary
Constructors Constructor Description CSSParameter(String id, I18nizableText label, I18nizableText description, Path cssFile, String cssProperty, String defaultValue)ConstructorCSSParameter(String id, I18nizableText label, I18nizableText description, List<Path> cssFiles, String cssProperty, String defaultValue)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCSSFile(Path cssFile)Add a CSS filevoidapply(Path tempDir, Path modelDir, Object value, String lang)Apply parameter to the skinprotected StringcssFileToString(Path cssFile)Get the css file input stream as StringList<Path>getCSSFiles()Get the CSS files pathprotected PatterngetCSSPattern()Get the CSS patternStringgetCSSProperty()Get the CSS propertyStringgetDefaultValue(SkinModel model)Get the default valueStringgetDefaultValue(SkinModel model, String lang)Get the default valueAbstractSkinParameter.SkinParameterTypegetType()Get typeMap<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
-
CSSParameter
public CSSParameter(String id, I18nizableText label, I18nizableText description, Path cssFile, String cssProperty, String defaultValue)
Constructor- Parameters:
id- the unique idlabel- the labeldescription- the descriptioncssFile- the css filecssProperty- the css propertydefaultValue- the default value
-
CSSParameter
public CSSParameter(String id, I18nizableText label, I18nizableText description, List<Path> cssFiles, String cssProperty, String defaultValue)
Constructor- Parameters:
id- the unique idlabel- the labeldescription- the descriptioncssFiles- the css filescssProperty- the css propertydefaultValue- the default value
-
-
Method Detail
-
getType
public AbstractSkinParameter.SkinParameterType getType()
Description copied from class:AbstractSkinParameterGet type- Specified by:
getTypein classAbstractSkinParameter- Returns:
- The type
-
getCSSFiles
public List<Path> getCSSFiles()
Get the CSS files path- Returns:
- the CSS files path
-
addCSSFile
public void addCSSFile(Path cssFile)
Add a CSS file- Parameters:
cssFile- The CSS file
-
getCSSProperty
public String getCSSProperty()
Get the CSS property- Returns:
- the CSS file path
-
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
-
getCSSPattern
protected Pattern getCSSPattern()
Get the CSS pattern- Returns:
- The CSS pattern
-
cssFileToString
protected String cssFileToString(Path cssFile) throws SkinParameterException
Get the css file input stream as String- Parameters:
cssFile- The css file- Returns:
- The css file content as String
- Throws:
SkinParameterException- if the css file was not parsable
-
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
-
-