1 16 package org.apache.cocoon.portal.layout.renderer.aspect.impl; 17 18 import org.apache.cocoon.portal.PortalService; 19 import org.apache.cocoon.portal.coplet.CopletInstanceData; 20 import org.apache.cocoon.portal.event.impl.LayoutRemoveEvent; 21 import org.apache.cocoon.portal.layout.Layout; 22 import org.apache.cocoon.portal.layout.impl.CopletLayout; 23 import org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext; 24 import org.apache.cocoon.xml.XMLUtils; 25 import org.xml.sax.ContentHandler ; 26 import org.xml.sax.SAXException ; 27 28 48 public class RemovableAspect 49 extends AbstractAspect { 50 51 54 public void toSAX(RendererAspectContext context, 55 Layout layout, 56 PortalService service, 57 ContentHandler handler) 58 throws SAXException { 59 60 CopletInstanceData cid = ((CopletLayout)layout).getCopletInstanceData(); 61 62 Boolean mandatory = (Boolean )cid.getCopletData().getAspectData("mandatory"); 63 if ( !mandatory.booleanValue() ) { 64 LayoutRemoveEvent lre = new LayoutRemoveEvent(layout); 65 XMLUtils.createElement(handler, "remove-uri", service.getComponentManager().getLinkService().getLinkURI(lre)); 66 } 67 context.invokeNext(layout, service, handler); 68 } 69 70 } 71 | Popular Tags |