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.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 | |
|
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 | } |
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 | |
} |