KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > fredck > FCKeditor > FCKeditorConfigurations


1 /*
2  * FCKeditor - The text editor for internet
3  * Copyright (C) 2003-2005 Frederico Caldeira Knabben
4  *
5  * Licensed under the terms of the GNU Lesser General Public License:
6  * http://www.opensource.org/licenses/lgpl-license.php
7  *
8  * For further information visit:
9  * http://www.fckeditor.net/
10  *
11  * File Name: FCKeditorConfigurations.java
12  * FCKeditor configurations container.
13  *
14  * Version: 2.3
15  * Modified: 2005-08-11 16:29:00
16  *
17  * File Authors:
18  * Simone Chiaretta (simo@users.sourceforge.net)
19  */

20
21
22 package com.fredck.FCKeditor;
23
24 import java.util.*;
25
26 /**
27  * Contains the configuration settings for the FCKEditor.<br>
28  * Adding element to this collection you can override the settings specified in the config.js file.
29  *
30  * @author Simone Chiaretta (simo@users.sourceforge.net)
31  */

32 public class FCKeditorConfigurations extends HashMap{
33     
34     /**
35      * Initialize the configuration collection
36      */

37     public FCKeditorConfigurations() {
38         super();
39     }
40
41     /**
42      * Generate the url parameter sequence used to pass this configuration to the editor.
43      *
44      *
45      *@return html endocode sequence of configuration parameters
46      */

47     public String JavaDoc getUrlParams() {
48         StringBuffer JavaDoc osParams = new StringBuffer JavaDoc();
49         
50         for(Iterator i=this.entrySet().iterator();i.hasNext();) {
51             Map.Entry entry = (Map.Entry) i.next();
52             if(entry.getValue()!=null)
53                 osParams.append("&"+encodeConfig(entry.getKey().toString())+"="+encodeConfig(entry.getValue().toString()));
54         }
55         return osParams.toString();
56     }
57     
58     private String JavaDoc encodeConfig(String JavaDoc txt) {
59         txt=txt.replaceAll("&","%26");
60         txt=txt.replaceAll("=","%3D");
61         txt=txt.replaceAll("\"","%22");
62         return txt;
63     }
64     
65 }
66
Popular Tags