1 16 package org.apache.cocoon.portal.event.impl; 17 18 import org.apache.cocoon.portal.coplet.CopletInstanceData; 19 import org.apache.cocoon.portal.event.RequestEvent; 20 import org.apache.cocoon.portal.event.ConvertableEvent; 21 import org.apache.cocoon.portal.layout.Layout; 22 import org.apache.cocoon.portal.PortalService; 23 24 32 public class FullScreenCopletEvent 33 extends CopletStatusEvent 34 implements RequestEvent, ConvertableEvent { 35 36 public static final String REQUEST_PARAMETER_NAME = "cocoon-portal-fs"; 37 38 protected Layout layout; 39 40 public FullScreenCopletEvent(CopletInstanceData data, Layout layout) { 41 this.coplet = data; 42 this.layout = layout; 43 } 44 45 FullScreenCopletEvent(PortalService service, String eventData) { 46 int index = eventData.indexOf('_'); 47 String copletId; 48 if (index > 0) { 49 copletId = eventData.substring(0, index); 50 this.coplet = 51 service.getComponentManager().getProfileManager().getCopletInstanceData(copletId); 52 if (eventData.length() > index + 1) { 53 String layoutId = eventData.substring(index + 1); 54 this.layout = 55 service.getComponentManager().getProfileManager().getPortalLayout(null, layoutId); 56 } 57 } else { 58 this.layout = null; 59 this.coplet = 60 service.getComponentManager().getProfileManager().getCopletInstanceData(eventData); 61 } 62 } 63 64 67 public String getRequestParameterName() { 68 return REQUEST_PARAMETER_NAME; 69 } 70 71 public Layout getLayout() { 72 return this.layout; 73 } 74 75 public String asString() { 76 if (this.layout == null) { 77 return this.coplet.getId(); 78 } 79 String layoutId = this.layout.getId(); 80 if (layoutId == null) { 81 return null; 83 } 84 return this.coplet.getId() + "_" + layoutId; 85 } 86 } | Popular Tags |