Coverage Report - org.kuali.student.lum.common.client.lo.OutlineManagerToolbar
 
Classes in this File Line Coverage Branch Coverage Complexity
OutlineManagerToolbar
0%
0/87
0%
0/10
1.455
OutlineManagerToolbar$1
0%
0/3
N/A
1.455
OutlineManagerToolbar$2
0%
0/3
N/A
1.455
OutlineManagerToolbar$3
0%
0/3
N/A
1.455
OutlineManagerToolbar$4
0%
0/3
N/A
1.455
OutlineManagerToolbar$5
0%
0/3
N/A
1.455
OutlineManagerToolbar$6
0%
0/3
N/A
1.455
OutlineManagerToolbar$7
0%
0/3
N/A
1.455
 
 1  
 package org.kuali.student.lum.common.client.lo;
 2  
 
 3  
 import org.kuali.student.common.ui.client.util.DebugIdUtils;
 4  
 
 5  
 import com.google.gwt.event.dom.client.ClickEvent;
 6  
 import com.google.gwt.event.dom.client.ClickHandler;
 7  
 import com.google.gwt.user.client.Event;
 8  
 import com.google.gwt.user.client.ui.Button;
 9  
 import com.google.gwt.user.client.ui.HorizontalPanel;
 10  
 import com.google.gwt.user.client.ui.Widget;
 11  
 
 12  
 /**
 13  
  * @author Igor
 14  
  */
 15  
 class OutlineManagerToolbar extends HorizontalPanel {
 16  0
         Button moveUpButton = new Button();
 17  
 
 18  0
         Button moveDownButton = new Button();
 19  
 
 20  0
         Button indentButton = new Button();
 21  
 
 22  0
         Button outdentButton = new Button();
 23  
 
 24  0
         Button deleteButton = new Button();
 25  
 
 26  
 
 27  0
         Button addPeerButton = new Button();
 28  
 
 29  0
         Button addChildButton = new Button();
 30  
 
 31  
         OutlineNodeModel outlineModel;
 32  
 
 33  0
         OutlineManagerToolbar() {
 34  
 
 35  0
                 HorizontalPanel buttonPanel = new HorizontalPanel();
 36  
 
 37  0
                 this.setStyleName("KS-LOOutlineManagerToolbar");
 38  0
                 super.add(buttonPanel);
 39  0
                 buttonPanel.add(moveUpButton);
 40  0
                 buttonPanel.add(moveDownButton);
 41  0
                 buttonPanel.add(indentButton);
 42  0
                 buttonPanel.add(outdentButton);
 43  0
                 buttonPanel.add(deleteButton);
 44  0
                 buttonPanel.addStyleName("KS-LOButtonPanel");
 45  
 
 46  0
                 sinkEvents(Event.ONMOUSEMOVE);
 47  0
                 sinkEvents(Event.ONMOUSEOUT);
 48  
 
 49  0
                 moveUpButton.sinkEvents(Event.ONMOUSEMOVE);
 50  0
                 moveUpButton.sinkEvents(Event.ONMOUSEOUT);
 51  0
                 moveUpButton.setTitle("Move learning objective up");
 52  0
                 moveUpButton.addStyleName("KS-LOMoveUpButton");
 53  0
                 moveDownButton.addStyleName("KS-LOMoveDownButton");
 54  0
                 moveDownButton.setTitle("Move learning objective down");
 55  0
                 deleteButton.setText("Delete");
 56  0
                 deleteButton.setTitle("Delete");
 57  0
                 deleteButton.addStyleName("KS-LODeleteButton");
 58  0
                 indentButton.addStyleName("KS-LOIndentButton");
 59  0
                 indentButton.setTitle("Indent learning objective");
 60  0
                 outdentButton.addStyleName("KS-LOOutdentButton");
 61  0
                 outdentButton.setTitle("Outdent learning objective");
 62  
 
 63  0
                 moveUpButton.addClickHandler(new ClickHandler() {
 64  
                         public void onClick(ClickEvent event) {
 65  0
                                 outlineModel.moveUpCurrent();
 66  
 
 67  0
                         }
 68  
                 });
 69  0
                 moveDownButton.addClickHandler(new ClickHandler() {
 70  
                         public void onClick(ClickEvent event) {
 71  0
                                 outlineModel.moveDownCurrent();
 72  0
                         }
 73  
                 });
 74  0
                 indentButton.addClickHandler(new ClickHandler() {
 75  
                         public void onClick(ClickEvent event) {
 76  0
                                 outlineModel.indentCurrent();
 77  0
                         }
 78  
                 });
 79  0
                 outdentButton.addClickHandler(new ClickHandler() {
 80  
                         public void onClick(ClickEvent event) {
 81  0
                                 outlineModel.outdentCurrent();
 82  0
                         }
 83  
                 });
 84  0
                 deleteButton.addClickHandler(new ClickHandler() {
 85  
                         public void onClick(ClickEvent event) {
 86  0
                                 outlineModel.deleteCurrent();
 87  0
                         }
 88  
                 });
 89  0
                 addPeerButton.addClickHandler(new ClickHandler() {
 90  
                         public void onClick(ClickEvent event) {
 91  0
                                 outlineModel.addPeer();
 92  0
                         }
 93  
                 });
 94  0
                 addChildButton.addClickHandler(new ClickHandler() {
 95  
                         public void onClick(ClickEvent event) {
 96  0
                                 outlineModel.addChild();
 97  0
                         }
 98  
                 });
 99  0
         }
 100  
 
 101  
         public void setModel(OutlineNodeModel model) {
 102  0
                 outlineModel = model;
 103  0
         }
 104  
 
 105  
         public void updateButtonStates() {
 106  0
                 if(  this.outlineModel.isMoveUpable()){
 107  0
                         moveUpButton.setEnabled(true);
 108  0
                         moveUpButton.removeStyleName("KS-LOMoveUpButtonDisabled");
 109  0
                         moveUpButton.addStyleName("KS-LOMoveUpButton");
 110  
                 }else{
 111  0
                         moveUpButton.setEnabled(false);
 112  0
                         moveUpButton.removeStyleName("KS-LOMoveUpButton");
 113  0
                         moveUpButton.addStyleName("KS-LOMoveUpButtonDisabled");
 114  
                 }
 115  0
                 if(this.outlineModel.isDeletable()){
 116  0
                         deleteButton.setEnabled(true);
 117  0
                         deleteButton.removeStyleName("KS-LODeleteButtonDisabled");
 118  0
                         deleteButton.addStyleName("KS-LODeleteButton");
 119  
                 } else{
 120  0
                         deleteButton.setEnabled(false);
 121  0
                         deleteButton.removeStyleName("KS-LODeleteButton");
 122  0
                         deleteButton.addStyleName("KS-LODeleteButtonDisabled");
 123  
                 }
 124  0
                 if(this.outlineModel.isIndentable()){
 125  0
                         indentButton.setEnabled(true);
 126  0
                         indentButton.removeStyleName("KS-LOIndentButtonDisabled");
 127  0
                         indentButton.addStyleName("KS-LOIndentButton");
 128  
                 }else{
 129  0
                         indentButton.setEnabled(false);
 130  0
                         indentButton.removeStyleName("KS-LOIndentButton");
 131  0
                         indentButton.addStyleName("KS-LOIndentButtonDisabled");
 132  
                 }
 133  0
                 if(this.outlineModel.isMoveDownable()){
 134  0
                         moveDownButton.setEnabled(true);
 135  0
                         moveDownButton.removeStyleName("KS-LOMoveDownButtonDisabled");
 136  0
                         moveDownButton.addStyleName("KS-LOMoveDownButton");
 137  
                 }else{
 138  0
                         moveDownButton.setEnabled(false);
 139  0
                         moveDownButton.removeStyleName("KS-LOMoveDownButton");
 140  0
                         moveDownButton.addStyleName("KS-LOMoveDownButtonDisabled");
 141  
                 }
 142  0
                 if(this.outlineModel.isOutdentable()){
 143  0
                         outdentButton.setEnabled(true);
 144  0
                         outdentButton.removeStyleName("KS-LOOutdentButtonDisabled");
 145  0
                         outdentButton.addStyleName("KS-LOOutdentButton");
 146  
                 }else{
 147  0
                         outdentButton.setEnabled(false);
 148  0
                         outdentButton.removeStyleName("KS-LOOutdentButton");
 149  0
                         outdentButton.addStyleName("KS-LOOutdentButtonDisabled");
 150  
                 }
 151  0
         }
 152  
 
 153  
     @Override
 154  
     protected void onEnsureDebugId(String baseID) {
 155  0
         super.onEnsureDebugId(baseID);
 156  0
         moveUpButton.ensureDebugId(DebugIdUtils.createWebDriverSafeDebugId(baseID + "-" + moveUpButton.getTitle()));
 157  0
         moveDownButton.ensureDebugId(DebugIdUtils.createWebDriverSafeDebugId(baseID + "-" + moveDownButton.getTitle()));
 158  0
         indentButton.ensureDebugId(DebugIdUtils.createWebDriverSafeDebugId(baseID + "-" + indentButton.getTitle()));
 159  0
         outdentButton.ensureDebugId(DebugIdUtils.createWebDriverSafeDebugId(baseID + "-" + outdentButton.getTitle()));
 160  0
         deleteButton.ensureDebugId(DebugIdUtils.createWebDriverSafeDebugId(baseID + "-" + deleteButton.getTitle()));
 161  0
         addPeerButton.ensureDebugId(DebugIdUtils.createWebDriverSafeDebugId(baseID + "-Add-Peer"));
 162  0
         addChildButton.ensureDebugId(DebugIdUtils.createWebDriverSafeDebugId(baseID + "-Add-Child"));
 163  0
     }
 164  
         
 165  
         
 166  
 }