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.datadictionary.parse.BeanTag;
020import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
021import org.kuali.rice.krad.keyvalues.KeyValuesBase;
022import org.kuali.rice.krad.uif.field.InputField;
023import org.kuali.rice.krad.uif.view.ViewModel;
024
025import java.util.Collections;
026import java.util.List;
027
028/**
029 * @author Kuali Rice Team (rice.collab@kuali.org)
030 */
031@BeanTag(name = "keyValuesFinder")
032public abstract class UifKeyValuesFinderBase extends KeyValuesBase implements UifKeyValuesFinder {
033
034    private boolean addBlankOption;
035
036    public UifKeyValuesFinderBase() {
037        addBlankOption = true;
038    }
039
040    /**
041     * {@inheritDoc}
042     */
043    public List<KeyValue> getKeyValues() {
044        return Collections.emptyList();
045    }
046
047    /**
048     * {@inheritDoc}
049     */
050    @Override
051    public List<KeyValue> getKeyValues(ViewModel model) {
052        return getKeyValues();
053    }
054
055    /**
056     * {@inheritDoc}
057     */
058    @Override
059    public List<KeyValue> getKeyValues(ViewModel model, InputField field){
060        return getKeyValues(model);
061    }
062
063    /**
064     * {@inheritDoc}
065     */
066    @BeanTagAttribute
067    @Override
068    public boolean isAddBlankOption() {
069        return addBlankOption;
070    }
071
072    /**
073     * Setter for the addBlankOption indicator
074     *
075     * @param addBlankOption
076     */
077    public void setAddBlankOption(boolean addBlankOption) {
078        this.addBlankOption = addBlankOption;
079    }
080}