View Javadoc

1   /**
2    * Copyright 2005-2015 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.datadictionary.parse.BeanTag;
19  import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
20  import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
21  import org.kuali.rice.krad.uif.util.ExpressionUtils;
22  import org.kuali.rice.krad.uif.view.View;
23  import org.kuali.rice.krad.uif.component.Component;
24  
25  import java.util.ArrayList;
26  import java.util.HashMap;
27  import java.util.List;
28  import java.util.Map;
29  
30  /**
31   * The breadcrumb widget contains various settings for setting up
32   * Breadcrumb/History support on the view
33   *
34   * @author Kuali Rice Team (rice.collab@kuali.org)
35   */
36  @BeanTag(name = "breadcrumbs-bean", parent = "Uif-Breadcrumbs")
37  public class Breadcrumbs extends WidgetBase {
38      private static final long serialVersionUID = -2864287914665842251L;
39  
40      private boolean displayBreadcrumbsWhenOne;
41      private boolean usePathBasedBreadcrumbs;
42  
43      public Breadcrumbs() {
44          super();
45      }
46  
47      /**
48       * The following updates are done here:
49       *
50       * <ul>
51       * <li>Evaluate expression on homeward path list</li>
52       * </ul>
53       *
54       * @see org.kuali.rice.krad.uif.component.Component#performApplyModel(org.kuali.rice.krad.uif.view.View,
55       *      java.lang.Object, org.kuali.rice.krad.uif.component.Component)
56       */
57      @Override
58      public void performApplyModel(View view, Object model, Component parent) {
59          super.performApplyModel(view, model, parent);
60      }
61  
62      /**
63       * If false, breadcrumbs will not be displayed if only one breadcrumb is
64       * going to be shown, this improves visual clarity of the page
65       *
66       * @return the displayBreadcrumbsWhenOne
67       */
68      @BeanTagAttribute(name = "displayBreadcrumbsWhenOne")
69      public boolean isDisplayBreadcrumbsWhenOne() {
70          return this.displayBreadcrumbsWhenOne;
71      }
72  
73      /**
74       * Set displayBreadcrumbsWhenOne
75       *
76       * @param displayBreadcrumbsWhenOne the displayBreadcrumbsWhenOne to set
77       */
78      public void setDisplayBreadcrumbsWhenOne(boolean displayBreadcrumbsWhenOne) {
79          this.displayBreadcrumbsWhenOne = displayBreadcrumbsWhenOne;
80      }
81  
82      /**
83       * If set to true, the breadcrumbs on the View will always be path-based (history backed)
84       *
85       * @return true if using path based breadcrumbs, false otherwise
86       */
87      @BeanTagAttribute(name = "usePathBasedBreadcrumbs")
88      public boolean isUsePathBasedBreadcrumbs() {
89          return usePathBasedBreadcrumbs;
90      }
91  
92      /**
93       * Set usePathBasedBreadcrumbs to true to use path-based breadcrumbs
94       *
95       * @param usePathBasedBreadcrumbs
96       */
97      public void setUsePathBasedBreadcrumbs(boolean usePathBasedBreadcrumbs) {
98          this.usePathBasedBreadcrumbs = usePathBasedBreadcrumbs;
99      }
100 
101     /**
102      * @see org.kuali.rice.krad.uif.component.ComponentBase#copy()
103      */
104     @Override
105     protected <T> void copyProperties(T component) {
106         super.copyProperties(component);
107         Breadcrumbs breadcrumbsCopy = (Breadcrumbs) component;
108         breadcrumbsCopy.setDisplayBreadcrumbsWhenOne(this.displayBreadcrumbsWhenOne);
109         breadcrumbsCopy.setUsePathBasedBreadcrumbs(this.usePathBasedBreadcrumbs);
110     }
111 }