KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > admingui > descriptors > CCHelp2MastheadViewBeanDescriptor


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.tools.admingui.descriptors;
25
26 import com.iplanet.jato.RequestContext;
27 import com.iplanet.jato.view.ContainerView;
28 import com.iplanet.jato.view.View;
29
30 import com.sun.enterprise.tools.guiframework.exception.FrameworkException;
31 import com.sun.enterprise.tools.guiframework.view.descriptors.ViewDescriptor;
32 import com.sun.enterprise.tools.admingui.view.DescriptorCCHelp2MastheadViewBean;
33
34
35 /**
36  *
37  */

38 public class CCHelp2MastheadViewBeanDescriptor extends ViewDescriptor {
39
40     /**
41      * Constructor
42      */

43     public CCHelp2MastheadViewBeanDescriptor(String JavaDoc name) {
44     super(name);
45     }
46
47     
48     /**
49      * This is a factory method. It will create a MastheadViewBean.
50      *
51      * @param ctx The RequestContext
52      * @param container The container for the newly created
53      * @param name The Name of the View to be created.
54      */

55     public View getInstance(RequestContext ctx, ContainerView container, String JavaDoc name) {
56     // Caching is done by view.getName()... since this always returns the
57
// 1st one called, it will only cache by the first one called. Since
58
// Masthead is called first, it will be cached under Masthead.
59
if (name.equals("com.sun.web.ui.servlet.help2.MastheadViewBean")) {
60         try {
61         return ctx.getViewBeanManager().getViewBean("Masthead");
62         } catch (ClassNotFoundException JavaDoc ex) {
63         throw new FrameworkException(
64             "MastheadViewBean is called by 2 names: " +
65             "'Masthead' and 'com.sun.web.ui.servlet.help2." +
66             "MastheadViewBean'. For this reason, you must " +
67             "register both of these in the ViewXML! The "+
68             "CCHelp2MastheadViewBeanDescriptor knows how to deal with " +
69             "this.", ex, this, container);
70         }
71     }
72     return new DescriptorCCHelp2MastheadViewBean(ctx, name, this);
73     }
74 }
75
Popular Tags