| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| LookupColumnDecorator |
|
| 6.0;6 |
| 1 | /** | |
| 2 | * Copyright 2005-2011 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.kew.lookupable; | |
| 17 | ||
| 18 | import javax.servlet.jsp.PageContext; | |
| 19 | ||
| 20 | import org.apache.commons.lang.StringUtils; | |
| 21 | import org.displaytag.decorator.DisplaytagColumnDecorator; | |
| 22 | import org.displaytag.exception.DecoratorException; | |
| 23 | import org.displaytag.properties.MediaTypeEnum; | |
| 24 | import org.kuali.rice.kew.api.KewApiConstants; | |
| 25 | ||
| 26 | ||
| 27 | /** | |
| 28 | * A ColumnDecorator for columns in a Lookup which adds an extra non-breaking space if the column | |
| 29 | * is an empty String. | |
| 30 | * | |
| 31 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 32 | */ | |
| 33 | 0 | public class LookupColumnDecorator implements DisplaytagColumnDecorator { |
| 34 | ||
| 35 | public Object decorate(Object columnValue, PageContext pageContext, MediaTypeEnum media) throws DecoratorException { | |
| 36 | 0 | if (columnValue == null) { |
| 37 | 0 | return KewApiConstants.HTML_NON_BREAKING_SPACE; |
| 38 | } | |
| 39 | 0 | if (columnValue instanceof String && StringUtils.isEmpty(((String)columnValue).trim())) { |
| 40 | 0 | return KewApiConstants.HTML_NON_BREAKING_SPACE; |
| 41 | } | |
| 42 | 0 | return columnValue; |
| 43 | } | |
| 44 | ||
| 45 | } |