Integer data = (Integer) layout.getAspectData(config.aspectName);
int selected = data.intValue();
// loop over all tabs
for (int j = 0; j < tabLayout.getSize(); j++) {
Item tab = tabLayout.getItem(j);
ChangeAspectDataEvent event = null;
// open named-item tag
attributes.clear();
if ( tab instanceof NamedItem ) {
attributes.addCDATAAttribute("name", String.valueOf(((NamedItem)tab).getName()));
}
if (j == selected) {
attributes.addCDATAAttribute("selected", "true");
}
event = new ChangeAspectDataEvent(tabLayout, config.aspectName, new Integer(j));
attributes.addCDATAAttribute("parameter", service.getComponentManager().getLinkService().getLinkURI(event));
// add parameters
final Iterator iter = tab.getParameters().entrySet().iterator();
while ( iter.hasNext() ) {
final Map.Entry entry = (Map.Entry) iter.next();
attributes.addCDATAAttribute((String)entry.getKey(), (String)entry.getValue());
}
XMLUtils.startElement(handler, "named-item", attributes);
if (j == selected) {
this.processLayout(tab.getLayout(), service, handler);
if (config.includeSelected) {
List events = new ArrayList();
events.add(event);
this.processNav(context, tab.getLayout(), service, handler, events);
}
} else if (config.showAllNav) {
List events = new ArrayList();
events.add(event);
this.processNav(context, tab.getLayout(), service, handler, events);
}
// close named-item tag
XMLUtils.endElement(handler, "named-item");
}