1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.widget;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
20 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
21
22 import java.util.HashMap;
23 import java.util.Map;
24
25
26
27
28
29
30
31
32
33
34
35
36 @BeanTag(name = "growls-bean", parent = "Uif-Growls")
37 public class Growls extends WidgetBase {
38 private static final long serialVersionUID = -8701090110933484411L;
39
40 private boolean sticky;
41 private int timeShown;
42 private String position;
43
44 public Growls() {
45 super();
46 }
47
48
49
50
51
52
53 @Override
54 public Map<String, String> getTemplateOptions() {
55 Map<String, String> templateOptions = super.getTemplateOptions();
56
57 if (templateOptions == null) {
58 super.setTemplateOptions(templateOptions = new HashMap<String, String>());
59 }
60
61 if (!templateOptions.containsKey("sticky")) {
62 templateOptions.put("sticky", Boolean.toString(sticky));
63 }
64 if (!templateOptions.containsKey("life")) {
65 templateOptions.put("life", Integer.toString(timeShown));
66 }
67 if (StringUtils.isNotBlank(position) && !templateOptions.containsKey("position")) {
68 templateOptions.put("position", position);
69 }
70
71 return templateOptions;
72 }
73
74
75
76
77
78
79 @BeanTagAttribute(name="sticky")
80 public boolean isSticky() {
81 return this.sticky;
82 }
83
84
85
86
87 public void setSticky(boolean sticky) {
88 this.sticky = sticky;
89 }
90
91
92
93
94
95
96 @BeanTagAttribute(name="timeShown")
97 public int getTimeShown() {
98 return this.timeShown;
99 }
100
101
102
103
104 public void setTimeShown(int timeShown) {
105 this.timeShown = timeShown;
106 }
107
108
109
110
111
112
113
114 @BeanTagAttribute(name="position")
115 public String getPosition() {
116 return this.position;
117 }
118
119
120
121
122 public void setPosition(String position) {
123 this.position = position;
124 }
125
126
127
128
129 @Override
130 protected <T> void copyProperties(T component) {
131 super.copyProperties(component);
132 Growls growlsCopy = (Growls) component;
133 growlsCopy.setSticky(this.isSticky());
134 growlsCopy.setTimeShown(this.getTimeShown());
135 growlsCopy.setPosition(this.getPosition());
136 }
137 }