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.configuration.preferences;
029
030import org.opencms.configuration.CmsDefaultUserSettings;
031import org.opencms.file.CmsObject;
032import org.opencms.xml.content.CmsXmlContentProperty;
033
034/**
035 * Interface describing a single preference value which can possibly be edited by the user.<p>
036 */
037public interface I_CmsPreference {
038
039    /**
040     * Creates the configuration for this preference.<p>
041     *
042     * @return the configuration for this preference
043     */
044    org.dom4j.Element createConfigurationItem();
045
046    /**
047     * Gets the default value for the preference.<p>
048     *
049     * @return the default value
050     */
051    String getDefaultValue();
052
053    /**
054     * Gets the preference name.<p>
055     *
056     * @return the preference name
057     */
058    String getName();
059
060    /**
061     * Gets the metadata describing how the setting should be edited.<p>
062     *
063     * @param cms the current CMS context
064     *
065     * @return the metadata for the client which describes how the setting should be edited
066     */
067    CmsXmlContentProperty getPropertyDefinition(CmsObject cms);
068
069    /**
070     * Gets the preference tab.<p>
071     *
072     * @return the preference tab
073     */
074    String getTab();
075
076    /**
077     * Reads the value of the preference from a CmsDefaultUserSettings instance .<p>
078     *
079     * @param userSettings the user settings from which to read the preference value
080     *
081     * @return the preference value
082     */
083    String getValue(CmsDefaultUserSettings userSettings);
084
085    /**
086     * Returns true if the preference is disabled.<p>
087     * @param cms the current CMS context
088     *
089     * @return true if the preference is disabled
090     */
091    boolean isDisabled(CmsObject cms);
092
093    /**
094     * Sets the value of the preference in a CmsDefaultUserSettings instance.<p>
095     *
096     * @param settings the settings used to store the preference value
097     * @param value the new value
098     */
099    void setValue(CmsDefaultUserSettings settings, String value);
100}