KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > httpserver > HttpServerSettingsBeanInfo


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.httpserver;
21
22 import java.awt.Image JavaDoc;
23 import java.beans.*;
24 import java.util.ResourceBundle JavaDoc;
25
26 import org.openide.ErrorManager;
27 import org.openide.util.NbBundle;
28 import org.openide.util.Utilities;
29
30 /** BeanInfo for http - custom editor for hosts property
31 *
32 * @author Ales Novak, Petr Jiricka
33 */

34 public class HttpServerSettingsBeanInfo extends SimpleBeanInfo {
35
36     /** @return the ExternalCompilerSettings' icon */
37     public Image JavaDoc getIcon(int type) {
38         if ((type == java.beans.BeanInfo.ICON_COLOR_16x16) || (type == java.beans.BeanInfo.ICON_MONO_16x16)) {
39         return Utilities.loadImage("org/netbeans/modules/httpserver/httpServerSettings.gif"); // NOI18N
40
} else {
41             return Utilities.loadImage ("org/netbeans/modules/httpserver/httpServerSettings32.gif"); // NOI18N
42
}
43     }
44
45     /** Descriptor of valid properties
46     * @return array of properties
47     */

48     public PropertyDescriptor[] getPropertyDescriptors () {
49         try {
50             PropertyDescriptor[] desc = new PropertyDescriptor[] {
51                        new PropertyDescriptor("port", HttpServerSettings.class), // 0 // NOI18N
52
new PropertyDescriptor("running", HttpServerSettings.class, "isRunning", null), // 1 // NOI18N
53
new PropertyDescriptor("hostProperty", HttpServerSettings.class), // 2 // NOI18N
54
new PropertyDescriptor("showGrantAccess", HttpServerSettings.class, "isShowGrantAccessDialog", "setShowGrantAccessDialog") // 3 // NOI18N
55
};
56             ResourceBundle JavaDoc bundle = NbBundle.getBundle(HttpServerSettingsBeanInfo.class);
57             desc[0].setDisplayName(bundle.getString("PROP_Port"));
58             desc[0].setShortDescription(bundle.getString("HINT_Port"));
59             desc[1].setDisplayName(bundle.getString("PROP_Running"));
60             desc[1].setShortDescription(bundle.getString("HINT_Running"));
61             desc[2].setDisplayName(bundle.getString("PROP_HostProperty"));
62             desc[2].setShortDescription(bundle.getString("HINT_HostProperty"));
63             desc[2].setPropertyEditorClass (HostPropertyEditor.class);
64             desc[3].setDisplayName(bundle.getString("PROP_showGrantAccess"));
65             desc[3].setShortDescription(bundle.getString("HINT_showGrantAccess"));
66             return desc;
67         } catch (IntrospectionException ex) {
68             ErrorManager.getDefault().notify(ex);
69             return null;
70         }
71     }
72
73     public BeanDescriptor getBeanDescriptor(){
74         BeanDescriptor bd = new BeanDescriptor(HttpServerSettings.class);
75         bd.setDisplayName(NbBundle.getMessage(HttpServerSettingsBeanInfo.class, "LBL_HTTPServerSettings"));
76         bd.setShortDescription(NbBundle.getMessage(HttpServerSettingsBeanInfo.class, "CTL_HTTP_sett_HINT"));
77         return bd;
78     }
79
80
81 }
82
Popular Tags