KickJava   Java API By Example, From Geeks To Geeks.

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


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.impl;
17
18 import org.apache.cocoon.portal.PortalService;
19 import org.apache.cocoon.portal.layout.Layout;
20 import org.apache.cocoon.portal.layout.impl.LinkLayout;
21 import org.xml.sax.ContentHandler JavaDoc;
22 import org.xml.sax.SAXException JavaDoc;
23
24 /**
25  * Include a linked layout in the generated XML.
26  *
27  * <h2>Applicable to:</h2>
28  * <ul>
29  * <li>{@link org.apache.cocoon.portal.layout.impl.LinkLayout}</li>
30  * </ul>
31  *
32  * @author <a HREF="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
33  * @author <a HREF="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
34  * @author <a HREF="mailto:juergen.seitz@basf-it-services.com">J&uuml;rgen Seitz</a>
35  *
36  * @version CVS $Id: DefaultLinkRenderer.java 30932 2004-07-29 17:35:38Z vgritsenko $
37  */

38 public class DefaultLinkRenderer extends AbstractRenderer {
39
40     public void process(Layout layout, PortalService service, ContentHandler JavaDoc handler)
41     throws SAXException JavaDoc {
42         if (layout instanceof LinkLayout) {
43             String JavaDoc layoutKey = (String JavaDoc)layout.getAspectData("link-layout-key");
44             String JavaDoc layoutId = (String JavaDoc)layout.getAspectData("link-layout-id");
45             if ( layoutKey == null && layoutId == null){
46                 // get default values
47
layoutKey = ((LinkLayout)layout).getLayoutKey();
48                 layoutId = ((LinkLayout)layout).getLayoutId();
49             }
50             this.processLayout(service.getComponentManager().getProfileManager().getPortalLayout(layoutKey, layoutId), service, handler);
51         } else {
52             throw new SAXException JavaDoc("Wrong layout type, LinkLayout expected: " + layout.getClass().getName());
53         }
54     }
55     
56 }
57
Popular Tags