KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > forte > XMLCSettingsBeanInfo


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  * Lisa Reese
21  *
22  */

23
24 package org.enhydra.kelp.forte;
25
26 import java.awt.Image JavaDoc;
27 import java.awt.Component JavaDoc;
28 import java.beans.*;
29 import java.util.ResourceBundle JavaDoc;
30 import javax.swing.JFileChooser JavaDoc;
31
32 import org.enhydra.tool.common.IconSet;
33
34 import org.openide.util.NbBundle;
35
36 /** Description of {@link XMLCSettings}.
37  *
38  * @author rees0234
39  */

40 public class XMLCSettingsBeanInfo extends SimpleBeanInfo {
41
42     private static final ResourceBundle JavaDoc bundle = NbBundle.getBundle(XMLCSettingsBeanInfo.class);
43     
44     public BeanDescriptor getBeanDescriptor()
45     {
46         return new BeanDescriptor(XMLCSettings.class, XMLCSettingsCustomizer.class);
47     }
48
49     public PropertyDescriptor[] getPropertyDescriptors () {
50         try {
51
52 // PropertyDescriptor build = new PropertyDescriptor ("Build", XMLCSettings.class);
53
// build.setDisplayName (NbBundle.getMessage (XMLCSettingsBeanInfo.class, "XMLC_BUILD"));
54
// build.setShortDescription (NbBundle.getMessage (XMLCSettingsBeanInfo.class, "HINT_build"));
55
// build.setPropertyEditorClass(BoolEd.class);
56

57             PropertyDescriptor root = new PropertyDescriptor ("Root", XMLCSettings.class);
58             root.setDisplayName (NbBundle.getMessage (XMLCSettingsBeanInfo.class, "PROP_enhydra.xmlc.project.root"));
59             root.setShortDescription (NbBundle.getMessage (XMLCSettingsBeanInfo.class, "HINT_enhydra.xmlc.project.root"));
60             root.setPropertyEditorClass(DirEd.class);
61
62             PropertyDescriptor source = new PropertyDescriptor ("Source", XMLCSettings.class);
63             source.setDisplayName (NbBundle.getMessage (XMLCSettingsBeanInfo.class, "PROP_enhydra.xmlc.src.dir"));
64             source.setShortDescription (NbBundle.getMessage (XMLCSettingsBeanInfo.class, "HINT_enhydra.xmlc.src.dir"));
65             source.setPropertyEditorClass(DirEd.class);
66                         
67             return new PropertyDescriptor[] {root, source};
68         } catch (IntrospectionException ie) {
69             if (Boolean.getBoolean ("netbeans.debug.exceptions"))
70                 ie.printStackTrace ();
71             return null;
72         }
73     }
74
75     private static Image JavaDoc icon, icon32;
76     public Image JavaDoc getIcon (int type) {
77         if (type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) {
78             if (icon == null)
79                 icon = loadImage("enhydraObject.gif");
80             return icon;
81
82         } else {
83             if (icon32 == null)
84                 icon32 = loadImage("enhydraObject32.gif");
85             return icon32;
86
87         }
88     }
89
90     public static class DirEd extends PropertyEditorSupport {
91         
92         public boolean supportsCustomEditor()
93         {
94             return true;
95         }
96         
97         public Component JavaDoc getCustomeEditor()
98         {
99             return new JFileChooser JavaDoc();
100         }
101     }
102 /* public String getAsText () {
103             return tags[((Boolean) getValue ()).booleanValue () ? 0 : 1];
104         }
105
106         public void setAsText (String text) throws IllegalArgumentException {
107             if (tags[0].equals (text))
108                 setValue (Boolean.TRUE);
109             else if (tags[1].equals (text))
110                 setValue (Boolean.FALSE);
111             else
112                 throw new IllegalArgumentException ();
113         }*/

114
115 /* public static class BoolEd extends PropertyEditorSupport {
116
117         private static final String[] tags = {
118             NbBundle.getMessage (XMLCSettingsBeanInfo.class, "LBL_true"),
119             NbBundle.getMessage (XMLCSettingsBeanInfo.class, "LBL_false")
120     };
121
122         public String[] getTags () {
123             return tags;
124         }
125
126         public String getAsText () {
127             return tags[((Boolean) getValue ()).booleanValue () ? 0 : 1];
128         }
129
130         public void setAsText (String text) throws IllegalArgumentException {
131             if (tags[0].equals (text))
132                 setValue (Boolean.TRUE);
133             else if (tags[1].equals (text))
134                 setValue (Boolean.FALSE);
135             else
136                 throw new IllegalArgumentException ();
137         }
138
139     }*/

140 }
141
Popular Tags