Coverage Report - org.kuali.rice.krad.web.ui.Column
 
Classes in this File Line Coverage Branch Coverage Complexity
Column
0%
0/75
0%
0/4
1.079
 
 1  
 /*
 2  
  * Copyright 2007 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.web.ui;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.Comparator;
 20  
 import java.util.List;
 21  
 
 22  
 import org.kuali.rice.core.web.format.Formatter;
 23  
 import org.kuali.rice.krad.lookup.HtmlData;
 24  
 import org.kuali.rice.krad.lookup.HtmlData.AnchorHtmlData;
 25  
 import org.kuali.rice.krad.lookup.HtmlData.MultipleAnchorHtmlData;
 26  
 
 27  
 /**
 28  
  * Represents a Column in a result table
 29  
  * 
 30  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 31  
  */
 32  
 public class Column implements java.io.Serializable, PropertyRenderingConfigElement {
 33  
     private static final long serialVersionUID = -5916942413570667803L;
 34  
     private String columnTitle;
 35  0
     private String sortable = "true";
 36  
     private String propertyName;
 37  
     private String propertyValue;
 38  
     private Object unformattedPropertyValue;
 39  
     private String propertyURL;
 40  
     private HtmlData columnAnchor;
 41  
     private Formatter formatter;
 42  
     private Comparator comparator;
 43  0
     private boolean escapeXMLValue=true;
 44  
     
 45  
     private String alternateDisplayPropertyName;
 46  
     private String additionalDisplayPropertyName;
 47  
     
 48  
     private boolean total;
 49  
     
 50  
     /**
 51  
      * A comparator used to compare the propertyValue values
 52  
      */
 53  
     private Comparator valueComparator;
 54  
     
 55  
     /**
 56  
      * Represents the maximum column length.  If propertyValue's length exceeds this value, then 
 57  
      * it will be truncated to this length when displayed
 58  
      */
 59  
     private int maxLength;
 60  
     
 61  0
     public Column() {
 62  0
     }
 63  
     
 64  0
     public Column(String columnTitle, String propertyName) {
 65  0
         this.columnTitle = columnTitle;
 66  0
         this.propertyName = propertyName;
 67  0
     }
 68  
     
 69  0
     public Column(String columnTitle, String sortable, String propertyName) {
 70  0
         this.columnTitle = columnTitle;
 71  0
         this.sortable = sortable;
 72  0
         this.propertyName = propertyName;
 73  0
     }
 74  
 
 75  
     public Column(String columnTitle, String sortable, String propertyName, Comparator comparator) {
 76  0
         this(columnTitle, sortable, propertyName);
 77  0
         this.comparator = comparator;
 78  0
     }
 79  
 
 80  0
     public Column(String columnTitle, String propertyName, Formatter formatter) {
 81  0
         this.columnTitle = columnTitle;
 82  0
         this.propertyName = propertyName;
 83  0
         this.formatter = formatter;
 84  0
     }
 85  
 
 86  
     /**
 87  
      * @return Returns the comparator.
 88  
      */
 89  
     public Comparator getComparator() {
 90  0
         return comparator;
 91  
     }
 92  
 
 93  
 
 94  
     /**
 95  
      * @param comparator The comparator to set.
 96  
      */
 97  
     public void setComparator(Comparator comparator) {
 98  0
         this.comparator = comparator;
 99  0
     }
 100  
 
 101  
 
 102  
     /**
 103  
      * @return Returns the columnTitle.
 104  
      */
 105  
     public String getColumnTitle() {
 106  0
         return columnTitle;
 107  
     }
 108  
 
 109  
 
 110  
     /**
 111  
      * @param columnTitle The columnTitle to set.
 112  
      */
 113  
     public void setColumnTitle(String columnTitle) {
 114  0
         this.columnTitle = columnTitle;
 115  0
     }
 116  
 
 117  
 
 118  
     /**
 119  
      * @return Returns the propertyName.
 120  
      */
 121  
     public String getPropertyName() {
 122  0
         return propertyName;
 123  
     }
 124  
 
 125  
 
 126  
     /**
 127  
      * @param propertyName The propertyName to set.
 128  
      */
 129  
     public void setPropertyName(String propertyName) {
 130  0
         this.propertyName = propertyName;
 131  0
     }
 132  
 
 133  
 
 134  
     /**
 135  
      * @return Returns the sortable.
 136  
      */
 137  
     public String getSortable() {
 138  0
         return sortable;
 139  
     }
 140  
 
 141  
 
 142  
     /**
 143  
      * @param sortable The sortable to set.
 144  
      */
 145  
     public void setSortable(String sortable) {
 146  0
         this.sortable = sortable;
 147  0
     }
 148  
 
 149  
 
 150  
     /**
 151  
      * @return Returns the propertyURL.
 152  
      */
 153  
     public String getPropertyURL() {
 154  0
         return propertyURL;
 155  
     }
 156  
 
 157  
 
 158  
     /**
 159  
      * @param propertyURL The propertyURL to set.
 160  
      */
 161  
     public void setPropertyURL(String propertyURL) {
 162  0
         this.propertyURL = propertyURL;
 163  0
     }
 164  
 
 165  
         /**
 166  
          * @return the columnAnchor
 167  
          */
 168  
         public HtmlData getColumnAnchor() {
 169  0
                 return this.columnAnchor;
 170  
         }
 171  
 
 172  
         public boolean isMultipleAnchors(){
 173  0
                 return this.columnAnchor instanceof MultipleAnchorHtmlData;
 174  
         }
 175  
 
 176  
         public List<AnchorHtmlData> getColumnAnchors(){
 177  0
                 if(isMultipleAnchors())
 178  0
                         return ((MultipleAnchorHtmlData)this.columnAnchor).getAnchorHtmlData();
 179  0
                 List<AnchorHtmlData> htmlData = new ArrayList<AnchorHtmlData>();
 180  0
                 htmlData.add((AnchorHtmlData)columnAnchor);
 181  0
                 return htmlData;
 182  
         }
 183  
 
 184  
         public int getNumberOfColumnAnchors(){
 185  0
                 return getColumnAnchors().size();
 186  
         }
 187  
 
 188  
         /**
 189  
          * @param columnAnchor the columnAnchor to set
 190  
          */
 191  
         public void setColumnAnchor(HtmlData columnAnchor) {
 192  0
                 this.columnAnchor = columnAnchor;
 193  0
                 if(columnAnchor!=null) 
 194  0
                         setPropertyURL(((AnchorHtmlData)columnAnchor).getHref());
 195  0
         }
 196  
 
 197  
         /**
 198  
      * @return Returns the propertyValue.
 199  
      */
 200  
     public String getPropertyValue() {
 201  0
         return propertyValue;
 202  
     }
 203  
 
 204  
 
 205  
     /**
 206  
      * @param propertyValue The propertyValue to set.
 207  
      */
 208  
     public void setPropertyValue(String propertyValue) {
 209  0
         this.propertyValue = propertyValue;
 210  0
     }
 211  
     
 212  
     /**
 213  
      * @return Returns the formatter.
 214  
      */
 215  
     public Formatter getFormatter() {
 216  0
         return formatter;
 217  
     }
 218  
 
 219  
 
 220  
     /**
 221  
      * @param formatter The formatter to set.
 222  
      */
 223  
     public void setFormatter(Formatter formatter) {
 224  0
         this.formatter = formatter;
 225  0
     }
 226  
 
 227  
     public Comparator getValueComparator() {
 228  0
         return valueComparator;
 229  
     }
 230  
 
 231  
     public void setValueComparator(Comparator valueComparator) {
 232  0
         this.valueComparator = valueComparator;
 233  0
     }
 234  
 
 235  
     /**
 236  
      * Returns the maximum column length.  If propertyValue's length exceeds this value, then 
 237  
      * it will be truncated to this length when displayed
 238  
      * @return
 239  
      */
 240  
     public int getMaxLength() {
 241  0
         return maxLength;
 242  
     }
 243  
 
 244  
     /**
 245  
      * Sets the maximum column length.  If propertyValue's length exceeds this value, then 
 246  
      * it will be truncated to this length when displayed
 247  
      * @param maxColumnLength
 248  
      */
 249  
     public void setMaxLength(int maxColumnLength) {
 250  0
         this.maxLength = maxColumnLength;
 251  0
     }
 252  
 
 253  
         /**
 254  
          * @return the escapeXMLValue
 255  
          */
 256  
         public boolean isEscapeXMLValue() {
 257  0
                 return this.escapeXMLValue;
 258  
         }
 259  
 
 260  
         /**
 261  
          * @param escapeXMLValue the escapeXMLValue to set
 262  
          */
 263  
         public void setEscapeXMLValue(boolean escapeXMLValue) {
 264  0
                 this.escapeXMLValue = escapeXMLValue;
 265  0
         }
 266  
 
 267  
         public String getAlternateDisplayPropertyName() {
 268  0
                 return this.alternateDisplayPropertyName;
 269  
         }
 270  
 
 271  
         public void setAlternateDisplayPropertyName(String alternateDisplayPropertyName) {
 272  0
                 this.alternateDisplayPropertyName = alternateDisplayPropertyName;
 273  0
         }
 274  
 
 275  
         public String getAdditionalDisplayPropertyName() {
 276  0
                 return this.additionalDisplayPropertyName;
 277  
         }
 278  
 
 279  
         public void setAdditionalDisplayPropertyName(String additionalDisplayPropertyName) {
 280  0
                 this.additionalDisplayPropertyName = additionalDisplayPropertyName;
 281  0
         }
 282  
 
 283  
         public boolean isTotal() {
 284  0
                 return this.total;
 285  
         }
 286  
 
 287  
         public void setTotal(boolean total) {
 288  0
                 this.total = total;
 289  0
         }
 290  
 
 291  
         public Object getUnformattedPropertyValue() {
 292  0
                 return this.unformattedPropertyValue;
 293  
         }
 294  
 
 295  
         public void setUnformattedPropertyValue(Object unformattedPropertyValue) {
 296  0
                 this.unformattedPropertyValue = unformattedPropertyValue;
 297  0
         }
 298  
         
 299  
 }