View Javadoc

1   /**
2    * Copyright 2005-2012 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 java.util.HashMap;
19  
20  /**
21   * Used for rendering a lightbox in the UI to display action links in dialog
22   * popups
23   *
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public class LightBox extends WidgetBase {
27      private static final long serialVersionUID = -4004284762546700975L;
28  
29      private String height;
30      private String width;
31  
32      private boolean addAppParms;
33      private boolean lookupReturnByScript;
34  
35      public LightBox() {
36          super();
37      }
38  
39      /**
40       * @see org.kuali.rice.krad.uif.component.ComponentBase#getTemplateOptionsJSString()
41       */
42      @Override
43      public String getTemplateOptionsJSString() {
44          if (getTemplateOptions() == null) {
45              setTemplateOptions(new HashMap<String, String>());
46          }
47  
48          // Add the width and height properties to the ComponentOptions
49          // before the JS String gets generated.
50          if (width != null) {
51              getTemplateOptions().put("width", width);
52          }
53          if (height != null) {
54              getTemplateOptions().put("height", height);
55          }
56  
57          return super.getTemplateOptionsJSString();
58      }
59  
60      /**
61       * @return height of light box
62       */
63      public String getHeight() {
64          return height;
65      }
66  
67      /**
68       * Setter for the height of the light box
69       * Can be percentage. ie. 75%
70       *
71       * @param height
72       */
73      public void setHeight(String height) {
74          this.height = height;
75      }
76  
77      /**
78       * @return width of light box
79       */
80      public String getWidth() {
81          return width;
82      }
83  
84      /**
85       * Setter for the width of the light box
86       * Can be percentage. ie. 75%
87       *
88       * @param width
89       */
90      public void setWidth(String width) {
91          this.width = width;
92      }
93  
94      /**
95       * Indicates that the light box link should have application parameters added to it.
96       *
97       * @return true if the link should have application parameters added, false otherwise
98       */
99      public boolean isAddAppParms() {
100         return addAppParms;
101     }
102 
103     /**
104      * Setter for the addAppParms.
105      *
106      * @param addAppParms
107      */
108     public void setAddAppParms(boolean addAppParms) {
109         this.addAppParms = addAppParms;
110     }
111 
112     /**
113      * @return the lookupReturnByScript flag
114      */
115     public boolean isLookupReturnByScript() {
116         return lookupReturnByScript;
117     }
118 
119     /**
120      * Setter for the flag to indicate that lookups will return the value
121      * by script and not a post
122      *
123      * @param lookupReturnByScript the lookupReturnByScript flag
124      */
125     public void setLookupReturnByScript(boolean lookupReturnByScript) {
126         this.lookupReturnByScript = lookupReturnByScript;
127     }
128 }