KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > jmx > browser > dialog > CreateMBeanDialog


1 /*
2
3  * EJTools, the Enterprise Java Tools
4
5  *
6
7  * Distributable under LGPL license.
8
9  * See terms of license at www.gnu.org.
10
11  */

12
13 package org.ejtools.jmx.browser.dialog;
14
15
16
17 import java.awt.Component JavaDoc;
18
19 import java.awt.GridBagConstraints JavaDoc;
20
21 import java.awt.GridBagLayout JavaDoc;
22
23 import java.awt.GridLayout JavaDoc;
24
25 import java.awt.Insets JavaDoc;
26
27 import java.awt.event.ActionEvent JavaDoc;
28
29 import java.awt.event.ActionListener JavaDoc;
30
31 import java.util.ResourceBundle JavaDoc;
32
33
34
35 import javax.swing.JButton JavaDoc;
36
37 import javax.swing.JComboBox JavaDoc;
38
39 import javax.swing.JDialog JavaDoc;
40
41 import javax.swing.JLabel JavaDoc;
42
43 import javax.swing.JPanel JavaDoc;
44
45 import javax.swing.JTextField JavaDoc;
46
47 import javax.swing.SwingConstants JavaDoc;
48
49
50
51 /**
52
53  * @author letiemble
54
55  * @created 11 d?cembre 2002
56
57  * @version $Revision: 1.5 $
58
59  */

