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.layout.renderer.aspect.impl;
18:
19: import org.apache.cocoon.portal.PortalService;
20: import org.apache.cocoon.portal.coplet.CopletInstanceData;
21: import org.apache.cocoon.portal.event.impl.FullScreenCopletEvent;
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: /**
30: * Includes a tag containing a URI that is connected with a fullscreen
31: * display of a coplet. If fullscreen is explicitly unsupported, no tag
32: * will be created. Otherwise, it depends on the current layout being the
33: * fullscreen layout or not whether the URI contains an event that switches
34: * to this layout or not.
35: *
36: * <h2>Example XML:</h2>
37: * <pre>
38: * <fullscreen-uri>fullscreen-event-if-supported</fullscreen-uri>
39: * <!-- output from following renderers -->
40: * </pre>
41: *
42: * <h2>Applicable to:</h2>
43: * <ul>
44: * <li>{@link org.apache.cocoon.portal.layout.impl.CopletLayout}</li>
45: * </ul>
46: *
47: *
48: * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
49: * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
50: *
51: * @version CVS $Id: FullScreenCopletAspect.java 433543 2006-08-22 06:22:54Z crossley $
52: */
53: public class FullScreenCopletAspect extends AbstractAspect {
54:
55: /* (non-Javadoc)
56: * @see org.apache.cocoon.portal.layout.renderer.RendererAspect#toSAX(org.apache.cocoon.portal.layout.renderer.RendererAspectContext, org.apache.cocoon.portal.layout.Layout, org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler)
57: */
58: public void toSAX(RendererAspectContext context, Layout layout,
59: PortalService service, ContentHandler handler)
60: throws SAXException {
61:
62: CopletInstanceData cid = ((CopletLayout) layout)
63: .getCopletInstanceData();
64:
65: Boolean supportsFullScreen = (Boolean) cid.getCopletData()
66: .getAspectData("full-screen");
67: if (supportsFullScreen == null
68: || supportsFullScreen.equals(Boolean.TRUE)) {
69: final Layout fullScreenLayout = service
70: .getEntryLayout(null);
71: if (fullScreenLayout != null
72: && fullScreenLayout.equals(layout)) {
73: FullScreenCopletEvent event = new FullScreenCopletEvent(
74: cid, null);
75: XMLUtils.createElement(handler, "maximize-uri", service
76: .getComponentManager().getLinkService()
77: .getLinkURI(event));
78: } else {
79: FullScreenCopletEvent event = new FullScreenCopletEvent(
80: cid, layout);
81: XMLUtils.createElement(handler, "fullscreen-uri",
82: service.getComponentManager().getLinkService()
83: .getLinkURI(event));
84: }
85: }
86: context.invokeNext(layout, service, handler);
87: }
88:
89: }
|