KickJava   Java API By Example, From Geeks To Geeks.

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


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.html.SelectableGroup;
29 import com.iplanet.jato.view.html.SelectableGroupImpl;
30 import com.iplanet.jato.view.html.OptionList;
31 import com.iplanet.jato.view.html.Option;
32 import com.iplanet.jato.view.View;
33 import com.iplanet.jato.view.ViewBean;
34 import com.iplanet.jato.view.event.DisplayEvent;
35 import com.sun.web.ui.view.html.CCDropDownMenu;
36
37 import com.sun.enterprise.tools.guiframework.exception.FrameworkException;
38
39 import java.util.ArrayList JavaDoc;
40 import java.util.List JavaDoc;
41
42 /**
43  * Unfortunately, this class has to exist to support Lockhart tags. They are
44  * not current with JATO and cannot use JATO BasicChoiceDisplayField's. Once,
45  * Lockhart supports those fields, then this class will be deprecated in favor
46  * of ChoiceFieldDescriptor.
47  */

48 public class CCDropDownMenuDescriptor extends SelectFieldDescriptor {
49
50     /**
51      * This constructor creates a DisplayFieldDescriptor. Name is
52      * required to create a SelectFieldDescriptor.
53      *
54      * @param name Instance name for the described SelectField
55      */

56     public CCDropDownMenuDescriptor(String JavaDoc name) {
57     super(name);
58     }
59
60
61     /**
62      *
63      */

64     public View getInstance(RequestContext ctx, ContainerView container, String JavaDoc name) {
65     // Create the CCDropDownMenu
66
String JavaDoc initialValue = (String JavaDoc)getParameter("initialValue");
67     CCDropDownMenu choice = new CCDropDownMenu(
68         container, name, getModelFieldName(), initialValue);
69
70     // Set the options
71
setOptions(choice);
72
73     // Set the extraHtml
74
setExtraHtml(choice);
75
76     // Set the commandChild (turns this into a navigation drop down)
77
String JavaDoc commandChild = (String JavaDoc)getParameter(COMMAND_CHILD);
78     if ((commandChild != null) && !commandChild.equals("")) {
79         choice.setCommandChild(commandChild);
80     }
81     return choice;
82     }
83
84
85     /**
86      * This parameter key ("commandChild") allows the CommandField child
87      * name to be supplied so that JavaScript will be generated to submit
88      * the form targetting the given CommandChild when a selection is made
89      * for this DropDownMenu.
90      */

91     public static final String JavaDoc COMMAND_CHILD = "commandChild";
92 }
93
Popular Tags