001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.krad.uif.widget; 017 018import java.util.HashMap; 019 020/** 021 * Used for rendering a lightbox in the UI to display action links in dialog 022 * popups 023 * 024 * @author Kuali Rice Team (rice.collab@kuali.org) 025 */ 026public class LightBox extends WidgetBase { 027 028 private static final long serialVersionUID = -4004284762546700975L; 029 030 private String actionParameterMapString; 031 032 private String height; 033 private String width; 034 035 private boolean lookupReturnByScript; 036 037 public LightBox() { 038 super(); 039 } 040 041 /** 042 * Setter for the action parameter map javascript string 043 * 044 * @param actionParameterMapString the action parameter map javascript string 045 */ 046 public void setActionParameterMapString(String actionParameterMapString) { 047 this.actionParameterMapString = actionParameterMapString; 048 } 049 050 /** 051 * Action parameter map javascript string 052 * <p> 053 * The action parameter map string will be used to write these parameters to 054 * the form. 055 * </p> 056 * 057 * @return the action parameter map javascript string 058 */ 059 public String getActionParameterMapString() { 060 return actionParameterMapString; 061 } 062 063 /** 064 * @return height of light box 065 */ 066 public String getHeight() { 067 return height; 068 } 069 070 /** 071 * Setter for the height of the light box 072 * Can be percentage. ie. 75% 073 * 074 * @param height 075 */ 076 public void setHeight(String height) { 077 this.height = height; 078 } 079 080 /** 081 * @return width of light box 082 */ 083 public String getWidth() { 084 return width; 085 } 086 087 /** 088 * Setter for the width of the light box 089 * Can be percentage. ie. 75% 090 * 091 * @param width 092 */ 093 public void setWidth(String width) { 094 this.width = width; 095 } 096 097 /** 098 * @see org.kuali.rice.krad.uif.component.ComponentBase#getComponentOptionsJSString() 099 */ 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}