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 GmbH & Co. KG, 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.widgets; 029 030import org.opencms.file.CmsObject; 031 032/** 033 * Parameter value wrapper used by the OpenCms workplace widgets.<p> 034 * 035 * @since 6.0.0 036 */ 037public interface I_CmsWidgetParameter { 038 039 /** 040 * Returns the default value of this parameter.<p> 041 * 042 * If no default value has been provided, <code>null</code> is returned.<p> 043 * 044 * @param cms an initialized instance of an OpenCms user context 045 * 046 * @return the default value of this parameter 047 */ 048 String getDefault(CmsObject cms); 049 050 /** 051 * Returns the form id of this parameter.<p> 052 * 053 * @return the form id of this parameter 054 */ 055 String getId(); 056 057 /** 058 * Returns the index of this widget parameter, 059 * starting with 0.<p> 060 * 061 * This is usefull in case there are more then one parameters 062 * with the same name, for example when creating a list of parameters of the same type.<p> 063 * 064 * @return the index of this widget parameter 065 */ 066 int getIndex(); 067 068 /** 069 * Returns the localized key identificator of this parameter.<p> 070 * 071 * @return the localized key identificator of this parameter 072 */ 073 String getKey(); 074 075 /** 076 * Returns the maximum occurences of this parameter.<p> 077 * 078 * @return the maximum occurences of this parameter 079 */ 080 int getMaxOccurs(); 081 082 /** 083 * Returns the minimum occurences of this parameter.<p> 084 * 085 * @return the minimum occurences of this parameter 086 */ 087 int getMinOccurs(); 088 089 /** 090 * Returns the name of this parameter.<p> 091 * 092 * @return the name of this parameter 093 */ 094 String getName(); 095 096 /** 097 * Returns the value of this parameter.<p> 098 * 099 * @param cms an initialized instance of an OpenCms user context 100 * 101 * @return the value of this parameter 102 */ 103 String getStringValue(CmsObject cms); 104 105 /** 106 * Returns <code>true</code> if this widgets value contains an error.<p> 107 * 108 * @return <code>true</code> if this widgets value contains an error 109 */ 110 boolean hasError(); 111 112 /** 113 * Sets an optional localized key prefix identificator of this parameter.<p> 114 * 115 * @param prefix the optional localized key prefix identificator of this parameter 116 */ 117 void setKeyPrefix(String prefix); 118 119 /** 120 * Sets the value of this parameter.<p> 121 * 122 * This method does provide processing of the content based on the 123 * users current OpenCms context. This can be used e.g. for link 124 * extraction and replacement in the content.<p> 125 * 126 * @param cms an initialized instance of an OpenCms user context 127 * @param value the value to set 128 */ 129 void setStringValue(CmsObject cms, String value); 130}