001/**
002 * Copyright 2005-2015 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 edu.sampleu.travel.options;
017
018import edu.sampleu.demo.kitchensink.UifComponentsTestForm;
019import org.kuali.rice.core.api.util.ConcreteKeyValue;
020import org.kuali.rice.core.api.util.KeyValue;
021import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase;
022import org.kuali.rice.krad.uif.view.ViewModel;
023
024import java.util.ArrayList;
025import java.util.List;
026
027/**
028 * @author Kuali Rice Team (rice.collab@kuali.org)
029 */
030public class FoodKeyValuesFinder extends UifKeyValuesFinderBase {
031
032    @Override
033    public List<KeyValue> getKeyValues(ViewModel model) {
034        UifComponentsTestForm testForm = (UifComponentsTestForm) model;
035
036        List<KeyValue> options = new ArrayList<KeyValue>();
037
038        if (testForm.getField88().equals("Fruits")) {
039            options.add(new ConcreteKeyValue("Apples", "Apples"));
040            options.add(new ConcreteKeyValue("Bananas", "Bananas"));
041            options.add(new ConcreteKeyValue("Cherries", "Cherries"));
042            options.add(new ConcreteKeyValue("Oranges", "Oranges"));
043            options.add(new ConcreteKeyValue("Pears", "Pears"));
044        } else if (testForm.getField88().equals("Vegetables")) {
045            options.add(new ConcreteKeyValue("Beans", "Beans"));
046            options.add(new ConcreteKeyValue("Broccoli", "Broccoli"));
047            options.add(new ConcreteKeyValue("Cabbage", "Cabbage"));
048            options.add(new ConcreteKeyValue("Carrots", "Carrots"));
049            options.add(new ConcreteKeyValue("Celery", "Celery"));
050            options.add(new ConcreteKeyValue("Corn", "Corn"));
051            options.add(new ConcreteKeyValue("Peas", "Peas"));
052        }
053
054        return options;
055    }
056
057}