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
015 package org.apache.tapestry5;
016
017 import java.util.Map;
018
019 /**
020 * A single option within a {@link OptionGroupModel}. Corresponds closely to the [X]HTML <option> element.
021 */
022 public interface OptionModel
023 {
024 /**
025 * The localized, user-presentable label for the option.
026 */
027 String getLabel();
028
029 /**
030 * If true, then a disabled attribute will be rendered with the <option>.
031 */
032 boolean isDisabled();
033
034 /**
035 * Additional attributes to render within the <option>. May return null.
036 */
037 Map<String, String> getAttributes();
038
039 /**
040 * The server-side value represented by this option. This is used to determine which option will be selected. It is
041 * also used, via {@link ValueEncoder#toClient(Object)}, to generate the client-side value attribute.
042 */
043 Object getValue();
044 }