/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: FCKeditor.java
* FCKeditor control class.
*
* Version: 2.3
* Modified: 2005-08-11 16:29:00
*
* File Authors:
* Simone Chiaretta (simo@users.sourceforge.net)
*
* Version: 2.5
* Modified: 2007-12-27 23:04:00
*
* File Authors:
* Axel Muench, Specto Design, Inc.
*/
package com.fredck.FCKeditor;
import javax.servlet.http.HttpServletRequest;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* The main class of the class lib.
*
* It's the container for all properties and the class that generate the output based on browser capabilities and configurations passed by the developer.
*
* @author Simone Chiaretta (simo@users.sourceforge.net)
*/
public class FCKeditor {
private FCKeditorConfigurations oConfig;
private String instanceName;
private String value = "";
private String basePath;
private String toolbarSet = "Default";
private String width = "100%";
private String height = "200";
HttpServletRequest request;
/**
* Get the unique name of the editor
*
* @return name
*/
public String getInstanceName() {
return instanceName;
}
/**
* Set the unique name of the editor
*
* @param value name
*/
public void setInstanceName(String value) {
instanceName = value;
}
/**
* Get the initial value to be edited.
*
* In HTML code
*
* @return value
*/
public String getValue() {
return value;
}
/**
* Set the initial value to be edited.
*
* In HTML code
*
* @param value value
*/
public void setValue(String value) {
this.value = value;
}
/**
* Get the dir where the FCKeditor files reside on the server
*
* @return path
*/
public String getBasePath() {
return basePath;
}
/**
* Set the dir where the FCKeditor files reside on the server.
*
* Remarks:
*
* Avoid using relative paths. It is preferable to set the base path starting from the root (/).
*
* Always finish the path with a slash (/).
*
* @param value path
*/
public void setBasePath(String value) {
basePath = value;
}
/**
* Get the name of the toolbar to display
*
* @return toolbar name
*/
public String getToolbarSet() {
return toolbarSet;
}
/**
* Set the name of the toolbar to display
*
* @param value toolbar name
*/
public void setToolbarSet(String value) {
toolbarSet = value;
}
/**
* Get the width of the textarea
*
* @return width
*/
public String getWidth() {
return width;
}
/**
* Set the width of the textarea
*
* @param value width
*/
public void setWidth(String value) {
width = value;
}
/**
* Get the height of the textarea
*
* @return height
*/
public String getHeight() {
return height;
}
/**
* Set the height of the textarea
*
* @param value height
*/
public void setHeight(String value) {
height = value;
}
/**
* Get the advanced configuation set.
*
* Adding element to this collection you can override the settings specified in the config.js file.
*
* @return configuration collection
*/
public FCKeditorConfigurations getConfig() {
return oConfig;
}
/**
* Set the advanced configuation set.
*
* @param value configuration collection
*/
public void setConfig(FCKeditorConfigurations value) {
oConfig = value;
}
/**
* Initialize the object setting all value to the default ones.
*
*
*
*
*
*
width: 100%
*
*
height: 200
*
*
toolbar name: Default
*
*
basePath: context root + "/FCKeditor/"
*
*
*
*
*
* @param req request object
*/
public FCKeditor(HttpServletRequest req) {
request = req;
basePath = request.getContextPath() + "/FCKeditor/";
oConfig = new FCKeditorConfigurations();
}
/**
* Initialize the object setting the unique name and then all value to the default ones.
*
*