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.field;
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.datadictionary.parse.BeanTags;
22  import org.kuali.rice.krad.uif.element.ProgressBar;
23  import org.kuali.rice.krad.uif.util.LifecycleElement;
24  
25  /**
26   * Field wrapper for the ProgressBar element
27   *
28   * @author Kuali Rice Team (rice.collab@kuali.org)
29   */
30  @BeanTags({@BeanTag(name = "progressBarField-bean", parent = "Uif-ProgressBarField"),
31          @BeanTag(name = "stepProgressBarField-bean", parent = "Uif-StepProgressBarField")})
32  public class ProgressBarField extends FieldBase {
33      private static final long serialVersionUID = 2002441871716395985L;
34  
35      private ProgressBar progressBar;
36  
37      public ProgressBarField() {
38          super();
39      }
40  
41      /**
42       * PerformFinalize override - calls super, corrects the field's Label for attribute to point to this field's
43       * content
44       *
45       * @param model the model
46       * @param parent the parent component
47       */
48      @Override
49      public void performFinalize(Object model, LifecycleElement parent) {
50          super.performFinalize(model, parent);
51  
52          //determine what id to use for the for attribute of the label, if present
53          if (this.getFieldLabel() != null && this.getProgressBar() != null && StringUtils.isNotBlank(
54                  this.getProgressBar().getId())) {
55              this.getFieldLabel().setLabelForComponentId(this.getProgressBar().getId());
56          }
57      }
58  
59      /**
60       * The ProgressBar to be shown for this field
61       *
62       * @return the ProgressBar
63       */
64      @BeanTagAttribute(name = "progressBar")
65      public ProgressBar getProgressBar() {
66          return progressBar;
67      }
68  
69      /**
70       * @see ProgressBarField#getProgressBar()
71       */
72      public void setProgressBar(ProgressBar progressBar) {
73          this.progressBar = progressBar;
74      }
75  }