1 16 package org.apache.cocoon.portal.layout.renderer.aspect.impl; 17 18 import java.util.Iterator ; 19 import java.util.List ; 20 21 import org.apache.cocoon.portal.PortalService; 22 import org.apache.cocoon.portal.layout.CompositeLayout; 23 import org.apache.cocoon.portal.layout.Item; 24 import org.apache.cocoon.portal.layout.Layout; 25 import org.apache.cocoon.portal.layout.NamedItem; 26 import org.apache.cocoon.portal.layout.renderer.Renderer; 27 import org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext; 28 import org.xml.sax.ContentHandler ; 29 import org.xml.sax.SAXException ; 30 31 47 public abstract class AbstractCompositeAspect 48 extends AbstractAspect { 49 50 53 public void toSAX(RendererAspectContext context, 54 Layout layout, 55 PortalService service, 56 ContentHandler handler) 57 throws SAXException { 58 if ( layout instanceof CompositeLayout) { 59 CompositeLayout compositeLayout = (CompositeLayout)layout; 60 for (Iterator iter = compositeLayout.getItems().iterator(); iter.hasNext();) { 62 Item item = (Item) iter.next(); 63 this.processItem(item, handler, service); 64 } 65 } else { 66 throw new SAXException ("CompositeLayout expected."); 67 } 68 } 69 70 78 protected abstract void processItem(Item item, ContentHandler handler, PortalService service) 79 throws SAXException ; 80 81 85 protected void processLayout(Layout layout, PortalService service, ContentHandler handler) throws SAXException { 86 if ( layout != null ) { 87 final String rendererName = layout.getRendererName(); 88 final Renderer renderer = service.getComponentManager().getRenderer(rendererName); 89 renderer.toSAX(layout, service, handler); 90 } 91 } 92 } 93 | Popular Tags |