org.opencms.workplace.editors.directedit
Class CmsDirectEditJspIncludeProvider

java.lang.Object
  extended byorg.opencms.workplace.editors.directedit.A_CmsDirectEditProvider
      extended byorg.opencms.workplace.editors.directedit.CmsDirectEditJspIncludeProvider
All Implemented Interfaces:
java.lang.Cloneable, I_CmsConfigurationParameterHandler, I_CmsDirectEditProvider

public class CmsDirectEditJspIncludeProvider
extends A_CmsDirectEditProvider
implements I_CmsDirectEditProvider

Direct edit provider that uses the same JSP include based logic that has been the default before the 6.2.3 release.

Even though placing the HTML of the direct edit buttons appears to be more "flexible" at first, there is a large overhead invloved using this provider as compared to an implementation like CmsDirectEditDefaultProvider. For every direct edit button on a page, a JSP include is processed twice using this provider, one include for the opening and one for the closing HTML. A JSP include is a costly operation, which means the performance of a website is be impacted if many content managers work on the system that makes great use of direct edit with a lot of elements on a page. In order to avoid this performance impact, OpenCms since version 6.2.3 uses the CmsDirectEditDefaultProvider by default.

This provider DOES NOT support CmsDirectEditMode.MANUAL mode.

Since:
6.2.3
Version:
$Revision: 1.5 $
Author:
Alexander Kandzior

Field Summary
static java.lang.String DIRECT_EDIT_AREA_END
          Prefix for direct edit end elements, used on JPS pages that supply the direct edit html.
static java.lang.String DIRECT_EDIT_AREA_START
          Prefix for direct edit start elements, used on JPS pages that supply the direct edit html.
static java.lang.String DIRECT_EDIT_INCLUDE_FILE_URI_DEFAULT
          Default direct edit include file URI.
static java.lang.String DIRECT_EDIT_INCLUDES
          Element name for direct edit includes.
static java.lang.String DIRECT_EDIT_PARAM_BUTTONSTYLE
          Key to identify the edit button style, used on JPS pages that supply the direct edit html.
static java.lang.String DIRECT_EDIT_PARAM_ELEMENT
          Key to identify the edit element, used on JPS pages that supply the direct edit html.
static java.lang.String DIRECT_EDIT_PARAM_LOCALE
          Key to identify the edit language, used on JPS pages that supply the direct edit html.
static java.lang.String DIRECT_EDIT_PARAM_NEWLINK
          Key to identify the link to use for the "new" button (if enabled).
static java.lang.String DIRECT_EDIT_PARAM_OPTIONS
          Key to identify additional direct edit options, used e.g. to control which direct edit buttons are displayed
static java.lang.String DIRECT_EDIT_PARAM_TARGET
          Key to identify the edit target, used on JPS pages that supply the direct edit html.
protected  java.lang.String m_editElement
          The last direct edit element.
protected  java.lang.String m_editTarget
          The last direct edit target.
protected  java.lang.String m_permissions
          The last calculated direct edit permissions.
 
Fields inherited from class org.opencms.workplace.editors.directedit.A_CmsDirectEditProvider
INCLUDE_FILE_DEFAULT, m_cms, m_configurationParameters, m_editButtonStyle, m_fileName, m_messages, m_mode, m_rnd
 
Fields inherited from interface org.opencms.workplace.editors.directedit.I_CmsDirectEditProvider
ATTRIBUTE_DIRECT_EDIT_PROVIDER, ATTRIBUTE_DIRECT_EDIT_PROVIDER_PARAMS
 
Fields inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD
 
