1 /*
2 * Copyright 2007 The Kuali Foundation Licensed under the Educational Community
3 * License, Version 1.0 (the "License"); you may not use this file except in
4 * compliance with the License. You may obtain a copy of the License at
5 * http://www.opensource.org/licenses/ecl1.php Unless required by applicable law
6 * or agreed to in writing, software distributed under the License is
7 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 * KIND, either express or implied. See the License for the specific language
9 * governing permissions and limitations under the License.
10 */
11 package org.kuali.rice.krad.uif.widget;
12
13 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
14 import org.kuali.rice.krad.uif.view.HistoryEntry;
15 import org.kuali.rice.krad.uif.view.View;
16 import org.kuali.rice.krad.uif.component.Component;
17
18 import java.util.HashMap;
19 import java.util.List;
20 import java.util.Map;
21
22 /**
23 * The breadcrumb widget contains various settings for setting up
24 * Breadcrumb/History support on the view.
25 *
26 * @author Kuali Rice Team (rice.collab@kuali.org)
27 */
28 public class BreadCrumbs extends WidgetBase {
29 private static final long serialVersionUID = -2864287914665842251L;
30
31 private boolean displayHomewardPath;
32 private boolean displayPassedHistory;
33 private boolean displayBreadcrumbsWhenOne;
34 private List<HistoryEntry> homewardPathList;
35
36 /**
37 * The following updates are done here:
38 *
39 * <ul>
40 * <li>Evaluate expression on howeward path list</li>
41 * </ul>
42 *
43 * @see org.kuali.rice.krad.uif.component.Component#performApplyModel(org.kuali.rice.krad.uif.view.View,
44 * java.lang.Object)
45 */
46 @Override
47 public void performApplyModel(View view, Object model, Component parent) {
48 super.performApplyModel(view, model, parent);
49
50 if (homewardPathList != null) {
51 Map<String, Object> context = new HashMap<String, Object>();
52 context.putAll(view.getContext());
53
54 for (HistoryEntry historyEntry : homewardPathList) {
55 KRADServiceLocatorWeb.getExpressionEvaluatorService().evaluateObjectExpressions(historyEntry, model,
56 context);
57 }
58 }
59 }
60
61 /**
62 * Determines if the homewardPath is to be displayed. Even when this is
63 * setting is on the code may determine to turn off homewardPath display
64 * based on user interaction and ui elements being displayed (ie lightbox)
65 *
66 * @return the displayHomewardPath
67 */
68 public boolean isDisplayHomewardPath() {
69 return this.displayHomewardPath;
70 }
71
72 /**
73 * @param displayHomewardPath the displayHomewardPath to set
74 */
75 public void setDisplayHomewardPath(boolean displayHomewardPath) {
76 this.displayHomewardPath = displayHomewardPath;
77 }
78
79 /**
80 * Determines if the passedHistory is to be displayed. In most cases this
81 * should not be set through the xml as this is toggled off and on through
82 * code during different ui procedures.
83 *
84 * @return the displayPassedHistory
85 */
86 public boolean isDisplayPassedHistory() {
87 return this.displayPassedHistory;
88 }
89
90 /**
91 * @param displayPassedHistory the displayPassedHistory to set
92 */
93 public void setDisplayPassedHistory(boolean displayPassedHistory) {
94 this.displayPassedHistory = displayPassedHistory;
95 }
96
97 /**
98 * The homewardPath to be displayed on this representative of the logical
99 * "location" of the view within the site hierarchy, can be set to anything
100 * desired.
101 *
102 * @return the homewardPathList
103 */
104 public List<HistoryEntry> getHomewardPathList() {
105 return this.homewardPathList;
106 }
107
108 /**
109 * @param homewardPathList the homewardPathList to set
110 */
111 public void setHomewardPathList(List<HistoryEntry> homewardPathList) {
112 this.homewardPathList = homewardPathList;
113 }
114
115 /**
116 * If true, breadcrumbs will not be displayed if only one breadcrumb is
117 * going to be shown, this improves visual clarity of the page
118 *
119 * @return the displayBreadcrumbsWhenOne
120 */
121 public boolean isDisplayBreadcrumbsWhenOne() {
122 return this.displayBreadcrumbsWhenOne;
123 }
124
125 /**
126 * @param displayBreadcrumbsWhenOne the displayBreadcrumbsWhenOne to set
127 */
128 public void setDisplayBreadcrumbsWhenOne(boolean displayBreadcrumbsWhenOne) {
129 this.displayBreadcrumbsWhenOne = displayBreadcrumbsWhenOne;
130 }
131
132 }