60
61 public class CreateMBeanDialog extends JDialog JavaDoc
62
63 {
64
65    /** Description of the Field */
66
67    protected JTextField JavaDoc argTypes;
68
69    /** Description of the Field */
70
71    protected JTextField JavaDoc argValues;
72
73    /** Description of the Field */
74
75    protected JTextField JavaDoc classLoader;
76
77    /** Description of the Field */
78
79    protected JComboBox JavaDoc classes;
80
81    /** Description of the Field */
82
83    protected JComboBox JavaDoc domains;
84
85    /** Description of the Field */
86
87    protected Object JavaDoc objectName = null;
88
89    /** Description of the Field */
90
91    private static ResourceBundle JavaDoc resources = ResourceBundle.getBundle("org.ejtools.jmx.browser.Resources");
92
93
94
95
96
97    /**
98
99     *Constructor for the CustomJOptionPane object
100
101     *
102
103     * @param parentComponent Description of the Parameter
104
105     * @param domainValues Description of the Parameter
106
107     * @param classValues Description of the Parameter
108
109     */

110
111    public CreateMBeanDialog(Component JavaDoc parentComponent, Object JavaDoc[] domainValues, Object JavaDoc[] classValues)
112
113    {
114
115       super();
116
117       this.setModal(true);
118
119       this.setTitle(resources.getString("create.dialog.title"));
120
121
122
123       JPanel JavaDoc main = new JPanel JavaDoc(new GridBagLayout JavaDoc());
124
125       GridBagConstraints JavaDoc constraints = new GridBagConstraints JavaDoc();
126
127       constraints.insets = new Insets JavaDoc(5, 5, 5, 5);
128
129
130
131       constraints.gridwidth = GridBagConstraints.REMAINDER;
132
133       constraints.weightx = 1.0;
134
135       constraints.fill = GridBagConstraints.HORIZONTAL;
136
137       constraints.anchor = GridBagConstraints.WEST;
138
139
140
141       JLabel JavaDoc label = new JLabel JavaDoc(resources.getString("create.dialog.text.description"));
142
143       main.add(label, constraints);
144
145
146
147       constraints.gridwidth = GridBagConstraints.RELATIVE;
148
149       constraints.weightx = 0.0;
150
151       label = new JLabel JavaDoc(resources.getString("create.dialog.text.objectName") + " : ", SwingConstants.RIGHT);
152
153       main.add(label, constraints);
154
155
156
157       constraints.gridwidth = GridBagConstraints.REMAINDER;
158
159       constraints.weightx = 1.0;
160
161       this.domains = new JComboBox JavaDoc(domainValues);
162
163       this.domains.setEditable(true);
164
165       main.add(this.domains, constraints);
166
167
168
169       constraints.gridwidth = GridBagConstraints.RELATIVE;
170
171       constraints.weightx = 0.0;
172
173       label = new JLabel JavaDoc(resources.getString("create.dialog.text.className") + " : ", SwingConstants.RIGHT);
174
175       main.add(label, constraints);
176
177
178
179       constraints.gridwidth = GridBagConstraints.REMAINDER;
180
181       constraints.weightx = 1.0;
182
183       this.classes = new JComboBox JavaDoc(classValues);
184
185       this.classes.setEditable(true);
186
187       main.add(this.classes, constraints);
188
189
190
191       constraints.gridwidth = GridBagConstraints.RELATIVE;
192
193       constraints.weightx = 0.0;
194
195       label = new JLabel JavaDoc(resources.getString("create.dialog.text.classLoader") + " : ", SwingConstants.RIGHT);
196
197       main.add(label, constraints);
198
199
200
201       constraints.gridwidth = GridBagConstraints.REMAINDER;
202
203       constraints.weightx = 1.0;
204
205       this.classLoader = new JTextField JavaDoc(30);
206
207       main.add(this.classLoader, constraints);
208
209
210
211       constraints.gridwidth = GridBagConstraints.RELATIVE;
212
213       constraints.weightx = 0.0;
214
215       label = new JLabel JavaDoc(resources.getString("create.dialog.text.argValues") + " : ", SwingConstants.RIGHT);
216
217       main.add(label, constraints);
218
219
220
221       constraints.gridwidth = GridBagConstraints.REMAINDER;
222
223       constraints.weightx = 1.0;
224
225       this.argValues = new JTextField JavaDoc(30);
226
227       main.add(this.argValues, constraints);
228
229
230
231       constraints.gridwidth = GridBagConstraints.RELATIVE;
232
233       constraints.weightx = 0.0;
234
235       label = new JLabel JavaDoc(resources.getString("create.dialog.text.argTypes") + " : ", SwingConstants.RIGHT);
236
237       main.add(label, constraints);
238
239
240
241       constraints.gridwidth = GridBagConstraints.REMAINDER;
242
243       constraints.weightx = 1.0;
244
245       this.argTypes = new JTextField JavaDoc(30);
246
247       main.add(this.argTypes, constraints);
248
249
250
251       JPanel JavaDoc buttons = new JPanel JavaDoc(new GridLayout JavaDoc(1, 2, 2, 2));
252
253
254
255       JButton JavaDoc buttonSelect = new JButton JavaDoc(resources.getString("create.dialog.button.create"));
256
257       buttons.add(buttonSelect);
258
259       buttonSelect.addActionListener(
260
261          new ActionListener JavaDoc()
262
263          {
264
265             public void actionPerformed(ActionEvent JavaDoc e)
266
267             {
268
269                objectName = domains.getEditor().getItem();
270
271                CreateMBeanDialog.this.dispose();
272
273             }
274
275          });
276
277
278
279       JButton JavaDoc buttonCancel = new JButton JavaDoc(resources.getString("create.dialog.button.cancel"));
280
281       buttons.add(buttonCancel);
282
283       buttonCancel.addActionListener(
284
285          new ActionListener JavaDoc()
286
287          {
288
289             /**
290
291              * @param e Description of the Parameter
292
293              */

294
295             public void actionPerformed(ActionEvent JavaDoc e)
296
297             {
298
299                objectName = null;
300
301                CreateMBeanDialog.this.dispose();
302
303             }
304
305          });
306
307
308
309       constraints.fill = GridBagConstraints.NONE;
310
311       constraints.anchor = GridBagConstraints.SOUTH;
312
313       main.add(buttons, constraints);
314
315
316
317       this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
318
319       this.getContentPane().add(main);
320
321       this.pack();
322
323       this.setLocationRelativeTo(parentComponent);
324
325    }
326
327
328
329
330
331    /**
332
333     * Gets the classLoader attribute of the CreateMBeanDialog object
334
335     *
336
337     * @return The classLoader value
338
339     */

340
341    public String JavaDoc getClassLoader()
342
343    {
344
345       return this.classLoader.getText();
346
347    }
348
349
350
351
352
353    /**
354
355     * Returns the objectClass.
356
357     *
358
359     * @return Object
360
361     */

362
363    public String JavaDoc getObjectClass()
364
365    {
366
367       return this.classes.getEditor().getItem().toString();
368
369    }
370
371
372
373
374
375    /**
376
377     * Returns the objectName.
378
379     *
380
381     * @return Object
382
383     */

384
385    public Object JavaDoc getObjectName()
386
387    {
388
389       return this.objectName;
390
391    }
392
393
394
395
396
397    /**
398
399     * Gets the parameters attribute of the CreateMBeanDialog object
400
401     *
402
403     * @return The parameters value
404
405     */

406
407    public String JavaDoc getParameters()
408
409    {
410
411       return this.argValues.getText();
412
413    }
414
415
416
417
418
419    /**
420
421     * Gets the signature attribute of the CreateMBeanDialog object
422
423     *
424
425     * @return The signature value
426
427     */

428
429    public String JavaDoc getSignature()
430
431    {
432
433       return this.argTypes.getText();
434
435    }
436
437 }
438
439
Popular Tags