001    /**
002     * Copyright 2005-2013 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     */
016    package org.kuali.rice.krad.demo.uif.options;
017    
018    import org.kuali.rice.core.api.util.ConcreteKeyValue;
019    import org.kuali.rice.core.api.util.KeyValue;
020    import org.kuali.rice.krad.keyvalues.KeyValuesBase;
021    
022    import java.util.ArrayList;
023    import java.util.List;
024    
025    /**
026     * @author Kuali Rice Team (rice.collab@kuali.org)
027     */
028    public class SimpleTestKeyValues extends KeyValuesBase {
029    
030        private boolean blankOption;
031    
032        /**
033         * This is a fake implementation of a key value finder, normally this would make a request to
034         * a database to obtain the necessary values.  Used only for testing.
035         *
036         * @see org.kuali.rice.krad.keyvalues.KeyValuesFinder#getKeyValues()
037         */
038        @Override
039        public List<KeyValue> getKeyValues() {
040            List<KeyValue> keyValues = new ArrayList<KeyValue>();
041    
042            if (blankOption) {
043                keyValues.add(new ConcreteKeyValue("", ""));
044            }
045    
046            keyValues.add(new ConcreteKeyValue("1", "Option 1"));
047            keyValues.add(new ConcreteKeyValue("2", "Option 2"));
048            keyValues.add(new ConcreteKeyValue("3", "Option 3"));
049            keyValues.add(new ConcreteKeyValue("4", "Option 4"));
050            keyValues.add(new ConcreteKeyValue("5", "Option 5"));
051    
052            return keyValues;
053        }
054    
055        /**
056         * @return the blankOption
057         */
058        public boolean isBlankOption() {
059            return this.blankOption;
060        }
061    
062        /**
063         * @param blankOption the blankOption to set
064         */
065        public void setBlankOption(boolean blankOption) {
066            this.blankOption = blankOption;
067        }
068    
069    }