⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fckeditortag.java

📁 这是一个简单的办公管理系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * 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: FCKeditorTag.java
 * 	FCKeditor tag library.
 * 
 * Version:  2.3
 * Modified: 2005-08-11 16:29:00
 * 
 * File Authors:
 * 		Simone Chiaretta (simo@users.sourceforge.net) */
 
 
package com.fredck.FCKeditor.tags;

import com.fredck.FCKeditor.FCKeditor;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;

/**
 * Custom Tag class to access the {@linkplain com.fredck.FCKeditor.FCKeditor container}.<br>
 *<p>
 * <b>Simple usage</b>:
 * <pre>
 *	&lt;FCK:editor
 *		id="EditorAccessibility"
 *		width="80%"
 *		height="120"
 *		toolbarSet="Accessibility"
 *	"&gt;This is another test. &lt;BR&gt;&lt;BR&gt;The "Second" row.&lt;/BR&gt;&lt;/FCK:editor"&gt;
 * </pre>
 *
 *<p>In this example we set all the attribute for the fckedit tag.
 *
 *<p>
 *  <b>Advanced usage of the tag</b>:
 *  <pre>
 *	&lt;FCK:editor id="EditorDefault" basePath="/FCKeditor/"
 *		styleNames=";Style 1;Style 2; Style 3" 
 *		fontNames=";Arial;Courier New;Times New Roman;Verdana" &gt;
 *		This is some &lt;B&gt;sample text&lt;/B&gt;.
 *	&lt;/FCK:editor&gt;
*  </pre>
 *<p>In this example we set the id and the basePath of the editor (since it is /FCKeditor/
 * we could have omitted it because it's already the default value).<br>
 * Then we used the the optional attributes to set some advanced configuration settings.
 *
			
 * @author Simone Chiaretta (simo@users.sourceforge.net)
 */
public class FCKeditorTag extends BodyTagSupport  {
	
	private String id;
	private String value = "";
	private String basePath = null;
	private String toolbarSet = null;
	private String width = null;
	private String height = null;
	private String customConfigurationsPath = null;
	private String editorAreaCSS = null;
	private String baseHref = null;
	private String skinPath = null;
	private String pluginsPath = null;
	private String fullPage = null;
	private String debug = null;	
	private String autoDetectLanguage = null;
	private String defaultLanguage = null;
	private String contentLangDirection = null;
	private String enableXHTML = null;
	private String enableSourceXHTML = null;
	private String fillEmptyBlocks = null;
	private String formatSource = null;
	private String formatOutput = null;
	private String formatIndentator = null;
	private String geckoUseSPAN = null;
	private String startupFocus = null;
	private String forcePasteAsPlainText = null;
	private String forceSimpleAmpersand = null;
	private String tabSpaces = null;
	private String useBROnCarriageReturn = null;
	private String toolbarStartExpanded = null;
	private String toolbarCanCollapse = null;
	private String fontColors = null;
	private String fontNames = null;
	private String fontSizes = null;
	private String fontFormats = null;
	private String stylesXmlPath = null;
	private String linkBrowserURL = null;
	private String imageBrowserURL = null;
	private String flashBrowserURL = null;
	private String linkUploadURL = null;
	private String imageUploadURL = null;
	private String flashUploadURL = null;
	



   /**
     * The underlying FCKeditor object
     *
     */		
	protected FCKeditor fcked = null;


    /**
     * Set the unique id of the editor
     *
     * @param value name
     */	
	public void setId(String value) {
		id=value;
	}

    /**
     * Set the dir where the FCKeditor files reside on the server
     *
     * @param value path
     */		
	public void setBasePath(String value) {
		basePath=value;
	}

    /**
     * Set the name of the toolbar to display
     *
     * @param value toolbar name
     */		
	public void setToolbarSet(String value) {
		toolbarSet=value;
	}

    /**
     * Set the width of the textarea
     *
     * @param value width
     */		
	public void setWidth(String value) {
		width=value;
	}

    /**
     * Set the height of the textarea
     *
     * @param value height
     */		
	public void setHeight(String value) {
		height=value;
	}

	/**
	 * Set the path of a custom file that can override some configurations.<br>
	 * It is recommended to use absolute paths (starting with /), like "/myfckconfig.js".
	 *
	 * @param value path
	 */
	public void setCustomConfigurationsPath(String value) {
		customConfigurationsPath=value;
	}
	

	/**
	 * Set the CSS styles file to be used in the editing area.<br>
	 * In this way you can point to a file that reflects your web site styles.
	 *
	 * @param value path
	 */
	public void setEditorAreaCSS(String value) {
		editorAreaCSS=value;
	}
	

