| |
|
| java.lang.Object com.opensymphony.webwork.components.Component com.opensymphony.webwork.components.UIBean com.opensymphony.webwork.components.RichTextEditor
RichTextEditor | public class RichTextEditor extends UIBean (Code) | |
Create a Rich Text Editor based on FCK editor (www.fckeditor.net).
<ww:richtexteditor
toolbarCanCollapse="false"
width="700"
label="Description 1"
name="description1"
value="Some Content I keyed In In The Tag Itself"
/>
It is possible to have a rich text editor do server side browsing
when for example the image button is clicked. To integrate this functionality with
webwork, one need to defined the following action definition typically in xwork.xml
<package name="richtexteditor-browse" extends="webwork-default"
namespace="/webwork/richtexteditor/editor/filemanager/browser/default/connectors/jsp">
<action name="connector"
class="com.opensymphony.webwork.components.DefaultRichtexteditorConnector"
method="browse">
<result name="getFolders" type="richtexteditorGetFolders" />
<result name="getFoldersAndFiles" type="richtexteditorGetFoldersAndFiles" />
<result name="createFolder" type="richtexteditorCreateFolder" />
<result name="fileUpload" type="richtexteditorFileUpload" />
</action>
</package>
By default whenever a browse command is triggered (eg. by clicking on the 'image' button and then
'browse server' button, the url '/webwork/static/richtexteditor/editor/filemanager/browser/default/browser.html?&Type=Image&Connector=connectors/jsp/connector.action'.
The page browser.html which comes with FCK Editor will trigger the url
'/webwork/richtexteditor/editor/filemanager/browser/default/connectors/jsp/connector.action' which will
caused the webwork's DefaultRichtexteditorConnector to be executed. The trigerring url could be
changed by altering the 'imageBrowseURL'. There 3 types of such related url, namely 'imageBrowseURL',
'linkBrowseURL' and 'flashBrowseURL'. It is recomended that the default one being used. One could change the
Connector parameter instead. For example
/webwork/static/richtexteditor/editor/filemanager/browser/default/browser.html?
&Type=Image&Connector=connectors/jsp/connector.action
could be changed to
/webwork/static/richtexteditor/editor/filemanager/browser/default/browser.html?
&Type=Image&Connector=myLittlePath/myConnector.action
In this case the action will need to have a namespace of '/webwork/richtexteditor/editor/filemanager/browser/default/myLittlePath'
and action name of 'myConnector'
By default the action method that needs to be defined in xwork.xml needs to be 'browse'. If this needs
to be something else say, myBrowse, the following could be used
public String myBrowse() {
browse();
}
It is possible for the richtexteditor to do server side uploading as well. For example when clicking
on the 'Image' button and then the 'Upload' tab and then selecting a file from client local
machine and the clicking 'Send it to the server'. To integrate this functionality with
webwork, one need to defined the following action definition typically in xwork.xml
<package name="richtexteditor-upload" extends="webwork-default"
namespace="/webwork/richtexteditor/editor/filemanager/upload">
<action name="uploader"
class="com.opensymphony.webwork.components.DefaultRichtexteditorConnector"
method="upload">
<result name="richtexteditorFileUpload" />
</action>
</package>
By default whenever an upload command is triggered, a '/webwork/static/richtexteditor/editor/filemanager/upload/uploader.action?Type=Image'
will be issued. This could be changed by setting the imageUploadURL attribute of the tag.
When this link is issued, the webwork action will get executed. There's 3 such related upload url
namely, 'imageUploadURL', 'linkUploadURL' and 'flashUploadURL'. It is recomended that the default
one being used. However one could change the url, but need to include the Type parameter. For example
/webwork/static/richtexteditor/editor/filemanager/upload/uploader.action?Type=Image
could be changed to
/webwork/static/richtexteditor/editor/filemanager/upload/aDifferentUploader.action?Type=Image
In this case the action will need to have a namespace of '/webwork/static/richtexteditor/editor/filemanager/upload'
and action name of 'aDifferentUploader'
By default the action method that needs to be defined in xwork.xml needs to be 'upload'. If this needs
to be something else say, myUpload, the following could be used
public String myUpload() {
upload();
}
The webwork action that handles the server-side browsing and uploading needs to extends from
AbstractRichtexteditorConnector.
There are four abstract methods need to be implemented, namely
protected abstract String calculateServerPath(String serverPath, String folderPath,
String type) throws Exception;
protected abstract Folder[] getFolders(String virtualFolderPath, String type)
throws Exception;
protected abstract FoldersAndFiles getFoldersAndFiles(String virtualFolderPath,
String type) throws Exception;
protected abstract CreateFolderResult createFolder(String virtualFolderPath,
String type, String newFolderName) throws Exception;
protected abstract FileUploadResult fileUpload(String virtualFolderPath,
String type, String filename, String contentType, java.io.File newFile)
throws Exception;
protected abstract void unknownCommand(String command, String virtualFolderPath,
String type, String filename, String contentType, java.io.File newFile)
throws Exception;
author: tm_jee version: $Date: 2006-03-18 17:28:55 +0100 (Sat, 18 Mar 2006) $ $Id: RichTextEditor.java 2468 2006-03-18 16:28:55Z rgielen $ See Also: AbstractRichtexteditorConnector |
evaluateExtraParams | protected void evaluateExtraParams()(Code) | | |
getAllowFlashBrowse | public String getAllowFlashBrowse()(Code) | | |
getAllowFlashUpload | public String getAllowFlashUpload()(Code) | | |
getAllowImageBrowse | public String getAllowImageBrowse()(Code) | | |
getAllowImageUpload | public String getAllowImageUpload()(Code) | | |
getAutoDetectLanguage | public String getAutoDetectLanguage()(Code) | | |
getContentLangDirection | public String getContentLangDirection()(Code) | | |
getCustomConfigurationsPath | public String getCustomConfigurationsPath()(Code) | | |
getDefaultTemplate | protected String getDefaultTemplate()(Code) | | |
getEnableSourceXHTML | public String getEnableSourceXHTML()(Code) | | |
getFlashUploadAllowedExtension | public String getFlashUploadAllowedExtension()(Code) | | |
getFlashUploadDeniedExtension | public String getFlashUploadDeniedExtension()(Code) | | |
getForcePasteAsPlainText | public String getForcePasteAsPlainText()(Code) | | |
getForceSimpleAmpersand | public String getForceSimpleAmpersand()(Code) | | |
getFormatIndentator | public String getFormatIndentator()(Code) | | |
getImageUploadAllowedExtension | public String getImageUploadAllowedExtension()(Code) | | |
getImageUploadDeniedExtension | public String getImageUploadDeniedExtension()(Code) | | |
getLinkUploadAllowedExtension | public String getLinkUploadAllowedExtension()(Code) | | |
getLinkUploadDeniedExtension | public String getLinkUploadDeniedExtension()(Code) | | |
getRichTextEditorJsLang | protected String getRichTextEditorJsLang()(Code) | | |
getTemplatesXmlPath | public String getTemplatesXmlPath()(Code) | | |
getToolbarCanCollapse | public String getToolbarCanCollapse()(Code) | | |
getToolbarStartExpanded | public String getToolbarStartExpanded()(Code) | | |
getUseBROnCarriageReturn | public String getUseBROnCarriageReturn()(Code) | | |
setAllowFlashBrowse | public void setAllowFlashBrowse(String allowFlashBrowse)(Code) | | determine if to allow flash browsing
|
setAllowFlashUpload | public void setAllowFlashUpload(String allowFlashUpload)(Code) | | determine if to allow flash upload
|
setAllowImageBrowse | public void setAllowImageBrowse(String allowImageBrowse)(Code) | | determine if to allow image browsing
|
setAllowImageUpload | public void setAllowImageUpload(String allowImageUpload)(Code) | | determine if to allow image uploading
|
setAllowLinkBrowse | public void setAllowLinkBrowse(String allowLinkBrowse)(Code) | | determine if to allow link browsing
|
setAllowLinkUpload | public void setAllowLinkUpload(String allowLinkUpload)(Code) | | determine if to allow link uploading
|
setAutoDetectLanguage | public void setAutoDetectLanguage(String autoDetectLanguage)(Code) | | Tells the editor to automatically detect the user language preferences to adapt its interface language. With Internet Explorer, the language configured in the Windows Control Panel is used. With Firefox, the browser language is used
|
setBaseHref | public void setBaseHref(String baseHref)(Code) | | Base URL used to resolve links (on images, links, styles, etc.). 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.
|
setBasePath | public void setBasePath(String basePath)(Code) | | Set the dir where the FCKeditor files reside on the server
|
setCheckBrowser | public void setCheckBrowser(String checkBrowser)(Code) | | Whether the rich text editor should check for browser compatibility when rendering its toolbar
|
setContentLangDirection | public void setContentLangDirection(String contentLangDirection)(Code) | | Sets the direction of the editor area contents. Either ltr or rtl
|
setCustomConfigurationsPath | public void setCustomConfigurationsPath(String customConfigurationsPath)(Code) | | Set the path of a custom file that can override some configurations. It is recommended to use absolute paths (starting with /), like /myfckconfig.js.
|
setDebug | public void setDebug(String debug)(Code) | | Enables the debug window to be shown when calling the FCKDebug.Output() function.
|
setDefaultLanguage | public void setDefaultLanguage(String defaultLanguage)(Code) | | Sets the default language used for the editor's interface localization. The default language is used when the AutoDetectLanguage options is disabled or when the user language is not available.
|
setDisplayError | public void setDisplayError(String displayError)(Code) | | Whether should the rich text editor display error when it fails to render etc.
|
setEditorAreaCSS | public void setEditorAreaCSS(String editorAreaCSS)(Code) | | Set the CSS styles file to be used in the editing area. In this way you can point to a file that reflects your web site styles
|
setEnableSourceXHTML | public void setEnableSourceXHTML(String enableSourceXHTML)(Code) | | Tells the editor to process the HTML source to XHTML when switching from WYSIWYG to Source view
|
setEnableXHTML | public void setEnableXHTML(String enableXHTML)(Code) | | Tells the editor to process the HTML source to XHTML on form post.
|
setFillEmptyBlocks | public void setFillEmptyBlocks(String fillEmptyBlocks)(Code) | | Block elements (like P, DIV, H1, PRE, etc...) are forced to have content (a ).
Empty blocks are "collapsed" by while browsing, so a empty <p></p> is not visible.
While editing, the editor "expand" empty blocks so you can insert content inside then.
Setting this option to "true" results useful to reflect the same output when browsing and editing.
|
setFlashBrowserURL | public void setFlashBrowserURL(String flashBrowserURL)(Code) | | Sets the URL of the page called when the user clicks the 'Browse Server' button in the "Flash" dialog window. In this way, you can create your custom Flash Browser that is well integrated with your system.
|
setFlashUploadAllowedExtension | public void setFlashUploadAllowedExtension(String flashUploadAllowedExtension)(Code) | | regexp for allowed flash upload file format
|
setFlashUploadDeniedExtension | public void setFlashUploadDeniedExtension(String flashUploadDeniedExtension)(Code) | | regexp for deinied flash upload file format
|
setFlashUploadURL | public void setFlashUploadURL(String flashUploadURL)(Code) | | Sets the URL of the upload handler called when the user clicks the 'Send it to server' button in the "Flash" dialog window. In this way, you can create your custom Flash Uploader that is well integrated with your system.
|
setFontColors | public void setFontColors(String fontColors)(Code) | | Sets the colors that must be shown in the colors panels (in the toolbar).
|
setFontFormats | public void setFontFormats(String fontFormats)(Code) | | Sets the list of formats to be shown in the "Format" toolbar command.
|
setFontNames | public void setFontNames(String fontNames)(Code) | | Sets the list of fonts to be shown in the "Font" toolbar command.
|
setFontSizes | public void setFontSizes(String fontSizes)(Code) | | Sets the list of font sizes to be shown in the "Size" toolbar command.
|
setForcePasteAsPlainText | public void setForcePasteAsPlainText(String forcePasteAsPlainText)(Code) | | Converts the clipboard contents to pure text on pasting operations
|
setForceSimpleAmpersand | public void setForceSimpleAmpersand(String forceSimpleAmpersand)(Code) | | Forces the ampersands (&) on tags attributes to not be converted to '&' This conversion is a W3C requirement for XHTML, so it is recommended to leave this option to 'false'.
|
setFormatIndentator | public void setFormatIndentator(String formatIndentator)(Code) | | Sets the characters to be used when indenting the HTML source when formatting it. Useful values are a sequence of spaces (' ') or a tab char ('\t').
|
setFormatOutput | public void setFormatOutput(String formatOutput)(Code) | | The output HTML generated by the editor will be processed and formatted.
|
setFormatSource | public void setFormatSource(String formatSource)(Code) | | The HTML shown by the editor, while switching from WYSIWYG to Source views, will be processed and formatted
|
setFullPage | public void setFullPage(String fullPage)(Code) | | Enables full page editing (from <HTML> to </HTML>). It also enables the 'Page Properties' toolbar button.
|
setGeckoUseSPAN | public void setGeckoUseSPAN(String geckoUseSPAN)(Code) | | Tells Gecko browsers to use SPAN instead of <B>, <I> and <U> for bold, italic an underline
|
setHeight | public void setHeight(String height)(Code) | | Set the height of the rich text editor
|
setImageBrowserURL | public void setImageBrowserURL(String imageBrowserURL)(Code) | | Sets the URL of the page called when the user clicks the 'Browse Server' button in the 'Image' dialog window. In this way, you can create your custom Image Browser that is well integrated with your system.
|
setImageUploadAllowedExtension | public void setImageUploadAllowedExtension(String imageUploadAllowedExtension)(Code) | | regexp for allowed image upload file format
|
setImageUploadDeniedExtension | public void setImageUploadDeniedExtension(String imageUploadDeniedExtension)(Code) | | regexp for denied image upload file format
|
setImageUploadURL | public void setImageUploadURL(String imageUploadURL)(Code) | | Sets the URL of the upload handler called when the user clicks the 'Send it to server' button in the 'Image' dialog window. In this way, you can create your custom Image Uploader that is well integrated with your system.
|
setLinkBrowserURL | public void setLinkBrowserURL(String linkBrowserURL)(Code) | | Sets the URL of the page called when the user clicks the 'Browse Server' button in the 'Link' dialog window. In this way, you can create your custom File Browser that is well integrated with your system.
|
setLinkUploadAllowedExtension | public void setLinkUploadAllowedExtension(String linkUploadAllowedExtension)(Code) | | regexp for allowed link upload file format
|
setLinkUploadDeniedExtension | public void setLinkUploadDeniedExtension(String linkUploadDeniedExtension)(Code) | | regexp for denied link upload file format
|
setLinkUploadURL | public void setLinkUploadURL(String linkUploadURL)(Code) | | Sets the URL of the upload handler called when the user clicks the 'Send it to server' button in the 'Link' dialog window. In this way, you can create your custom Link Uploader that is well integrated with your system.
|
setPluginsPath | public void setPluginsPath(String pluginsPath)(Code) | | Sets the base path used when looking for registered plugins.
|
setSkinPath | public void setSkinPath(String skinPath)(Code) | | Sets the path to the skin (graphical interface settings) to be used by the editor.
|
setSmileyImages | public void setSmileyImages(String smileyImages)(Code) | | js array of smilies files to be included
|
setSmileyPath | public void setSmileyPath(String smileyPath)(Code) | | path where smilies are located
|
setStartupFocus | public void setStartupFocus(String startupFocus)(Code) | | Forces the editor to get the keyboard input focus on startup (page load)
|
setStylesXmlPath | public void setStylesXmlPath(String stylesXmlPath)(Code) | | Sets the path to the XML file that has the definitions and rules of the styles used by the 'Style' toolbar command
|
setTabSpaces | public void setTabSpaces(String tabSpaces)(Code) | | Set the number of spaces ( ) to be inserted when the user hits the 'tab' key. This is an Internet Explorer only feature. Other browsers insert spaces automatically by default.
|
setTemplatesXmlPath | public void setTemplatesXmlPath(String templatesXmlPath)(Code) | | |
setToolbarCanCollapse | public void setToolbarCanCollapse(String toolbarCanCollapse)(Code) | | Tells the editor that the toolbar can be Collapsed/Expanded by the user when clicking the vertical bar placed on the left of it (on the right for 'rtl' languages).
|
setToolbarSet | public void setToolbarSet(String toolbarSet)(Code) | | Set the name of the toolbar to display
|
setToolbarStartExpanded | public void setToolbarStartExpanded(String toolbarStartExpanded)(Code) | | Decide if the toolbar should be expanded when the rich text editor is loaded
|
setUseBROnCarriageReturn | public void setUseBROnCarriageReturn(String useBROnCarriageReturn)(Code) | | Decide if a <br/> should be used in place of the occurence of a carriage return
|
setWidth | public void setWidth(String width)(Code) | | set the width of the rich text editor
|
Methods inherited from com.opensymphony.webwork.components.Component | public void addAllParameters(Map params)(Code)(Java Doc) public void addParameter(String key, Object value)(Code)(Java Doc) public boolean altSyntax()(Code)(Java Doc) public void copyParams(Map params)(Code)(Java Doc) protected String determineActionURL(String action, String namespace, String method, HttpServletRequest req, HttpServletResponse res, Map parameters, String scheme, boolean includeContext, boolean encodeResult, boolean escapeXml)(Code)(Java Doc) protected String determineNamespace(String namespace, OgnlValueStack stack, HttpServletRequest req)(Code)(Java Doc) public boolean end(Writer writer, String body)(Code)(Java Doc) protected boolean end(Writer writer, String body, boolean popComponentStack)(Code)(Java Doc) protected WebWorkException fieldError(String field, String errorMsg, Exception e)(Code)(Java Doc) protected Component findAncestor(Class clazz)(Code)(Java Doc) protected String findString(String expr)(Code)(Java Doc) protected String findString(String expr, String field, String errorMsg)(Code)(Java Doc) protected Object findValue(String expr)(Code)(Java Doc) protected Object findValue(String expr, String field, String errorMsg)(Code)(Java Doc) protected Object findValue(String expr, Class toType)(Code)(Java Doc) public Stack getComponentStack()(Code)(Java Doc) public String getId()(Code)(Java Doc) public Map getParameters()(Code)(Java Doc) public OgnlValueStack getStack()(Code)(Java Doc) protected void popComponentStack()(Code)(Java Doc) public void setId(String id)(Code)(Java Doc) public boolean start(Writer writer)(Code)(Java Doc) protected String toString(Throwable t)(Code)(Java Doc) public boolean usesBody()(Code)(Java Doc)
|
|
|
|