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.xml.containerpage.CmsContainerElementBean; 031 032/** 033 * A parameter set to start a direct edit element, for internal use only.<p> 034 * 035 * @since 6.2.3 036 */ 037public class CmsDirectEditParams { 038 039 /** The collector name. */ 040 protected String m_collectorName; 041 042 /** The collector params. */ 043 protected String m_collectorParams; 044 045 /** The selected element in the target content.*/ 046 protected String m_element; 047 048 /** The link to the current page useed when closing an editor or dialog. */ 049 protected String m_linkForClose; 050 051 /** The link to create a new VFS resource of the edited type. */ 052 protected String m_linkForNew; 053 054 /** The direct edit mode to use. */ 055 protected CmsDirectEditMode m_mode; 056 057 /** The direct edit options to display buttons for. */ 058 protected CmsDirectEditButtonSelection m_options; 059 060 /** The edit target VFS resource name. */ 061 protected String m_resourceName; 062 063 /** The 'container' element (when using display tag). */ 064 private CmsContainerElementBean m_containerElement; 065 066 /** ID to identify the contentload instance. */ 067 private String m_id; 068 069 /** The post-create handler class name. */ 070 private String m_postCreateHandler; 071 072 /** 073 * Creates a new direct edit parameter set usually used for including the head HTML.<p> 074 * 075 * @param linkForClose the link to the current page useed when closing an editor or dialog 076 */ 077 public CmsDirectEditParams(String linkForClose) { 078 079 m_resourceName = null; 080 m_options = null; 081 m_element = null; 082 m_linkForNew = null; 083 m_linkForClose = linkForClose; 084 m_mode = CmsDirectEditMode.TRUE; 085 } 086 087 /** 088 * Creates a new direct edit parameter set usually used within a XML content load loop for a <code>xmlcontent</code>.<p> 089 * 090 * @param resourceName the edit target VFS resource name 091 * @param options the direct edit options to display buttons for 092 * @param linkForNew the link to create a new VFS resource of the edited type 093 * @param mode the direct edit mode to use 094 */ 095 public CmsDirectEditParams( 096 String resourceName, 097 CmsDirectEditButtonSelection options, 098 CmsDirectEditMode mode, 099 String linkForNew) { 100 101 m_resourceName = resourceName; 102 m_options = options; 103 m_element = null; 104 m_linkForNew = linkForNew; 105 m_linkForClose = null; 106 m_mode = mode != null ? mode : CmsDirectEditMode.TRUE; 107 } 108 109 /** 110 * Creates a new direct edit parameter set usually used within a <code>cms:include</code> call for a <code>xmlpage</code>.<p> 111 * 112 * @param resourceName the edit target VFS resource name 113 * @param element the selected element in the target content 114 */ 115 public CmsDirectEditParams(String resourceName, String element) { 116 117 m_resourceName = resourceName; 118 m_options = CmsDirectEditButtonSelection.EDIT; 119 m_element = element; 120 m_linkForNew = null; 121 m_linkForClose = null; 122 m_mode = CmsDirectEditMode.TRUE; 123 } 124 125 /** 126 * Returns the direct edit buttons selection to display.<p> 127 * 128 * @return the direct edit buttons selection to display 129 */ 130 public CmsDirectEditButtonSelection getButtonSelection() { 131 132 return m_options; 133 } 134 135 /** 136 * Returns the collectorName.<p> 137 * 138 * @return the collectorName 139 */ 140 public String getCollectorName() { 141 142 return m_collectorName; 143 } 144 145 /** 146 * Returns the collectorParams.<p> 147 * 148 * @return the collectorParams 149 */ 150 public String getCollectorParams() { 151 152 return m_collectorParams; 153 } 154 155 /** 156 * Gets the container element (used for display formatters).<p> 157 * 158 * @return the container element 159 */ 160 public CmsContainerElementBean getContainerElement() { 161 162 return m_containerElement; 163 } 164 165 /** 166 * Returns the selected element in the target content.<p> 167 * 168 * @return the selected element in the target content 169 */ 170 public String getElement() { 171 172 return m_element; 173 } 174 175 /** 176 * Gets the ID for the contentload tag instance.<p> 177 * 178 * @return the id 179 */ 180 public String getId() { 181 182 return m_id; 183 } 184 185 /** 186 * Returns the link to the current page useed when closing an editor or dialog.<p> 187 * 188 * @return the link to the current page useed when closing an editor or dialog 189 */ 190 public String getLinkForClose() { 191 192 return m_linkForClose; 193 } 194 195 /** 196 * Returns the link to delete the selected VFS resource.<p> 197 * 198 * @return the link to delete the selected VFS resource 199 */ 200 public String getLinkForDelete() { 201 202 return "/system/workplace/commons/delete.jsp"; 203 } 204 205 /** 206 * Returns the link to edit the selected VFS resource (element).<p> 207 * 208 * @return the link to edit the selected VFS resource (element) 209 */ 210 public String getLinkForEdit() { 211 212 return "/system/workplace/editors/editor.jsp"; 213 } 214 215 /** 216 * Returns the link to create a new VFS resource of the edited type.<p> 217 * 218 * @return the link to create a new VFS resource of the edited type 219 */ 220 public String getLinkForNew() { 221 222 return m_linkForNew; 223 } 224 225 /** 226 * Returns the direct edit mode.<p> 227 * 228 * @return the direct edit mode 229 */ 230 public CmsDirectEditMode getMode() { 231 232 return m_mode; 233 } 234 235 /** 236 * Gets the post-create handler class name.<p> 237 * 238 * @return the post-create handler class name 239 */ 240 public String getPostCreateHandler() { 241 242 return m_postCreateHandler; 243 } 244 245 /** 246 * Returns the edit target VFS resource name.<p> 247 * 248 * @return the edit target VFS resource name 249 */ 250 public String getResourceName() { 251 252 return m_resourceName; 253 } 254 255 /** 256 * Sets the collectorName.<p> 257 * 258 * @param collectorName the collectorName to set 259 */ 260 public void setCollectorName(String collectorName) { 261 262 m_collectorName = collectorName; 263 } 264 265 /** 266 * Sets the collectorParams.<p> 267 * 268 * @param collectorParams the collectorParams to set 269 */ 270 public void setCollectorParams(String collectorParams) { 271 272 m_collectorParams = collectorParams; 273 } 274 275 /** 276 * Sets the container element bean.<p> 277 * 278 * @param element the container element 279 */ 280 public void setContainerElement(CmsContainerElementBean element) { 281 282 m_containerElement = element; 283 } 284 285 /** 286 * Sets the ID for the contentload tag instance.<p> 287 * 288 * @param id the id to set 289 */ 290 public void setId(String id) { 291 292 m_id = id; 293 } 294 295 /** 296 * Sets the post-create handler class name.<p> 297 * 298 * @param postCreateHandler the post-create handler class name 299 */ 300 public void setPostCreateHandler(String postCreateHandler) { 301 302 m_postCreateHandler = postCreateHandler; 303 } 304}