001/**
002 * Copyright 2005-2018 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.krad.datadictionary.parse.BeanTag;
019import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
020
021/**
022 * OptionListControl is used for listing out options from an option finder or options list.  This control can show all
023 * items in the options or it can show only the selected options (if backed by a propertyName).  One use case for this
024 * control is to use it in combination with UifKeyValueLocation to provide a list of locations retrieved through a
025 * KeyValuesFinder.
026 *
027 * @author Kuali Rice Team (rice.collab@kuali.org)
028 */
029@BeanTag(name = "optionListControl", parent = "Uif-OptionListControl")
030public class OptionListControl extends MultiValueControlBase {
031    private static final long serialVersionUID = 8249529888721507155L;
032
033    private String itemCssClass;
034    private String selectedItemCssClass;
035    private boolean showOnlySelected;
036
037    /**
038     * The item css class to add to each li element of the list
039     *
040     * @return the item css class
041     */
042    @BeanTagAttribute
043    public String getItemCssClass() {
044        return itemCssClass;
045    }
046
047    /**
048     * Set the itemCssClass
049     *
050     * @param itemCssClass
051     */
052    public void setItemCssClass(String itemCssClass) {
053        this.itemCssClass = itemCssClass;
054    }
055
056    /**
057     * When true, only show the "selected" options (items which match a value in the property of the field).  Otherwise,
058     * show all options.
059     *
060     * @return true if only showing selected options, otherwise show all
061     */
062    @BeanTagAttribute
063    public boolean isShowOnlySelected() {
064        return showOnlySelected;
065    }
066
067    /**
068     * Set the showOnlySelected flag
069     *
070     * @param showOnlySelected
071     */
072    public void setShowOnlySelected(boolean showOnlySelected) {
073        this.showOnlySelected = showOnlySelected;
074    }
075
076    /**
077     * The css class to add to each item of the list which matches a value in the property
078     *
079     * @return the selected item css class
080     */
081    @BeanTagAttribute
082    public String getSelectedItemCssClass() {
083        return selectedItemCssClass;
084    }
085
086    /**
087     * Set the selectedItemCssClass
088     *
089     * @param selectedItemCssClass
090     */
091    public void setSelectedItemCssClass(String selectedItemCssClass) {
092        this.selectedItemCssClass = selectedItemCssClass;
093    }
094}