1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.element;
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 import org.kuali.rice.krad.uif.container.Container;
22 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycle;
23 import org.kuali.rice.krad.uif.view.View;
24
25
26
27
28 @BeanTag(name = "pageBreadcrumbOptions", parent = "Uif-PageBreadcrumbOptions")
29 public class PageBreadcrumbOptions extends BreadcrumbOptions {
30 private static final long serialVersionUID = -5666730356781875858L;
31
32
33 private boolean renderViewBreadcrumb;
34 private boolean renderHomewardPathBreadcrumbs;
35 private boolean renderPreViewBreadcrumbs;
36 private boolean renderPrePageBreadcrumbs;
37 private boolean renderParentLocations;
38
39
40
41
42
43
44 @Override
45 public void setupBreadcrumbs(Object model) {
46 View view = ViewLifecycle.getView();
47 BreadcrumbOptions viewBreadcrumbOptions = view.getBreadcrumbOptions();
48
49
50 if (this.getHomewardPathBreadcrumbs() == null
51 && viewBreadcrumbOptions != null
52 && viewBreadcrumbOptions.getHomewardPathBreadcrumbs() != null) {
53 this.setHomewardPathBreadcrumbs(viewBreadcrumbOptions.getHomewardPathBreadcrumbs());
54 }
55
56 if (this.getPrePageBreadcrumbs() == null
57 && viewBreadcrumbOptions != null
58 && viewBreadcrumbOptions.getPrePageBreadcrumbs() != null) {
59 this.setPrePageBreadcrumbs(viewBreadcrumbOptions.getPrePageBreadcrumbs());
60 }
61
62 if (this.getPreViewBreadcrumbs() == null
63 && viewBreadcrumbOptions != null
64 && viewBreadcrumbOptions.getPreViewBreadcrumbs() != null) {
65 this.setPreViewBreadcrumbs(viewBreadcrumbOptions.getPreViewBreadcrumbs());
66 }
67
68 if (this.getBreadcrumbOverrides() == null
69 && viewBreadcrumbOptions != null
70 && viewBreadcrumbOptions.getBreadcrumbOverrides() != null) {
71 this.setBreadcrumbOverrides(viewBreadcrumbOptions.getBreadcrumbOverrides());
72 }
73 }
74
75
76
77
78
79
80
81 @Override
82 public void finalizeBreadcrumbs(Object model, Container parent, BreadcrumbItem breadcrumbItem) {
83
84 if (StringUtils.isBlank(breadcrumbItem.getLabel()) && parent.getHeader() != null && StringUtils.isNotBlank(
85 parent.getHeader().getHeaderText())) {
86 breadcrumbItem.setLabel(parent.getHeader().getHeaderText());
87 }
88
89
90 if (StringUtils.isBlank(breadcrumbItem.getLabel())) {
91 breadcrumbItem.setRender(false);
92 }
93
94
95 finalizeBreadcrumbsUrl(model, parent, breadcrumbItem);
96
97 if (breadcrumbItem.getUrl().getPageId() == null) {
98 breadcrumbItem.getUrl().setPageId(parent.getId());
99 }
100 }
101
102
103
104
105
106
107 @BeanTagAttribute(name = "renderViewBreadcrumb")
108 public boolean isRenderViewBreadcrumb() {
109 return renderViewBreadcrumb;
110 }
111
112
113
114
115
116
117 public void setRenderViewBreadcrumb(boolean renderViewBreadcrumb) {
118 this.renderViewBreadcrumb = renderViewBreadcrumb;
119 }
120
121
122
123
124
125
126 @BeanTagAttribute(name = "renderHomewardPathBreadcrumbs")
127 public boolean isRenderHomewardPathBreadcrumbs() {
128 return renderHomewardPathBreadcrumbs;
129 }
130
131
132
133
134
135
136 public void setRenderHomewardPathBreadcrumbs(boolean renderHomewardPathBreadcrumbs) {
137 this.renderHomewardPathBreadcrumbs = renderHomewardPathBreadcrumbs;
138 }
139
140
141
142
143
144
145 @BeanTagAttribute(name = "renderPreViewBreadcrumbs")
146 public boolean isRenderPreViewBreadcrumbs() {
147 return renderPreViewBreadcrumbs;
148 }
149
150
151
152
153
154
155 public void setRenderPreViewBreadcrumbs(boolean renderPreViewBreadcrumbs) {
156 this.renderPreViewBreadcrumbs = renderPreViewBreadcrumbs;
157 }
158
159
160
161
162
163
164 @BeanTagAttribute(name = "renderPrePageBreadcrumbs")
165 public boolean isRenderPrePageBreadcrumbs() {
166 return renderPrePageBreadcrumbs;
167 }
168
169
170
171
172
173
174 public void setRenderPrePageBreadcrumbs(boolean renderPrePageBreadcrumbs) {
175 this.renderPrePageBreadcrumbs = renderPrePageBreadcrumbs;
176 }
177
178
179
180
181
182
183
184 @BeanTagAttribute(name = "renderParentLocations")
185 public boolean isRenderParentLocations() {
186 return renderParentLocations;
187 }
188
189
190
191
192
193
194 public void setRenderParentLocations(boolean renderParentLocations) {
195 this.renderParentLocations = renderParentLocations;
196 }
197 }