Class ImageParameter
- java.lang.Object
-
- org.ametys.skinfactory.parameters.AbstractSkinParameter
-
- org.ametys.skinfactory.parameters.ImageParameter
-
public class ImageParameter extends AbstractSkinParameter
Implementation ofAbstractSkinParameter
for an image
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ImageParameter.FileValue
Class representing a file value-
Nested classes/interfaces inherited from class org.ametys.skinfactory.parameters.AbstractSkinParameter
AbstractSkinParameter.SkinParameterType, AbstractSkinParameter.Widget
-
-
Field Summary
Fields Modifier and Type Field Description private String
_iconGlyph
private String
_iconLarge
private String
_iconSmall
private String
_imagePath
private boolean
_localUploadEnabled
-
Fields inherited from class org.ametys.skinfactory.parameters.AbstractSkinParameter
_description, _id, _label
-
-
Constructor Summary
Constructors Constructor Description ImageParameter(String relPath, I18nizableText label, I18nizableText description)
ConstructorImageParameter(String relPath, I18nizableText label, I18nizableText description, String iconGlyph, String iconSmall, String iconLarge)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_copyFile(Path srcFile, Path targetFile)
private Path
_getLibraryFile(Path tempDir, Path modelDir, boolean uploaded)
private boolean
_isImage(Path file)
private List<Path>
_listCSSFiles(Path file)
void
apply(Path tempDir, Path modelDir, Object value, String lang)
Apply parameter to the skinImageParameter.FileValue
getDefaultValue(SkinModel model)
Get the default valueImageParameter.FileValue
getDefaultValue(SkinModel model, String lang)
Get the default valueString
getIconGlyph()
Get the CSS iconString
getIconLarge()
Get the large iconString
getIconSmall()
Get the small iconString
getLibraryPath()
Get relative path of imagesAbstractSkinParameter.SkinParameterType
getType()
Get typeboolean
isLocalUploadEnabled()
Determines if local upload is enabledvoid
setIconGlyph(String iconGlyph)
Set the CSS iconvoid
setIconLarge(String iconLarge)
Set the large icon relative pathvoid
setIconSmall(String iconSmall)
Set the small icon relative pathMap<String,Object>
toJson(String modelName)
Transform the parameter into a JSON objectvoid
toSAX(ContentHandler contentHandler, String modelName)
SAX the parameter-
Methods inherited from class org.ametys.skinfactory.parameters.AbstractSkinParameter
getDescription, getId, getLabel, setDescription, setLabel
-
-
-
-
Field Detail
-
_iconGlyph
private String _iconGlyph
-
_iconSmall
private String _iconSmall
-
_iconLarge
private String _iconLarge
-
_localUploadEnabled
private boolean _localUploadEnabled
-
_imagePath
private String _imagePath
-
-
Constructor Detail
-
ImageParameter
public ImageParameter(String relPath, I18nizableText label, I18nizableText description)
Constructor- Parameters:
relPath
- the relative path of the target imagelabel
- the labeldescription
- the description
-
ImageParameter
public ImageParameter(String relPath, I18nizableText label, I18nizableText description, String iconGlyph, String iconSmall, String iconLarge)
Constructor- Parameters:
relPath
- the relative path of the target imagelabel
- the labeldescription
- the descriptioniconGlyph
- The CSS classe for icon, to use instead of small and large iconiconSmall
- The small iconiconLarge
- The large icon
-
-
Method Detail
-
getType
public AbstractSkinParameter.SkinParameterType getType()
Description copied from class:AbstractSkinParameter
Get type- Specified by:
getType
in classAbstractSkinParameter
- Returns:
- The type
-
isLocalUploadEnabled
public boolean isLocalUploadEnabled()
Determines if local upload is enabled- Returns:
- true if local upload is enabled
-
getLibraryPath
public String getLibraryPath()
Get relative path of images- Returns:
- the relative path of images
-
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 relative path of 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 relative path of 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)
Description copied from class:AbstractSkinParameter
Apply parameter to the skin- Specified by:
apply
in classAbstractSkinParameter
- Parameters:
tempDir
- the work directorymodelDir
- the model directoryvalue
- the valuelang
- The language. Can be null.
-
_listCSSFiles
private List<Path> _listCSSFiles(Path file) throws IOException
- Throws:
IOException
-
_getLibraryFile
private Path _getLibraryFile(Path tempDir, Path modelDir, boolean uploaded)
-
toSAX
public void toSAX(ContentHandler contentHandler, String modelName) throws SAXException
Description copied from class:AbstractSkinParameter
SAX the parameter- Specified by:
toSAX
in 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:AbstractSkinParameter
Transform the parameter into a JSON object- Specified by:
toJson
in classAbstractSkinParameter
- Parameters:
modelName
- The model name- Returns:
- The JSON representation of the parameter
-
getDefaultValue
public ImageParameter.FileValue getDefaultValue(SkinModel model)
Description copied from class:AbstractSkinParameter
Get the default value- Specified by:
getDefaultValue
in classAbstractSkinParameter
- Parameters:
model
- The model- Returns:
- The default value
-
getDefaultValue
public ImageParameter.FileValue getDefaultValue(SkinModel model, String lang)
Description copied from class:AbstractSkinParameter
Get the default value- Specified by:
getDefaultValue
in classAbstractSkinParameter
- Parameters:
model
- The modellang
- The language- Returns:
- The default value
-
-