001    package org.kuali.student.common.ui.client.widgets;
002    
003    import java.util.List;
004    
005    import com.google.gwt.dom.client.Document;
006    import com.google.gwt.dom.client.UListElement;
007    import com.google.gwt.user.client.Element;
008    import com.google.gwt.user.client.ui.ComplexPanel;
009    import com.google.gwt.user.client.ui.Widget;
010    
011    /**
012     * 
013     * A simple list panel that uses the UL/LI tag HTML structure 
014     * 
015     * @author alubbers
016     *
017     */
018    @Deprecated
019    public class ULPanel extends ComplexPanel {
020    
021        private UListElement list;
022    
023        public ULPanel() {
024            list = Document.get().createULElement();
025            setElement(list);
026        }
027    
028        @Override
029        public void add(Widget child) {
030            addChildElement(child, null);
031        }
032    
033        public void add(Widget child, String liClassName) {
034            addChildElement(child, liClassName);
035        }
036        
037        private void addChildElement(Widget child, String className) {
038            Element li = Document.get().createLIElement().cast();
039            if(className != null) {
040                li.setClassName(className);
041            }
042            list.appendChild(li);
043            super.add(child, li);
044        }
045        
046        public void setULClassName(String className) {
047            list.setClassName(className);
048        }
049    
050        /**
051         * 
052         * This method adds a collection of widgets as LI entries under this UL
053         * 
054         * @param reqCompWidgets
055         * @param className CSS class name for each LI
056         */
057        public void addAll(List<Widget> widgets, String className) {
058            for(Widget w : widgets) {
059                add(w, className);
060            }
061        }
062    }