Class StaticRichTextConfiguration
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.ui.widgets.richtext.StaticRichTextConfiguration
-
- All Implemented Interfaces:
RichTextConfiguration,LogEnabled,PluginAware,Configurable
public class StaticRichTextConfiguration extends AbstractLogEnabled implements RichTextConfiguration, Configurable, PluginAware
A configurable implementation ofRichTextConfiguration<tags category="cat1"> <tag name="p" empty="CLOSE|OPEN|REMOVE_EMPTY_CONTENT|PADDING|REMOVE_EMPTY_ATTRIBUTES"> <synonyms> <synonym>div</synonym> </synonyms> <attributes> <attribute name="align"> <default-value>left</default-value> <values> <value>left</value> <value>right</value> </values> </attribute> <!-- 'class' is a special attributes with additional possibilities (technical-values) --> <attribute name="class"> <default-value>para1</default-value> <values> <value>para1</value> <value technical="true">para2</value> </values> </attribute> </attributes> </tag> </tags> <tags category=""> ... </tags> <styles category=""> <style name="paragraph"> <group> <values> <value rendering="h1.bigger"> <label i18n="false">Header 1 (bigger)</label> <description i18n="false">Creates a bigger header of first level</description> <cssclass>bigger-heading-1</cssclass> <!-- class name for backoffice button --> <icon-small type='file'>img/h1bigger_16.png</icon-small> <icon-medium type='file'>img/h1bigger_32.png</icon-medium> <icon-large type='file'>img/h1bigger_48.png</icon-large> </tagname> </values> </group> </style> </styles> <css category=""> <file>css/file.css</file> </css> <validators category=""> <validator> <class name="..."> <config>...</config> </class> <scripts> <file>...>/file> </scripts> </validator> </validators> <validators category=""> ... </validators> <convertors category=""> <convertor> <class name="..."> <config>...</config> </class> <scripts> <file>...>/file> </scripts> </convertor> </convertors> <convertors category=""> ... </convertors>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStaticRichTextConfiguration.StaticRichTextConfigurationAttributeA configured implementation of theStaticRichTextConfiguration.StaticRichTextConfigurationAttributeprotected static classStaticRichTextConfiguration.StaticRichTextConfigurationClientSideElementA configured implementation of theClientSideElementstatic classStaticRichTextConfiguration.StaticRichTextConfigurationStyleA configured implementation ofRichTextConfigurationStylestatic classStaticRichTextConfiguration.StaticRichTextConfigurationStyleGroupA configured implementation ofRichTextConfigurationStyleGroupstatic classStaticRichTextConfiguration.StaticRichTextConfigurationTagA configured implementation of theRichTextConfigurationTag
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Set<ClientSideElement>>_convertorsThe convertors by categoriesprotected Map<String,List<ClientSideElement.ScriptFile>>_cssFilesThe css files to load by categoriesprotected String_featureNameThe feature in the plugin where thie extension was definedprotected Map<String,Map<String,RichTextConfigurationTag>>_handledTagsThe handled tags classified by categoriesprotected String_idThe identifier of this extensionprotected String_pluginNameThe name of the plugin where thie extension was definedprotected Map<String,Map<String,Map<RichTextConfigurationStyleGroup,List<RichTextConfigurationStyle>>>>_stylesThe styles by categoriesprotected Map<String,Set<ClientSideElement>>_validatorsThe validators by categories
-
Constructor Summary
Constructors Constructor Description StaticRichTextConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Map<String,Map<String,Map<RichTextConfigurationStyleGroup,List<RichTextConfigurationStyle>>>>_configureCategoryAndStyles(Configuration configuration)Configure all the styles for all categoriesprotected Set<ClientSideElement>_configureConvertors(Configuration convertorsConfiguration)Configure the convertorsprotected Map<String,Map<RichTextConfigurationStyleGroup,List<RichTextConfigurationStyle>>>_configureStyles(Configuration stylesConfiguration)Configure the styles for one categoryprotected Map<String,RichTextConfigurationTag>_configureTags(Configuration tagsConfiguration)Configure the tagsprotected Set<ClientSideElement>_configureValidators(Configuration validatorsConfiguration)Configure the validatorsvoidconfigure(Configuration configuration)Map<String,Map<RichTextConfigurationStyleGroup,List<RichTextConfigurationStyle>>>getAvailableStyles(String category, Map<String,Object> contextualParameters)Get the available styles classified by identifiers such as "table", "link"...Set<String>getCategories()Get the categories supported by this extensionSet<ClientSideElement>getConvertors(String category, Map<String,Object> contextParameters)Get the convertors used when richtext switch from code to view and from view to code.List<ClientSideElement.ScriptFile>getCSSFiles(String category, Map<String,Object> contextParameters)Get the CSS files required during the edition of the given category.Collection<RichTextConfigurationTag>getHandledTags(String category, Map<String,Object> contextParameters)Get the authorized tags for the given categorySet<ClientSideElement>getValidators(String category, Map<String,Object> contextParameters)Get the validators used during an edition of the rich text to ensure the value is correct.voidsetPluginInfo(String pluginName, String featureName, String id)Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_pluginName
protected String _pluginName
The name of the plugin where thie extension was defined
-
_featureName
protected String _featureName
The feature in the plugin where thie extension was defined
-
_handledTags
protected Map<String,Map<String,RichTextConfigurationTag>> _handledTags
The handled tags classified by categories
-
_cssFiles
protected Map<String,List<ClientSideElement.ScriptFile>> _cssFiles
The css files to load by categories
-
_validators
protected Map<String,Set<ClientSideElement>> _validators
The validators by categories
-
_convertors
protected Map<String,Set<ClientSideElement>> _convertors
The convertors by categories
-
_styles
protected Map<String,Map<String,Map<RichTextConfigurationStyleGroup,List<RichTextConfigurationStyle>>>> _styles
The styles by categories
-
-
Constructor Detail
-
StaticRichTextConfiguration
public StaticRichTextConfiguration()
-
-
Method Detail
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAwareSets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfoin interfacePluginAware- Parameters:
pluginName- Unique identifier for the plugin hosting the extensionfeatureName- Unique feature identifier (unique for a given pluginName)id- Unique identifier of this component
-
_configureTags
protected Map<String,RichTextConfigurationTag> _configureTags(Configuration tagsConfiguration) throws ConfigurationException
Configure the tags- Parameters:
tagsConfiguration- The tags part of the configuration- Returns:
- The configured tags
- Throws:
ConfigurationException- If an error occurred
-
_configureValidators
protected Set<ClientSideElement> _configureValidators(Configuration validatorsConfiguration) throws ConfigurationException
Configure the validators- Parameters:
validatorsConfiguration- The validators part of the configuration- Returns:
- The configured validators
- Throws:
ConfigurationException- If an error occurred
-
_configureConvertors
protected Set<ClientSideElement> _configureConvertors(Configuration convertorsConfiguration) throws ConfigurationException
Configure the convertors- Parameters:
convertorsConfiguration- The convertors part of the configuration- Returns:
- The configured convertors
- Throws:
ConfigurationException- If an error occurred
-
_configureCategoryAndStyles
private Map<String,Map<String,Map<RichTextConfigurationStyleGroup,List<RichTextConfigurationStyle>>>> _configureCategoryAndStyles(Configuration configuration) throws ConfigurationException
Configure all the styles for all categories- Parameters:
configuration- The styles configuration- Returns:
- The configured styles
- Throws:
ConfigurationException- If an error occurred
-
_configureStyles
protected Map<String,Map<RichTextConfigurationStyleGroup,List<RichTextConfigurationStyle>>> _configureStyles(Configuration stylesConfiguration) throws ConfigurationException
Configure the styles for one category- Parameters:
stylesConfiguration- The style configuration of the configuration- Returns:
- The configured styles
- Throws:
ConfigurationException- If an error occurred
-
getCategories
public Set<String> getCategories()
Description copied from interface:RichTextConfigurationGet the categories supported by this extension- Specified by:
getCategoriesin interfaceRichTextConfiguration- Returns:
- The categories supported. Cannot be null, but may be empty and of course contains the "" key for the default category.
-
getHandledTags
public Collection<RichTextConfigurationTag> getHandledTags(String category, Map<String,Object> contextParameters)
Description copied from interface:RichTextConfigurationGet the authorized tags for the given category- Specified by:
getHandledTagsin interfaceRichTextConfiguration- Parameters:
category- The category. "" is the default category.contextParameters- Contextuals parameters transmitted by the environment.- Returns:
- The tags supported (can be null). The key is the html tag name supported and the value is the associated value.
-
getCSSFiles
public List<ClientSideElement.ScriptFile> getCSSFiles(String category, Map<String,Object> contextParameters)
Description copied from interface:RichTextConfigurationGet the CSS files required during the edition of the given category.- Specified by:
getCSSFilesin interfaceRichTextConfiguration- Parameters:
category- The category. "" is the default category.contextParameters- Contextuals parameters transmitted by the environment.- Returns:
- The CSS files requires. Can be null.
-
getValidators
public Set<ClientSideElement> getValidators(String category, Map<String,Object> contextParameters)
Description copied from interface:RichTextConfigurationGet the validators used during an edition of the rich text to ensure the value is correct. Validators can be differents by category.- Specified by:
getValidatorsin interfaceRichTextConfiguration- Parameters:
category- The category. "" is the default category.contextParameters- Contextuals parameters transmitted by the environment.- Returns:
- The validators to use. The class of the ClientSideElement must inherit the front-side validor js interface. Can be null.
-
getConvertors
public Set<ClientSideElement> getConvertors(String category, Map<String,Object> contextParameters)
Description copied from interface:RichTextConfigurationGet the convertors used when richtext switch from code to view and from view to code. Convertors can be differents by category.- Specified by:
getConvertorsin interfaceRichTextConfiguration- Parameters:
category- The category. "" is the default category.contextParameters- Contextuals parameters transmitted by the environment.- Returns:
- The convertors to use. The class of the ClientSideElement must inherit the front-side convertor js interface. Can be null.
-
getAvailableStyles
public Map<String,Map<RichTextConfigurationStyleGroup,List<RichTextConfigurationStyle>>> getAvailableStyles(String category, Map<String,Object> contextualParameters)
Description copied from interface:RichTextConfigurationGet the available styles classified by identifiers such as "table", "link"...- Specified by:
getAvailableStylesin interfaceRichTextConfiguration- Parameters:
category- The category. "" is the default category.contextualParameters- Contextuals parameters transmitted by the environment.- Returns:
- The available styles. Can be null.
-
-