Constructor Summary
CmsDirectEditJspIncludeProvider()
           
 
Method Summary
static java.lang.String includeDirectEditElement(javax.servlet.jsp.PageContext context, java.lang.String jspIncludeFile, java.lang.String element, java.lang.String editTarget, java.lang.String editElement, java.lang.String editOptions, java.lang.String editPermissions, java.lang.String createLink)
          Includes the "direct edit" element that adds HTML for the editable area to the output page.
 void init(CmsObject cms, CmsDirectEditMode mode, java.lang.String fileName)
          Initialize method for a new instance of the direct edit provider.
 void insertDirectEditEnd(javax.servlet.jsp.PageContext context)
          Inserts the "end direct edit" HTML in the provided JSP page context.
 void insertDirectEditIncludes(javax.servlet.jsp.PageContext context, CmsDirectEditParams params)
          Inserts the "direct edit header" HTML in the provided JSP page context.
 boolean insertDirectEditStart(javax.servlet.jsp.PageContext context, CmsDirectEditParams params)
          Inserts the "start direct edit" HTML in the provided JSP page context.
 boolean isManual(CmsDirectEditMode mode)
          Returns false because the JSP include provider does not support manual button placement.
 I_CmsDirectEditProvider newInstance()
          Creates a new instance of this direct edit provider with the same basic configuration.
 
Methods inherited from class org.opencms.workplace.editors.directedit.A_CmsDirectEditProvider
addConfigurationParameter, getConfiguration, getLink, getNextDirectEditId, getResourceInfo, initConfiguration, print
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler
addConfigurationParameter, getConfiguration, initConfiguration
 

Field Detail

DIRECT_EDIT_AREA_END

public static final java.lang.String DIRECT_EDIT_AREA_END
Prefix for direct edit end elements, used on JPS pages that supply the direct edit html.

See Also:
Constant Field Values

DIRECT_EDIT_AREA_START

public static final java.lang.String DIRECT_EDIT_AREA_START
Prefix for direct edit start elements, used on JPS pages that supply the direct edit html.

See Also:
Constant Field Values

DIRECT_EDIT_INCLUDE_FILE_URI_DEFAULT

public static final java.lang.String DIRECT_EDIT_INCLUDE_FILE_URI_DEFAULT
Default direct edit include file URI.

See Also:
Constant Field Values

DIRECT_EDIT_INCLUDES

public static final java.lang.String DIRECT_EDIT_INCLUDES
Element name for direct edit includes.

See Also:
Constant Field Values

DIRECT_EDIT_PARAM_BUTTONSTYLE

public static final java.lang.String DIRECT_EDIT_PARAM_BUTTONSTYLE
Key to identify the edit button style, used on JPS pages that supply the direct edit html.

See Also:
Constant Field Values

DIRECT_EDIT_PARAM_ELEMENT

public static final java.lang.String DIRECT_EDIT_PARAM_ELEMENT
Key to identify the edit element, used on JPS pages that supply the direct edit html.

See Also:
Constant Field Values

DIRECT_EDIT_PARAM_LOCALE

public static final java.lang.String DIRECT_EDIT_PARAM_LOCALE
Key to identify the edit language, used on JPS pages that supply the direct edit html.

See Also:
Constant Field Values

DIRECT_EDIT_PARAM_NEWLINK

public static final java.lang.String DIRECT_EDIT_PARAM_NEWLINK
Key to identify the link to use for the "new" button (if enabled).

See Also:
Constant Field Values

DIRECT_EDIT_PARAM_OPTIONS

public static final java.lang.String DIRECT_EDIT_PARAM_OPTIONS
Key to identify additional direct edit options, used e.g. to control which direct edit buttons are displayed

See Also:
Constant Field Values

DIRECT_EDIT_PARAM_TARGET

public static final java.lang.String DIRECT_EDIT_PARAM_TARGET
Key to identify the edit target, used on JPS pages that supply the direct edit html.

See Also:
Constant Field Values

m_editElement

protected java.lang.String m_editElement
The last direct edit element.


m_editTarget

protected java.lang.String m_editTarget
The last direct edit target.


m_permissions

protected java.lang.String m_permissions
The last calculated direct edit permissions.

Constructor Detail

CmsDirectEditJspIncludeProvider

public CmsDirectEditJspIncludeProvider()
Method Detail

includeDirectEditElement

public static java.lang.String includeDirectEditElement(javax.servlet.jsp.PageContext context,
                                                        java.lang.String jspIncludeFile,
                                                        java.lang.String element,
                                                        java.lang.String editTarget,
                                                        java.lang.String editElement,
                                                        java.lang.String editOptions,
                                                        java.lang.String editPermissions,
                                                        java.lang.String createLink)
                                                 throws javax.servlet.jsp.JspException
