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.coplet.status.SizingStatus; 21 import org.apache.cocoon.portal.event.impl.ChangeCopletInstanceAspectDataEvent; 22 import org.apache.cocoon.portal.layout.Layout; 23 import org.apache.cocoon.portal.layout.impl.CopletLayout; 24 import org.apache.cocoon.portal.layout.renderer.aspect.RendererAspectContext; 25 import org.apache.cocoon.xml.XMLUtils; 26 import org.xml.sax.ContentHandler ; 27 import org.xml.sax.SAXException ; 28 29 58 public class SizingAspect extends AbstractAspect { 59 60 63 public void toSAX(RendererAspectContext context, 64 Layout layout, 65 PortalService service, 66 ContentHandler handler) 67 throws SAXException { 68 69 CopletInstanceData cid = ((CopletLayout)layout).getCopletInstanceData(); 70 71 boolean showContent = true; 72 73 boolean sizable = ((Boolean )cid.getCopletData().getAspectData("sizable")).booleanValue(); 74 Integer size = null; 75 76 if ( sizable ) { 77 size = (Integer )cid.getAspectData("size"); 78 if ( size == null ) { 79 size = SizingStatus.STATUS_MAXIMIZED; 80 } 81 82 ChangeCopletInstanceAspectDataEvent event; 83 84 if ( size.equals(SizingStatus.STATUS_MAXIMIZED) ) { 85 event = new ChangeCopletInstanceAspectDataEvent(cid, "size", SizingStatus.STATUS_MINIMIZED); 86 XMLUtils.createElement(handler, "minimize-uri", service.getComponentManager().getLinkService().getLinkURI(event)); 87 } 88 89 if ( size.equals(SizingStatus.STATUS_MINIMIZED)) { 90 event = new ChangeCopletInstanceAspectDataEvent(cid, "size", SizingStatus.STATUS_MAXIMIZED); 91 XMLUtils.createElement(handler, "maximize-uri", service.getComponentManager().getLinkService().getLinkURI(event)); 92 } 93 94 if (size.equals(SizingStatus.STATUS_MINIMIZED)) { 95 showContent = false; 96 } 97 } 98 118 if ( showContent ) { 119 context.invokeNext(layout, service, handler); 120 } 121 } 122 123 } 124 | Popular Tags |