View Javadoc
1   /*
2    * Copyright (C) 2003-2008 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.ecm.webui.core.fckconfig;
18  
19  import java.util.ArrayList;
20  import java.util.List;
21  
22  import org.exoplatform.container.component.ComponentPlugin;
23  import org.exoplatform.webui.form.wysiwyg.FCKEditorConfig;
24  
25  /**
26   * Created by The eXo Platform SAS.
27   *
28   * @author : Hoa.Pham hoa.pham@exoplatform.com Jun 23, 2008
29   */
30  public class FCKConfigService {
31  
32    private List<FCKConfigPlugin> fckConfigPlugins = new ArrayList<FCKConfigPlugin>();
33  
34    public FCKConfigService() { }
35  
36    /**
37     * Adds the FCKConfigPlugin.
38     *
39     * @param plugin the FCKConfigPlugin
40     */
41    public void addPlugin(ComponentPlugin plugin) {
42      if(plugin instanceof FCKConfigPlugin) {
43        fckConfigPlugins.add(FCKConfigPlugin.class.cast(plugin));
44      }
45    }
46  
47    /**
48     * Use to configure the fckeditoConfig by via FCKConfigPlugin.
49     *
50     * @param editorConfig the FCKEditorConfig
51     * @throws Exception the exception
52     */
53    public void processFCKEditorConfig(final FCKEditorConfig editorConfig, final FCKEditorContext context) throws Exception{
54      for(FCKConfigPlugin plugin: fckConfigPlugins) {
55        plugin.addParameters(editorConfig,context);
56      }
57    }
58  }