001 /** 002 * Copyright 2005-2012 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 */ 016 package org.kuali.rice.krad.uif.widget; 017 018 import org.apache.commons.lang.StringUtils; 019 import org.kuali.rice.krad.datadictionary.parse.BeanTag; 020 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute; 021 022 import java.util.HashMap; 023 import java.util.Map; 024 025 /** 026 * BlockUI element is used within the view element for managing element/page blocking attributes 027 * 028 * <p> 029 * Some basic options of the plugin are exposed through this class. Messages can be managed via 030 * Action elements. See the jquery BlockUI plugin for more details. 031 * </p> 032 * 033 * @author Kuali Rice Team (rice.collab@kuali.org) 034 */ 035 @BeanTag(name = "blockUI", parent = "Uif-BlockUI") 036 public class BlockUI extends WidgetBase { 037 038 private String blockingImageSource; 039 040 public BlockUI() { 041 super(); 042 } 043 044 /** 045 * Override to add property values to the template options 046 * 047 * @see org.kuali.rice.krad.uif.component.Component#getTemplateOptions() 048 */ 049 @Override 050 public Map<String, String> getTemplateOptions() { 051 Map<String, String> templateOptions = super.getTemplateOptions(); 052 053 if (templateOptions == null) { 054 templateOptions = new HashMap<String, String>(); 055 } 056 057 if (StringUtils.isNotBlank(blockingImageSource) && !templateOptions.containsKey("blockingImage")) { 058 templateOptions.put("blockingImage", blockingImageSource); 059 } 060 061 return templateOptions; 062 } 063 064 /** 065 * Path to an image that will be rendered in the blocking overlay 066 * 067 * <p> 068 * If specified, the image will be picked up and rendered before the blocking message in 069 * the overlay. If not given just the message will be displayed 070 * </p> 071 * 072 * @return String url to the blocking image 073 */ 074 @BeanTagAttribute(name="blockingImageSource") 075 public String getBlockingImageSource() { 076 return blockingImageSource; 077 } 078 079 /** 080 * Setter for the url (source) of the blocking image to use (if any) 081 * 082 * @param blockingImageSource 083 */ 084 public void setBlockingImageSource(String blockingImageSource) { 085 this.blockingImageSource = blockingImageSource; 086 } 087 }