Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/beans/SimpleBeanInfo.java
38829 views
1
/*
2
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
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
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
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
*
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.
24
*/
25
26
package java.beans;
27
28
import java.awt.Image;
29
import java.awt.Toolkit;
30
import java.awt.image.ImageProducer;
31
import java.net.URL;
32
33
/**
34
* This is a support class to make it easier for people to provide
35
* BeanInfo classes.
36
* <p>
37
* It defaults to providing "noop" information, and can be selectively
38
* overriden to provide more explicit information on chosen topics.
39
* When the introspector sees the "noop" values, it will apply low
40
* level introspection and design patterns to automatically analyze
41
* the target bean.
42
*/
43
44
public class SimpleBeanInfo implements BeanInfo {
45
46
/**
47
* Deny knowledge about the class and customizer of the bean.
48
* You can override this if you wish to provide explicit info.
49
*/
50
public BeanDescriptor getBeanDescriptor() {
51
return null;
52
}
53
54
/**
55
* Deny knowledge of properties. You can override this
56
* if you wish to provide explicit property info.
57
*/
58
public PropertyDescriptor[] getPropertyDescriptors() {
59
return null;
60
}
61
62
/**
63
* Deny knowledge of a default property. You can override this
64
* if you wish to define a default property for the bean.
65
*/
66
public int getDefaultPropertyIndex() {
67
return -1;
68
}
69
70
/**
71
* Deny knowledge of event sets. You can override this
72
* if you wish to provide explicit event set info.
73
*/
74
public EventSetDescriptor[] getEventSetDescriptors() {
75
return null;
76
}
77
78
/**
79
* Deny knowledge of a default event. You can override this
80
* if you wish to define a default event for the bean.
81
*/
82
public int getDefaultEventIndex() {
83
return -1;
84
}
85
86
/**
87
* Deny knowledge of methods. You can override this
88
* if you wish to provide explicit method info.
89
*/
90
public MethodDescriptor[] getMethodDescriptors() {
91
return null;
92
}
93
94
/**
95
* Claim there are no other relevant BeanInfo objects. You
96
* may override this if you want to (for example) return a
97
* BeanInfo for a base class.
98
*/
99
public BeanInfo[] getAdditionalBeanInfo() {
100
return null;
101
}
102
103
/**
104
* Claim there are no icons available. You can override
105
* this if you want to provide icons for your bean.
106
*/
107
public Image getIcon(int iconKind) {
108
return null;
109
}
110
111
/**
112
* This is a utility method to help in loading icon images.
113
* It takes the name of a resource file associated with the
114
* current object's class file and loads an image object
115
* from that file. Typically images will be GIFs.
116
* <p>
117
* @param resourceName A pathname relative to the directory
118
* holding the class file of the current class. For example,
119
* "wombat.gif".
120
* @return an image object. May be null if the load failed.
121
*/
122
public Image loadImage(final String resourceName) {
123
try {
124
final URL url = getClass().getResource(resourceName);
125
if (url != null) {
126
final ImageProducer ip = (ImageProducer) url.getContent();
127
if (ip != null) {
128
return Toolkit.getDefaultToolkit().createImage(ip);
129
}
130
}
131
} catch (final Exception ignored) {
132
}
133
return null;
134
}
135
}
136
137