KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > guiframework > view > descriptors > CCAlertInlineDescriptor


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.guiframework.view.descriptors;
25
26 import com.iplanet.jato.RequestContext;
27 import com.iplanet.jato.view.ContainerView;
28 import com.iplanet.jato.view.View;
29 import com.sun.web.ui.view.alert.CCAlertInline;
30
31
32 /**
33  *
34  */

35 public class CCAlertInlineDescriptor extends DisplayFieldDescriptor {
36
37     /**
38      * Constructor
39      */

40     public CCAlertInlineDescriptor(String JavaDoc name) {
41     super(name);
42     }
43
44
45     /**
46      * <P>This is a factory method for CCAlertInline instances. The following
47      * parameters are supported:</P>
48      *
49      * <UL><LI>summary -- The Alert Summary</LI>
50      * <LI>detail -- The Alert Detail</LI>
51      * <LI>type -- The Alert type ("error", "help", "info",
52      * "warning")</LI></UL>
53      *
54      * <P>See Lockhart Documenation for more details.</P>
55      *
56      * @param ctx The RequestContext
57      * @param container The container for the newly created
58      */

59     public View getInstance(RequestContext ctx, ContainerView container, String JavaDoc name) {
60         // Create the alert, use "error" as default type
61
CCAlertInline alert = new CCAlertInline(container, name, "error");
62
63     // Set the bound name
64
setBoundName(alert);
65
66     // Figure out the alert type & create w/ that type
67
Object JavaDoc value=getParameter(TYPE);
68     if (value != null) {
69         alert.setValue(value);
70     }
71
72     // Set Summary if supplied
73
value=getParameter(SUMMARY);
74     if (value != null) {
75         alert.setSummary(value.toString());
76     }
77
78     // Set Detail if supplied
79
value=getParameter(DETAIL);
80     if (value != null) {
81         alert.setDetail(value.toString());
82     }
83     return alert;
84     }
85
86
87     /**
88      * This parameter ("summary") is used to supply the summary.
89      */

90     public static final String JavaDoc SUMMARY = "summary";
91
92     /**
93      * This parameter ("detail") is used to supply the detail.
94      */

95     public static final String JavaDoc DETAIL = "detail";
96
97     /**
98      * The parameter ("type") is used to set the Alert type. Valid values
99      * are: "error", "help", "info", and "warning" See
100      * com.sun.web.ui.view.alert.CCAlert.
101      */

102     public static final String JavaDoc TYPE = "type";
103 }
104
Popular Tags