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 @Override
037 public String parse() {
038 StringBundler sb = new StringBundler(_children.size() * 4 + 4);
039
040 sb.append(OPEN_UL);
041 sb.append(StringPool.NEW_LINE);
042
043 for (ResponseElement child : _children) {
044 sb.append(child.parse());
045 }
046
047 sb.append(CLOSE_UL);
048 sb.append(StringPool.NEW_LINE);
049
050 return sb.toString();
051 }
052
053 private List<ResponseElement> _children = new ArrayList<ResponseElement>();
054
055 }