1 31 32 package org.opencms.workplace.administration; 33 34 import org.opencms.util.CmsIdentifiableObjectContainer; 35 import org.opencms.workplace.CmsWorkplace; 36 import org.opencms.workplace.tools.CmsToolMacroResolver; 37 38 import java.util.Iterator ; 39 import java.util.List ; 40 41 50 public class CmsAdminMenuGroup { 51 52 53 private final CmsIdentifiableObjectContainer m_container = new CmsIdentifiableObjectContainer(true, true); 54 55 56 private final String m_id; 57 58 59 private final String m_name; 60 61 67 public CmsAdminMenuGroup(String id, String name) { 68 69 m_id = id; 70 m_name = name; 71 } 72 73 80 public void addMenuItem(CmsAdminMenuItem item) { 81 82 m_container.addIdentifiableObject(item.getId(), item); 83 } 84 85 93 public void addMenuItem(CmsAdminMenuItem item, float position) { 94 95 m_container.addIdentifiableObject(item.getId(), item, position); 96 } 97 98 103 public String getId() { 104 105 return m_id; 106 } 107 108 113 public List getMenuItems() { 114 115 return m_container.elementList(); 116 } 117 118 123 public String getName() { 124 125 return m_name; 126 } 127 128 135 public String groupHtml(CmsWorkplace wp) { 136 137 StringBuffer html = new StringBuffer (512); 138 html.append(htmlStart(wp)); 139 Iterator itItem = m_container.elementList().iterator(); 140 while (itItem.hasNext()) { 141 CmsAdminMenuItem item = (CmsAdminMenuItem)itItem.next(); 142 html.append(item.itemHtml(wp)); 143 html.append("\n"); 144 } 145 html.append(htmlEnd()); 146 return html.toString(); 147 } 148 149 154 private String htmlEnd() { 155 156 StringBuffer html = new StringBuffer (512); 157 html.append("\t\t\t\t\t\t</td>\n"); 158 html.append("\t\t\t\t\t</tr>\n"); 159 html.append("\t\t\t\t</table>\n"); 160 html.append("\t\t\t</div>\n"); 161 html.append("\t\t</td>\n"); 162 html.append("\t</tr>\n"); 163 html.append("</table>\n"); 164 return html.toString(); 165 } 166 167 174 private String htmlStart(CmsWorkplace wp) { 175 176 StringBuffer html = new StringBuffer (1024); 177 html.append("<table border='0' cellspacing='0' cellpadding='0' width='100%' class='navOpened' id='"); 178 html.append(getId()); 179 html.append("'>\n"); 180 html.append("\t<tr>\n"); 181 html.append("\t\t<td class='titleBorder'>\n"); 182 html.append("\t\t\t<table border='0' cellspacing='0' cellpadding='0' width='100%' class='navTitle' onMouseOver='mouseGroupEvent(this, true);' onMouseOut='mouseGroupEvent(this, false);' onClick=\"return openGroup('"); 183 html.append(getId()); 184 html.append("');\" >\n"); 185 html.append("\t\t\t\t<tr>\n"); 186 html.append("\t\t\t\t\t<td class='titleText' width='100%'>"); 187 html.append(CmsToolMacroResolver.resolveMacros(getName(), wp)); 188 html.append("</td>\n"); 189 html.append("\t\t\t\t</tr>\n"); 190 html.append("\t\t\t</table>\n"); 191 html.append("\t\t</td>\n"); 192 html.append("\t</tr><tr>\n"); 193 html.append("\t\t<td class='treeBorder'>\n"); 194 html.append("\t\t\t<div class='tree'>\n"); 195 html.append("\t\t\t\t<table border='0' cellspacing='0' cellpadding='0' width='100%'>\n"); 196 html.append("\t\t\t\t\t<tr>\n"); 197 html.append("\t\t\t\t\t\t<td>\n"); 198 return html.toString(); 199 } 200 201 } | Popular Tags |