Coverage Report - org.kuali.student.common.ui.client.widgets.field.layout.element.SpanPanel
 
Classes in this File Line Coverage Branch Coverage Complexity
SpanPanel
0%
0/23
N/A
1
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may
 3  
  * not use this file except in compliance with the License. You may obtain a copy of the License at
 4  
  * http://www.osedu.org/licenses/ECL-2.0 Unless required by applicable law or agreed to in writing, software distributed
 5  
  * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 6  
  * implied. See the License for the specific language governing permissions and limitations under the License.
 7  
  */
 8  
 
 9  
 package org.kuali.student.common.ui.client.widgets.field.layout.element;
 10  
 
 11  
 import java.util.ArrayList;
 12  
 import java.util.List;
 13  
 
 14  
 import org.kuali.student.common.ui.client.reporting.ReportExportWidget;
 15  
 import org.kuali.student.common.ui.client.util.ExportElement;
 16  
 import org.kuali.student.common.ui.client.util.ExportUtils;
 17  
 
 18  
 import com.google.gwt.dom.client.Element;
 19  
 import com.google.gwt.user.client.DOM;
 20  
 import com.google.gwt.user.client.ui.ComplexPanel;
 21  
 import com.google.gwt.user.client.ui.Widget;
 22  
 
 23  
 public class SpanPanel extends ComplexPanel implements ReportExportWidget {
 24  
 
 25  0
     boolean exportElement = true;
 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  
      * Adds a new child widget to the panel.
 39  
      * 
 40  
      * @param w
 41  
      *            the widget to be added
 42  
      */
 43  
     @Override
 44  
     public void add(Widget w) {
 45  0
         add(w, getElement());
 46  0
     }
 47  
 
 48  
     /**
 49  
      * Inserts a widget before the specified index.
 50  
      * 
 51  
      * @param w
 52  
      *            the widget to be inserted
 53  
      * @param beforeIndex
 54  
      *            the index before which it will be inserted
 55  
      * @throws IndexOutOfBoundsException
 56  
      *             if <code>beforeIndex</code> is out of range
 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
     }
 65  
 
 66  
     public void setHTML(String html) {
 67  0
         this.getElement().setInnerHTML(html);
 68  0
     }
 69  
 
 70  
     public String getText() {
 71  0
         return this.getElement().getInnerText();
 72  
     }
 73  
 
 74  
     @Override
 75  
     public boolean isExportElement() {
 76  0
         return exportElement;
 77  
     }
 78  
 
 79  
     public void setExportElement(boolean export) {
 80  0
         this.exportElement = export;
 81  0
     }
 82  
 
 83  
     @Override
 84  
     public List<ExportElement> getExportElementSubset(ExportElement parent) {
 85  0
         return ExportUtils.getDetailsForWidget(this, parent.getViewName(), parent.getSectionName());
 86  
     }
 87  
 
 88  
     @Override
 89  
     public String getExportFieldValue() {
 90  0
         return this.getText();
 91  
     }
 92  
 
 93  
 }