001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.uif.control;
017
018import org.kuali.rice.krad.uif.component.Component;
019
020/**
021 * Represents an interactive element in the UI (typically an HTML control)
022 * <p>
023 * Each control that can be rendered in the UIF should be an implement the
024 * <code>Control</code> interface. The control is a regular component, thus has
025 * a corresponding template that will render the control for the UI. Controls
026 * provide the mechanism for gathering data from the User or for the User to
027 * initiate an action. HTML controls must be rendered within a <code>Form</code>
028 * element.
029 * </p>
030 *
031 * @author Kuali Rice Team (rice.collab@kuali.org)
032 */
033public interface Control extends Component {
034
035    /**
036     * Unique index of the control within the tab order
037     *
038     * <p>
039     * Tab index provides a way to set the order users will tab through the
040     * controls. The control with index 1 will receive focus when the page is
041     * rendered. Tabing from the field will then take the user to the control
042     * with index 2, then index 3, and so on.
043     * </p>
044     *
045     * @return int the tab index for the control
046     */
047    public int getTabIndex();
048
049    /**
050     * Setter for the controls tab order index
051     *
052     * @param tabIndex
053     */
054    public void setTabIndex(int tabIndex);
055
056    /**
057     * Indicates whether the control is disabled (doesn't allow input)
058     *
059     * @return boolean true if the control is disabled, false if not
060     */
061    public boolean isDisabled();
062
063    /**
064     * Setter for the disabled indicator
065     *
066     * @param disabled
067     */
068    public void setDisabled(boolean disabled);
069
070    /**
071     * If the control is disabled, gives a reason for why which will be displayed as a tooltip
072     * on the control
073     *
074     * @return String disabled reason text
075     * @see {@link #isDisabled()}
076     */
077    public String getDisabledReason();
078
079    /**
080     * Setter for the disabled reason text
081     *
082     * @param disabledReason
083     */
084    public void setDisabledReason(String disabledReason);
085}
086
087