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.gwt.shared.attributeselect;
029
030import java.util.List;
031import java.util.Map;
032
033/**
034 * AutoBean interface for the data used by the attribute select widget.
035 *
036 * <p>An attribute select widget consists of several attribute filter select boxes and one main select box, such
037 * that choosing values from the attribute filters restricts the available options in the main select box to those which
038 * have a matching value for every filter attribute.
039 */
040public interface I_CmsAttributeSelectData {
041
042    /**
043     * AutoBean interface for a filter attribute definition.
044     */
045    interface AttributeDefinition {
046
047        /**
048         * Gets the default option (initially selected).
049         *
050         * @return the default option
051         */
052        String getDefaultOption();
053
054        /**
055         * Gets the attribute label.
056         *
057         * @return the attribute label
058         */
059        String getLabel();
060
061        /**
062         * Gets the attribute name.
063         *
064         * @return the attribute name
065         */
066        String getName();
067
068        /**
069         * Gets the neutral option, which is chosen when a pre-existing value is not among the current options for the main select widget.
070         *
071         * @return the neutral optiob
072         */
073        String getNeutralOption();
074
075        /**
076         * Gets the list of all options.
077         *
078         * @return the list of all options
079         */
080        List<Option> getOptions();
081
082        /**
083         * Sets the default option (initially selected).
084         *
085         * @param defaultOption the default option
086         */
087        void setDefaultOption(String defaultOption);
088
089        /**
090         * Sets the label.
091         *
092         * @param label the label
093         */
094        void setLabel(String label);
095
096        /**
097         * Sets the attribute name.
098         *
099         * @param name the attribute name
100         */
101        void setName(String name);
102
103        /**
104         * Sets the neutral option (will be set when a pre-existing value is not among the current options)
105         *
106         * @param neutralOption the neutral option
107         */
108        void setNeutralOption(String neutralOption);
109
110        /**
111         * Sets the options.
112         *
113         * @param options the list of options
114         */
115        void setOptions(List<Option> options);
116    }
117
118    /**
119     * Represents a single option.
120     */
121    interface Option {
122
123        /**
124         * Gets the help text.
125         *
126         * @return the help text
127         */
128        String getHelpText();
129
130        /**
131         * Gets the label text.
132         *
133         * @return the label text
134         */
135        String getLabel();
136
137        /**
138         * Gets the value.
139         *
140         * @return the value
141         */
142        String getValue();
143
144        /**
145         * Sets the help text.
146         *
147         * @param helpText the help text
148         */
149        void setHelpText(String helpText);
150
151        /**
152         * Sets the label.
153         *
154         * @param label the label
155         */
156        void setLabel(String label);
157
158        /**
159         * Sets the value.
160         *
161         * @param value the value
162         */
163        void setValue(String value);
164    }
165
166    /**
167     * A choice option, but with (multi-valued) attributes added.
168     */
169    interface OptionWithAttributes extends Option {
170
171        /**
172         * Gets the attributes.
173         *
174         * <p>The set of keys should be equal to set of names of all attribute definitions.
175         *
176         * @return the attributes
177         */
178        Map<String, List<String>> getAttributes();
179
180        /**
181         * Sets the attributes.
182         *
183         * @param attributes the attributes
184         */
185        void setAttributes(Map<String, List<String>> attributes);
186
187    }
188
189    /**
190     * Gets the attribute definitions.
191     *
192     * @return the attribute definitions
193     */
194    List<AttributeDefinition> getAttributeDefinitions();
195
196    /**
197     * Gets all options.
198     *
199     * @return the options
200     */
201    List<OptionWithAttributes> getOptions();
202
203    /**
204     * Sets the attribute definitions.
205     *
206     * @param attributeDefinitions the attribute definitions
207     */
208    void setAttributeDefinitions(List<AttributeDefinition> attributeDefinitions);
209
210    /**
211     * Sets the options.
212     *
213     * @param options the options
214     */
215    void setOptions(List<OptionWithAttributes> options);
216
217}