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.xml.containerpage; 029 030import org.opencms.util.CmsUUID; 031import org.opencms.xml.content.CmsXmlContentProperty; 032 033import java.util.Collection; 034import java.util.List; 035import java.util.Locale; 036import java.util.Map; 037import java.util.Set; 038 039/** 040 * Interface representing a configured formatter.<p> 041 */ 042public interface I_CmsFormatterBean { 043 044 /** 045 * Gets the map of attributes.<p> 046 * 047 * @return the attribute map 048 */ 049 Map<String, String> getAttributes(); 050 051 /** 052 * Returns the formatter container type.<p> 053 * 054 * If this is "*", then the formatter is a width based formatter.<p> 055 * 056 * @return the formatter container type 057 */ 058 Set<String> getContainerTypes(); 059 060 /** 061 * Gets the CSS head includes.<p> 062 * 063 * @return the CSS head includes 064 */ 065 Set<String> getCssHeadIncludes(); 066 067 /** 068 * Gets the formatter description.<p> 069 * 070 * If a locale is passed in, macros in the configured description will be resolved with a macro resolver set to that locale. 071 * If null is passed in as a locale, the raw configured description will be returned. 072 * 073 * @param locale the locale (may be null) 074 * 075 * @return the formatter description 076 */ 077 String getDescription(Locale locale); 078 079 /** 080 * The display type of this formatter or <code>null</code> in case this is not a display formatter.<p> 081 * 082 * @return the display type 083 */ 084 String getDisplayType(); 085 086 /** 087 * Returns the id of this formatter.<p> 088 * 089 * This method may return null because the id is not always defined for formatters, e.g. for those formatters declared in a schema.<p> 090 * 091 * @return the formatter id 092 */ 093 String getId(); 094 095 /** 096 * Gets the inline CSS snippets.<p> 097 * 098 * @return the inline CSS snippets 099 */ 100 String getInlineCss(); 101 102 /** 103 * Gets the inline JS snippets.<p> 104 * 105 * @return the inline JS snippets 106 */ 107 String getInlineJavascript(); 108 109 /** 110 * Gets the Javascript head includes.<p> 111 * 112 * @return the head includes 113 */ 114 List<String> getJavascriptHeadIncludes(); 115 116 /** 117 * Returns the root path of the formatter JSP in the OpenCms VFS.<p> 118 * 119 * @return the root path of the formatter JSP in the OpenCms VFS.<p> 120 */ 121 String getJspRootPath(); 122 123 /** 124 * Returns the structure id of the JSP resource for this formatter.<p> 125 * 126 * @return the structure id of the JSP resource for this formatter 127 */ 128 CmsUUID getJspStructureId(); 129 130 /** 131 * Returns the location this formatter was defined in.<p> 132 * 133 * This will be an OpenCms VFS root path, either to the XML schema XSD, or the 134 * configuration file this formatter was defined in, or to the JSP that 135 * makes up this formatter.<p> 136 * 137 * @return the location this formatter was defined in 138 */ 139 String getLocation(); 140 141 /** 142 * Returns the maximum formatter width.<p> 143 * 144 * If this is not set, then {@link Integer#MAX_VALUE} is returned.<p> 145 * 146 * @return the maximum formatter width 147 */ 148 int getMaxWidth(); 149 150 /** 151 * Returns the meta mappings.<p> 152 * 153 * @return the meta mappings 154 */ 155 List<CmsMetaMapping> getMetaMappings(); 156 157 /** 158 * Returns the minimum formatter width.<p> 159 * 160 * If this is not set, then <code>-1</code> is returned.<p> 161 * 162 * @return the minimum formatter width 163 */ 164 int getMinWidth(); 165 166 /** 167 * Gets the nice name for this formatter.<p> 168 * 169 * @param locale the locale 170 * 171 * @return the nice name for this formatter 172 */ 173 String getNiceName(Locale locale); 174 175 /** 176 * Gets the rank.<p> 177 * 178 * @return the rank 179 */ 180 int getRank(); 181 182 /** 183 * Gets the resource type names.<p> 184 * 185 * @return the resource type names 186 */ 187 Collection<String> getResourceTypeNames(); 188 189 /** 190 * Gets the defined settings.<p> 191 * 192 * @return the defined settings 193 */ 194 Map<String, CmsXmlContentProperty> getSettings(); 195 196 /** 197 * Returns if nested formatter settings should be displayed.<p> 198 * 199 * @return <code>true</code> if nested formatter settings should be displayed 200 */ 201 boolean hasNestedFormatterSettings(); 202 203 /** 204 * Returns whether this formatter allows settings to be edited in the content editor.<p> 205 * 206 * @return <code>true</code> in case editing the settings is allowed in the content editor 207 */ 208 boolean isAllowsSettingsInEditor(); 209 210 /** 211 * Returns true if the formatter is automatically enabled.<p> 212 * 213 * @return true if the formatter is automatically enabled 214 */ 215 boolean isAutoEnabled(); 216 217 /** 218 * Returns true if the formatter can be used for detail views.<p> 219 * 220 * @return true if the formatter can be used for detail views 221 */ 222 boolean isDetailFormatter(); 223 224 /** 225 * Returns whether this formatter should be used by the 'display' tag.<p> 226 * 227 * @return <code>true</code> if this formatter should be used by the 'display' tag 228 */ 229 boolean isDisplayFormatter(); 230 231 /** 232 * Returns true if the formatter is from a formatter configuration file.<p> 233 * 234 * @return formatter f 235 */ 236 boolean isFromFormatterConfigFile(); 237 238 /** 239 * Returns true if this formatter should match all type/width combinations.<p> 240 * 241 * @return true if this formatter should match all type/width combinations 242 */ 243 boolean isMatchAll(); 244 245 /** 246 * Indicates if this formatter is to be used as preview in the ADE gallery GUI. 247 * 248 * @return <code>true</code> if this formatter is to be used as preview in the ADE gallery GUI 249 */ 250 boolean isPreviewFormatter(); 251 252 /** 253 * Returns <code>true</code> in case an XML content formatted with this formatter should be included in the 254 * online full text search.<p> 255 * 256 * @return <code>true</code> in case an XML content formatted with this formatter should be included in the 257 * online full text search 258 */ 259 boolean isSearchContent(); 260 261 /** 262 * Returns <code>true</code> in case this formatter is based on type information.<p> 263 * 264 * @return <code>true</code> in case this formatter is based on type information 265 */ 266 boolean isTypeFormatter(); 267 268 /** 269 * Sets the JSP structure id.<p> 270 * 271 * @param structureId the jsp structure id 272 */ 273 void setJspStructureId(CmsUUID structureId); 274 275 /** 276 * Returns true if meta mappings should be evaluated for normal container elements using this formatter, not just detail elements.<p> 277 * 278 * @return true if meta mappings should be evaluated for normal container elements 279 */ 280 boolean useMetaMappingsForNormalElements(); 281 282}