View Javadoc

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