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.ade.contenteditor.client; 029 030import java.util.Collections; 031import java.util.HashMap; 032import java.util.Map; 033 034/** 035 * This class can be used by code which uses the Acacia editor to pass additional information to the editor on startup.<p> 036 */ 037public class CmsEditorContext { 038 039 /** The path of the style sheet to use for the WYSIWYG editor. */ 040 private String m_editorStylesheet; 041 042 /** The HTML context info. */ 043 private String m_htmlContextInfo; 044 045 /** The parameters for the publish function in the Acacia editor. */ 046 private Map<String, String> m_publishParameters = new HashMap<String, String>(); 047 048 /** True if the edited element is reused. */ 049 private boolean m_reusedElement; 050 051 /** The setting presets. */ 052 private Map<String, String> m_settingPresets = Collections.emptyMap(); 053 054 /** 055 * Default constructor.<p> 056 */ 057 public CmsEditorContext() { 058 059 // do nothing 060 } 061 062 /** 063 * Gets the path of the style sheet to use for the WYSIWYG editor. 064 * 065 * @return the style sheet path 066 */ 067 public String getEditorStylesheet() { 068 069 return m_editorStylesheet; 070 } 071 072 /** 073 * Returns the HTML context info.<p> 074 * 075 * @return the HTML context info 076 */ 077 public String getHtmlContextInfo() { 078 079 return m_htmlContextInfo; 080 } 081 082 /** 083 * Gets the additional publish parameters which should be used for the publish functionality in the Acacia editor.<p> 084 * 085 * @return the additional publish parameters 086 */ 087 public Map<String, String> getPublishParameters() { 088 089 return m_publishParameters; 090 } 091 092 /** 093 * Returns the setting presets.<p> 094 * 095 * @return the setting presets 096 */ 097 public Map<String, String> getSettingPresets() { 098 099 return m_settingPresets; 100 } 101 102 /** 103 * Returns true if the edited element is reused. 104 * 105 * @return true if the edited element is reused 106 */ 107 public boolean isReusedElement() { 108 109 return m_reusedElement; 110 111 } 112 113 /** 114 * Sets the path of the style sheet to use for the WYSIWYG editor. 115 * 116 * @param stylesheetPath the style sheet path 117 */ 118 public void setEditorStylesheet(String stylesheetPath) { 119 120 m_editorStylesheet = stylesheetPath; 121 } 122 123 /** 124 * Sets the HTML context info.<p> 125 * 126 * @param htmlContextInfo the HTML context info to set 127 */ 128 public void setHtmlContextInfo(String htmlContextInfo) { 129 130 m_htmlContextInfo = htmlContextInfo; 131 } 132 133 /** 134 * Sets the additional publish parameters for the publish functionality in the Acacia editor.<p> 135 * 136 * @param publishParams the additional publish parameters 137 */ 138 public void setPublishParameters(Map<String, String> publishParams) { 139 140 m_publishParameters = publishParams; 141 } 142 143 /** 144 * Sets the 'reused' status for the currently edited element. 145 * 146 * @param reusedElement the new reuse status 147 */ 148 public void setReusedElement(boolean reusedElement) { 149 150 m_reusedElement = reusedElement; 151 } 152 153 /** 154 * Sets the setting presets.<p> 155 * 156 * @param settingPresets the setting presets to set 157 */ 158 public void setSettingPresets(Map<String, String> settingPresets) { 159 160 m_settingPresets = settingPresets; 161 } 162}