/**
 * Copyright 2005-2013 The Kuali Foundation
 *
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.opensource.org/licenses/ecl2.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.rice.krad.demo.uif.options;

import org.kuali.rice.core.api.util.ConcreteKeyValue;
import org.kuali.rice.core.api.util.KeyValue;
import org.kuali.rice.krad.demo.uif.form.KradSampleAppForm;
import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase;
import org.kuali.rice.krad.uif.view.ViewModel;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Kuali Rice Team (rice.collab@kuali.org)
 */
public class FoodKeyValuesFinder extends UifKeyValuesFinderBase {

    @Override
    public List<KeyValue> getKeyValues(ViewModel model) {
        KradSampleAppForm testForm = (KradSampleAppForm) model;

        List<KeyValue> options = new ArrayList<KeyValue>();

        //options would come from a db in a real scenario
        if (testForm.getInputField4() == null || testForm.getInputField4().equals("Fruits")) {
            options.add(new ConcreteKeyValue("Apples", "Apples"));
            options.add(new ConcreteKeyValue("Bananas", "Bananas"));
            options.add(new ConcreteKeyValue("Cherries", "Cherries"));
            options.add(new ConcreteKeyValue("Oranges", "Oranges"));
            options.add(new ConcreteKeyValue("Pears", "Pears"));
        } else if (testForm.getInputField4().equals("Vegetables")) {
            options.add(new ConcreteKeyValue("Beans", "Beans"));
            options.add(new ConcreteKeyValue("Broccoli", "Broccoli"));
            options.add(new ConcreteKeyValue("Cabbage", "Cabbage"));
            options.add(new ConcreteKeyValue("Carrots", "Carrots"));
            options.add(new ConcreteKeyValue("Celery", "Celery"));
            options.add(new ConcreteKeyValue("Corn", "Corn"));
            options.add(new ConcreteKeyValue("Peas", "Peas"));
        }

        return options;
    }

}

@@ -873,42 +873,160 @@
 rad.
-uif.control.UifKeyValuesFinderBase
+labs.kitchensink.UifComponentsTestForm;%0D%0Aimport org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase;%0D%0Aimport org.kuali.rice.krad.uif.field.InputField
 ;%0D%0Ai
@@ -1346,63 +1346,357 @@
     
-KradSampleAppForm testForm = (KradSampleAppForm) model;
+String foodType = null;%0D%0A%0D%0A        if (model instanceof KradSampleAppForm) %7B%0D%0A            KradSampleAppForm testForm = (KradSampleAppForm) model;%0D%0A            foodType = testForm.getInputField4();%0D%0A        %7D else %7B%0D%0A            UifComponentsTestForm testForm = (UifComponentsTestForm) model;%0D%0A            foodType = testForm.getField88();%0D%0A        %7D
 %0D%0A%0D%0A
@@ -1833,70 +1833,36 @@
 if (
-testForm.getInputField4() == null %7C%7C testForm.getInputField4()
+foodType == null %7C%7C foodType
 .equ
@@ -2248,33 +2248,16 @@
 if (
-testForm.getInputField4()
+foodType
 .equ

Fix for kitchen sink in krad sampleapp