1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 import org.kuali.rice.krad.uif.component.Component;
21 import org.kuali.rice.krad.uif.element.ContentElementBase;
22 import org.kuali.rice.krad.uif.view.View;
23
24 import java.util.ArrayList;
25 import java.util.HashMap;
26 import java.util.List;
27 import java.util.Map;
28
29
30
31
32
33
34 @BeanTag(name = "breadcrumbItem-bean", parent = "Uif-BreadcrumbItem")
35 public class BreadcrumbItem extends ContentElementBase {
36 private String label;
37 private UrlInfo url;
38 private Component siblingBreadcrumbComponent;
39 private boolean renderAsLink;
40
41
42
43
44
45
46
47
48
49
50
51 @Override
52 public void performApplyModel(View view, Object model, Component parent) {
53 super.performApplyModel(view, model, parent);
54
55 if (url != null) {
56 Map<String, Object> context = new HashMap<String, Object>();
57
58 Map<String, Object> viewContext = view.getContext();
59 if (viewContext != null) {
60 context.putAll(viewContext);
61 }
62
63 ExpressionUtils.populatePropertyExpressionsFromGraph(url, false);
64 view.getViewHelperService().getExpressionEvaluator().evaluateExpressionsOnConfigurable(view, url,
65 context);
66 }
67 }
68
69
70
71
72
73
74 @Override
75 public List<Component> getComponentsForLifecycle() {
76 List<Component> components = new ArrayList<Component>();
77
78 components.add(siblingBreadcrumbComponent);
79 components.addAll(super.getComponentsForLifecycle());
80
81 return components;
82 }
83
84
85
86
87
88
89 @BeanTagAttribute(name = "label")
90 public String getLabel() {
91 return label;
92 }
93
94
95
96
97
98
99
100 public void setLabel(String label) {
101 this.label = label;
102 }
103
104
105
106
107
108
109 @BeanTagAttribute(name = "url")
110 public UrlInfo getUrl() {
111 return url;
112 }
113
114
115
116
117
118
119 public void setUrl(UrlInfo urlObject) {
120 this.url = urlObject;
121 }
122
123
124
125
126
127
128
129 @BeanTagAttribute(name = "siblingBreadcrumbComponent", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
130 public Component getSiblingBreadcrumbComponent() {
131 return siblingBreadcrumbComponent;
132 }
133
134
135
136
137
138
139 public void setSiblingBreadcrumbComponent(Component siblingBreadcrumbComponent) {
140 this.siblingBreadcrumbComponent = siblingBreadcrumbComponent;
141 }
142
143
144
145
146
147
148
149 @BeanTagAttribute(name = "renderAsLink")
150 public boolean isRenderAsLink() {
151 return renderAsLink;
152 }
153
154
155
156
157
158
159 public void setRenderAsLink(boolean renderAsLink) {
160 this.renderAsLink = renderAsLink;
161 }
162
163
164
165
166 @Override
167 protected <T> void copyProperties(T component) {
168 super.copyProperties(component);
169 BreadcrumbItem breadcrumbItemCopy = (BreadcrumbItem) component;
170 breadcrumbItemCopy.setLabel(this.label);
171
172 if (this.siblingBreadcrumbComponent != null) {
173 breadcrumbItemCopy.setSiblingBreadcrumbComponent((Component)this.siblingBreadcrumbComponent.copy());
174 }
175
176 breadcrumbItemCopy.setRenderAsLink(this.renderAsLink);
177
178 if (this.url != null) {
179 breadcrumbItemCopy.setUrl((UrlInfo)this.url.copy());
180 }
181 }
182 }