01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.portal.event.impl;
18:
19: import org.apache.cocoon.portal.coplet.CopletInstanceData;
20: import org.apache.cocoon.portal.event.RequestEvent;
21: import org.apache.cocoon.portal.event.ConvertableEvent;
22: import org.apache.cocoon.portal.layout.Layout;
23: import org.apache.cocoon.portal.PortalService;
24:
25: /**
26: * EventSource: copletID
27: *
28: * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
29: * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
30: *
31: * @version CVS $Id: FullScreenCopletEvent.java 433543 2006-08-22 06:22:54Z crossley $
32: */
33: public class FullScreenCopletEvent extends CopletStatusEvent implements
34: 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 = service.getComponentManager()
51: .getProfileManager()
52: .getCopletInstanceData(copletId);
53: if (eventData.length() > index + 1) {
54: String layoutId = eventData.substring(index + 1);
55: this .layout = service.getComponentManager()
56: .getProfileManager().getPortalLayout(null,
57: layoutId);
58: }
59: } else {
60: this .layout = null;
61: this .coplet = service.getComponentManager()
62: .getProfileManager().getCopletInstanceData(
63: eventData);
64: }
65: }
66:
67: /* (non-Javadoc)
68: * @see org.apache.cocoon.portal.event.RequestEvent#getRequestParameterName()
69: */
70: public String getRequestParameterName() {
71: return REQUEST_PARAMETER_NAME;
72: }
73:
74: public Layout getLayout() {
75: return this .layout;
76: }
77:
78: public String asString() {
79: if (this .layout == null) {
80: return this .coplet.getId();
81: }
82: String layoutId = this .layout.getId();
83: if (layoutId == null) {
84: // Without a layout id this can't be marshalled.
85: return null;
86: }
87: return this .coplet.getId() + "_" + layoutId;
88: }
89: }
|