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.jsp.decorator;
029
030import org.opencms.file.CmsObject;
031import org.opencms.main.CmsException;
032import org.opencms.xml.content.CmsXmlContent;
033
034import java.util.Locale;
035
036import org.htmlparser.Tag;
037
038/**
039 * Interface for a CmsDecoratorConfiguration.<p>
040 *
041 * This interface describes a CmsDecoratorConfiguration which provides methods to
042 * get a filled CmsDecorationBundle. A decoration bundle contains a datastructure
043 * of text decorations which can be used in the current request context.
044 *
045 */
046public interface I_CmsDecoratorConfiguration {
047
048    /**
049     * Builds a CmsDecorationDefintion from a given configuration file.<p>
050     *
051     * @param configuration the configuration file
052     * @param i the number of the decoration definition to create
053     * @return CmsDecorationDefintion created form configuration file
054     */
055    CmsDecorationDefintion getDecorationDefinition(CmsXmlContent configuration, int i);
056
057    /**
058     * Gets the decoration bundle.<p>
059     *@return the decoration bundle to be used
060     */
061    CmsDecorationBundle getDecorations();
062
063    /**
064     * Tests if a decoration key was used before in this configuration.<p>
065     * @param key the key to look for
066     * @return true if this key was already used
067     */
068    boolean hasUsed(String key);
069
070    /**
071     * Initialises the configuration.<p>
072     *
073     *@param cms the CmsObject
074     * @param configFile the configuration file
075     * @param locale to locale to build this configuration for
076     * @throws CmsException if something goes wrong
077     */
078    void init(CmsObject cms, String configFile, Locale locale) throws CmsException;
079
080    /**
081     * Tests if a tag is contained in the exclude list of the decorator.<p>
082     *
083     * @param tag the tag to test
084     * @return true if the tag is in the exclude list, false otherwise.
085     */
086    boolean isExcluded(String tag);
087
088    /**
089     * Tests if a tag has an attribute thatis contained in the exclude list of the decorator.<p>
090     *
091     * @param tag the tag to test
092     * @return true if the tag is in the exclude list, false otherwise.
093     */
094    boolean isExcludedAttr(Tag tag);
095
096    /**
097     * Mark a decoration key as already used.<p>
098     * @param key the key to mark
099     */
100    void markAsUsed(String key);
101
102    /**
103     * Resets the used decoration keys.<p>
104     */
105    void resetMarkedDecorations();
106}