001// Copyright 2007 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007//     http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry5;
016
017import java.util.List;
018import java.util.Map;
019
020/**
021 * Defines a group of related options. Options may be enabled or disabled as a group. Corresponds to the [X]HTML element
022 * <optgroup>.
023 */
024public interface OptionGroupModel
025{
026    /**
027     * Localized, user-presentable label for the group.
028     */
029    String getLabel();
030
031    /**
032     * If true, the group (and all options within it) will be disabled. Note that some browsers do not honor the
033     * disabled attribute property.
034     *
035     * @return true if a disabled attribute should be rendered.
036     */
037    boolean isDisabled();
038
039    /**
040     * Additional attributes to render with the <optgroup>. This is often used to render the CSS class attribute.
041     * May return null.
042     */
043    Map<String, String> getAttributes();
044
045    /**
046     * The list of options within the group.
047     */
048    List<OptionModel> getOptions();
049}