org.opencms.workplace.editors
Class CmsEditorActionDefault

java.lang.Object
  extended byorg.opencms.workplace.editors.CmsEditorActionDefault
All Implemented Interfaces:
I_CmsEditorActionHandler

public class CmsEditorActionDefault
extends java.lang.Object
implements I_CmsEditorActionHandler

Provides a method to perform a user defined action when editing a page.

Since:
6.0.0
Version:
$Revision: 1.19 $
Author:
Andreas Zahner

Field Summary
 
Fields inherited from interface org.opencms.workplace.editors.I_CmsEditorActionHandler
DIRECT_EDIT_AREA_END, DIRECT_EDIT_AREA_START, DIRECT_EDIT_INCLUDE_FILE_URI, DIRECT_EDIT_INCLUDE_FILE_URI_DEFAULT, DIRECT_EDIT_INCLUDES, DIRECT_EDIT_MODE_DISABLED, DIRECT_EDIT_MODE_ENABLED, DIRECT_EDIT_MODE_INACTIVE, DIRECT_EDIT_OPTION_DELETE, DIRECT_EDIT_OPTION_EDIT, DIRECT_EDIT_OPTION_NEW, DIRECT_EDIT_PARAM_BUTTONSTYLE, DIRECT_EDIT_PARAM_ELEMENT, DIRECT_EDIT_PARAM_LOCALE, DIRECT_EDIT_PARAM_NEWLINK, DIRECT_EDIT_PARAM_OPTIONS, DIRECT_EDIT_PARAM_TARGET
 
Constructor Summary
CmsEditorActionDefault()
          Default constructor needed for editor action handler implementation.
 
Method Summary
 void editorAction(CmsEditor editor, CmsJspActionElement jsp)
          Performs an action which is configurable in the implementation of the interface, e.g. save, exit, publish.
 java.lang.String getButtonName()
          Returns the key name of the button displayed in the editor.
 java.lang.String getButtonUrl(CmsJspActionElement jsp, java.lang.String resourceName)
          Returns the URL of the button displayed in the editor.
 java.lang.String getEditMode(CmsObject cmsObject, java.lang.String filename, java.lang.String element, javax.servlet.ServletRequest req)
          Checks the current edit mode.
 boolean isButtonActive(CmsJspActionElement jsp, java.lang.String resourceName)
          Returns true if the customized button should be active, otherwise false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsEditorActionDefault

public CmsEditorActionDefault()
Default constructor needed for editor action handler implementation.

Method Detail

editorAction

public void editorAction(CmsEditor editor,
                         CmsJspActionElement jsp)
                  throws java.io.IOException,
                         javax.servlet.jsp.JspException
Description copied from interface: I_CmsEditorActionHandler
Performs an action which is configurable in the implementation of the interface, e.g. save, exit, publish.

Specified by:
editorAction in interface I_CmsEditorActionHandler
Parameters:
editor - the current editor instance
jsp - the JSP action element
Throws:
java.io.IOException - if a redirection fails
javax.servlet.jsp.JspException - if including a JSP fails
See Also:
I_CmsEditorActionHandler.editorAction(org.opencms.workplace.editors.CmsEditor, org.opencms.jsp.CmsJspActionElement)

getButtonName

public java.lang.String getButtonName()
Description copied from interface: I_CmsEditorActionHandler
Returns the key name of the button displayed in the editor.

Specified by:
getButtonName in interface I_CmsEditorActionHandler
Returns:
the key name of the button
See Also:
I_CmsEditorActionHandler.getButtonName()

getButtonUrl

public java.lang.String getButtonUrl(CmsJspActionElement jsp,
                                     java.lang.String resourceName)
Description copied from interface: I_CmsEditorActionHandler
Returns the URL of the button displayed in the editor.

Specified by:
getButtonUrl in interface I_CmsEditorActionHandler
Parameters:
jsp - the JSP action element
resourceName - the name of the edited resource
Returns:
the URL of the button
See Also:
I_CmsEditorActionHandler.getButtonUrl(CmsJspActionElement, java.lang.String)

getEditMode

public java.lang.String getEditMode(CmsObject cmsObject,
                                    java.lang.String filename,
                                    java.lang.String element,
                                    javax.servlet.ServletRequest req)
Description copied from interface: I_CmsEditorActionHandler
Checks the current edit mode.

The mode is used to select the appropriate elements for displaying the direct edit button. If the resource is displayed in online project -> editmode = null If the resource is temporary -> editmode = inactive If the resource does not belong to the current project -> editmode = inactive If the current user has no write permissions on the resource -> editmode = inactive If the resource is locked for another user -> editmode = disabled Otherwise -> editmode = enabled

Specified by:
getEditMode in interface I_CmsEditorActionHandler
Parameters:
cmsObject - the cms object
filename - name of the resource
element - of the desired element or null
req - the current request
Returns:
the current edit mode ( null | inactive | disabled | enabled )
See Also:
I_CmsEditorActionHandler.getEditMode(org.opencms.file.CmsObject, java.lang.String, java.lang.String, javax.servlet.ServletRequest)

isButtonActive

public boolean isButtonActive(CmsJspActionElement jsp,
                              java.lang.String resourceName)
Description copied from interface: I_CmsEditorActionHandler
Returns true if the customized button should be active, otherwise false.

Specified by:
isButtonActive in interface I_CmsEditorActionHandler
Parameters:
jsp - the JSP action element
resourceName - the name of the edited resource
Returns:
true if the customized button should be active, otherwise false
See Also:
I_CmsEditorActionHandler.isButtonActive(CmsJspActionElement, java.lang.String)