/* (non-Javadoc)
* @see org.xml.sax.ContentHandler#startDocument()
*/
public void startDocument() throws SAXException {
super.startDocument();
AttributesImpl a = new AttributesImpl();
// took the div-tag as root, because it does not matter in the output, if it passes the xsl transformation
super.startPrefixMapping("i18n", "http://apache.org/cocoon/i18n/2.1");
super.startElement("", "div","div", a);
super.startElement("", "tab-layout", "tab-layout", a);
Collection tools = pm.getToolsWithFunctions();
for(Iterator it = tools.iterator(); it.hasNext();) {
AttributesImpl attr = new AttributesImpl();
PortalTool pt = (PortalTool) it.next();
attr.addCDATAAttribute("parameter", "tools/functions/" + pt.getId());
attr.addCDATAAttribute("name", pt.getName());
attr.addCDATAAttribute("http://apache.org/cocoon/i18n/2.1", "attr", "i18n:attr", "name");
if(selected != null) {
if(selected.equals(pt.getId())) {
attr.addCDATAAttribute("selected", "true");
}
}
super.startElement("","named-item", "named-item", attr);
super.endElement("", "named-item", "named-item");
}
super.endElement("", "tab-layout", "tab-layout");
if(selected != null) {
PortalTool ct = pm.getTool(selected);
if(ct != null) {
super.startElement("", "tool-functions", "tool-functions", a);
Collection funs = ct.getFunctions();
for(Iterator it = funs.iterator();it.hasNext();) {
PortalToolFunction ptf = (PortalToolFunction) it.next();
AttributesImpl attr = new AttributesImpl();
attr.addCDATAAttribute("parameter", "tools/plugins/" + ct.getId() + "/" + ptf.getFunction());
attr.addCDATAAttribute("name", ptf.getName());
attr.addCDATAAttribute("http://apache.org/cocoon/i18n/2.1", "attr", "i18n:attr", "name"); super.startElement("", "function", "function", attr);
super.endElement("", "function", "function");
}
super.endElement("", "tool-functions", "tool-functions");
}
}