| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| RemovableItem | 
 | 
 | 1.1666666666666667;1.167 | ||||
| RemovableItem$1 | 
 | 
 | 1.1666666666666667;1.167 | 
| 1 |  /** | |
| 2 |   * Copyright 2010 The Kuali Foundation Licensed under the | |
| 3 |   * Educational Community License, Version 2.0 (the "License"); you may | |
| 4 |   * not use this file except in compliance with the License. You may | |
| 5 |   * obtain a copy of the License at | |
| 6 |   * | |
| 7 |   * http://www.osedu.org/licenses/ECL-2.0 | |
| 8 |   * | |
| 9 |   * Unless required by applicable law or agreed to in writing, | |
| 10 |   * software distributed under the License is distributed on an "AS IS" | |
| 11 |   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | |
| 12 |   * or implied. See the License for the specific language governing | |
| 13 |   * permissions and limitations under the License. | |
| 14 |   */ | |
| 15 | ||
| 16 |  package org.kuali.student.common.ui.client.configurable.mvc.multiplicity; | |
| 17 | ||
| 18 |  import com.google.gwt.event.dom.client.ClickEvent; | |
| 19 |  import com.google.gwt.event.dom.client.ClickHandler; | |
| 20 |  import com.google.gwt.user.client.ui.FlowPanel; | |
| 21 |  import com.google.gwt.user.client.ui.Label; | |
| 22 |  import com.google.gwt.user.client.ui.Widget; | |
| 23 | ||
| 24 |  /** | |
| 25 |   * This wraps a widget item | |
| 26 |   * | |
| 27 |   * @author Kuali Student Team | |
| 28 |   */ | |
| 29 | ||
| 30 |  /** | |
| 31 |   * @deprecated | |
| 32 |   */ | |
| 33 | public class RemovableItem extends MultiplicityItem { | |
| 34 | 0 |      private boolean loaded = false; | 
| 35 | ||
| 36 | 0 |      protected FlowPanel itemPanel = new FlowPanel(); | 
| 37 | ||
| 38 | 0 |      public RemovableItem(){ | 
| 39 | 0 |          initWidget(itemPanel); | 
| 40 | 0 |      } | 
| 41 | ||
| 42 | public void onLoad(){ | |
| 43 | 0 |      } | 
| 44 | ||
| 45 |      private Widget generateRemoveWidget() { | |
| 46 | 0 |          ClickHandler ch = new ClickHandler() { | 
| 47 | public void onClick(ClickEvent event) { | |
| 48 | 0 |                  getRemoveCallback().exec(RemovableItem.this); | 
| 49 | 0 |              } | 
| 50 | }; | |
| 51 | ||
| 52 | 0 |          itemPanel.addStyleName("KS-Multiplicity-Item"); | 
| 53 | 0 |          Label deleteLabel = new Label("Delete"); | 
| 54 | 0 |          deleteLabel.addStyleName("KS-Multiplicity-Link-Label"); | 
| 55 | 0 |          deleteLabel.addClickHandler(ch); | 
| 56 | ||
| 57 | 0 |          return deleteLabel; | 
| 58 | } | |
| 59 | ||
| 60 |      /** | |
| 61 |       * @see org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityItem#clear() | |
| 62 |       */ | |
| 63 | @Override | |
| 64 | public void clear() { | |
| 65 | 0 |          loaded = false; | 
| 66 | 0 |      } | 
| 67 | ||
| 68 |      /** | |
| 69 |       * @see org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityItem#redraw() | |
| 70 |       */ | |
| 71 | @Override | |
| 72 | public void redraw() { | |
| 73 | 0 |          Widget item = getItemWidget(); | 
| 74 | 0 |          if (!loaded){ | 
| 75 | ||
| 76 | 0 |              itemPanel.add(item); | 
| 77 | 0 |              itemPanel.add(generateRemoveWidget()); | 
| 78 | 0 |              loaded = true; | 
| 79 | } | |
| 80 |  //redraw() removed | |
| 81 |  /*        if (item instanceof Section){ | |
| 82 |              ((Section)item).redraw(); | |
| 83 |          }*/ | |
| 84 | 0 |      } | 
| 85 | ||
| 86 | } |