1 /**
2 * Copyright 2005-2012 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.widget;
17
18 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
19 import org.kuali.rice.krad.uif.util.ExpressionUtils;
20 import org.kuali.rice.krad.uif.view.HistoryEntry;
21 import org.kuali.rice.krad.uif.view.View;
22 import org.kuali.rice.krad.uif.component.Component;
23
24 import java.util.HashMap;
25 import java.util.List;
26 import java.util.Map;
27
28 /**
29 * The breadcrumb widget contains various settings for setting up
30 * Breadcrumb/History support on the view
31 *
32 * @author Kuali Rice Team (rice.collab@kuali.org)
33 */
34 public class BreadCrumbs extends WidgetBase {
35 private static final long serialVersionUID = -2864287914665842251L;
36
37 private boolean displayHomewardPath;
38 private boolean displayPassedHistory;
39 private boolean displayBreadcrumbsWhenOne;
40
41 private List<HistoryEntry> homewardPathList;
42
43 /**
44 * The following updates are done here:
45 *
46 * <ul>
47 * <li>Evaluate expression on homeward path list</li>
48 * </ul>
49 *
50 * @see org.kuali.rice.krad.uif.component.Component#performApplyModel(org.kuali.rice.krad.uif.view.View,
51 * java.lang.Object, org.kuali.rice.krad.uif.component.Component)
52 */
53 @Override
54 public void performApplyModel(View view, Object model, Component parent) {
55 super.performApplyModel(view, model, parent);
56
57 if (homewardPathList != null) {
58 Map<String, Object> context = new HashMap<String, Object>();
59 context.putAll(view.getContext());
60
61 for (HistoryEntry historyEntry : homewardPathList) {
62 ExpressionUtils.populatePropertyExpressionsFromGraph(historyEntry, false);
63 KRADServiceLocatorWeb.getExpressionEvaluatorService().evaluateExpressionsOnConfigurable(view,
64 historyEntry, model, context);
65 }
66 }
67 }
68
69 /**
70 * Determines if the homewardPath is to be displayed. Even when this is
71 * setting is on the code may determine to turn off homewardPath display
72 * based on user interaction and ui elements being displayed (ie lightbox)
73 *
74 * @return the displayHomewardPath
75 */
76 public boolean isDisplayHomewardPath() {
77 return this.displayHomewardPath;
78 }
79
80 /**
81 * @param displayHomewardPath the displayHomewardPath to set
82 */
83 public void setDisplayHomewardPath(boolean displayHomewardPath) {
84 this.displayHomewardPath = displayHomewardPath;
85 }
86
87 /**
88 * Determines if the passedHistory is to be displayed. In most cases this
89 * should not be set through the xml as this is toggled off and on through
90 * code during different ui procedures.
91 *
92 * @return the displayPassedHistory
93 */
94 public boolean isDisplayPassedHistory() {
95 return this.displayPassedHistory;
96 }
97
98 /**
99 * @param displayPassedHistory the displayPassedHistory to set
100 */
101 public void setDisplayPassedHistory(boolean displayPassedHistory) {
102 this.displayPassedHistory = displayPassedHistory;
103 }
104
105 /**
106 * The homewardPath to be displayed on this representative of the logical
107 * "location" of the view within the site hierarchy, can be set to anything
108 * desired.
109 *
110 * @return the homewardPathList
111 */
112 public List<HistoryEntry> getHomewardPathList() {
113 return this.homewardPathList;
114 }
115
116 /**
117 * @param homewardPathList the homewardPathList to set
118 */
119 public void setHomewardPathList(List<HistoryEntry> homewardPathList) {
120 this.homewardPathList = homewardPathList;
121 }
122
123 /**
124 * If true, breadcrumbs will not be displayed if only one breadcrumb is
125 * going to be shown, this improves visual clarity of the page
126 *
127 * @return the displayBreadcrumbsWhenOne
128 */
129 public boolean isDisplayBreadcrumbsWhenOne() {
130 return this.displayBreadcrumbsWhenOne;
131 }
132
133 /**
134 * @param displayBreadcrumbsWhenOne the displayBreadcrumbsWhenOne to set
135 */
136 public void setDisplayBreadcrumbsWhenOne(boolean displayBreadcrumbsWhenOne) {
137 this.displayBreadcrumbsWhenOne = displayBreadcrumbsWhenOne;
138 }
139
140 }