Includes the "direct edit" element that adds HTML for the editable area to the output page.

Parameters:
context - the current JSP page context
jspIncludeFile - the VFS path of the JSP that contains the direct edit HTML fragments
element - the editor element to include
editTarget - the direct edit target
editElement - the direct edit element
editOptions - the direct edit options
editPermissions - the direct edit permissions
createLink - the direct edit create link
Returns:
the direct edit permissions
Throws:
javax.servlet.jsp.JspException - in case something goes wrong

init

public void init(CmsObject cms,
                 CmsDirectEditMode mode,
                 java.lang.String fileName)
Description copied from interface: I_CmsDirectEditProvider
Initialize method for a new instance of the direct edit provider.

Specified by:
init in interface I_CmsDirectEditProvider
Overrides:
init in class A_CmsDirectEditProvider
See Also:
A_CmsDirectEditProvider.init(org.opencms.file.CmsObject, org.opencms.workplace.editors.directedit.CmsDirectEditMode, java.lang.String)

insertDirectEditEnd

public void insertDirectEditEnd(javax.servlet.jsp.PageContext context)
                         throws javax.servlet.jsp.JspException
Description copied from interface: I_CmsDirectEditProvider
Inserts the "end direct edit" HTML in the provided JSP page context.

Specified by:
insertDirectEditEnd in interface I_CmsDirectEditProvider
Parameters:
context - the JSP page context to insert the HTML to
Throws:
javax.servlet.jsp.JspException - in case something goes wrong
See Also:
I_CmsDirectEditProvider.insertDirectEditEnd(javax.servlet.jsp.PageContext)

insertDirectEditIncludes

public void insertDirectEditIncludes(javax.servlet.jsp.PageContext context,
                                     CmsDirectEditParams params)
                              throws javax.servlet.jsp.JspException
Description copied from interface: I_CmsDirectEditProvider
Inserts the "direct edit header" HTML in the provided JSP page context.

Specified by:
insertDirectEditIncludes in interface I_CmsDirectEditProvider
Parameters:
context - the JSP page context to insert the HTML to
params - the parameters for the direct edit includes
Throws:
javax.servlet.jsp.JspException - in case something goes wrong
See Also:
I_CmsDirectEditProvider.insertDirectEditIncludes(javax.servlet.jsp.PageContext, org.opencms.workplace.editors.directedit.CmsDirectEditParams)

insertDirectEditStart

public boolean insertDirectEditStart(javax.servlet.jsp.PageContext context,
                                     CmsDirectEditParams params)
                              throws javax.servlet.jsp.JspException
Description copied from interface: I_CmsDirectEditProvider
Inserts the "start direct edit" HTML in the provided JSP page context.

Specified by:
insertDirectEditStart in interface I_CmsDirectEditProvider
Parameters:
context - the JSP page context to insert the HTML to
params - the parameters for the direct edit call
Returns:
true in case a direct edit element was opened, false otherwise
Throws:
javax.servlet.jsp.JspException - in case something goes wrong
See Also:
I_CmsDirectEditProvider.insertDirectEditStart(javax.servlet.jsp.PageContext, org.opencms.workplace.editors.directedit.CmsDirectEditParams)

isManual

public boolean isManual(CmsDirectEditMode mode)
Returns false because the JSP include provider does not support manual button placement.

Specified by:
isManual in interface I_CmsDirectEditProvider
Overrides:
isManual in class A_CmsDirectEditProvider
See Also:
I_CmsDirectEditProvider.isManual(org.opencms.workplace.editors.directedit.CmsDirectEditMode)

newInstance

public I_CmsDirectEditProvider newInstance()
Description copied from interface: I_CmsDirectEditProvider
Creates a new instance of this direct edit provider with the same basic configuration.

Specified by:
newInstance in interface I_CmsDirectEditProvider
Returns:
a new instance of this direct edit provider with the same basic configuration
See Also:
I_CmsDirectEditProvider.newInstance()