| 1 |  |   | 
  | 2 |  |   | 
  | 3 |  |   | 
  | 4 |  |   | 
  | 5 |  |   | 
  | 6 |  |   | 
  | 7 |  |   | 
  | 8 |  |   | 
  | 9 |  |  package org.kuali.student.common.ui.client.widgets.field.layout.element; | 
  | 10 |  |   | 
  | 11 |  |  import java.util.List; | 
  | 12 |  |   | 
  | 13 |  |  import org.kuali.student.common.ui.client.reporting.ReportExportWidget; | 
  | 14 |  |  import org.kuali.student.common.ui.client.util.ExportElement; | 
  | 15 |  |  import org.kuali.student.common.ui.client.util.ExportUtils; | 
  | 16 |  |   | 
  | 17 |  |  import com.google.gwt.dom.client.Element; | 
  | 18 |  |  import com.google.gwt.user.client.DOM; | 
  | 19 |  |  import com.google.gwt.user.client.ui.ComplexPanel; | 
  | 20 |  |  import com.google.gwt.user.client.ui.Widget; | 
  | 21 |  |   | 
  | 22 |  |  public class SpanPanel extends ComplexPanel implements ReportExportWidget { | 
  | 23 |  |   | 
  | 24 | 0 |      private boolean exportElement = true; | 
  | 25 |  |      private String reportText; | 
  | 26 |  |   | 
  | 27 | 0 |      public SpanPanel() { | 
  | 28 | 0 |          setElement(DOM.createSpan()); | 
  | 29 | 0 |      } | 
  | 30 |  |   | 
  | 31 | 0 |      public SpanPanel(String text) { | 
  | 32 | 0 |          Element span = DOM.createSpan(); | 
  | 33 | 0 |          span.setInnerText(text); | 
  | 34 | 0 |          setElement(span); | 
  | 35 | 0 |      } | 
  | 36 |  |   | 
  | 37 |  |       | 
  | 38 |  |   | 
  | 39 |  |   | 
  | 40 |  |   | 
  | 41 |  |   | 
  | 42 |  |   | 
  | 43 |  |      @Override | 
  | 44 |  |      public void add(Widget w) { | 
  | 45 | 0 |          add(w, getElement()); | 
  | 46 | 0 |      } | 
  | 47 |  |   | 
  | 48 |  |       | 
  | 49 |  |   | 
  | 50 |  |   | 
  | 51 |  |   | 
  | 52 |  |   | 
  | 53 |  |   | 
  | 54 |  |   | 
  | 55 |  |   | 
  | 56 |  |   | 
  | 57 |  |   | 
  | 58 |  |      public void insert(Widget w, int beforeIndex) { | 
  | 59 | 0 |          insert(w, getElement(), beforeIndex, true); | 
  | 60 | 0 |      } | 
  | 61 |  |   | 
  | 62 |  |      public void setText(String text) { | 
  | 63 | 0 |          this.getElement().setInnerText(text); | 
  | 64 | 0 |          this.reportText = text; | 
  | 65 | 0 |      } | 
  | 66 |  |   | 
  | 67 |  |      public void setHTML(String html) { | 
  | 68 | 0 |          this.getElement().setInnerHTML(html); | 
  | 69 | 0 |          this.reportText = html; | 
  | 70 | 0 |      } | 
  | 71 |  |   | 
  | 72 |  |      public String getText() { | 
  | 73 | 0 |          return this.getElement().getInnerText(); | 
  | 74 |  |      } | 
  | 75 |  |   | 
  | 76 |  |      @Override | 
  | 77 |  |      public boolean isExportElement() { | 
  | 78 | 0 |          return exportElement; | 
  | 79 |  |      } | 
  | 80 |  |   | 
  | 81 |  |      public void setExportElement(boolean export) { | 
  | 82 | 0 |          this.exportElement = export; | 
  | 83 | 0 |      } | 
  | 84 |  |   | 
  | 85 |  |      @Override | 
  | 86 |  |      public List<ExportElement> getExportElementSubset(ExportElement parent) { | 
  | 87 | 0 |          return ExportUtils.getDetailsForWidget(this, parent.getViewName(), parent.getSectionName()); | 
  | 88 |  |      } | 
  | 89 |  |   | 
  | 90 |  |      @Override | 
  | 91 |  |      public String getExportFieldValue() { | 
  | 92 | 0 |          if (this.reportText != null){ | 
  | 93 | 0 |              return this.reportText; | 
  | 94 | 0 |          } else if (this.getWidgetCount() == 0){ | 
  | 95 | 0 |              return this.getText(); | 
  | 96 |  |          } | 
  | 97 | 0 |          return ""; | 
  | 98 |  |      } | 
  | 99 |  |   | 
  | 100 |  |  } |