KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > nqadmin > swingSet > datasources > SSConnectionBeanInfo


1 /* $Id: SSConnectionBeanInfo.java,v 1.5 2005/02/09 06:40:43 prasanth Exp $
2  *
3  * Tab Spacing = 4
4  *
5  * Copyright (c) 2005, The Pangburn Company and Prasanth R. Pasala.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * Redistributions of source code must retain the above copyright notice, this
12  * list of conditions and the following disclaimer. Redistributions in binary
13  * form must reproduce the above copyright notice, this list of conditions and
14  * the following disclaimer in the documentation and/or other materials
15  * provided with the distribution. The names of its contributors may not be
16  * used to endorse or promote products derived from this software without
17  * specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  */

32  
33 package com.nqadmin.swingSet.datasources;
34
35 import java.beans.*;
36 import java.beans.IntrospectionException JavaDoc;
37
38 /**
39  * SSConnectionBeanInfo.java
40  *<p>
41  * SwingSet - Open Toolkit For Making Swing Controls Database-Aware
42  *<p><pre>
43  * Contains & controls various bean properties for SSConnection.
44  *</pre><p>
45  * @author $Author: prasanth $
46  * @version $Revision: 1.5 $
47  */

48  public class SSConnectionBeanInfo extends SimpleBeanInfo {
49
50     /**
51      * Provides the icon representation for the related bean.
52      *
53      * @param _iconKind The kind of icon requested. This should be one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, ICON_MONO_16x16, or ICON_MONO_32x32.
54      *
55      * @return An image object representing the requested icon. May return null if no suitable icon is available.
56      */

57     public java.awt.Image JavaDoc getIcon(int _iconKind) {
58         
59         if (_iconKind == BeanInfo.ICON_MONO_16x16 ||
60             _iconKind == BeanInfo.ICON_COLOR_16x16 )
61         {
62             java.awt.Image JavaDoc img = loadImage("/images/icons/ssconnection.gif");
63             return img;
64         }
65         if (_iconKind == BeanInfo.ICON_MONO_32x32 ||
66             _iconKind == BeanInfo.ICON_COLOR_32x32 )
67         {
68             java.awt.Image JavaDoc img = loadImage("/images/icons/ssconnection32.gif");
69             return img;
70         }
71         
72         return null;
73         
74     } // end public java.awt.Image getIcon(int _iconKind) {
75

76     public PropertyDescriptor[] getPropertyDescriptors(){
77         try{
78         
79             PropertyDescriptor urlDescriptor = new PropertyDescriptor("url", SSConnection.class, "getUrl", "setUrl");
80             urlDescriptor.setBound(true);
81             PropertyDescriptor usernameDescriptor = new PropertyDescriptor("username", SSConnection.class, "getUsername", "setUsername");
82             usernameDescriptor.setBound(true);
83             PropertyDescriptor passwordDescriptor = new PropertyDescriptor("password", SSConnection.class, "getPassword", "setPassword");
84             passwordDescriptor.setBound(true);
85             PropertyDescriptor driverNameDescriptor = new PropertyDescriptor("driverName", SSConnection.class, "getDriverName", "setDriverName");
86             driverNameDescriptor.setBound(true);
87             
88             PropertyDescriptor[] propertyDescriptors = new PropertyDescriptor[]{urlDescriptor, usernameDescriptor, passwordDescriptor, driverNameDescriptor};
89             return propertyDescriptors;
90         }catch(IntrospectionException JavaDoc ie){
91             ie.printStackTrace();
92         }
93         return null;
94     }
95
96 }
97
98 /*
99  * $Log: SSConnectionBeanInfo.java,v $
100  * Revision 1.5 2005/02/09 06:40:43 prasanth
101  * added getPropertyDescriptor method.
102  *
103  * Revision 1.4 2005/02/07 19:56:16 yoda2
104  * Fixing JavaDoc errors with _iconKind parameter name.
105  *
106  * Revision 1.3 2005/02/04 22:41:35 yoda2
107  * Updated Copyright info.
108  *
109  * Revision 1.2 2005/02/02 23:19:04 yoda2
110  * Fixed log tag.
111  *
112  */

113
Popular Tags