001// Licensed under the Apache License, Version 2.0 (the "License");
002// you may not use this file except in compliance with the License.
003// You may obtain a copy of the License at
004//
005//     http://www.apache.org/licenses/LICENSE-2.0
006//
007// Unless required by applicable law or agreed to in writing, software
008// distributed under the License is distributed on an "AS IS" BASIS,
009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010// See the License for the specific language governing permissions and
011// limitations under the License.
012
013package org.apache.tapestry5.corelib.data;
014
015import org.apache.tapestry5.SelectModel;
016import org.apache.tapestry5.corelib.components.Select;
017
018/**
019 * Possible values of the "secure" parameter for components that use a
020 * {@link SelectModel} (such as {@link Select}), to control whether the submitted
021 * value must be one of the values in the SelectModel.
022 */
023public enum SecureOption
024{
025    /**
026     * Always check that the submitted value is found in the SelectModel (and
027     * record a validation error if the SelectModel is not provided (null).
028     */
029    ALWAYS,
030
031    /**
032     * Never check that submitted value is found in the SelectModel. It is left
033     * to the user of the component to validate the submitted value.
034     */
035    NEVER,
036
037    /**
038     * The default: check that the submitted value is found in the SelectModel,
039     * unless the SelectModel is not provided (null) at the time of submission.
040     * Since SelectModels are automatically provided for enums but not custom
041     * classes, this is the most useful option in cases where you don't want to
042     * persist a custom SelectModel across a form submission or recreate it
043     * when the form is submitted). 
044     */
045    AUTO
046}