1 /** 2 * Copyright 2005-2015 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.util; 17 18 import org.kuali.rice.krad.datadictionary.parse.BeanTag; 19 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute; 20 21 /** 22 * KeyValue that has an additional location property that takes a Url object. When this is used with a dropdown or 23 * an optionList control, those options become navigation controls. 24 * 25 * @author Kuali Rice Team (rice.collab@kuali.org) 26 */ 27 @BeanTag(name = "keyValueLocation", parent = "Uif-KeyValueLocation") 28 public class UifKeyValueLocation extends UifKeyValue { 29 private static final long serialVersionUID = -4613047498920929280L; 30 31 private UrlInfo location; 32 33 /** 34 * Base constructor 35 */ 36 public UifKeyValueLocation() { 37 super(); 38 } 39 40 public UifKeyValueLocation(String key, String value) { 41 super(key, value); 42 } 43 44 /** 45 * KeyValueLocation constructor 46 * 47 * @param key the key 48 * @param value the value 49 * @param location the url location object 50 */ 51 public UifKeyValueLocation(String key, String value, UrlInfo location) { 52 this.key = key; 53 this.value = value; 54 this.location = location; 55 } 56 57 /** 58 * Get the url object representing the location 59 * 60 * @return the url location object 61 */ 62 @BeanTagAttribute(name = "location", type = BeanTagAttribute.AttributeType.SINGLEBEAN) 63 public UrlInfo getLocation() { 64 return location; 65 } 66 67 /** 68 * Set the url location object 69 * 70 * @param location 71 */ 72 public void setLocation(UrlInfo location) { 73 this.location = location; 74 } 75 76 /** 77 * Convenience setter for setting the href (full URL) of the location object 78 * 79 * @param href URL for location option 80 */ 81 public void setHref(String href) { 82 if (this.location == null) { 83 this.location = ComponentFactory.getUrlInfo(); 84 } 85 86 this.location.setHref(href); 87 } 88 89 }