View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.uif.control;
17  
18  import org.kuali.rice.krad.datadictionary.parse.BeanTag;
19  import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
20  
21  /**
22   * OptionListControl is used for listing out options from an option finder or options list.  This control can show all
23   * items in the options or it can show only the selected options (if backed by a propertyName).  One use case for this
24   * control is to use it in combination with UifKeyValueLocation to provide a list of locations retrieved through a
25   * KeyValuesFinder.
26   *
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  @BeanTag(name = "optionListControl-bean", parent = "Uif-OptionListControl")
30  public class OptionListControl extends MultiValueControlBase {
31      private static final long serialVersionUID = 8249529888721507155L;
32  
33      private String itemCssClass;
34      private String selectedItemCssClass;
35      private boolean showOnlySelected;
36  
37      /**
38       * The item css class to add to each li element of the list
39       *
40       * @return the item css class
41       */
42      @BeanTagAttribute(name = "itemCssClass")
43      public String getItemCssClass() {
44          return itemCssClass;
45      }
46  
47      /**
48       * Set the itemCssClass
49       *
50       * @param itemCssClass
51       */
52      public void setItemCssClass(String itemCssClass) {
53          this.itemCssClass = itemCssClass;
54      }
55  
56      /**
57       * When true, only show the "selected" options (items which match a value in the property of the field).  Otherwise,
58       * show all options.
59       *
60       * @return true if only showing selected options, otherwise show all
61       */
62      @BeanTagAttribute(name = "showOnlySelected")
63      public boolean isShowOnlySelected() {
64          return showOnlySelected;
65      }
66  
67      /**
68       * Set the showOnlySelected flag
69       *
70       * @param showOnlySelected
71       */
72      public void setShowOnlySelected(boolean showOnlySelected) {
73          this.showOnlySelected = showOnlySelected;
74      }
75  
76      /**
77       * The css class to add to each item of the list which matches a value in the property
78       *
79       * @return the selected item css class
80       */
81      @BeanTagAttribute(name = "selectedItemCssClass")
82      public String getSelectedItemCssClass() {
83          return selectedItemCssClass;
84      }
85  
86      /**
87       * Set the selectedItemCssClass
88       *
89       * @param selectedItemCssClass
90       */
91      public void setSelectedItemCssClass(String selectedItemCssClass) {
92          this.selectedItemCssClass = selectedItemCssClass;
93      }
94  }