	/**
	 * Base URL used to resolve links (on images, links, styles, etc.).<br>
	 * For example, if BaseHref is set to 'http://www.fredck.com', an image that points to "/images/Logo.gif" will be interpreted by the editor as "http://www.fredck.com/images/Logo.gif", without touching the "src" attribute of the image.
	 *
	 * @param value URL
	 */
	public void setBaseHref(String value) {
		baseHref=value;
	}
	
	
	/**
	 * Sets the path to the skin (graphical interface settings) to be used by the editor.
	 *
	 * @param value path
	 */
	public void setSkinPath(String value) {
		skinPath=value;
	}
	
	
	/**
	 * Sets the base path used when looking for registered plugins.
	 *
	 * @param value path
	 */
	public void setPluginsPath(String value) {
		pluginsPath=value;
	}
	
	
	/**
	 * Enables full page editing (from &lt;HTML&gt; to &lt;/HTML&gt;).<br>
	 * It also enables the "Page Properties" toolbar button.
	 *
	 * @param value true/false
	 * @throws JspException if value is not true or false
	 */
	public void setFullPage(String value) throws JspException {
		if(! value.equals("true") && ! value.equals("false"))
			throw new JspException("fullPage attribute can only be true or false");
		fullPage=value;
	}
	
	
	/**
	 * Enables the debug window to be shown when calling the FCKDebug.Output() function.
	 *
	 * @param value true/false
	 * @throws JspException if value is not true or false
	 */
	public void setDebug(String value) throws JspException {
		if(! value.equals("true") && ! value.equals("false"))
			throw new JspException("debug attribute can only be true or false");
		debug=value;
	}
	
	
	/**
	 * Tells the editor to automatically detect the user language preferences to adapt its interface language.<br>
	 * With Internet Explorer, the language configured in the Windows Control Panel is used.<br>
	 * With Firefox, the browser language is used.
	 *
	 * @param value true/false
	 * @throws JspException if value is not true or false
	 */
	public void setAutoDetectLanguage(String value) throws JspException {
		if(! value.equals("true") && ! value.equals("false"))
			throw new JspException("autoDetectLanguage attribute can only be true or false: here was " + value);
		autoDetectLanguage=value;
	}
	
	
	/**
	 * Sets the default language used for the editor's interface localization.<br>
	 * The default language is used when the AutoDetectLanguage options is disabled or when the user language is not available.
	 *
	 * @param value language code
	 */
	public void setDefaultLanguage(String value) {
		defaultLanguage=value;
	}
	
	
	/**
	 * Sets the direction of the editor area contents.<br>
	 * The possible values are:
	 * <ul>
     * <li>ltr - Left to Right
     * <li>rtl - Right to Left
     * </ul>
	 *
	 * @param value ltr/rtl
	 * @throws JspException if value is not ltr or rtl
	 */
	public void setContentLangDirection(String value) throws JspException {
		if(! value.equals("true") && ! value.equals("false"))
			throw new JspException("debug attribute can only be ltr or rtl");
		contentLangDirection=value;
	}
	
	
	/**
	 * Tells the editor to process the HTML source to XHTML on form post.
	 *
	 * @param value true/false
	 * @throws JspException if value is not true or false
	 */
	public void setEnableXHTML(String value) throws JspException {
		if(! value.equals("true") && ! value.equals("false"))
			throw new JspException("enableXHTML attribute can only be true or false");
		enableXHTML=value;
	}
	
	
	/**
	 * Tells the editor to process the HTML source to XHTML when switching from WYSIWYG to Source view
	 *
	 * @param value true/false
	 * @throws JspException if value is not true or false
	 */
	public void setEnableSourceXHTML(String value) throws JspException {
		if(! value.equals("true") && ! value.equals("false"))
			throw new JspException("enableSourceXHTML attribute can only be true or false");
		enableSourceXHTML=value;
	}
	
	
	/**
	 * Block elements (like P, DIV, H1, PRE, etc...) are forced to have content (a &amp;nbsp;).<br>
	 * Empty blocks are "collapsed" by while browsing, so a empty &lt;p&gt;&lt;/p&gt; is not visible.<br>
	 * While editing, the editor "expand" empty blocks so you can insert content inside then.<br>
	 * Setting this option to "true" results useful to reflect the same output when browsing and editing.
	 *
	 * @param value true/false
	 * @throws JspException if value is not true or false
	 */
	public void setFillEmptyBlocks(String value) throws JspException {
		if(! value.equals("true") && ! value.equals("false"))
			throw new JspException("fillEmptyBlocks attribute can only be true or false");
		fillEmptyBlocks=value;
	}
	
	
	/**
	 * The HTML shown by the editor, while switching from WYSIWYG to Source views, will be processed and formatted
	 *
	 * @param value true/false
	 * @throws JspException if value is not true or false
	 */
	public void setFormatSource(String value) throws JspException {
		if(! value.equals("true") && ! value.equals("false"))
			throw new JspException("formatSource attribute can only be true or false");
		formatSource=value;
	}
	
	
	/**
	 * The output HTML generated by the editor will be processed and formatted.
	 *
	 * @param value true/false

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -