001/* 002 * Copyright 2017 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.core.ui.widgets.richtext; 017 018import java.util.Collection; 019import java.util.List; 020import java.util.Map; 021import java.util.Set; 022 023import org.ametys.core.ui.ClientSideElement; 024import org.ametys.core.ui.ClientSideElement.ScriptFile; 025 026/** 027 * Extension for the {@link RichTextConfigurationExtensionPoint}. 028 * Extensions are classified by categories: "" is the default category. 029 */ 030public interface RichTextConfiguration 031{ 032 /** 033 * Get the categories supported by this extension 034 * @return The categories supported. Cannot be null, but may be empty and of course contains the "" key for the default category. 035 */ 036 public Set<String> getCategories(); 037 038 /** 039 * Get the authorized tags for the given category 040 * @param category The category. "" is the default category. 041 * @param contextualParameters Contextuals parameters transmitted by the environment. 042 * @return The tags supported (can be null). The key is the html tag name supported and the value is the associated value. 043 */ 044 public Collection<RichTextConfigurationTag> getHandledTags(String category, Map<String, Object> contextualParameters); 045 046 /** 047 * Get the CSS files required during the edition of the given category. 048 * @param category The category. "" is the default category. 049 * @param contextualParameters Contextuals parameters transmitted by the environment. 050 * @return The CSS files requires. Can be null. 051 */ 052 public List<ScriptFile> getCSSFiles(String category, Map<String, Object> contextualParameters); 053 054 /** 055 * Get the validators used during an edition of the rich text to ensure the value is correct. Validators can be differents by category. 056 * @param category The category. "" is the default category. 057 * @param contextualParameters Contextuals parameters transmitted by the environment. 058 * @return The validators to use. The class of the ClientSideElement must inherit the front-side validor js interface. Can be null. 059 */ 060 public Set<ClientSideElement> getValidators(String category, Map<String, Object> contextualParameters); 061 062 /** 063 * Get the convertors used when richtext switch from code to view and from view to code. Convertors can be differents by category. 064 * @param category The category. "" is the default category. 065 * @param contextualParameters Contextuals parameters transmitted by the environment. 066 * @return The convertors to use. The class of the ClientSideElement must inherit the front-side convertor js interface. Can be null. 067 */ 068 public Set<ClientSideElement> getConvertors(String category, Map<String, Object> contextualParameters); 069 070 /** 071 * Get the available styles classified by identifiers such as "table", "link"... 072 * @param category The category. "" is the default category. 073 * @param contextualParameters Contextuals parameters transmitted by the environment. 074 * @return The available styles. Can be null. 075 */ 076 public Map<String, Map<RichTextConfigurationStyleGroup, List<RichTextConfigurationStyle>>> getAvailableStyles(String category, Map<String, Object> contextualParameters); 077}