View Javadoc
1   /**
2    * Copyright 2005-2016 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.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  
23  import java.util.HashMap;
24  import java.util.Map;
25  
26  /**
27   * Used for rendering a lightbox in the UI to display action links in dialog popups.
28   *
29   * @author Kuali Rice Team (rice.collab@kuali.org)
30   */
31  @BeanTags({@BeanTag(name = "lightBox", parent = "Uif-LightBox"),
32          @BeanTag(name = "lightBoxPost", parent = "Uif-LightBoxPost")})
33  public class LightBox extends WidgetBase {
34      private static final long serialVersionUID = -4004284762546700975L;
35  
36      private String height;
37      private String width;
38  
39      private boolean addAppParms;
40  
41      public LightBox() {
42          super();
43      }
44  
45      /**
46       * Override to add property values to the template options
47       *
48       * {@inheritDoc}
49       */
50      @Override
51      public Map<String, String> getTemplateOptions() {
52          Map<String, String> templateOptions = super.getTemplateOptions();
53  
54          if (templateOptions == null) {
55              super.setTemplateOptions(templateOptions = new HashMap<String, String>());
56          }
57  
58          if (StringUtils.isNotBlank(width) && !templateOptions.containsKey("width")) {
59              templateOptions.put("width", width);
60          }
61  
62          if (StringUtils.isNotBlank(height) && !templateOptions.containsKey("height")) {
63              templateOptions.put("height", height);
64          }
65  
66          return templateOptions;
67      }
68  
69      /**
70       * @return height of light box
71       */
72      @BeanTagAttribute
73      public String getHeight() {
74          return height;
75      }
76  
77      /**
78       * Setter for the height of the light box
79       * Can be percentage. ie. 75%
80       *
81       * @param height
82       */
83      public void setHeight(String height) {
84          this.height = height;
85      }
86  
87      /**
88       * @return width of light box
89       */
90      @BeanTagAttribute
91      public String getWidth() {
92          return width;
93      }
94  
95      /**
96       * Setter for the width of the light box
97       * Can be percentage. ie. 75%
98       *
99       * @param width
100      */
101     public void setWidth(String width) {
102         this.width = width;
103     }
104 
105     /**
106      * Indicates that the light box link should have application parameters added to it.
107      *
108      * @return true if the link should have application parameters added, false otherwise
109      */
110     @BeanTagAttribute
111     public boolean isAddAppParms() {
112         return addAppParms;
113     }
114 
115     /**
116      * Setter for the addAppParms.
117      *
118      * @param addAppParms
119      */
120     public void setAddAppParms(boolean addAppParms) {
121         this.addAppParms = addAppParms;
122     }
123 }