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.event.dom.client.ClickHandler;
 4  
 import com.google.gwt.user.client.DOM;
 5  
 import com.google.gwt.user.client.Element;
 6  
 import com.google.gwt.user.client.Event;
 7  
 import com.google.gwt.user.client.ui.FlexTable;
 8  
 
 9  
 public class MouseHoverFlexTable extends FlexTable {
 10  
     private TableModel tableModel;
 11  
     ClickHandler clickHandler;
 12  0
     public MouseHoverFlexTable(){
 13  0
         sinkEvents(Event.ONMOUSEOVER |Event.ONMOUSEOUT);
 14  
         
 15  0
     }
 16  
     public void setModel(TableModel tableModel){
 17  0
         this.tableModel = tableModel;
 18  0
     }
 19  
     
 20  
     public void onBrowserEvent(Event event) {
 21  0
         super.onBrowserEvent(event);
 22  0
         Element td = getEventTargetCell(event);
 23  0
         if (td == null)
 24  0
             return;
 25  
        
 26  0
         switch (DOM.eventGetType(event)) {
 27  
             case Event.ONMOUSEOVER: {
 28  0
                 Element tr = DOM.getParent(td);
 29  0
                 DOM.setStyleAttribute(tr, "backgroundColor", "#2b60ec");
 30  
 
 31  0
                 break;
 32  
             }
 33  
             case Event.ONMOUSEOUT: {
 34  0
                 int count = tableModel.getRowCount();
 35  0
                 for (int r = 0; r < count; r++) {
 36  0
                     Element tr = getRowFormatter().getElement(r);
 37  0
                     if (tableModel.getRow(r).isSelected()) {
 38  0
                         DOM.setStyleAttribute(tr, "backgroundColor", "#C6D9FF");
 39  
                     }else{
 40  0
                         DOM.setStyleAttribute(tr, "backgroundColor", "#FFFFFF");
 41  
                     }
 42  
                 }
 43  0
                 break;
 44  
             }
 45  
         }
 46  
 
 47  0
     }
 48  
 
 49  
 }