001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.workplace.editors.directedit; 029 030import org.opencms.configuration.I_CmsConfigurationParameterHandler; 031import org.opencms.file.CmsObject; 032import org.opencms.gwt.shared.I_CmsContentLoadCollectorInfo; 033 034import javax.servlet.jsp.JspException; 035import javax.servlet.jsp.PageContext; 036 037/** 038 * Provides the methods to generate the "direct edit" HTML fragments that are inserted 039 * in the generated pages in offline mode.<p> 040 * 041 * In case you want to implement this, it's a good idea to extend from {@link A_CmsDirectEditProvider} 042 * or {@link CmsDirectEditDefaultProvider} as these already contain the required low level logic.<p> 043 * 044 * The default direct edit provider used can be configured in <code>opencms-workplace.xml</code> in the 045 * <code><directeditprovider class="..." /></code> node. The standard provider is the 046 * {@link CmsDirectEditDefaultProvider}.<p> 047 * 048 * @since 6.2.3 049 * 050 * @see CmsDirectEditDefaultProvider 051 * @see CmsDirectEditTextButtonProvider 052 * @see CmsDirectEditJspIncludeProvider 053 * @see org.opencms.jsp.CmsJspTagEditable 054 */ 055public interface I_CmsDirectEditProvider extends I_CmsConfigurationParameterHandler, Cloneable { 056 057 /** Key to identify the direct edit provider instance. */ 058 String ATTRIBUTE_DIRECT_EDIT_PROVIDER = "org.opencms.workplace.editors.directedit.__directEditProvider"; 059 060 /** Key to identify the direct edit provider parameteres. */ 061 String ATTRIBUTE_DIRECT_EDIT_PROVIDER_PARAMS = "org.opencms.workplace.editors.directedit.__directEditProviderParams"; 062 063 /** 064 * Initialize method for a new instance of the direct edit provider.<p> 065 * 066 * @param cms the current users OpenCms context 067 * @param mode the direct edit mode to use 068 * @param fileName link to a file that contains the direct edit HTML elements (optional) 069 */ 070 void init(CmsObject cms, CmsDirectEditMode mode, String fileName); 071 072 /** 073 * Inserts the direct edit HTML for empty lists in the provided JSP page context.<p> 074 * 075 * @param context the JSP page context to insert the HTML to 076 * @param params the parameters for the direct edit call 077 * 078 * @throws JspException in case something goes wrong 079 */ 080 void insertDirectEditEmptyList(PageContext context, CmsDirectEditParams params) throws JspException; 081 082 /** 083 * Inserts the "end direct edit" HTML in the provided JSP page context.<p> 084 * 085 * @param context the JSP page context to insert the HTML to 086 * 087 * @throws JspException in case something goes wrong 088 */ 089 void insertDirectEditEnd(PageContext context) throws JspException; 090 091 /** 092 * Inserts the "direct edit header" HTML in the provided JSP page context.<p> 093 * 094 * @param context the JSP page context to insert the HTML to 095 * @param params the parameters for the direct edit includes 096 * 097 * @throws JspException in case something goes wrong 098 */ 099 void insertDirectEditIncludes(PageContext context, CmsDirectEditParams params) throws JspException; 100 101 /** 102 * Inserts HTML used as metadata for a collector list in the current JSP context.<p> 103 * 104 * @param context the current JSP context 105 * @param info the collector lsit information 106 * 107 * @throws JspException if something goes wrong 108 */ 109 void insertDirectEditListMetadata(PageContext context, I_CmsContentLoadCollectorInfo info) throws JspException; 110 111 /** 112 * Inserts the "start direct edit" HTML in the provided JSP page context.<p> 113 * 114 * @param context the JSP page context to insert the HTML to 115 * @param params the parameters for the direct edit call 116 * 117 * @return <code>true</code> in case a direct edit element was opened, <code>false</code> otherwise 118 * 119 * @throws JspException in case something goes wrong 120 */ 121 boolean insertDirectEditStart(PageContext context, CmsDirectEditParams params) throws JspException; 122 123 /** 124 * Returns <code>true</code> if this provider (currently) operates in manual mode.<p> 125 * 126 * In manual mode the direct edit HTML is inserted with <code><cms:enditable mode="manual" /></code> 127 * tags. Otherwise the direct edit HTML is automatically inserted in the current page.<p> 128 * 129 * Some providers may not be able to operate in manual mode. These will always return <code>false</code>.<p> 130 * 131 * @param mode the mode of the current direct edit element 132 * 133 * @return <code>true</code> if this provider (currently) operates in manual mode 134 */ 135 boolean isManual(CmsDirectEditMode mode); 136 137 /** 138 * Creates a new instance of this direct edit provider with the same basic configuration.<p> 139 * 140 * @return a new instance of this direct edit provider with the same basic configuration 141 */ 142 I_CmsDirectEditProvider newInstance(); 143}