    001// Copyright 2007-2013 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 org.apache.tapestry5.corelib.components.Radio;
    018
    019/**
    020 * A container of {@link Radio} components, used to identify the element name used when rendering the individual radio
    021 * buttons. (All buttons in a group share the same element name.)
    022 */
    023public interface RadioContainer
    024{
    025    /**
    026     * Returns the value used as the name attribute of the rendered element. This value will be unique within an
    027     * enclosing form, even if the same component renders multiple times.
    028     *
    029     * @see org.apache.tapestry5.Field#getControlName()
    030     */
    031    String getControlName();
    032
    033    /**
    034     * If true, then all radio buttons within the container should be disabled.
    035     */
    036    boolean isDisabled();
    037
    038    /**
    039     * Converts an object to a client-side string representation of that value.
    040     *
    041     * @param value to convert (may be null)
    042     * @return string representation of the value
    043     * @see ValueEncoder#toClient(Object)
    044     */
    045    String toClient(Object value);
    046
    047    /**
    048     * Returns true if the value is the current selected value.
    049     */
    050    boolean isSelected(Object value);
    051}