1 | |
package org.kuali.student.common.ui.client.widgets; |
2 | |
|
3 | |
import java.util.List; |
4 | |
|
5 | |
import com.google.gwt.dom.client.Document; |
6 | |
import com.google.gwt.dom.client.UListElement; |
7 | |
import com.google.gwt.user.client.Element; |
8 | |
import com.google.gwt.user.client.ui.ComplexPanel; |
9 | |
import com.google.gwt.user.client.ui.Widget; |
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
public class ULPanel extends ComplexPanel { |
19 | |
|
20 | |
private UListElement list; |
21 | |
|
22 | 0 | public ULPanel() { |
23 | 0 | list = Document.get().createULElement(); |
24 | 0 | setElement(list); |
25 | 0 | } |
26 | |
|
27 | |
@Override |
28 | |
public void add(Widget child) { |
29 | 0 | addChildElement(child, null); |
30 | 0 | } |
31 | |
|
32 | |
public void add(Widget child, String liClassName) { |
33 | 0 | addChildElement(child, liClassName); |
34 | 0 | } |
35 | |
|
36 | |
private void addChildElement(Widget child, String className) { |
37 | 0 | Element li = Document.get().createLIElement().cast(); |
38 | 0 | if(className != null) { |
39 | 0 | li.setClassName(className); |
40 | |
} |
41 | 0 | list.appendChild(li); |
42 | 0 | super.add(child, li); |
43 | 0 | } |
44 | |
|
45 | |
public void setULClassName(String className) { |
46 | 0 | list.setClassName(className); |
47 | 0 | } |
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
public void addAll(List<Widget> widgets, String className) { |
57 | 0 | for(Widget w : widgets) { |
58 | 0 | add(w, className); |
59 | |
} |
60 | 0 | } |
61 | |
} |