Coverage Report - org.kuali.student.common.ui.client.widgets.table.scroll.Column
 
Classes in this File Line Coverage Branch Coverage Complexity
Column
0%
0/49
0%
0/12
1.429
 
 1  
 package org.kuali.student.common.ui.client.widgets.table.scroll;
 2  
 
 3  
 import com.google.gwt.user.client.ui.Label;
 4  
 import com.google.gwt.user.client.ui.Widget;
 5  
 
 6  
 /**
 7  
  * Column definition for table column.
 8  
  * 
 9  
  * 
 10  
  * */
 11  0
 public class Column {
 12  
         /** Ascending order. */
 13  
         public final static int Ascending = 1;
 14  
         /** Descending order */
 15  
         public final static int Descending = 2;
 16  
         /** Not sorted */
 17  
         public final static int NotOrdered = 3;
 18  
     
 19  
         private Widget columnTitleWidget;
 20  
         private String id;
 21  0
         private String name = "";
 22  
         private String width;
 23  0
         private int sortDirection = NotOrdered;
 24  0
         private boolean isVisible = true;
 25  
         private boolean isSortable;
 26  
 
 27  
         private RowComparator ascendingRowComparator;
 28  
         private RowComparator descendingRowComparator;
 29  
 
 30  
         /**
 31  
          * Get the row comparator.
 32  
          * */
 33  
         public RowComparator getComparator() {
 34  0
                 if (this.sortDirection == Ascending) {
 35  0
                         return ascendingRowComparator;
 36  0
                 } else if (this.sortDirection == Descending) {
 37  0
                         return descendingRowComparator;
 38  
                 } else {
 39  0
                         return null;
 40  
                 }
 41  
         }
 42  
     /** Get comparator for ascending sort*/
 43  
         public RowComparator getAscendingRowComparator() {
 44  0
                 return ascendingRowComparator;
 45  
         }
 46  
 
 47  
         public void setAscendingRowComparator(RowComparator ascendingRowComparator) {
 48  0
                 this.ascendingRowComparator = ascendingRowComparator;
 49  0
                 this.isSortable = true;
 50  0
         }
 51  
 
 52  
         public RowComparator getDescendingRowComparator() {
 53  0
                 return descendingRowComparator;
 54  
         }
 55  
 
 56  
         public void setDescendingRowComparator(RowComparator descedingRowcomparator) {
 57  0
                 this.descendingRowComparator = descedingRowcomparator;
 58  0
                 this.isSortable = true;
 59  0
         }
 60  
 
 61  
         public boolean isVisible() {
 62  0
                 return isVisible;
 63  
         }
 64  
 
 65  
         public void setVisible(boolean isVisible) {
 66  0
                 this.isVisible = isVisible;
 67  0
         }
 68  
 
 69  
         public Widget getColumnTitleWidget() {
 70  0
                 if (columnTitleWidget == null) {
 71  0
                         return new Label(name);
 72  
                 }
 73  
 
 74  0
                 return columnTitleWidget;
 75  
         }
 76  
 
 77  
         public void setColumnTitleWidget(Widget c) {
 78  0
                 columnTitleWidget = c;
 79  0
         }
 80  
 
 81  
         public String getId() {
 82  0
                 return id;
 83  
         }
 84  
 
 85  
         public void setId(String id) {
 86  0
                 this.id = id;
 87  0
         }
 88  
 
 89  
         public boolean isSortable() {
 90  0
                 return isSortable;
 91  
         }
 92  
 
 93  
         public void setSortable(boolean isSortable) {
 94  0
                 this.isSortable = isSortable;
 95  0
         }
 96  
 
 97  
         public String getName() {
 98  0
                 return name;
 99  
         }
 100  
 
 101  
         public void setName(String name) {
 102  0
                 this.name = name;
 103  0
         }
 104  
 
 105  
         public String getWidth() {
 106  0
                 return width;
 107  
         }
 108  
 
 109  
         public void setWidth(String width) {
 110  0
                 this.width = width;
 111  0
         }
 112  
 
 113  
         public void changeSortDirection() {
 114  0
                 if (this.sortDirection == NotOrdered) {
 115  0
                         this.sortDirection = Ascending;
 116  0
                 } else if (this.sortDirection == Ascending) {
 117  0
                         this.sortDirection = Descending;
 118  0
                 } else if (this.sortDirection == Descending) {
 119  0
                         this.sortDirection = Ascending;
 120  
                 }
 121  0
         }
 122  
 
 123  
         public void setSortDirection(int sortDirection) {
 124  0
                 this.sortDirection = sortDirection;
 125  0
         }
 126  
 
 127  
         public int getSortDirection() {
 128  0
                 return sortDirection;
 129  
         }
 130  
 
 131  
         public void setSortedType(int direction) {
 132  0
                 sortDirection = direction;
 133  0
         }
 134  
 }