|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4
|
|
package org.ejtools.graph.frame;
|
|
5
|
|
|
|
6
|
|
import java.awt.Image;
|
|
7
|
|
import java.beans.BeanDescriptor;
|
|
8
|
|
import java.beans.BeanInfo;
|
|
9
|
|
import java.beans.Introspector;
|
|
10
|
|
import java.beans.IntrospectionException;
|
|
11
|
|
import java.beans.PropertyDescriptor;
|
|
12
|
|
import java.beans.ParameterDescriptor;
|
|
13
|
|
import java.beans.MethodDescriptor;
|
|
14
|
|
import java.beans.SimpleBeanInfo;
|
|
15
|
|
import java.lang.reflect.Method;
|
|
16
|
|
import java.util.ResourceBundle;
|
|
17
|
|
import java.util.Vector;
|
|
18
|
|
|
|
19
|
|
|
|
20
|
|
|
|
21
|
|
|
|
22
|
|
public class GraphInternalFrameBeanInfo extends SimpleBeanInfo
|
|
23
|
|
{
|
|
24
|
|
|
|
25
|
|
protected BeanDescriptor bd = new BeanDescriptor(org.ejtools.graph.frame.GraphInternalFrame.class);
|
|
26
|
|
|
|
27
|
|
protected Image iconColor16 = null;
|
|
28
|
|
|
|
29
|
|
protected Image iconMono16 = null;
|
|
30
|
|
|
|
31
|
|
protected Image iconColor32 = null;
|
|
32
|
|
|
|
33
|
|
protected Image iconMono32 = null;
|
|
34
|
|
|
|
35
|
|
private final static ResourceBundle res = ResourceBundle.getBundle("org.ejtools.graph.frame.GraphInternalFrameBeanInfo");
|
|
36
|
|
|
|
37
|
|
|
|
38
|
0
|
public GraphInternalFrameBeanInfo()
|
|
39
|
|
{
|
|
40
|
0
|
try
|
|
41
|
|
{
|
|
42
|
0
|
BeanInfo info = Introspector.getBeanInfo(getBeanDescriptor().getBeanClass().getSuperclass());
|
|
43
|
0
|
String order = info.getBeanDescriptor().getValue("propertyorder") == null ? "" : (String) info.getBeanDescriptor().getValue("propertyorder");
|
|
44
|
0
|
PropertyDescriptor[] pd = getPropertyDescriptors();
|
|
45
|
0
|
for (int i = 0; i != pd.length; i++)
|
|
46
|
|
{
|
|
47
|
0
|
if (order.indexOf(pd[i].getName()) == -1)
|
|
48
|
|
{
|
|
49
|
0
|
order = order + (order.length() == 0 ? "" : ":") + pd[i].getName();
|
|
50
|
|
}
|
|
51
|
|
}
|
|
52
|
0
|
getBeanDescriptor().setValue("propertyorder", order);
|
|
53
|
|
}
|
|
54
|
|
catch (Exception e)
|
|
55
|
|
{
|
|
56
|
|
|
|
57
|
|
}
|
|
58
|
|
}
|
|
59
|
|
|
|
60
|
|
|
|
61
|
|
|
|
62
|
|
|
|
63
|
|
|
|
64
|
|
|
|
65
|
0
|
public BeanInfo[] getAdditionalBeanInfo()
|
|
66
|
|
{
|
|
67
|
0
|
Vector bi = new Vector();
|
|
68
|
0
|
BeanInfo[] biarr = null;
|
|
69
|
0
|
try
|
|
70
|
|
{
|
|
71
|
|
}
|
|
72
|
|
catch (Exception e)
|
|
73
|
|
{
|
|
74
|
|
|
|
75
|
|
}
|
|
76
|
0
|
return biarr;
|
|
77
|
|
}
|
|
78
|
|
|
|
79
|
|
|
|
80
|
|
|
|
81
|
|
|
|
82
|
|
|
|
83
|
|
|
|
84
|
0
|
public BeanDescriptor getBeanDescriptor()
|
|
85
|
|
{
|
|
86
|
|
|
|
87
|
0
|
bd.setDisplayName(res.getString("bean.displayName"));
|
|
88
|
0
|
bd.setShortDescription(res.getString("bean.shortDescription"));
|
|
89
|
|
|
|
90
|
0
|
return bd;
|
|
91
|
|
}
|
|
92
|
|
|
|
93
|
|
|
|
94
|
|
|
|
95
|
|
|
|
96
|
|
|
|
97
|
|
|
|
98
|
0
|
public int getDefaultPropertyIndex()
|
|
99
|
|
{
|
|
100
|
0
|
String defName = "";
|
|
101
|
0
|
if (defName.equals(""))
|
|
102
|
|
{
|
|
103
|
0
|
return -1;
|
|
104
|
|
}
|
|
105
|
0
|
PropertyDescriptor[] pd = getPropertyDescriptors();
|
|
106
|
0
|
for (int i = 0; i < pd.length; i++)
|
|
107
|
|
{
|
|
108
|
0
|
if (pd[i].getName().equals(defName))
|
|
109
|
|
{
|
|
110
|
0
|
return i;
|
|
111
|
|
}
|
|
112
|
|
}
|
|
113
|
0
|
return -1;
|
|
114
|
|
}
|
|
115
|
|
|
|
116
|
|
|
|
117
|
|
|
|
118
|
|
|
|
119
|
|
|
|
120
|
|
|
|
121
|
|
|
|
122
|
0
|
public Image getIcon(int type)
|
|
123
|
|
{
|
|
124
|
0
|
if (type == BeanInfo.ICON_COLOR_16x16)
|
|
125
|
|
{
|
|
126
|
|
|
|
127
|
0
|
return iconColor16;
|
|
128
|
|
}
|
|
129
|
0
|
if (type == BeanInfo.ICON_MONO_16x16)
|
|
130
|
|
{
|
|
131
|
|
|
|
132
|
0
|
return iconMono16;
|
|
133
|
|
}
|
|
134
|
0
|
if (type == BeanInfo.ICON_COLOR_32x32)
|
|
135
|
|
{
|
|
136
|
|
|
|
137
|
0
|
return iconColor32;
|
|
138
|
|
}
|
|
139
|
0
|
if (type == BeanInfo.ICON_MONO_32x32)
|
|
140
|
|
{
|
|
141
|
|
|
|
142
|
0
|
return iconMono32;
|
|
143
|
|
}
|
|
144
|
0
|
return null;
|
|
145
|
|
}
|
|
146
|
|
|
|
147
|
|
|
|
148
|
|
|
|
149
|
|
|
|
150
|
|
|
|
151
|
|
|
|
152
|
0
|
public PropertyDescriptor[] getPropertyDescriptors()
|
|
153
|
|
{
|
|
154
|
0
|
try
|
|
155
|
|
{
|
|
156
|
0
|
Vector descriptors = new Vector();
|
|
157
|
0
|
PropertyDescriptor descriptor = null;
|
|
158
|
|
|
|
159
|
0
|
try
|
|
160
|
|
{
|
|
161
|
0
|
descriptor = new PropertyDescriptor("name", org.ejtools.graph.frame.GraphInternalFrame.class);
|
|
162
|
|
}
|
|
163
|
|
catch (IntrospectionException e)
|
|
164
|
|
{
|
|
165
|
0
|
descriptor = new PropertyDescriptor("name", org.ejtools.graph.frame.GraphInternalFrame.class, "getName", null);
|
|
166
|
|
}
|
|
167
|
|
|
|
168
|
0
|
descriptor.setDisplayName(res.getString("property.name.displayName"));
|
|
169
|
0
|
descriptor.setShortDescription(res.getString("property.name.shortDescription"));
|
|
170
|
|
|
|
171
|
0
|
descriptors.add(descriptor);
|
|
172
|
|
|
|
173
|
0
|
try
|
|
174
|
|
{
|
|
175
|
0
|
descriptor = new PropertyDescriptor("delay", org.ejtools.graph.frame.GraphInternalFrame.class);
|
|
176
|
|
}
|
|
177
|
|
catch (IntrospectionException e)
|
|
178
|
|
{
|
|
179
|
0
|
descriptor = new PropertyDescriptor("delay", org.ejtools.graph.frame.GraphInternalFrame.class, "getDelay", null);
|
|
180
|
|
}
|
|
181
|
|
|
|
182
|
0
|
descriptor.setDisplayName(res.getString("property.delay.displayName"));
|
|
183
|
0
|
descriptor.setShortDescription(res.getString("property.delay.shortDescription"));
|
|
184
|
|
|
|
185
|
0
|
descriptor.setPropertyEditorClass(Class.forName("org.ejtools.graph.editor.GraphDelayEditor"));
|
|
186
|
|
|
|
187
|
0
|
descriptors.add(descriptor);
|
|
188
|
|
|
|
189
|
0
|
try
|
|
190
|
|
{
|
|
191
|
0
|
descriptor = new PropertyDescriptor("scale", org.ejtools.graph.frame.GraphInternalFrame.class);
|
|
192
|
|
}
|
|
193
|
|
catch (IntrospectionException e)
|
|
194
|
|
{
|
|
195
|
0
|
descriptor = new PropertyDescriptor("scale", org.ejtools.graph.frame.GraphInternalFrame.class, "getScale", null);
|
|
196
|
|
}
|
|
197
|
|
|
|
198
|
0
|
descriptor.setDisplayName(res.getString("property.scale.displayName"));
|
|
199
|
0
|
descriptor.setShortDescription(res.getString("property.scale.shortDescription"));
|
|
200
|
|
|
|
201
|
0
|
descriptor.setPropertyEditorClass(Class.forName("org.ejtools.graph.editor.GraphScaleEditor"));
|
|
202
|
|
|
|
203
|
0
|
descriptors.add(descriptor);
|
|
204
|
|
|
|
205
|
0
|
return (PropertyDescriptor[]) descriptors.toArray(new PropertyDescriptor[descriptors.size()]);
|
|
206
|
|
}
|
|
207
|
|
catch (Exception e)
|
|
208
|
|
{
|
|
209
|
|
|
|
210
|
|
}
|
|
211
|
0
|
return null;
|
|
212
|
|
}
|
|
213
|
|
|
|
214
|
|
|
|
215
|
|
|
|
216
|
|
|
|
217
|
|
|
|
218
|
|
|
|
219
|
0
|
public MethodDescriptor[] getMethodDescriptors() {
|
|
220
|
0
|
Vector descriptors = new Vector();
|
|
221
|
0
|
MethodDescriptor descriptor = null;
|
|
222
|
0
|
Method[] m;
|
|
223
|
0
|
Method method;
|
|
224
|
|
|
|
225
|
0
|
try {
|
|
226
|
0
|
m = Class.forName("org.ejtools.graph.frame.GraphInternalFrame").getMethods();
|
|
227
|
|
} catch (ClassNotFoundException e) {
|
|
228
|
0
|
return new MethodDescriptor[0];
|
|
229
|
|
}
|
|
230
|
|
|
|
231
|
0
|
return (MethodDescriptor[]) descriptors.toArray(new MethodDescriptor[descriptors.size()]);
|
|
232
|
|
}
|
|
233
|
|
}
|
|
234
|
|
|