jdk/src/share/classes/java/beans/BeanInfo.java
author mcimadamore
Thu, 01 Dec 2011 18:34:23 +0000
changeset 11120 f8576c769572
parent 5506 202f599c92aa
child 11660 a414b9083e9e
permissions -rw-r--r--
7116954: Misc warnings in java.beans/java.beans.context Summary: Remove generic warnings form java.beans and java.beans.context Reviewed-by: alanb, chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.beans;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * A bean implementor who wishes to provide explicit information about
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * their bean may provide a BeanInfo class that implements this BeanInfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * interface and provides explicit information about the methods,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * properties, events, etc, of their  bean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * A bean implementor doesn't need to provide a complete set of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * explicit information.  You can pick and choose which information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * you want to provide and the rest will be obtained by automatic
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * analysis using low-level reflection of the bean classes' methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * and applying standard design patterns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * You get the opportunity to provide lots and lots of different
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * information as part of the various XyZDescriptor classes.  But
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * don't panic, you only really need to provide the minimal core
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * information required by the various constructors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * See also the SimpleBeanInfo class which provides a convenient
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * "noop" base class for BeanInfo classes, which you can override
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * for those specific places where you want to return explicit info.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * To learn about all the behaviour of a bean see the Introspector class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
public interface BeanInfo {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * Gets the beans <code>BeanDescriptor</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * @return  A BeanDescriptor providing overall information about
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * the bean, such as its displayName, its customizer, etc.  May
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * return null if the information should be obtained by automatic
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * analysis.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    BeanDescriptor getBeanDescriptor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * Gets the beans <code>EventSetDescriptor</code>s.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * @return  An array of EventSetDescriptors describing the kinds of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * events fired by this bean.  May return null if the information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * should be obtained by automatic analysis.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    EventSetDescriptor[] getEventSetDescriptors();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * A bean may have a "default" event that is the event that will
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * mostly commonly be used by humans when using the bean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * @return Index of default event in the EventSetDescriptor array
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     *          returned by getEventSetDescriptors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * <P>      Returns -1 if there is no default event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    int getDefaultEventIndex();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * Returns descriptors for all properties of the bean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * May return {@code null} if the information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * should be obtained by automatic analysis.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * If a property is indexed, then its entry in the result array
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * will belong to the {@link IndexedPropertyDescriptor} subclass
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * of the {@link PropertyDescriptor} class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * A client of the {@code getPropertyDescriptors} method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * can use "{@code instanceof}" to check
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * whether a given {@code PropertyDescriptor}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * is an {@code IndexedPropertyDescriptor}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * @return an array of {@code PropertyDescriptor}s
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     *         describing all properties supported by the bean
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     *         or {@code null}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    PropertyDescriptor[] getPropertyDescriptors();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * A bean may have a "default" property that is the property that will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * mostly commonly be initially chosen for update by human's who are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * customizing the bean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @return  Index of default property in the PropertyDescriptor array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *          returned by getPropertyDescriptors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * <P>      Returns -1 if there is no default property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    int getDefaultPropertyIndex();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * Gets the beans <code>MethodDescriptor</code>s.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * @return An array of MethodDescriptors describing the externally
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * visible methods supported by this bean.  May return null if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * the information should be obtained by automatic analysis.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    MethodDescriptor[] getMethodDescriptors();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * This method allows a BeanInfo object to return an arbitrary collection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * of other BeanInfo objects that provide additional information on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * current bean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * If there are conflicts or overlaps between the information provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * by different BeanInfo objects, then the current BeanInfo takes precedence
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * over the getAdditionalBeanInfo objects, and later elements in the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * take precedence over earlier ones.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * @return an array of BeanInfo objects.  May return null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    BeanInfo[] getAdditionalBeanInfo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * This method returns an image object that can be used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * represent the bean in toolboxes, toolbars, etc.   Icon images
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * will typically be GIFs, but may in future include other formats.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * Beans aren't required to provide icons and may return null from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * There are four possible flavors of icons (16x16 color,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * 32x32 color, 16x16 mono, 32x32 mono).  If a bean choses to only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * support a single icon we recommend supporting 16x16 color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * We recommend that icons have a "transparent" background
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * so they can be rendered onto an existing background.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * @param  iconKind  The kind of icon requested.  This should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     *    one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     *    ICON_MONO_16x16, or ICON_MONO_32x32.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * @return  An image object representing the requested icon.  May
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     *    return null if no suitable icon is available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    java.awt.Image getIcon(int iconKind);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * Constant to indicate a 16 x 16 color icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    final static int ICON_COLOR_16x16 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * Constant to indicate a 32 x 32 color icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    final static int ICON_COLOR_32x32 = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * Constant to indicate a 16 x 16 monochrome icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    final static int ICON_MONO_16x16 = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * Constant to indicate a 32 x 32 monochrome icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    final static int ICON_MONO_32x32 = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
}