001//  Copyright 2008, 2010, 2011 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
017/**
018 * Used to determine which field on a page should receive focus, based on its status.
019 *
020 * @see org.apache.tapestry5.services.javascript.JavaScriptSupport#autofocus(FieldFocusPriority, String)
021 */
022public enum FieldFocusPriority
023{
024    /**
025     * An optional field, the lowest priority.
026     */
027    OPTIONAL,
028
029    /**
030     * A field whose input is required, which takes higher priority than optional.
031     */
032    REQUIRED,
033
034    /**
035     * A field that contains a validation error, the highest normal priority.
036     */
037    IN_ERROR,
038
039    /**
040     * Used to allow field focus to be manually overridden; this would be selected in user code and is higher priority
041     * than {@link #IN_ERROR}.
042     *
043     * @since 5.1.0.4
044     * @see org.apache.tapestry5.corelib.mixins.FormFieldFocus
045     */
046    OVERRIDE;
047}