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.core.api.util.KeyValue;
019import org.kuali.rice.krad.keyvalues.KeyValuesFinder;
020import org.kuali.rice.krad.uif.field.InputField;
021import org.kuali.rice.krad.uif.view.ViewModel;
022
023import java.util.List;
024
025/**
026 * Values finder that can taken the {@link org.kuali.rice.krad.uif.view.ViewModel} that provides data to the view
027 * for conditionally setting the valid options
028 *
029 * <p>
030 * Values finder also allows configuration for a blank option that will be added by the framework
031 * </p>
032 *
033 * @author Kuali Rice Team (rice.collab@kuali.org)
034 */
035public interface UifKeyValuesFinder extends KeyValuesFinder {
036
037    /**
038     * Builds a list of key values representations for valid value selections using the given view model
039     * to retrieve values from other fields and conditionally building the options
040     *
041     * @param model object instance containing the view data
042     *
043     * @return List of KeyValue objects
044     */
045    public List<KeyValue> getKeyValues(ViewModel model);
046
047    /**
048     * Builds a list of key values representations for valid value selections using the given view model
049     * to retrieve values from other fields and conditionally building the options
050     *
051     * @param model  object instance containing the view data
052     * @param field  object instance containing the field data of the key value lookup
053     *
054     * @return List of KeyValue objects
055     */
056    public List<KeyValue> getKeyValues(ViewModel model, InputField field);
057
058    /**
059     * Indicates whether a blank option should be included as a valid option
060     *
061     * @return boolean true if the blank option should be given, false if not
062     */
063    public boolean isAddBlankOption();
064}