|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.webwork.components.Component
com.opensymphony.webwork.components.UIBean
com.opensymphony.webwork.components.RichTextEditor
public class RichTextEditor
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.actioncould be changed to
/webwork/static/richtexteditor/editor/filemanager/browser/default/browser.html? &Type=Image&Connector=myLittlePath/myConnector.actionIn 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=Imagecould be changed to
/webwork/static/richtexteditor/editor/filemanager/upload/aDifferentUploader.action?Type=ImageIn 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;
AbstractRichtexteditorConnector
Field Summary | |
---|---|
static String |
TEMPLATE
|
Fields inherited from class com.opensymphony.webwork.components.UIBean |
---|
accesskey, cssClass, cssStyle, disabled, label, labelPosition, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, required, requiredposition, response, tabindex, template, templateDir, templateSuffix, theme, title, tooltip, tooltipConfig, value |
Fields inherited from class com.opensymphony.webwork.components.Component |
---|
COMPONENT_STACK, id, parameters, stack |
Constructor Summary | |
---|---|
RichTextEditor(OgnlValueStack stack,
HttpServletRequest request,
HttpServletResponse response)
|
Method Summary | |
---|---|
protected void |
evaluateExtraParams()
|
String |
getAllowFlashBrowse()
|
String |
getAllowFlashUpload()
|
String |
getAllowImageBrowse()
|
String |
getAllowImageUpload()
|
String |
getAllowLinkBrowse()
|
String |
getAllowLinkUpload()
|
String |
getAutoDetectLanguage()
|
String |
getBaseHref()
|
String |
getBasePath()
|
String |
getCheckBrowser()
|
String |
getContentLangDirection()
|
String |
getCustomConfigurationsPath()
|
String |
getDebug()
|
String |
getDefaultLanguage()
|
protected String |
getDefaultTemplate()
A contract that requires each concrete UI Tag to specify which template should be used as a default. |
String |
getDisplayError()
|
String |
getEditorAreaCSS()
|
String |
getEnableSourceXHTML()
|
String |
getEnableXHTML()
|
String |
getFillEmptyBlocks()
|
String |
getFlashBrowserURL()
|
String |
getFlashUploadAllowedExtension()
|
String |
getFlashUploadDeniedExtension()
|
String |
getFlashUploadURL()
|
String |
getFontColors()
|
String |
getFontFormats()
|
String |
getFontNames()
|
String |
getFontSizes()
|
String |
getForcePasteAsPlainText()
|
String |
getForceSimpleAmpersand()
|
String |
getFormatIndentator()
|
String |
getFormatOutput()
|
String |
getFormatSource()
|
String |
getFullPage()
|
String |
getGeckoUseSPAN()
|
String |
getHeight()
|
String |
getImageBrowserURL()
|
String |
getImageUploadAllowedExtension()
|
String |
getImageUploadDeniedExtension()
|
String |
getImageUploadURL()
|
String |
getLinkBrowserURL()
|
String |
getLinkUploadAllowedExtension()
|
String |
getLinkUploadDeniedExtension()
|
String |
getLinkUploadURL()
|
String |
getPluginsPath()
|
protected String |
getRichTextEditorJsLang()
|
String |
getSkinPath()
|
String |
getSmileyImages()
|
String |
getSmileyPath()
|
String |
getStartupFocus()
|
String |
getStylesXmlPath()
|
String |
getTabSpaces()
|
String |
getTemplatesXmlPath()
|
String |
getToolbarCanCollapse()
|
String |
getToolbarSet()
|
String |
getToolbarStartExpanded()
|
String |
getUseBROnCarriageReturn()
|
String |
getWidth()
|
void |
setAllowFlashBrowse(String allowFlashBrowse)
determine if to allow flash browsing |
void |
setAllowFlashUpload(String allowFlashUpload)
determine if to allow flash upload |
void |
setAllowImageBrowse(String allowImageBrowse)
determine if to allow image browsing |
void |
setAllowImageUpload(String allowImageUpload)
determine if to allow image uploading |
void |
setAllowLinkBrowse(String allowLinkBrowse)
determine if to allow link browsing |
void |
setAllowLinkUpload(String allowLinkUpload)
determine if to allow link uploading |
void |
setAutoDetectLanguage(String autoDetectLanguage)
Tells the editor to automatically detect the user language preferences to adapt its interface language. |
void |
setBaseHref(String baseHref)
Base URL used to resolve links (on images, links, styles, etc.). |
void |
setBasePath(String basePath)
Set the dir where the FCKeditor files reside on the server |
void |
setCheckBrowser(String checkBrowser)
Whether the rich text editor should check for browser compatibility when rendering its toolbar |
void |
setContentLangDirection(String contentLangDirection)
Sets the direction of the editor area contents. |
void |
setCustomConfigurationsPath(String customConfigurationsPath)
Set the path of a custom file that can override some configurations. |
void |
setDebug(String debug)
Enables the debug window to be shown when calling the FCKDebug.Output() function. |
void |
setDefaultLanguage(String defaultLanguage)
Sets the default language used for the editor's interface localization. |
void |
setDisplayError(String displayError)
Whether should the rich text editor display error when it fails to render etc. |
void |
setEditorAreaCSS(String editorAreaCSS)
Set the CSS styles file to be used in the editing area. |
void |
setEnableSourceXHTML(String enableSourceXHTML)
Tells the editor to process the HTML source to XHTML when switching from WYSIWYG to Source view |
void |
setEnableXHTML(String enableXHTML)
Tells the editor to process the HTML source to XHTML on form post. |
void |
setFillEmptyBlocks(String fillEmptyBlocks)
Block elements (like P, DIV, H1, PRE, etc...) are forced to have content (a ). |
void |
setFlashBrowserURL(String flashBrowserURL)
Sets the URL of the page called when the user clicks the 'Browse Server' button in the "Flash" dialog window. |
void |
setFlashUploadAllowedExtension(String flashUploadAllowedExtension)
regexp for allowed flash upload file format |
void |
setFlashUploadDeniedExtension(String flashUploadDeniedExtension)
regexp for deinied flash upload file format |
void |
setFlashUploadURL(String flashUploadURL)
Sets the URL of the upload handler called when the user clicks the 'Send it to server' button in the "Flash" dialog window. |
void |
setFontColors(String fontColors)
Sets the colors that must be shown in the colors panels (in the toolbar). |
void |
setFontFormats(String fontFormats)
Sets the list of formats to be shown in the "Format" toolbar command. |
void |
setFontNames(String fontNames)
Sets the list of fonts to be shown in the "Font" toolbar command. |
void |
setFontSizes(String fontSizes)
Sets the list of font sizes to be shown in the "Size" toolbar command. |
void |
setForcePasteAsPlainText(String forcePasteAsPlainText)
Converts the clipboard contents to pure text on pasting operations |
void |
setForceSimpleAmpersand(String forceSimpleAmpersand)
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'. |
void |
setFormatIndentator(String formatIndentator)
Sets the characters to be used when indenting the HTML source when formatting it. |
void |
setFormatOutput(String formatOutput)
The output HTML generated by the editor will be processed and formatted. |
void |
setFormatSource(String formatSource)
The HTML shown by the editor, while switching from WYSIWYG to Source views, will be processed and formatted |
void |
setFullPage(String fullPage)
Enables full page editing (from <HTML> to </HTML>). |
void |
setGeckoUseSPAN(String geckoUseSPAN)
Tells Gecko browsers to use SPAN instead of <B>, <I> and <U> for bold, italic an underline |
void |
setHeight(String height)
Set the height of the rich text editor |
void |
setImageBrowserURL(String imageBrowserURL)
Sets the URL of the page called when the user clicks the 'Browse Server' button in the 'Image' dialog window. |
void |
setImageUploadAllowedExtension(String imageUploadAllowedExtension)
regexp for allowed image upload file format |
void |
setImageUploadDeniedExtension(String imageUploadDeniedExtension)
regexp for denied image upload file format |
void |
setImageUploadURL(String imageUploadURL)
Sets the URL of the upload handler called when the user clicks the 'Send it to server' button in the 'Image' dialog window. |
void |
setLinkBrowserURL(String linkBrowserURL)
Sets the URL of the page called when the user clicks the 'Browse Server' button in the 'Link' dialog window. |
void |
setLinkUploadAllowedExtension(String linkUploadAllowedExtension)
regexp for allowed link upload file format |
void |
setLinkUploadDeniedExtension(String linkUploadDeniedExtension)
regexp for denied link upload file format |
void |
setLinkUploadURL(String linkUploadURL)
Sets the URL of the upload handler called when the user clicks the 'Send it to server' button in the 'Link' dialog window. |
void |
setPluginsPath(String pluginsPath)
Sets the base path used when looking for registered plugins. |
void |
setSkinPath(String skinPath)
Sets the path to the skin (graphical interface settings) to be used by the editor. |
void |
setSmileyImages(String smileyImages)
js array of smilies files to be included |
void |
setSmileyPath(String smileyPath)
path where smilies are located |
void |
setStartupFocus(String startupFocus)
Forces the editor to get the keyboard input focus on startup (page load) |
void |
setStylesXmlPath(String stylesXmlPath)
Sets the path to the XML file that has the definitions and rules of the styles used by the 'Style' toolbar command |
void |
setTabSpaces(String tabSpaces)
Set the number of spaces ( ) to be inserted when the user hits the 'tab' key. |
void |
setTemplatesXmlPath(String templatesXmlPath)
|
void |
setToolbarCanCollapse(String toolbarCanCollapse)
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). |
void |
setToolbarSet(String toolbarSet)
Set the name of the toolbar to display |
void |
setToolbarStartExpanded(String toolbarStartExpanded)
Decide if the toolbar should be expanded when the rich text editor is loaded |
void |
setUseBROnCarriageReturn(String useBROnCarriageReturn)
Decide if a <br/> should be used in place of the occurence of a carriage return |
void |
setWidth(String width)
set the width of the rich text editor |
Methods inherited from class com.opensymphony.webwork.components.UIBean |
---|
addFormParameter, buildTemplateName, enableAncestorFormCustomOnsubmit, end, escape, evaluateNameValue, evaluateParams, getTemplate, getTemplateDir, getTheme, getTooltipConfig, getValueClassType, mergeTemplate, populateComponentHtmlId, setAccesskey, setCssClass, setCssStyle, setDisabled, setLabel, setLabelposition, setLabelPosition, setName, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequired, setRequiredposition, setTabindex, setTemplate, setTemplateDir, setTheme, setTitle, setTooltip, setTooltipConfig, setValue |
Methods inherited from class com.opensymphony.webwork.components.Component |
---|
addAllParameters, addParameter, altSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findValue, findValue, findValue, getComponentStack, getId, getParameters, getStack, popComponentStack, setId, start, toString, usesBody |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String TEMPLATE
Constructor Detail |
---|
public RichTextEditor(OgnlValueStack stack, HttpServletRequest request, HttpServletResponse response)
Method Detail |
---|
protected String getDefaultTemplate()
UIBean
getDefaultTemplate
in class UIBean
protected void evaluateExtraParams()
evaluateExtraParams
in class UIBean
protected String getRichTextEditorJsLang()
public String getCheckBrowser()
public void setCheckBrowser(String checkBrowser)
public String getDisplayError()
public void setDisplayError(String displayError)
public String getAutoDetectLanguage()
public void setAutoDetectLanguage(String autoDetectLanguage)
public String getBaseHref()
public void setBaseHref(String baseHref)
public String getBasePath()
public void setBasePath(String basePath)
public String getContentLangDirection()
public void setContentLangDirection(String contentLangDirection)
public String getCustomConfigurationsPath()
public void setCustomConfigurationsPath(String customConfigurationsPath)
public String getDebug()
public void setDebug(String debug)
public String getDefaultLanguage()
public void setDefaultLanguage(String defaultLanguage)
public String getEditorAreaCSS()
public void setEditorAreaCSS(String editorAreaCSS)
public String getEnableSourceXHTML()
public void setEnableSourceXHTML(String enableSourceXHTML)
public String getEnableXHTML()
public void setEnableXHTML(String enableXHTML)
public String getFillEmptyBlocks()
public void setFillEmptyBlocks(String fillEmptyBlocks)
public String getFlashBrowserURL()
public void setFlashBrowserURL(String flashBrowserURL)
public String getFlashUploadURL()
public void setFlashUploadURL(String flashUploadURL)
public String getFontColors()
public void setFontColors(String fontColors)
public String getFontFormats()
public void setFontFormats(String fontFormats)
public String getFontNames()
public void setFontNames(String fontNames)
public String getFontSizes()
public void setFontSizes(String fontSizes)
public String getForcePasteAsPlainText()
public void setForcePasteAsPlainText(String forcePasteAsPlainText)
public String getForceSimpleAmpersand()
public void setForceSimpleAmpersand(String forceSimpleAmpersand)
public String getFormatIndentator()
public void setFormatIndentator(String formatIndentator)
public String getFormatOutput()
public void setFormatOutput(String formatOutput)
public String getFormatSource()
public void setFormatSource(String formatSource)
public String getFullPage()
public void setFullPage(String fullPage)
public String getGeckoUseSPAN()
public void setGeckoUseSPAN(String geckoUseSPAN)
public String getHeight()
public void setHeight(String height)
public String getImageBrowserURL()
public void setImageBrowserURL(String imageBrowserURL)
public String getImageUploadURL()
public void setImageUploadURL(String imageUploadURL)
public String getLinkBrowserURL()
public void setLinkBrowserURL(String linkBrowserURL)
public String getLinkUploadURL()
public void setLinkUploadURL(String linkUploadURL)
public String getPluginsPath()
public void setPluginsPath(String pluginsPath)
public String getSkinPath()
public void setSkinPath(String skinPath)
public String getStartupFocus()
public void setStartupFocus(String startupFocus)
public String getStylesXmlPath()
public void setStylesXmlPath(String stylesXmlPath)
public String getTabSpaces()
public void setTabSpaces(String tabSpaces)
public String getToolbarCanCollapse()
public void setToolbarCanCollapse(String toolbarCanCollapse)
public String getToolbarSet()
public void setToolbarSet(String toolbarSet)
public String getToolbarStartExpanded()
public void setToolbarStartExpanded(String toolbarStartExpanded)
public String getUseBROnCarriageReturn()
public void setUseBROnCarriageReturn(String useBROnCarriageReturn)
public String getWidth()
public void setWidth(String width)
public String getAllowFlashBrowse()
public void setAllowFlashBrowse(String allowFlashBrowse)
public String getAllowFlashUpload()
public void setAllowFlashUpload(String allowFlashUpload)
public String getAllowImageBrowse()
public void setAllowImageBrowse(String allowImageBrowse)
public String getAllowImageUpload()
public void setAllowImageUpload(String allowImageUpload)
public String getAllowLinkBrowse()
public void setAllowLinkBrowse(String allowLinkBrowse)
public String getAllowLinkUpload()
public void setAllowLinkUpload(String allowLinkUpload)
public String getFlashUploadAllowedExtension()
public void setFlashUploadAllowedExtension(String flashUploadAllowedExtension)
public String getFlashUploadDeniedExtension()
public void setFlashUploadDeniedExtension(String flashUploadDeniedExtension)
public String getImageUploadAllowedExtension()
public void setImageUploadAllowedExtension(String imageUploadAllowedExtension)
public String getImageUploadDeniedExtension()
public void setImageUploadDeniedExtension(String imageUploadDeniedExtension)
public String getLinkUploadAllowedExtension()
public void setLinkUploadAllowedExtension(String linkUploadAllowedExtension)
public String getLinkUploadDeniedExtension()
public void setLinkUploadDeniedExtension(String linkUploadDeniedExtension)
public String getSmileyImages()
public void setSmileyImages(String smileyImages)
public String getSmileyPath()
public void setSmileyPath(String smileyPath)
public String getTemplatesXmlPath()
public void setTemplatesXmlPath(String templatesXmlPath)
|
WebWork Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |