View Javadoc

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   * A simple list panel that uses the UL/LI tag HTML structure 
14   * 
15   * @author alubbers
16   *
17   */
18  @Deprecated
19  public class ULPanel extends ComplexPanel {
20  
21      private UListElement list;
22  
23      public ULPanel() {
24          list = Document.get().createULElement();
25          setElement(list);
26      }
27  
28      @Override
29      public void add(Widget child) {
30          addChildElement(child, null);
31      }
32  
33      public void add(Widget child, String liClassName) {
34          addChildElement(child, liClassName);
35      }
36      
37      private void addChildElement(Widget child, String className) {
38          Element li = Document.get().createLIElement().cast();
39          if(className != null) {
40              li.setClassName(className);
41          }
42          list.appendChild(li);
43          super.add(child, li);
44      }
45      
46      public void setULClassName(String className) {
47          list.setClassName(className);
48      }
49  
50      /**
51       * 
52       * This method adds a collection of widgets as LI entries under this UL
53       * 
54       * @param reqCompWidgets
55       * @param className CSS class name for each LI
56       */
57      public void addAll(List<Widget> widgets, String className) {
58          for(Widget w : widgets) {
59              add(w, className);
60          }
61      }
62  }