Layout layout,
PortalService service,
ContentHandler handler)
throws SAXException {
if (layout instanceof CompositeLayout) {
AttributesImpl attributes = new AttributesImpl();
Map parameter = layout.getParameters();
for (Iterator iter = parameter.values().iterator(); iter.hasNext();) {
Parameter param = (Parameter) iter.next();
attributes.addCDATAAttribute(param.getName(), param.getValue());
}
XMLUtils.startElement(handler, this.getTagName(context), attributes);
PortalService portalService = null;
try {
portalService = (PortalService) this.manager.lookup(PortalService.ROLE);
attributes = new AttributesImpl();
CompositeLayout tabLayout = (CompositeLayout) layout;
// selected tab
Integer data = (Integer) layout.getAspectData("tab");
int selected = data.intValue();
// loop over all tabs
for (int j = 0; j < tabLayout.getSize(); j++) {
NamedItem tab = (NamedItem) tabLayout.getItem(j);
// open named-item tag
attributes.clear();
attributes.addCDATAAttribute("name", String.valueOf(tab.getName()));
if (j == selected) {
attributes.addCDATAAttribute("selected", "true");
} else {
LayoutAspectDataEvent event = new LayoutAspectDataEvent(tabLayout, "tab", new Integer(j));
attributes.addCDATAAttribute("parameter", portalService.getLinkService().getLinkURI(event));
}
XMLUtils.startElement(handler, "named-item", attributes);
if (j == selected) {
this.processLayout(tab.getLayout(), service, handler);
}