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 of
RichTextConfiguration
<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
Modifier and TypeClassDescriptionstatic class
A configured implementation of theStaticRichTextConfiguration.StaticRichTextConfigurationAttribute
protected static class
A configured implementation of theClientSideElement
static class
A configured implementation ofRichTextConfigurationStyle
static class
A configured implementation ofRichTextConfigurationStyleGroup
static class
A configured implementation of theRichTextConfigurationTag
-
Field Summary
Modifier and TypeFieldDescriptionprotected Map<String,
Set<ClientSideElement>> The convertors by categoriesprotected Map<String,
List<ClientSideElement.ScriptFile>> The css files to load by categoriesprotected String
The feature in the plugin where thie extension was definedprotected Map<String,
Map<String, RichTextConfigurationTag>> The handled tags classified by categoriesprotected String
The identifier of this extensionprotected String
The name of the plugin where thie extension was definedprotected Map<String,
Map<String, Map<RichTextConfigurationStyleGroup, List<RichTextConfigurationStyle>>>> The styles by categoriesprotected Map<String,
Set<ClientSideElement>> The validators by categories -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Set<ClientSideElement>
_configureConvertors
(Configuration convertorsConfiguration) Configure the convertors_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 validatorsvoid
configure
(Configuration configuration) getAvailableStyles
(String category, Map<String, Object> contextualParameters) Get the available styles classified by identifiers such as "table", "link"...Get the categories supported by this extensiongetConvertors
(String category, Map<String, Object> contextParameters) Get the convertors used when richtext switch from code to view and from view to code.getCSSFiles
(String category, Map<String, Object> contextParameters) Get the CSS files required during the edition of the given category.getHandledTags
(String category, Map<String, Object> contextParameters) Get the authorized tags for the given categorygetValidators
(String category, Map<String, Object> contextParameters) Get the validators used during an edition of the rich text to ensure the value is correct.void
setPluginInfo
(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 Details
-
_pluginName
The name of the plugin where thie extension was defined -
_featureName
The feature in the plugin where thie extension was defined -
_id
The identifier of this extension -
_handledTags
The handled tags classified by categories -
_cssFiles
The css files to load by categories -
_validators
The validators by categories -
_convertors
The convertors by categories -
_styles
protected Map<String,Map<String, _stylesMap<RichTextConfigurationStyleGroup, List<RichTextConfigurationStyle>>>> The styles by categories
-
-
Constructor Details
-
StaticRichTextConfiguration
public StaticRichTextConfiguration()
-
-
Method Details
-
configure
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
setPluginInfo
Description copied from interface:PluginAware
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.- Specified by:
setPluginInfo
in 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
-
_configureStyles
protected Map<String,Map<RichTextConfigurationStyleGroup, _configureStylesList<RichTextConfigurationStyle>>> (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
Description copied from interface:RichTextConfiguration
Get the categories supported by this extension- Specified by:
getCategories
in 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:RichTextConfiguration
Get the authorized tags for the given category- Specified by:
getHandledTags
in 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:RichTextConfiguration
Get the CSS files required during the edition of the given category.- Specified by:
getCSSFiles
in 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
Description copied from interface:RichTextConfiguration
Get the validators used during an edition of the rich text to ensure the value is correct. Validators can be differents by category.- Specified by:
getValidators
in 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
Description copied from interface:RichTextConfiguration
Get the convertors used when richtext switch from code to view and from view to code. Convertors can be differents by category.- Specified by:
getConvertors
in 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, getAvailableStylesList<RichTextConfigurationStyle>>> (String category, Map<String, Object> contextualParameters) Description copied from interface:RichTextConfiguration
Get the available styles classified by identifiers such as "table", "link"...- Specified by:
getAvailableStyles
in interfaceRichTextConfiguration
- Parameters:
category
- The category. "" is the default category.contextualParameters
- Contextuals parameters transmitted by the environment.- Returns:
- The available styles. Can be null.
-