author | prr |
Sat, 19 Sep 2015 15:45:59 -0700 | |
changeset 32865 | f9cb6e427f9e |
parent 25859 | 3317bb8137f4 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
2 |
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package java.beans; |
|
27 |
||
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
28 |
import java.awt.Image; |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
29 |
|
2 | 30 |
/** |
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
31 |
* Use the {@code BeanInfo} interface |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
32 |
* to create a {@code BeanInfo} class |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
33 |
* and provide explicit information about the methods, |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
34 |
* properties, events, and other features of your beans. |
2 | 35 |
* <p> |
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
36 |
* When developing your bean, you can implement |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
37 |
* the bean features required for your application task |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
38 |
* omitting the rest of the {@code BeanInfo} features. |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
39 |
* They will be obtained through the automatic analysis |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
40 |
* by using the low-level reflection of the bean methods |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
41 |
* and applying standard design patterns. |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
42 |
* You have an opportunity to provide additional bean information |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
43 |
* through various descriptor classes. |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
44 |
* <p> |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
45 |
* See the {@link SimpleBeanInfo} class that is |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
46 |
* a convenient basic class for {@code BeanInfo} classes. |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
47 |
* You can override the methods and properties of |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
48 |
* the {@code SimpleBeanInfo} class to define specific information. |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
49 |
* <p> |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
50 |
* See also the {@link Introspector} class to learn more about bean behavior. |
25130
adfaa02ea516
8044855: Add missing @since tag under java.beans.*
henryjen
parents:
11660
diff
changeset
|
51 |
* |
adfaa02ea516
8044855: Add missing @since tag under java.beans.*
henryjen
parents:
11660
diff
changeset
|
52 |
* @since 1.1 |
2 | 53 |
*/ |
54 |
public interface BeanInfo { |
|
55 |
||
56 |
/** |
|
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
57 |
* Returns the bean descriptor |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
58 |
* that provides overall information about the bean, |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
59 |
* such as its display name or its customizer. |
2 | 60 |
* |
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
61 |
* @return a {@link BeanDescriptor} object, |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
62 |
* or {@code null} if the information is to |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
63 |
* be obtained through the automatic analysis |
2 | 64 |
*/ |
65 |
BeanDescriptor getBeanDescriptor(); |
|
66 |
||
67 |
/** |
|
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
68 |
* Returns the event descriptors of the bean |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
69 |
* that define the types of events fired by this bean. |
2 | 70 |
* |
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
71 |
* @return an array of {@link EventSetDescriptor} objects, |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
72 |
* or {@code null} if the information is to |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
73 |
* be obtained through the automatic analysis |
2 | 74 |
*/ |
75 |
EventSetDescriptor[] getEventSetDescriptors(); |
|
76 |
||
77 |
/** |
|
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
78 |
* A bean may have a default event typically applied when this bean is used. |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
79 |
* |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
80 |
* @return index of the default event in the {@code EventSetDescriptor} array |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
81 |
* returned by the {@code getEventSetDescriptors} method, |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
82 |
* or -1 if there is no default event |
2 | 83 |
*/ |
84 |
int getDefaultEventIndex(); |
|
85 |
||
86 |
/** |
|
87 |
* Returns descriptors for all properties of the bean. |
|
88 |
* <p> |
|
89 |
* If a property is indexed, then its entry in the result array |
|
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
90 |
* belongs to the {@link IndexedPropertyDescriptor} subclass |
2 | 91 |
* of the {@link PropertyDescriptor} class. |
92 |
* A client of the {@code getPropertyDescriptors} method |
|
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
93 |
* can use the {@code instanceof} operator to check |
2 | 94 |
* whether a given {@code PropertyDescriptor} |
95 |
* is an {@code IndexedPropertyDescriptor}. |
|
96 |
* |
|
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
97 |
* @return an array of {@code PropertyDescriptor} objects, |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
98 |
* or {@code null} if the information is to |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
99 |
* be obtained through the automatic analysis |
2 | 100 |
*/ |
101 |
PropertyDescriptor[] getPropertyDescriptors(); |
|
102 |
||
103 |
/** |
|
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
104 |
* A bean may have a default property commonly updated when this bean is customized. |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
105 |
* |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
106 |
* @return index of the default property in the {@code PropertyDescriptor} array |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
107 |
* returned by the {@code getPropertyDescriptors} method, |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
108 |
* or -1 if there is no default property |
2 | 109 |
*/ |
110 |
int getDefaultPropertyIndex(); |
|
111 |
||
112 |
/** |
|
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
113 |
* Returns the method descriptors of the bean |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
114 |
* that define the externally visible methods supported by this bean. |
2 | 115 |
* |
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
116 |
* @return an array of {@link MethodDescriptor} objects, |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
117 |
* or {@code null} if the information is to |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
118 |
* be obtained through the automatic analysis |
2 | 119 |
*/ |
120 |
MethodDescriptor[] getMethodDescriptors(); |
|
121 |
||
122 |
/** |
|
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
123 |
* This method enables the current {@code BeanInfo} object |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
124 |
* to return an arbitrary collection of other {@code BeanInfo} objects |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
125 |
* that provide additional information about the current bean. |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
126 |
* <p> |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
127 |
* If there are conflicts or overlaps between the information |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
128 |
* provided by different {@code BeanInfo} objects, |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
129 |
* the current {@code BeanInfo} object takes priority |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
130 |
* over the additional {@code BeanInfo} objects. |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
131 |
* Array elements with higher indices take priority |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
132 |
* over the elements with lower indices. |
2 | 133 |
* |
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
134 |
* @return an array of {@code BeanInfo} objects, |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
135 |
* or {@code null} if there are no additional {@code BeanInfo} objects |
2 | 136 |
*/ |
137 |
BeanInfo[] getAdditionalBeanInfo(); |
|
138 |
||
139 |
/** |
|
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
140 |
* Returns an image that can be used to represent the bean in toolboxes or toolbars. |
2 | 141 |
* <p> |
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
142 |
* There are four possible types of icons: |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
143 |
* 16 x 16 color, 32 x 32 color, 16 x 16 mono, and 32 x 32 mono. |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
144 |
* If you implement a bean so that it supports a single icon, |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
145 |
* it is recommended to use 16 x 16 color. |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
146 |
* Another recommendation is to set a transparent background for the icons. |
2 | 147 |
* |
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
148 |
* @param iconKind the kind of icon requested |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
149 |
* @return an image object representing the requested icon, |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
150 |
* or {@code null} if no suitable icon is available |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
151 |
* |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
152 |
* @see #ICON_COLOR_16x16 |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
153 |
* @see #ICON_COLOR_32x32 |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
154 |
* @see #ICON_MONO_16x16 |
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
155 |
* @see #ICON_MONO_32x32 |
2 | 156 |
*/ |
11660
a414b9083e9e
7121905: grammatically incorrect apostrophe in BeanInfo javadoc
malenkov
parents:
5506
diff
changeset
|
157 |
Image getIcon(int iconKind); |
2 | 158 |
|
159 |
/** |
|
160 |
* Constant to indicate a 16 x 16 color icon. |
|
161 |
*/ |
|
32865
f9cb6e427f9e
8136783: Run blessed-modifier-order script on java.desktop
prr
parents:
25859
diff
changeset
|
162 |
static final int ICON_COLOR_16x16 = 1; |
2 | 163 |
|
164 |
/** |
|
165 |
* Constant to indicate a 32 x 32 color icon. |
|
166 |
*/ |
|
32865
f9cb6e427f9e
8136783: Run blessed-modifier-order script on java.desktop
prr
parents:
25859
diff
changeset
|
167 |
static final int ICON_COLOR_32x32 = 2; |
2 | 168 |
|
169 |
/** |
|
170 |
* Constant to indicate a 16 x 16 monochrome icon. |
|
171 |
*/ |
|
32865
f9cb6e427f9e
8136783: Run blessed-modifier-order script on java.desktop
prr
parents:
25859
diff
changeset
|
172 |
static final int ICON_MONO_16x16 = 3; |
2 | 173 |
|
174 |
/** |
|
175 |
* Constant to indicate a 32 x 32 monochrome icon. |
|
176 |
*/ |
|
32865
f9cb6e427f9e
8136783: Run blessed-modifier-order script on java.desktop
prr
parents:
25859
diff
changeset
|
177 |
static final int ICON_MONO_32x32 = 4; |
2 | 178 |
} |