001
014
015 package com.liferay.portal.sharepoint;
016
017 import com.liferay.portal.kernel.util.StringBundler;
018 import com.liferay.portal.kernel.util.StringPool;
019
020 import java.util.ArrayList;
021 import java.util.List;
022
023
026 public class Tree implements ResponseElement {
027
028 public static final String CLOSE_UL = "</ul>";
029
030 public static final String OPEN_UL = "<ul>";
031
032 public void addChild(ResponseElement node) {
033 _children.add(node);
034 }
035
036 public String parse() {
037 StringBundler sb = new StringBundler(_children.size() * 4 + 4);
038
039 sb.append(OPEN_UL);
040 sb.append(StringPool.NEW_LINE);
041
042 for (ResponseElement child : _children) {
043 sb.append(child.parse());
044 }
045
046 sb.append(CLOSE_UL);
047 sb.append(StringPool.NEW_LINE);
048
049 return sb.toString();
050 }
051
052 private List<ResponseElement> _children = new ArrayList<ResponseElement>();
053
054 }