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  
28      private static final long serialVersionUID = -4004284762546700975L;
29  
30      private String actionParameterMapString;
31  
32      private String height;
33      private String width;
34  
35      private boolean lookupReturnByScript;
36  
37      public LightBox() {
38          super();
39      }
40  
41      /**
42       * Setter for the action parameter map javascript string
43       *
44       * @param actionParameterMapString the action parameter map javascript string
45       */
46      public void setActionParameterMapString(String actionParameterMapString) {
47          this.actionParameterMapString = actionParameterMapString;
48      }
49  
50      /**
51       * Action parameter map javascript string
52       * <p>
53       * The action parameter map string will be used to write these parameters to
54       * the form.
55       * </p>
56       *
57       * @return the action parameter map javascript string
58       */
59      public String getActionParameterMapString() {
60          return actionParameterMapString;
61      }
62  
63      /**
64       * @return height of light box
65       */
66      public String getHeight() {
67          return height;
68      }
69  
70      /**
71       * Setter for the height of the light box
72       * Can be percentage. ie. 75%
73       *
74       * @param height
75       */
76      public void setHeight(String height) {
77          this.height = height;
78      }
79  
80      /**
81       * @return width of light box
82       */
83      public String getWidth() {
84          return width;
85      }
86  
87       /**
88       * Setter for the width of the light box
89       * Can be percentage. ie. 75%
90       *
91       * @param width
92       */
93      public void setWidth(String width) {
94          this.width = width;
95      }
96  
97       /**
98       * @see org.kuali.rice.krad.uif.component.ComponentBase#getComponentOptionsJSString()
99       */
100     @Override
101     public String getComponentOptionsJSString() {
102         if (getComponentOptions() == null) {
103             setComponentOptions(new HashMap<String, String>());
104         }
105 
106         // Add the width and height properties to the ComponentOptions
107         // before the JS String gets generated.
108         if (width != null) {
109             getComponentOptions().put("width", width);
110         }
111         if (height != null) {
112             getComponentOptions().put("height", height);
113         }
114         return super.getComponentOptionsJSString();
115     }
116 
117     /**
118      * @return the lookupReturnByScript flag
119      */
120     public boolean isLookupReturnByScript() {
121         return lookupReturnByScript;
122     }
123 
124 /**
125      * Setter for the flag to indicate that lookups will return the value
126      * by script and not a post
127      *
128      * @param lookupReturnByScript the lookupReturnByScript flag
129      */
130     public void setLookupReturnByScript(boolean lookupReturnByScript) {
131         this.lookupReturnByScript = lookupReturnByScript;
132     }
133 }