KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > layout > renderer > aspect > impl > FullScreenCopletAspect


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

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.FullScreenCopletEvent;
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 JavaDoc;
26 import org.xml.sax.SAXException JavaDoc;
27
28 /**
29  * Includes a tag containing a URI that is connected with a fullscreen
30  * display of a coplet. If fullscreen is explicitly unsupported, no tag
31  * will be created. Otherwise, it depends on the current layout being the
32  * fullscreen layout or not whether the URI contains an event that switches
33  * to this layout or not.
34  *
35  * <h2>Example XML:</h2>
36  * <pre>
37  * &lt;fullscreen-uri&gt;fullscreen-event-if-supported&lt;/fullscreen-uri&gt;
38  * &lt;!-- output from following renderers --&gt;
39  * </pre>
40  *
41  * <h2>Applicable to:</h2>
42  * <ul>
43  * <li>{@link org.apache.cocoon.portal.layout.impl.CopletLayout}</li>
44  * </ul>
45  *
46  *
47  * @author <a HREF="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
48  * @author <a HREF="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
49  *
50  * @version CVS $Id: FullScreenCopletAspect.java 312938 2005-10-11 19:11:56Z cziegeler $
51  */

52 public class FullScreenCopletAspect extends AbstractAspect {
53
54     /* (non-Javadoc)
55      * @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)
56      */

57     public void toSAX(RendererAspectContext context,
58                         Layout layout,
59                         PortalService service,
60                         ContentHandler JavaDoc handler)
61     throws SAXException JavaDoc {
62         
63         CopletInstanceData cid = ((CopletLayout)layout).getCopletInstanceData();
64
65         Boolean JavaDoc supportsFullScreen = (Boolean JavaDoc)cid.getCopletData().getAspectData("full-screen");
66         if ( supportsFullScreen == null || supportsFullScreen.equals(Boolean.TRUE) ) {
67             final Layout fullScreenLayout = service.getEntryLayout(null);
68             if ( fullScreenLayout != null && fullScreenLayout.equals( layout )) {
69                 FullScreenCopletEvent event = new FullScreenCopletEvent( cid, null );
70                 XMLUtils.createElement(handler, "maximize-uri", service.getComponentManager().getLinkService().getLinkURI(event));
71             } else {
72                 FullScreenCopletEvent event = new FullScreenCopletEvent( cid, layout );
73                 XMLUtils.createElement(handler, "fullscreen-uri", service.getComponentManager().getLinkService().getLinkURI(event));
74             }
75         }
76         context.invokeNext(layout, service, handler);
77     }
78
79 }
80
Popular Tags