001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (https://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: https://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: https://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.configuration.preferences; 029 030import org.opencms.search.galleries.CmsGallerySearchParameters.CmsGallerySearchWordMode; 031import org.opencms.xml.content.CmsXmlContentProperty; 032 033/** 034 * Class for the preference which controls how the search words entered in a gallery are pre-processed. 035 */ 036public class CmsGallerySearchWordModePreference extends CmsBuiltinPreference { 037 038 /** The preference name. */ 039 public static final String PREFERENCE_NAME = "gallerySearchWordMode"; 040 041 /** Widget configuration. */ 042 public static final String WIDGET_CONFIG = "plain:%(key.GUI_PREF_GALLERY_SEARCH_WORD_MODE_PLAIN_0)" 043 + "|infix:%(key.GUI_PREF_GALLERY_SEARCH_WORD_MODE_INFIX_0)"; 044 045 /** The nice name. */ 046 private static final String NICE_NAME = "%(key." 047 + org.opencms.workplace.commons.Messages.GUI_PREF_GALLERY_SEARCH_WORD_MODE_0 048 + ")"; 049 050 /** 051 * Creates a new instance.<p> 052 * 053 * @param propName the property name 054 */ 055 public CmsGallerySearchWordModePreference(String propName) { 056 057 super(propName); 058 m_basic = true; 059 060 } 061 062 /** 063 * @see org.opencms.configuration.preferences.CmsBuiltinPreference#getDefaultValue() 064 */ 065 @Override 066 public String getDefaultValue() { 067 068 return CmsGallerySearchWordMode.DEFAULT.name(); 069 } 070 071 /** 072 * @see org.opencms.configuration.preferences.CmsBuiltinPreference#getPropertyDefinition() 073 */ 074 @Override 075 public CmsXmlContentProperty getPropertyDefinition() { 076 077 CmsXmlContentProperty prop = new CmsXmlContentProperty( 078 getName(), //name 079 "string", //type 080 "select_notnull", //widget 081 WIDGET_CONFIG, //widgetconfig 082 null, //regex 083 null, //ruletype 084 getDefaultValue(), //default 085 NICE_NAME, //nicename 086 null, //description 087 null, //error 088 null //preferfolder 089 ); 090 return prop; 091 092 } 093 094}