Coverage Report - org.kuali.student.common.ui.client.widgets.table.scroll.MouseHoverFlexTable
 
Classes in this File Line Coverage Branch Coverage Complexity
MouseHoverFlexTable
0%
0/21
0%
0/9
3
 
 1  
 package org.kuali.student.common.ui.client.widgets.table.scroll;
 2  
 
 3  
 import com.google.gwt.user.client.DOM;
 4  
 import com.google.gwt.user.client.Element;
 5  
 import com.google.gwt.user.client.Event;
 6  
 import com.google.gwt.user.client.ui.FlexTable;
 7  
 
 8  
 public class MouseHoverFlexTable extends FlexTable {
 9  
     private TableModel tableModel;
 10  0
     public MouseHoverFlexTable(){
 11  0
         sinkEvents(Event.ONMOUSEOVER |Event.ONMOUSEOUT);
 12  
         
 13  0
     }
 14  
     public void setModel(TableModel tableModel){
 15  0
         this.tableModel = tableModel;
 16  0
     }
 17  
     
 18  
     public void onBrowserEvent(Event event) {
 19  0
         super.onBrowserEvent(event);
 20  0
         Element td = getEventTargetCell(event);
 21  0
         if (td == null)
 22  0
             return;
 23  
        
 24  0
         switch (DOM.eventGetType(event)) {
 25  
             case Event.ONMOUSEOVER: {
 26  0
                 Element tr = DOM.getParent(td);
 27  0
                 tr.setAttribute("class", "table-row-hover");
 28  
 
 29  0
                 break;
 30  
             }
 31  
             case Event.ONMOUSEOUT: {
 32  0
                 int count = tableModel.getRowCount();
 33  0
                 for (int r = 0; r < count; r++) {
 34  0
                     Element tr = getRowFormatter().getElement(r);
 35  0
                     if (tableModel.getRow(r).isSelected()) {
 36  0
                             tr.setAttribute("class", "table-row-selected");
 37  
                     }else{
 38  0
                             tr.setAttribute("class", "table-row");
 39  
                     }
 40  
                 }
 41  0
                 break;
 42  
             }
 43  
 
 44  
         }
 45  
 
 46  0
     }
 47  
 
 48  
 }