SwingBeanInfo.template revision 2362
195N/A/*
195N/A * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
195N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
195N/A *
195N/A * This code is free software; you can redistribute it and/or modify it
195N/A * under the terms of the GNU General Public License version 2 only, as
195N/A * published by the Free Software Foundation. Oracle designates this
195N/A * particular file as subject to the "Classpath" exception as provided
195N/A * by Oracle in the LICENSE file that accompanied this code.
195N/A *
195N/A * This code is distributed in the hope that it will be useful, but WITHOUT
195N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
195N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
195N/A * version 2 for more details (a copy is included in the LICENSE file that
195N/A * accompanied this code).
195N/A *
195N/A * You should have received a copy of the GNU General Public License version
195N/A * 2 along with this work; if not, write to the Free Software Foundation,
195N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
195N/A *
195N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
195N/A * or visit www.oracle.com if you need additional information or have any
195N/A * questions.
195N/A */
195N/A
195N/Apackage @(BeanPackageName);
195N/A
195N/Aimport java.beans.BeanDescriptor;
195N/Aimport java.beans.PropertyDescriptor;
195N/Aimport java.awt.Image;
195N/A
195N/Aimport sun.swing.BeanInfoUtils;
195N/A
195N/A/**
195N/A * Descriptive information about the @(BeanClassName) class for Java
195N/A * Beans application builders. This BeanInfo class provides descriptions
195N/A * of each property, of the bean itself, it indicates which
195N/A * @(BeanClassName) properties are bound, and it provides other
195N/A * information and icons useful to builders.
195N/A *
195N/A * @author Auto-Generated Source Code
195N/A */
195N/A
195N/Apublic class @(BeanClassName)BeanInfo extends javax.swing.SwingBeanInfoBase {
195N/A private static final Class class@(BeanClassName) = @(BeanClassObject);
195N/A
195N/A /**
195N/A * @return a @(BeanClassName) BeanDescriptor
195N/A */
195N/A public BeanDescriptor getBeanDescriptor() {
195N/A return BeanInfoUtils.createBeanDescriptor(class@(BeanClassName),
195N/A new Object[] {
195N/A BeanInfoUtils.PREFERRED, Boolean.TRUE,
195N/A @(ClassDescriptors)
195N/A BeanInfoUtils.SHORTDESCRIPTION, "@(BeanDescription)"
195N/A });
195N/A }
/**
* Create a @(BeanClassName) PropertyDescriptor. This is just an internal
* convenience method that allows one to leave the @(BeanClassName).class
* argument out of the createPropertyDescriptor() class in the
* getPropertyDescriptors() method below.
*
* @param name the name of the property
* @param args an array java.beans.PropertyDescriptor property names and values
* @return a @(BeanClassName) PropertyDescriptor.
* @see BeanInfoUtils#createPropertyDescriptor
*/
private PropertyDescriptor createPropertyDescriptor(String name, Object[] args) {
return BeanInfoUtils.createPropertyDescriptor(class@(BeanClassName), name, args);
}
/**
* This method returns a list of bean PropertyDescriptors, one for each public
* property in @(BeanClassName). The first property is the "default" property.
*
* @return a complete list of bean PropertyDescriptors for @(BeanClassName)
* @see SwingBeanInfo
* @see java.beans.BeanInfo#getDefaultPropertyIndex
*/
public PropertyDescriptor[] getPropertyDescriptors() {
@(EnumVariables)
return new PropertyDescriptor[] {
@(BeanPropertyDescriptors)
};
}
/**
* @return an icon of the specified kind for @(BeanClassName)
*/
public Image getIcon(int kind) {
Image i;
switch (kind){
case ICON_COLOR_32x32:
i = loadImage("beaninfo/images/@(BeanClassName)Color32.gif");
return ((i == null) ? loadImage("beaninfo/images/JComponentColor32.gif") : i);
case ICON_COLOR_16x16:
i = loadImage("beaninfo/images/@(BeanClassName)Color16.gif");
return ((i == null) ? loadImage("beaninfo/images/JComponentColor16.gif") : i);
case ICON_MONO_32x32:
i = loadImage("beaninfo/images/@(BeanClassName)Mono32.gif");
return ((i == null) ? loadImage("beaninfo/images/JComponentMono32.gif") : i);
case ICON_MONO_16x16:
i = loadImage("beaninfo/images/@(BeanClassName)Mono16.gif");
return ((i == null) ? loadImage("beaninfo/images/JComponentMono16.gif") : i);
default:
return super.getIcon(kind);
}
}
}