Coverage Report - org.kuali.rice.kns.uif.helper.TableToolsHelper
 
Classes in this File Line Coverage Branch Coverage Complexity
TableToolsHelper
0%
0/11
0%
0/10
6
 
 1  
 /*
 2  
  * Copyright 2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.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/ecl1.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.kns.uif.helper;
 17  
 
 18  
 import java.util.Date;
 19  
 
 20  
 import org.apache.commons.lang.ClassUtils;
 21  
 import org.kuali.rice.kns.uif.UifConstants;
 22  
 
 23  
 /**
 24  
  * 
 25  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 26  
  */
 27  0
 public class TableToolsHelper {
 28  
 
 29  
         public static String constructTableColumnOptions(boolean isSortable, Class dataTypeClass){
 30  
                 
 31  0
                 String colOptions = "null";
 32  
                 
 33  0
                 if (!isSortable || dataTypeClass == null){
 34  0
                         colOptions = "{ \"" + UifConstants.TableToolsKeys.SORTABLE + "\" : false } ";
 35  
                 }else{
 36  0
                         if (ClassUtils.isAssignable(dataTypeClass, String.class)){
 37  0
                                 colOptions = "{ \"" + UifConstants.TableToolsKeys.SORT_DATA_TYPE + "\" : \"" + UifConstants.TableToolsValues.DOM_TEXT + "\" } ";
 38  0
                         }else if (ClassUtils.isAssignable(dataTypeClass, Date.class)){
 39  0
                                 colOptions = "{ \"" + UifConstants.TableToolsKeys.SORT_DATA_TYPE + "\" : \"" + UifConstants.TableToolsValues.DOM_TEXT + "\" , \"" + UifConstants.TableToolsKeys.SORT_TYPE + "\" : \"" + UifConstants.TableToolsValues.DATE + "\" } ";                                
 40  0
                         }else if (ClassUtils.isAssignable(dataTypeClass, Number.class)){
 41  0
                                 colOptions = "{ \"" + UifConstants.TableToolsKeys.SORT_DATA_TYPE + "\" : \"" + UifConstants.TableToolsValues.DOM_TEXT + "\" , \"" + UifConstants.TableToolsKeys.SORT_TYPE + "\" : \"" + UifConstants.TableToolsValues.NUMERIC + "\" } ";
 42  
                         }
 43  
                 }
 44  
                 
 45  0
                 return colOptions;
 46  
         }
 47  
 }