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.element;
17
18 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
19 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
20 import org.kuali.rice.krad.datadictionary.parse.BeanTags;
21
22 import org.kuali.rice.krad.datadictionary.validator.ValidationTrace;
23 import org.kuali.rice.krad.datadictionary.validator.Validator;
24
25 /**
26 * Element that presents an Icon.
27 *
28 * @author Kuali Rice Team (rice.collab@kuali.org)
29 */
30 @BeanTags({@BeanTag(name = "icon", parent = "Uif-Icon")})
31 public class Icon extends ContentElementBase {
32 private static final long serialVersionUID = 6771810101056598912L;
33
34 private String iconClass;
35
36 public Icon() {
37 super();
38 }
39
40 /**
41 * Icon Class for the action
42 *
43 * <p>
44 * Bootstrap Icon Class to be rendered on this Action
45 * </p>
46 *
47 * @return label for action
48 */
49 @BeanTagAttribute
50 public String getIconClass() {
51 return iconClass;
52 }
53
54 /**
55 * Setter for the Icon Class
56 *
57 * @param iconClass
58 */
59 public void setIconClass(String iconClass) {
60 this.iconClass = iconClass;
61 }
62
63 /**
64 * {@inheritDoc}
65 */
66 @Override
67 public void completeValidation(ValidationTrace tracer){
68 tracer.addBean(this);
69
70 // Checks that a source is set
71 if(getIconClass()==null){
72 if(!Validator.checkExpressions(this, "iconClass")){
73 String currentValues [] = {"iconClass ="+getIconClass()};
74 tracer.createError("iconClass must be set",currentValues);
75 }
76 }
77
78 super.completeValidation(tracer.getCopy());
79 }
80 }