Statistics
| Revision:

root / branches / v10 / libraries / libUI / src-test / org / gvsig / gui / beans / comboBoxItemsSeeker / userTests / JPanelUserTestOfJComboBoxItemsSeekerConfigurable.java @ 9097

History | View | Annotate | Download (103 KB)

1
package org.gvsig.gui.beans.comboBoxItemsSeeker.userTests;
2

    
3
import java.awt.Color;
4
import java.awt.ComponentOrientation;
5
import java.awt.Dimension;
6
import java.awt.FlowLayout;
7
import java.awt.Font;
8
import java.awt.GridLayout;
9
import java.awt.event.MouseAdapter;
10
import java.awt.event.MouseEvent;
11
import java.awt.event.WindowAdapter;
12
import java.awt.event.WindowEvent;
13
import java.io.BufferedReader;
14
import java.io.File;
15
import java.io.FileReader;
16
import java.io.IOException;
17
import java.io.PrintStream;
18
import java.io.Serializable;
19
import java.lang.reflect.InvocationTargetException;
20
import java.lang.reflect.Method;
21
import java.util.HashMap;
22
import java.util.Map;
23
import java.util.StringTokenizer;
24
import java.util.Vector;
25

    
26
import javax.swing.BorderFactory;
27
import javax.swing.JButton;
28
import javax.swing.JCheckBox;
29
import javax.swing.JComboBox;
30
import javax.swing.JFrame;
31
import javax.swing.JLabel;
32
import javax.swing.JOptionPane;
33
import javax.swing.JPanel;
34
import javax.swing.JScrollPane;
35
import javax.swing.JTabbedPane;
36
import javax.swing.JTextArea;
37
import javax.swing.JTextField;
38
import javax.swing.SwingConstants;
39
import javax.swing.border.TitledBorder;
40
import javax.swing.event.PopupMenuEvent;
41
import javax.swing.event.PopupMenuListener;
42

    
43
import org.gvsig.gui.beans.Messages;
44
import org.gvsig.gui.beans.comboBoxItemsSeeker.AbstractDefaultComboBoxItemsSeekerConfigurableModel;
45
import org.gvsig.gui.beans.comboBoxItemsSeeker.Item;
46
import org.gvsig.gui.beans.comboBoxItemsSeeker.JComboBoxItemsSeekerConfigurable;
47

    
48

    
49
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
50
*
51
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
52
*
53
* This program is free software; you can redistribute it and/or
54
* modify it under the terms of the GNU General Public License
55
* as published by the Free Software Foundation; either version 2
56
* of the License, or (at your option) any later version.
57
*
58
* This program is distributed in the hope that it will be useful,
59
* but WITHOUT ANY WARRANTY; without even the implied warranty of
60
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
61
* GNU General Public License for more details.
62
*
63
* You should have received a copy of the GNU General Public License
64
* along with this program; if not, write to the Free Software
65
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
66
*
67
* For more information, contact:
68
*
69
*  Generalitat Valenciana
70
*   Conselleria d'Infraestructures i Transport
71
*   Av. Blasco Ib??ez, 50
72
*   46010 VALENCIA
73
*   SPAIN
74
*
75
*      +34 963862235
76
*   gvsig@gva.es
77
*      www.gvsig.gva.es
78
*
79
*    or
80
*
81
*   IVER T.I. S.A
82
*   Salamanca 50
83
*   46005 Valencia
84
*   Spain
85
*
86
*   +34 963163400
87
*   dac@iver.es
88
*/
89

    
90
/** 
91
 * Application for testing JComboBoxItemsSeekerConfigurable objects
92
 * This class is a JPanel and has other classes nested.
93
 * 
94
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
95
 */
96
public class JPanelUserTestOfJComboBoxItemsSeekerConfigurable extends JPanel implements Serializable {
97
        private static final long serialVersionUID = -6215950904003508523L;
98
        private final int panelWidth = 735;
99
        private final int panelHeight = 530;
100
        private final int testWidth = 260;
101
        private ConfigurationJPanel configurationPanel = null;
102
        private OtherTestsJPanel otherTestsPanel = null;
103
        private JavaFileMethodsLoader javaFileMethodsLoader;
104
        private int testNumber;
105
        private String path;
106
        
107
        /**
108
         * Default constructor
109
         */
110
        public JPanelUserTestOfJComboBoxItemsSeekerConfigurable() {
111
                super();
112
                this.initialize();
113
        }
114

    
115
        /**
116
         * Initializes the application pane
117
         */
118
        private void initialize() {
119
                path = "src/org/gvsig/gui/beans/comboBoxItemsSeeker/JComboBoxItemsSeekerConfigurable.java";
120
                this.setPreferredSize(new Dimension(panelWidth, panelHeight));
121
                this.setSize(new Dimension(panelWidth, panelHeight));
122
                FlowLayout flowLayout = new FlowLayout();
123
                flowLayout.setAlignment(FlowLayout.LEFT);
124
                this.setLayout(flowLayout);
125
                this.add(this.getConfigurationPanel());
126
                this.add(this.getOtherTestsPanel());        
127
                this.loadPublicMethods();
128
                this.redirectDebugAndErrorMessages();
129
                testNumber = 1;
130
        }        
131

    
132
        /**
133
         * Loads public methods of the JComboBoxItemsSeekerConfigurable from its file class and adds the constructors to the
134
         *   inner ConfigurationPanel and the other methods to the OtherTestsPanel
135
         */
136
        private void loadPublicMethods() {
137
                String methodHead;
138
                String reservedWord = new String("public ");
139
                int reservedWordLength = reservedWord.length();
140
                
141
                for (int i = 0; i < javaFileMethodsLoader.size(); i++)
142
                {
143
                        methodHead = javaFileMethodsLoader.getMethodHead(i);
144
                        if (methodHead.startsWith(reservedWord))
145
                        {
146
                                if (methodHead.startsWith(reservedWord + javaFileMethodsLoader.getClassName()))
147
                                        getConfigurationPanel().addConstructorItem(methodHead.substring(reservedWordLength, methodHead.length()));
148
                                else
149
                                        getOtherTestsPanel().addMethodItem(methodHead.substring(reservedWordLength, methodHead.length()));
150
                        }
151
                }
152
        }
153
        
154
        /**
155
         * Redirects the default output and error stream to the inner log JTextArea
156
         */
157
        private void redirectDebugAndErrorMessages() {
158
                // Now create a new TextAreaOutputStream to write to our JTextArea control and wrap a
159
                // PrintStream around it to support the println/printf methods.
160
                PrintStream out = new PrintStream( new TextAreaOutputStream( getOtherTestsPanel().getJTextAreaLog() ) );
161

    
162
                // Redirect standard output stream to the TextAreaOutputStream
163
                System.setOut( out );
164

    
165
                // Redirect standard error stream to the TextAreaOutputStream
166
                System.setErr( out );
167
        }
168
        
169
        /**
170
         * This method initializes configurationPanel        
171
         *         
172
         * @return javax.swing.JComboBoxItemsSeekerConfigurableTestingByTheUserConfigurationPanel        
173
         */
174
        private ConfigurationJPanel getConfigurationPanel() {
175
                if (configurationPanel == null) {                        
176
                        configurationPanel = new ConfigurationJPanel();
177
                        configurationPanel.getJButtonNew().addMouseListener(new MouseAdapter() {
178
                                /*
179
                                 * (non-Javadoc)
180
                                 * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
181
                                 */
182
                                public void mouseClicked(MouseEvent arg0) {
183
                                        addNewTestObject();
184
                                }
185
                        });
186
                }
187

    
188
                return configurationPanel;
189
        }
190
        
191
        /**
192
         * This method initializes otherTestsPanel        
193
         *         
194
         * @return javax.swing.JComboBoxItemsSeekerConfigurableTestingByTheUserOtherTestsPanel        
195
         */
196
        private OtherTestsJPanel getOtherTestsPanel() {
197
                if (this.otherTestsPanel == null)
198
                        this.otherTestsPanel = new OtherTestsJPanel(path);
199

    
200
                return this.otherTestsPanel;
201
        }
202
        
203
        /**
204
         * This method creates a JFrame with a new object for testing.
205
         * This method also defines the closing methods and the name of the JFrame, and add the JFrame to the OtherTestPanel; that panel
206
         *    will use it for do methods.
207
         */
208
        private void addNewTestObject() {
209
                JComboBoxItemsSeekerConfigurable object = this.createComponent();
210
                object.setPreferredSize(new Dimension(testWidth, object.getPreferredSize().height));
211
                String keyAndTitle = Messages.getText("test") + " " + String.valueOf(testNumber++);
212
                
213
                JFrame jFrame = new JFrame(keyAndTitle);
214
                jFrame.getContentPane().add(object);
215
                jFrame.pack();
216
                jFrame.setVisible(true);
217
                
218
                // Centers the JFrame in the middle of the screen
219
                jFrame.setLocationRelativeTo(null);
220
                
221
                // Defines the methods that will have to do the JFrame when it would have to be closed
222
                jFrame.addWindowListener(new WindowAdapter(){
223

    
224
                        /*
225
                         * (non-Javadoc)
226
                         * @see java.awt.event.WindowAdapter#windowClosed(java.awt.event.WindowEvent)
227
                         */
228
                        public void windowClosed(WindowEvent e) {
229
                                // It's executen when the application closes the JFrame
230
                                getOtherTestsPanel().removeTestObject(((JFrame)e.getSource()).getTitle());
231
                                getOtherTestsPanel().getJTextAreaLog().append('(' + ((JFrame)e.getSource()).getTitle() + ", " + Messages.getText("elimination") + ")\n");
232
                        }
233
                        
234
                        /*
235
                         * (non-Javadoc)
236
                         * @see java.awt.event.WindowAdapter#windowClosing(java.awt.event.WindowEvent)
237
                         */
238
                        public void windowClosing(WindowEvent e) {
239
                                // It's executen when the user closes the JFrame
240
                                getOtherTestsPanel().removeTestObject(((JFrame)e.getSource()).getTitle());
241
                                getOtherTestsPanel().getJTextAreaLog().append('(' + ((JFrame)e.getSource()).getTitle() + ", " + Messages.getText("elimination") + ")\n");
242
                        }
243
                });
244

    
245
                this.getOtherTestsPanel().addTestObject(keyAndTitle, jFrame);
246
        }
247
        
248

    
249
        /**
250
         * Obteins the configuration value for create the new object and creates it
251
         * 
252
         * @return JComboBoxItemsSeekerConfigurable The new object created
253
         */
254
        private JComboBoxItemsSeekerConfigurable createComponent() {
255
                int startBehavior, searchBehavior;
256
                
257
                // Start Behavior
258
                switch(getConfigurationPanel().getSelectedBehaviorOfJComboBoxStartBehavior())
259
                {
260
                        case 0:
261
                                startBehavior = AbstractDefaultComboBoxItemsSeekerConfigurableModel.MAINTAIN_ORIGINAL_POSITION_START;
262
                                break;
263
                        case 1:
264
                                startBehavior = AbstractDefaultComboBoxItemsSeekerConfigurableModel.ORDERED_START;
265
                                break;
266
                        case 2:
267
                                startBehavior = AbstractDefaultComboBoxItemsSeekerConfigurableModel.DISORDERED_START;
268
                                break;
269
                        default:
270
                                startBehavior = AbstractDefaultComboBoxItemsSeekerConfigurableModel.DEFAULT_START_BEHAVIOR_CONFIGURATION;
271
                }                
272
                
273
                // Search Behavior
274
                switch(getConfigurationPanel().getSelectedBehaviorOfJComboBoxSearchBehavior())
275
                {
276
                        case 0:
277
                                searchBehavior = AbstractDefaultComboBoxItemsSeekerConfigurableModel.MAINTAIN_ORIGINAL_POSITION_ALL_ITEMS_SEARCH;
278
                                break;
279
                        case 1:
280
                                searchBehavior = AbstractDefaultComboBoxItemsSeekerConfigurableModel.ORDERED_ALL_ITEMS_SEARCH;
281
                                break;
282
                        case 2:
283
                                searchBehavior = AbstractDefaultComboBoxItemsSeekerConfigurableModel.DISORDERED_ALL_ITEMS_SEARCH;
284
                                break;
285
                        case 3:
286
                                searchBehavior = AbstractDefaultComboBoxItemsSeekerConfigurableModel.MAINTAIN_ORIGINAL_POSITION_DYNAMIC_SEARCH;
287
                                break;
288
                        case 4:
289
                                searchBehavior = AbstractDefaultComboBoxItemsSeekerConfigurableModel.ORDERED_DYNAMIC_SEARCH;
290
                                break;
291
                        case 5:
292
                                searchBehavior = AbstractDefaultComboBoxItemsSeekerConfigurableModel.DISORDERED_DYNAMIC_SEARCH;
293
                                break;
294
                        default:
295
                                searchBehavior = AbstractDefaultComboBoxItemsSeekerConfigurableModel.DEFAULT_SEARCH_BEHAVIOR_CONFIGURATION;
296
                }
297

    
298
                getOtherTestsPanel().getJTextAreaLog().append('(' + Messages.getText("test") + " " + String.valueOf(testNumber) + ", " +
299
                                Messages.getText("creaction") + ": " + startBehavior + ": " + searchBehavior + ", " + getConfigurationPanel().isSelectedJCheckBoxCaseSensitive() + ", " + 
300
                                getConfigurationPanel().isSelectedJCheckBoxOnlyOneColor() + ", " + getConfigurationPanel().isSelectedJCheckBoxCompleteMatchedItem() + ", " + 
301
                                getConfigurationPanel().isSelectedJCheckBoxUseBeep() + ", " + getConfigurationPanel().isSelectedJCheckBoxAllowedRepeatedItems() + ", " + 
302
                                getConfigurationPanel().isSelectedJCheckBoxAllowedMouseEditionPopupMenu() + ", " + getConfigurationPanel().isSelectedJCheckBoxToForceToOnlyCoincidencesInTheSearch() + ", " + 
303
                                getConfigurationPanel().isSelectedJCheckBoxUseHighLight() + getConfigurationPanel().isSelectedJCheckBoxSelectAnItemWhenLosesFocus() + ")\n");
304
                
305
                return new JComboBoxItemsSeekerConfigurable(startBehavior, searchBehavior, getConfigurationPanel().isSelectedJCheckBoxCaseSensitive(),
306
                getConfigurationPanel().isSelectedJCheckBoxOnlyOneColor(), getConfigurationPanel().isSelectedJCheckBoxCompleteMatchedItem(),
307
                getConfigurationPanel().isSelectedJCheckBoxUseBeep(),        getConfigurationPanel().isSelectedJCheckBoxAllowedRepeatedItems(),
308
                getConfigurationPanel().isSelectedJCheckBoxAllowedMouseEditionPopupMenu(), getConfigurationPanel().isSelectedJCheckBoxToForceToOnlyCoincidencesInTheSearch(),
309
                getConfigurationPanel().isSelectedJCheckBoxUseHighLight(), getConfigurationPanel().isSelectedJCheckBoxSelectAnItemWhenLosesFocus());        
310
        }
311
        
312
        
313
        /**
314
         * A JPanel for the configuration and create a new JComboBoxItemsSeekerConfigurable for testing
315
         *  
316
         * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
317
         */
318
        private class ConfigurationJPanel extends JPanel implements Serializable {
319
                private static final long serialVersionUID = -1346586262697239304L;
320
                private final int configurationPanelWidth = 310;
321
                private final int configurationPanelHeight = 520;
322
                private final int subPanelWidth = 280;
323
                private final int subPanelHeight = 28;
324
                private final int buttonWidth = 90;
325
                private final int buttonHeight = 20;
326
                private final int jComboBoxWidth = 200;
327
                private final int jComboBoxHeight = 20;
328
                private final int jPaneConfigurationParametersWidth = 296;
329
                private final int jPaneConfigurationParametersHeight = 390;
330
                private final int jPaneConstructorsWidth = jPaneConfigurationParametersWidth;
331
                private final int jPaneConstructorsHeight = 55;
332
                private final int jComboBoxConstructorsWidth = jPaneConfigurationParametersWidth - 10;
333
                private final int jComboBoxConstructorsHeight = jComboBoxHeight;
334
                private JCheckBox jCheckBoxCaseSensitive = null;
335
                private JCheckBox jCheckBoxOnlyOneColorOnText = null;
336
                private JCheckBox jCheckBoxCompleteMatchedItem = null;
337
                private JCheckBox jCheckBoxUseBeep = null;
338
                private JCheckBox jCheckBoxAllowedRepeatedItems = null;
339
                private JCheckBox jCheckBoxAllowedMouseEditionPopupMenu = null;
340
                private JCheckBox jCheckBoxToForceToOnlyCoincidencesInTheSearch = null;
341
                private JCheckBox jCheckBoxUseHighLight = null;
342
                private JCheckBox jCheckBoxSelectAnItemWhenLosesFocus = null;
343
                private JLabel jLabelStartBehavior = null;
344
                private JLabel jLabelSearchBehavior = null;
345
                private JLabel jLabelCaseSensitive = null;
346
                private JLabel jLabelOnlyOneColorOnText = null;
347
                private JLabel jLabelCompleteMatchedItem = null;
348
                private JLabel jLabelUseBeep = null;
349
                private JLabel jLabelAllowedRepeatedItems = null;
350
                private JLabel jLabelAllowedMouseEditionPopupMenu = null;
351
                private JLabel jLabelToForceToOnlyCoincidencesInTheSearch = null;
352
                private JLabel jLabelUseHighLight = null;
353
                private JLabel jLabelSelectAnItemWhenLosesFocus = null;
354
                private JButton jButtonReset = null;
355
                private JPanel jPaneConstructor = null;
356
                private JPanel jPaneConfigurationParameters = null;
357
                private JPanel jPaneStartBehavior = null;
358
                private JPanel jPaneSearchBehavior = null;
359
                private JPanel jPaneCaseSensitive = null;
360
                private JPanel jPaneOnlyOneColorOnText = null;
361
                private JPanel jPaneCompleteMatchedItem = null;
362
                private JPanel jPaneUseBeep = null;
363
                private JPanel jPaneCaseAllowedRepeatedItems = null;
364
                private JPanel jPaneAllowedMouseEditionPopupMenu = null;
365
                private JPanel jPaneToForceToOnlyCoincidencesInTheSearch = null;
366
                private JPanel jPaneUseHighLight = null;
367
                private JPanel jPaneSelectAnItemWhenLosesFocus = null;
368
                private JPanel jPaneButtons = null;
369
                private JComboBox jComboBoxConstructors = null;
370
                private JComboBox jComboBoxStartBehavior = null;
371
                private JComboBox jComboBoxSearchBehavior = null;
372
                private JButton jButtonNew = null;
373
                private Object lastSelectedConstructor = null;
374

    
375
                /**
376
                 * Default constructor
377
                 */
378
                public ConfigurationJPanel() {
379
                        super();
380
                        this.initialize();
381
                }
382

    
383
                /**
384
                 * Initializes this pane
385
                 */
386
                private void initialize() {
387
                        this.setPreferredSize(new Dimension(configurationPanelWidth, configurationPanelHeight));
388
                        this.setSize(new Dimension(configurationPanelWidth, configurationPanelHeight));
389
                        this.setBorder(BorderFactory.createTitledBorder(null, Messages.getText("objectsCreation"), TitledBorder.LEFT, TitledBorder.TOP, new Font("Dialog", Font.BOLD, 12), Color.black));
390
                        this.add(getJPaneConstructors(), null);
391
                        this.add(getJPaneConfigurationParameters(), null);
392
                        this.add(getJPaneButtons(), null);
393
                        this.resetConfigurationPanel();
394
                }
395

    
396
                /**
397
                 * This method initializes jCheckBoxCaseSensitive        
398
                 *         
399
                 * @return javax.swing.JCheckBox        
400
                 */
401
                private JCheckBox getJCheckBoxCaseSensitive() {
402
                        if (jCheckBoxCaseSensitive == null) {
403
                                jCheckBoxCaseSensitive = new JCheckBox();
404
                        }
405
                        return jCheckBoxCaseSensitive;
406
                }
407

    
408
                /**
409
                 * This method initializes jCheckBoxOnlyOneColor        
410
                 *         
411
                 * @return javax.swing.JCheckBox        
412
                 */
413
                private JCheckBox getJCheckBoxOnlyOneColorOnText() {
414
                        if (jCheckBoxOnlyOneColorOnText == null) {
415
                                jCheckBoxOnlyOneColorOnText = new JCheckBox();
416
                        }
417
                        return jCheckBoxOnlyOneColorOnText;
418
                }
419

    
420
                /**
421
                 * This method initializes jCheckBoxCompleteMatchedItem        
422
                 *         
423
                 * @return javax.swing.JCheckBox        
424
                 */
425
                private JCheckBox getJCheckBoxCompleteMatchedItem() {
426
                        if (jCheckBoxCompleteMatchedItem == null) {
427
                                jCheckBoxCompleteMatchedItem = new JCheckBox();
428
                        }
429
                        return jCheckBoxCompleteMatchedItem;
430
                }
431

    
432
                /**
433
                 * This method initializes jCheckBoxUseBeep        
434
                 *         
435
                 * @return javax.swing.JCheckBox        
436
                 */
437
                private JCheckBox getJCheckBoxUseBeep() {
438
                        if (jCheckBoxUseBeep == null) {
439
                                jCheckBoxUseBeep = new JCheckBox();
440
                        }
441
                        return jCheckBoxUseBeep;
442
                }
443

    
444
                /**
445
                 * This method initializes jCheckBoxAllowedRepeatedItems        
446
                 *         
447
                 * @return javax.swing.JCheckBox        
448
                 */
449
                private JCheckBox getJCheckBoxAllowedRepeatedItems() {
450
                        if (jCheckBoxAllowedRepeatedItems == null) {
451
                                jCheckBoxAllowedRepeatedItems = new JCheckBox();
452
                        }
453
                        return jCheckBoxAllowedRepeatedItems;
454
                }
455
                
456
                /**
457
                 * This method initializes jCheckBoxAllowedMouseEditionPopupMenu        
458
                 *         
459
                 * @return javax.swing.JCheckBox        
460
                 */
461
                private JCheckBox getJCheckBoxAllowedMouseEditionPopupMenu() {
462
                        if (jCheckBoxAllowedMouseEditionPopupMenu == null) {
463
                                jCheckBoxAllowedMouseEditionPopupMenu = new JCheckBox();
464
                        }
465
                        return jCheckBoxAllowedMouseEditionPopupMenu;
466
                }
467

    
468
                /**
469
                 * This method initializes jCheckBoxToForceToOnlyCoincidencesInTheSearch        
470
                 *         
471
                 * @return javax.swing.JCheckBox        
472
                 */
473
                private JCheckBox getJCheckBoxToForceToOnlyCoincidencesInTheSearch() {
474
                        if (jCheckBoxToForceToOnlyCoincidencesInTheSearch == null) {
475
                                jCheckBoxToForceToOnlyCoincidencesInTheSearch = new JCheckBox();
476
                        }
477
                        return jCheckBoxToForceToOnlyCoincidencesInTheSearch;
478
                }
479
                
480
                /**
481
                 * This method initializes jCheckBoxUseHighLight        
482
                 *         
483
                 * @return javax.swing.JCheckBox        
484
                 */
485
                private JCheckBox getJCheckBoxUseHighLight() {
486
                        if (jCheckBoxUseHighLight == null) {
487
                                jCheckBoxUseHighLight = new JCheckBox();
488
                        }
489
                        return jCheckBoxUseHighLight;
490
                }
491

    
492
                /**
493
                 * This method initializes jCheckBoxSelectAnItemWhenLosesFocus        
494
                 *         
495
                 * @return javax.swing.JCheckBox        
496
                 */
497
                private JCheckBox getJCheckBoxSelectAnItemWhenLosesFocus() {
498
                        if (jCheckBoxSelectAnItemWhenLosesFocus == null) {
499
                                jCheckBoxSelectAnItemWhenLosesFocus = new JCheckBox();
500
                        }
501
                        return jCheckBoxSelectAnItemWhenLosesFocus;
502
                }
503
                
504
                /**
505
                 * @see JCheckBox#setSelected(boolean)
506
                 */
507
                public void setSelectedJCheckBoxCaseSensitive(boolean b) {
508
                        jCheckBoxCaseSensitive.setSelected(b);
509
                }
510

    
511
                /**
512
                 * @see JCheckBox#setSelected(boolean)
513
                 */
514
                public void setSelectedJCheckBoxOnlyOneColor(boolean b) {
515
                        getJCheckBoxOnlyOneColorOnText().setSelected(b);
516
                }
517

    
518
                /**
519
                 * @see JCheckBox#setSelected(boolean)
520
                 */
521
                public void setSelectedJCheckBoxCompleteMatchedItem(boolean b) {
522
                        getJCheckBoxCompleteMatchedItem().setSelected(b);
523
                }
524

    
525
                /**
526
                 * @see JCheckBox#setSelected(boolean)
527
                 */
528
                public void setSelectedJCheckBoxUseBeep(boolean b) {
529
                        getJCheckBoxUseBeep().setSelected(b);
530
                }
531

    
532
                /**
533
                 * @see JCheckBox#setSelected(boolean)
534
                 */
535
                public void setSelectedJCheckBoxAllowedRepeatedItems(boolean b) {
536
                        getJCheckBoxAllowedRepeatedItems().setSelected(b);
537
                }
538
                
539
                /**
540
                 * @see JCheckBox#setSelected(boolean)
541
                 */
542
                public void setSelectedJCheckBoxAllowedMouseEditionPopupMenu(boolean b) {
543
                        getJCheckBoxAllowedMouseEditionPopupMenu().setSelected(b);
544
                }
545

    
546
                /**
547
                 * @see JCheckBox#setSelected(boolean)
548
                 */
549
                public void setSelectedJCheckBoxToForceToOnlyCoincidencesInTheSearch(boolean b) {
550
                        getJCheckBoxToForceToOnlyCoincidencesInTheSearch().setSelected(b);
551
                }
552
                
553
                /**
554
                 * @see JCheckBox#setSelected(boolean)
555
                 */
556
                public void setSelectedJCheckBoxUseHighLight(boolean b) {
557
                        getJCheckBoxUseHighLight().setSelected(b);
558
                }        
559

    
560
                /**
561
                 * @see JCheckBox#setSelected(boolean)
562
                 */
563
                public void setSelectedJCheckBoxSelectAnItemWhenLosesFocus(boolean b) {
564
                        getJCheckBoxSelectAnItemWhenLosesFocus().setSelected(b);
565
                }
566
                
567
                /**
568
                 * @see JCheckBox#isSelected()
569
                 */
570
                public boolean isSelectedJCheckBoxCaseSensitive() {
571
                        return jCheckBoxCaseSensitive.isSelected();
572
                }
573

    
574
                /**
575
                 * @see JCheckBox#isSelected()
576
                 */
577
                public boolean isSelectedJCheckBoxOnlyOneColor() {
578
                        return getJCheckBoxOnlyOneColorOnText().isSelected();
579
                }
580

    
581
                /**
582
                 * @see JCheckBox#isSelected()
583
                 */
584
                public boolean isSelectedJCheckBoxCompleteMatchedItem() {
585
                        return getJCheckBoxCompleteMatchedItem().isSelected();
586
                }
587

    
588
                /**
589
                 * @see JCheckBox#isSelected()
590
                 */
591
                public boolean isSelectedJCheckBoxUseBeep() {
592
                        return getJCheckBoxUseBeep().isSelected();
593
                }
594

    
595
                /**
596
                 * @see JCheckBox#isSelected()
597
                 */
598
                public boolean isSelectedJCheckBoxAllowedRepeatedItems() {
599
                        return getJCheckBoxAllowedRepeatedItems().isSelected();
600
                }
601
                
602
                /**
603
                 * @see JCheckBox#isSelected()
604
                 */
605
                public boolean isSelectedJCheckBoxAllowedMouseEditionPopupMenu() {
606
                        return getJCheckBoxAllowedMouseEditionPopupMenu().isSelected();
607
                }
608

    
609
                /**
610
                 * @see JCheckBox#isSelected()
611
                 */
612
                public boolean isSelectedJCheckBoxToForceToOnlyCoincidencesInTheSearch() {
613
                        return getJCheckBoxToForceToOnlyCoincidencesInTheSearch().isSelected();
614
                }
615
                
616
                /**
617
                 * @see JCheckBox#isSelected(boolean)
618
                 */
619
                public boolean isSelectedJCheckBoxUseHighLight() {
620
                        return getJCheckBoxUseHighLight().isSelected();
621
                }
622

    
623
                /**
624
                 * @see JCheckBox#isSelected(boolean)
625
                 */
626
                public boolean isSelectedJCheckBoxSelectAnItemWhenLosesFocus() {
627
                        return getJCheckBoxSelectAnItemWhenLosesFocus().isSelected();
628
                }
629
                                
630
                /**
631
                 * This method initializes jButtonReset        
632
                 *         
633
                 * @return javax.swing.JButton        
634
                 */
635
                private JButton getJButtonReset() {
636
                        if (jButtonReset == null) {
637
                                jButtonReset = new JButton();
638
                                jButtonReset.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
639
                                jButtonReset.setText(Messages.getText("reset"));
640
                                jButtonReset.addMouseListener(new MouseAdapter() {
641
                                        /*
642
                                         * (non-Javadoc)
643
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
644
                                         */
645
                                        public void mouseClicked(MouseEvent arg0) {
646
                                                resetConfigurationPanel();
647
                                        }
648
                                });
649
                        }
650
                        return jButtonReset;
651
                }
652

    
653
                /**
654
                 * This method initializes jPaneConfigurationParameters        
655
                 *         
656
                 * @return javax.swing.JPanel        
657
                 */
658
                private JPanel getJPaneConfigurationParameters() {
659
                        if (jPaneConfigurationParameters == null) {                                
660
                                jPaneConfigurationParameters = new JPanel();
661
                                jPaneConfigurationParameters.setPreferredSize(new Dimension(jPaneConfigurationParametersWidth, jPaneConfigurationParametersHeight));
662
                                jPaneConfigurationParameters.setBorder(BorderFactory.createTitledBorder(null, Messages.getText("configurationParameters"), TitledBorder.LEFT, TitledBorder.TOP, new Font("Dialog", Font.BOLD, 12), Color.black));
663
                                jPaneConfigurationParameters.add(getJPaneStartBehavior(), null);
664
                                jPaneConfigurationParameters.add(getJPaneSearchBehavior(), null);
665
                                jPaneConfigurationParameters.add(getJPaneCaseSensitive(), null);
666
                                jPaneConfigurationParameters.add(getJPaneOnlyOneColorOnText(), null);
667
                                jPaneConfigurationParameters.add(getJPaneCompleteMatchedItem(), null);
668
                                jPaneConfigurationParameters.add(getJPaneUseBeep(), null);
669
                                jPaneConfigurationParameters.add(getJPaneCaseAllowedRepeatedItems(), null);
670
                                jPaneConfigurationParameters.add(getJPaneAllowedMouseEditionPopupMenu(), null);
671
                                jPaneConfigurationParameters.add(getJPaneToForceToOnlyCoincidencesInTheSearch(), null);
672
                                jPaneConfigurationParameters.add(getJPaneUseHighLight(), null);
673
                                jPaneConfigurationParameters.add(getJPaneSelectAnItemWhenLosesFocus(), null);
674
                        }
675
                        return jPaneConfigurationParameters;
676
                }
677
                
678
                /**
679
                 * This method initializes jPanelStartBehavior        
680
                 *         
681
                 * @return javax.swing.JPanel        
682
                 */
683
                private JPanel getJPaneStartBehavior() {
684
                        if (jPaneStartBehavior == null) {
685
                                
686
                                FlowLayout flowLayout = new FlowLayout();
687
                                flowLayout.setAlignment(FlowLayout.LEFT);
688
                                jPaneStartBehavior = new JPanel();
689
                                jPaneStartBehavior.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
690
                                jPaneStartBehavior.setLayout(flowLayout);
691
                                jPaneStartBehavior.setPreferredSize(new Dimension(subPanelWidth, subPanelHeight));
692
                                jPaneStartBehavior.add(getJComboBoxStartBehavior(), null);
693
                                jPaneStartBehavior.add(getJLabelStartBehavior(), null);
694
                        }
695
                        return jPaneStartBehavior;
696
                }
697

    
698
                /**
699
                 * This method initializes jLabelStartBehavior1        
700
                 *         
701
                 * @return javax.swing.JLabel        
702
                 */
703
                private JLabel getJLabelStartBehavior() {
704
                        if (jLabelStartBehavior == null) {
705
                                jLabelStartBehavior = new JLabel();
706
                                jLabelStartBehavior.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
707
                                jLabelStartBehavior.setHorizontalAlignment(SwingConstants.RIGHT);
708
                                jLabelStartBehavior.setText(Messages.getText("startConfigurationLabel"));
709
                        }
710
                        return jLabelStartBehavior;
711
                }
712

    
713
                /**
714
                 * This method initializes jLabelSearchBehavior1        
715
                 *         
716
                 * @return javax.swing.JLabel        
717
                 */
718
                private JLabel getJLabelSearchBehavior() {
719
                        if (jLabelSearchBehavior == null) {
720
                                jLabelSearchBehavior = new JLabel();
721
                                jLabelSearchBehavior.setText(Messages.getText("searchConfigurationLabel"));
722
                        }
723
                        return jLabelSearchBehavior;
724
                }
725

    
726
                /**
727
                 * This method initializes jLabelCaseSensitive1        
728
                 *         
729
                 * @return javax.swing.JLabel        
730
                 */
731
                private JLabel getJLabelCaseSensitive() {
732
                        if (jLabelCaseSensitive == null) {
733
                                jLabelCaseSensitive = new JLabel();
734
                                jLabelCaseSensitive.setText(Messages.getText("caseSensitiveConfigurationLabel"));
735
                                jLabelCaseSensitive.addMouseListener(new MouseAdapter(){
736
                                        /*
737
                                         * (non-Javadoc)
738
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
739
                                         */
740
                                        public void mouseClicked(MouseEvent arg0) {
741
                                                getJCheckBoxCaseSensitive().setSelected(!getJCheckBoxCaseSensitive().isSelected());
742
                                        }
743
                                });
744
                        }
745
                        return jLabelCaseSensitive;
746
                }
747

    
748
                /**
749
                 * This method initializes jLabelOnlyOneColorOnText
750
                 *         
751
                 * @return javax.swing.JLabel        
752
                 */
753
                private JLabel getJLabelOnlyOneColorOnText() {
754
                        if (jLabelOnlyOneColorOnText == null) {
755
                                jLabelOnlyOneColorOnText = new JLabel();
756
                                jLabelOnlyOneColorOnText.setText(Messages.getText("onlyOneColorOnTextConfigurationLabel"));
757
                                jLabelOnlyOneColorOnText.addMouseListener(new MouseAdapter(){
758
                                        /*
759
                                         * (non-Javadoc)
760
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
761
                                         */
762
                                        public void mouseClicked(MouseEvent arg0) {
763
                                                getJCheckBoxOnlyOneColorOnText().setSelected(!getJCheckBoxOnlyOneColorOnText().isSelected());
764
                                        }
765
                                });
766
                        }
767
                        return jLabelOnlyOneColorOnText;
768
                }
769

    
770
                /**
771
                 * This method initializes jLabelCompleteMatchedItem1        
772
                 *         
773
                 * @return javax.swing.JLabel        
774
                 */
775
                private JLabel getJLabelCompleteMatchedItem() {
776
                        if (jLabelCompleteMatchedItem == null) {
777
                                jLabelCompleteMatchedItem = new JLabel();
778
                                jLabelCompleteMatchedItem.setText(Messages.getText("completeMatchedItemConfigurationLabel"));
779
                                jLabelCompleteMatchedItem.addMouseListener(new MouseAdapter(){
780
                                        /*
781
                                         * (non-Javadoc)
782
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
783
                                         */
784
                                        public void mouseClicked(MouseEvent arg0) {
785
                                                getJCheckBoxCompleteMatchedItem().setSelected(!getJCheckBoxCompleteMatchedItem().isSelected());
786
                                        }
787
                                });
788
                        }
789
                        return jLabelCompleteMatchedItem;
790
                }
791

    
792
                /**
793
                 * This method initializes jLabelUseBeep1        
794
                 *         
795
                 * @return javax.swing.JLabel        
796
                 */
797
                private JLabel getJLabelUseBeep() {
798
                        if (jLabelUseBeep == null) {
799
                                jLabelUseBeep = new JLabel();
800
                                jLabelUseBeep.setText(Messages.getText("beepConfigurationLabel"));
801
                                jLabelUseBeep.addMouseListener(new MouseAdapter(){
802
                                        /*
803
                                         * (non-Javadoc)
804
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
805
                                         */
806
                                        public void mouseClicked(MouseEvent arg0) {
807
                                                getJCheckBoxUseBeep().setSelected(!getJCheckBoxUseBeep().isSelected());
808
                                        }
809
                                });
810
                        }
811
                        return jLabelUseBeep;
812
                }
813

    
814
                /**
815
                 * This method initializes jLabelAllowedRepeatedItems1        
816
                 *         
817
                 * @return javax.swing.JLabel        
818
                 */
819
                private JLabel getJLabelAllowedRepeatedItems() {
820
                        if (jLabelAllowedRepeatedItems == null) {
821
                                jLabelAllowedRepeatedItems = new JLabel();
822
                                jLabelAllowedRepeatedItems.setText(Messages.getText("allowedRepeatedItemsConfigurationLabel"));
823
                                jLabelAllowedRepeatedItems.addMouseListener(new MouseAdapter(){
824
                                        /*
825
                                         * (non-Javadoc)
826
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
827
                                         */
828
                                        public void mouseClicked(MouseEvent arg0) {
829
                                                getJCheckBoxAllowedRepeatedItems().setSelected(!getJCheckBoxAllowedRepeatedItems().isSelected());
830
                                        }
831
                                });
832
                        }
833
                        return jLabelAllowedRepeatedItems;
834
                }
835

    
836
                /**
837
                 * This method initializes jLabelAllowedMouseEditionPopupMenu        
838
                 *         
839
                 * @return javax.swing.JLabel        
840
                 */
841
                private JLabel getJLabelAllowedMouseEditionPopupMenu() {
842
                        if (jLabelAllowedMouseEditionPopupMenu == null) {
843
                                jLabelAllowedMouseEditionPopupMenu = new JLabel();
844
                                jLabelAllowedMouseEditionPopupMenu.setText(Messages.getText("allowedMEditionPMConfigurationLabel"));
845
                                jLabelAllowedMouseEditionPopupMenu.addMouseListener(new MouseAdapter(){
846
                                        /*
847
                                         * (non-Javadoc)
848
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
849
                                         */
850
                                        public void mouseClicked(MouseEvent arg0) {
851
                                                getJCheckBoxAllowedMouseEditionPopupMenu().setSelected(!getJCheckBoxAllowedMouseEditionPopupMenu().isSelected());
852
                                        }
853
                                });
854
                        }
855
                        return jLabelAllowedMouseEditionPopupMenu;
856
                }
857

    
858
                /**
859
                 * This method initializes jLabelToForceToOnlyCoincidencesInTheSearch        
860
                 *         
861
                 * @return javax.swing.JLabel        
862
                 */
863
                private JLabel getJLabelToForceToOnlyCoincidencesInTheSearch() {
864
                        if (jLabelToForceToOnlyCoincidencesInTheSearch == null) {
865
                                jLabelToForceToOnlyCoincidencesInTheSearch = new JLabel();
866
                                jLabelToForceToOnlyCoincidencesInTheSearch.setText(Messages.getText("forceCoincidencesConfigurationLabel"));
867
                                jLabelToForceToOnlyCoincidencesInTheSearch.addMouseListener(new MouseAdapter(){
868
                                        /*
869
                                         * (non-Javadoc)
870
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
871
                                         */
872
                                        public void mouseClicked(MouseEvent arg0) {
873
                                                getJCheckBoxToForceToOnlyCoincidencesInTheSearch().setSelected(!getJCheckBoxToForceToOnlyCoincidencesInTheSearch().isSelected());
874
                                        }
875
                                });
876
                        }
877
                        return jLabelToForceToOnlyCoincidencesInTheSearch;
878
                }
879
                
880
                /**
881
                 * This method initializes jLabelUseHighLight        
882
                 *         
883
                 * @return javax.swing.JLabel        
884
                 */
885
                private JLabel getJLabelUseHighLight() {
886
                        if (jLabelUseHighLight == null) {
887
                                jLabelUseHighLight = new JLabel();
888
                                jLabelUseHighLight.setText(Messages.getText("useHighLightConfigurationLabel"));
889
                                jLabelUseHighLight.addMouseListener(new MouseAdapter(){
890
                                        /*
891
                                         * (non-Javadoc)
892
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
893
                                         */
894
                                        public void mouseClicked(MouseEvent arg0) {
895
                                                getJCheckBoxUseHighLight().setSelected(!getJCheckBoxUseHighLight().isSelected());
896
                                        }
897
                                });
898
                        }
899
                        return jLabelUseHighLight;
900
                }
901
                
902
                /**
903
                 * This method initializes jLabelSelectAnItemWhenLosesFocus        
904
                 *         
905
                 * @return javax.swing.JLabel        
906
                 */
907
                private JLabel getJLabelSelectAnItemWhenLosesFocus() {
908
                        if (jLabelSelectAnItemWhenLosesFocus == null) {
909
                                jLabelSelectAnItemWhenLosesFocus = new JLabel();
910
                                jLabelSelectAnItemWhenLosesFocus.setText(Messages.getText("selectAnItemWhenLosesFocusConfigurationLabel"));
911
                                jLabelSelectAnItemWhenLosesFocus.addMouseListener(new MouseAdapter(){
912
                                        /*
913
                                         * (non-Javadoc)
914
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
915
                                         */
916
                                        public void mouseClicked(MouseEvent arg0) {
917
                                                getJCheckBoxSelectAnItemWhenLosesFocus().setSelected(!getJCheckBoxSelectAnItemWhenLosesFocus().isSelected());
918
                                        }
919
                                });
920
                        }
921
                        return jLabelSelectAnItemWhenLosesFocus;
922
                }
923
        
924
                /**
925
                 * This method initializes jPaneConstructor        
926
                 *         
927
                 * @return javax.swing.JPanel        
928
                 */
929
                private JPanel getJPaneConstructors() {
930
                        if (jPaneConstructor == null) {
931
                                jPaneConstructor = new JPanel();
932
                                jPaneConstructor.setPreferredSize(new Dimension(jPaneConstructorsWidth, jPaneConstructorsHeight));
933
                                jPaneConstructor.setBorder(BorderFactory.createTitledBorder(null, Messages.getText("constructors"), TitledBorder.LEFT, TitledBorder.TOP, new Font("Dialog", Font.BOLD, 12), Color.black));
934
                                jPaneConstructor.add(getJComboBoxConstructors(), null);
935
                        }
936
                        return jPaneConstructor;
937
                }
938
                
939
                /**
940
                 * This method initializes jPanelSearchBehavior        
941
                 *         
942
                 * @return javax.swing.JPanel        
943
                 */
944
                private JPanel getJPaneSearchBehavior() {
945
                        if (jPaneSearchBehavior == null) {
946
                                FlowLayout flowLayout = new FlowLayout();
947
                                flowLayout.setAlignment(FlowLayout.LEFT);
948
                                jPaneSearchBehavior = new JPanel();
949
                                jPaneSearchBehavior.setPreferredSize(new Dimension(subPanelWidth, subPanelHeight));
950
                                jPaneSearchBehavior.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
951
                                jPaneSearchBehavior.setLayout(flowLayout);
952
                                jPaneSearchBehavior.add(getJComboBoxSearchBehavior(), null);
953
                                jPaneSearchBehavior.add(getJLabelSearchBehavior(), null);
954
                        }
955
                        return jPaneSearchBehavior;
956
                }
957

    
958
                /**
959
                 * This method initializes jPaneCaseSensitive        
960
                 *         
961
                 * @return javax.swing.JPanel        
962
                 */
963
                private JPanel getJPaneCaseSensitive() {
964
                        if (jPaneCaseSensitive == null) {
965
                                FlowLayout flowLayout = new FlowLayout();
966
                                flowLayout.setAlignment(FlowLayout.LEFT);
967
                                jPaneCaseSensitive = new JPanel();
968
                                jPaneCaseSensitive.setPreferredSize(new Dimension(subPanelWidth, subPanelHeight));
969
                                jPaneCaseSensitive.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
970
                                jPaneCaseSensitive.setLayout(flowLayout);
971
                                jPaneCaseSensitive.add(getJCheckBoxCaseSensitive(), null);
972
                                jPaneCaseSensitive.add(getJLabelCaseSensitive(), null);
973
                        }
974
                        return jPaneCaseSensitive;
975
                }
976

    
977
                /**
978
                 * This method initializes jPaneOnlyOneColor        
979
                 *         
980
                 * @return javax.swing.JPanel        
981
                 */
982
                private JPanel getJPaneOnlyOneColorOnText() {
983
                        if (jPaneOnlyOneColorOnText == null) {                                
984
                                FlowLayout flowLayout = new FlowLayout();
985
                                flowLayout.setAlignment(FlowLayout.LEFT);
986
                                jPaneOnlyOneColorOnText = new JPanel();
987
                                jPaneOnlyOneColorOnText.setPreferredSize(new Dimension(subPanelWidth, subPanelHeight));
988
                                jPaneOnlyOneColorOnText.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
989
                                jPaneOnlyOneColorOnText.setLayout(flowLayout);
990
                                jPaneOnlyOneColorOnText.add(getJCheckBoxOnlyOneColorOnText(), null);
991
                                jPaneOnlyOneColorOnText.add(getJLabelOnlyOneColorOnText(), null);
992
                        }
993
                        return jPaneOnlyOneColorOnText;
994
                }
995

    
996
                /**
997
                 * This method initializes jPaneCompleteMatchedItem        
998
                 *         
999
                 * @return javax.swing.JPanel        
1000
                 */
1001
                private JPanel getJPaneCompleteMatchedItem() {
1002
                        if (jPaneCompleteMatchedItem == null) {
1003
                                FlowLayout flowLayout = new FlowLayout();
1004
                                flowLayout.setAlignment(FlowLayout.LEFT);
1005
                                jPaneCompleteMatchedItem = new JPanel();
1006
                                jPaneCompleteMatchedItem.setPreferredSize(new Dimension(subPanelWidth, subPanelHeight));
1007
                                jPaneCompleteMatchedItem.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
1008
                                jPaneCompleteMatchedItem.setLayout(flowLayout);
1009
                                jPaneCompleteMatchedItem.add(getJCheckBoxCompleteMatchedItem(), null);
1010
                                jPaneCompleteMatchedItem.add(getJLabelCompleteMatchedItem(), null);
1011
                        }
1012
                        return jPaneCompleteMatchedItem;
1013
                }
1014

    
1015
                /**
1016
                 * This method initializes jPaneUseBeep        
1017
                 *         
1018
                 * @return javax.swing.JPanel        
1019
                 */
1020
                private JPanel getJPaneUseBeep() {
1021
                        if (jPaneUseBeep == null) {
1022
                                FlowLayout flowLayout = new FlowLayout();
1023
                                flowLayout.setAlignment(FlowLayout.LEFT);
1024
                                jPaneUseBeep = new JPanel();
1025
                                jPaneUseBeep.setPreferredSize(new Dimension(subPanelWidth, subPanelHeight));
1026
                                jPaneUseBeep.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
1027
                                jPaneUseBeep.setLayout(flowLayout);
1028
                                jPaneUseBeep.add(getJCheckBoxUseBeep(), null);
1029
                                jPaneUseBeep.add(getJLabelUseBeep(), null);
1030
                        }
1031
                        return jPaneUseBeep;
1032
                }
1033

    
1034
                /**
1035
                 * This method initializes jPaneCaseAllowRepeatedItems        
1036
                 *         
1037
                 * @return javax.swing.JPanel        
1038
                 */
1039
                private JPanel getJPaneCaseAllowedRepeatedItems() {
1040
                        if (jPaneCaseAllowedRepeatedItems == null) {
1041
                                FlowLayout flowLayout = new FlowLayout();
1042
                                flowLayout.setAlignment(FlowLayout.LEFT);
1043
                                jPaneCaseAllowedRepeatedItems = new JPanel();
1044
                                jPaneCaseAllowedRepeatedItems.setPreferredSize(new Dimension(subPanelWidth, subPanelHeight));
1045
                                jPaneCaseAllowedRepeatedItems.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
1046
                                jPaneCaseAllowedRepeatedItems.setLayout(flowLayout);
1047
                                jPaneCaseAllowedRepeatedItems.add(getJCheckBoxAllowedRepeatedItems(), null);
1048
                                jPaneCaseAllowedRepeatedItems.add(getJLabelAllowedRepeatedItems(), null);
1049
                        }
1050
                        return jPaneCaseAllowedRepeatedItems;
1051
                }
1052
                
1053
                /**
1054
                 * This method initializes jPaneAllowedMouseEditionPopupMenu        
1055
                 *         
1056
                 * @return javax.swing.JPanel        
1057
                 */
1058
                private JPanel getJPaneAllowedMouseEditionPopupMenu() {
1059
                        if (jPaneAllowedMouseEditionPopupMenu == null) {                        
1060
                                FlowLayout flowLayout = new FlowLayout();
1061
                                flowLayout.setAlignment(FlowLayout.LEFT);
1062
                                jPaneAllowedMouseEditionPopupMenu = new JPanel();
1063
                                jPaneAllowedMouseEditionPopupMenu.setPreferredSize(new Dimension(subPanelWidth, subPanelHeight));
1064
                                jPaneAllowedMouseEditionPopupMenu.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
1065
                                jPaneAllowedMouseEditionPopupMenu.setLayout(flowLayout);
1066
                                jPaneAllowedMouseEditionPopupMenu.add(getJCheckBoxAllowedMouseEditionPopupMenu(), null);
1067
                                jPaneAllowedMouseEditionPopupMenu.add(getJLabelAllowedMouseEditionPopupMenu(), null);
1068
                        }
1069
                        return jPaneAllowedMouseEditionPopupMenu;
1070
                }
1071

    
1072
                /**
1073
                 * This method initializes jPaneToForceToOnlyCoincidencesInTheSearch        
1074
                 *         
1075
                 * @return javax.swing.JPanel        
1076
                 */
1077
                private JPanel getJPaneToForceToOnlyCoincidencesInTheSearch() {
1078
                        if (jPaneToForceToOnlyCoincidencesInTheSearch == null) {
1079
                                FlowLayout flowLayout = new FlowLayout();
1080
                                flowLayout.setAlignment(FlowLayout.LEFT);
1081
                                jPaneToForceToOnlyCoincidencesInTheSearch = new JPanel();
1082
                                jPaneToForceToOnlyCoincidencesInTheSearch.setPreferredSize(new Dimension(subPanelWidth, subPanelHeight));
1083
                                jPaneToForceToOnlyCoincidencesInTheSearch.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
1084
                                jPaneToForceToOnlyCoincidencesInTheSearch.setLayout(flowLayout);
1085
                                jPaneToForceToOnlyCoincidencesInTheSearch.add(getJCheckBoxToForceToOnlyCoincidencesInTheSearch(), null);
1086
                                jPaneToForceToOnlyCoincidencesInTheSearch.add(getJLabelToForceToOnlyCoincidencesInTheSearch(), null);
1087
                        }
1088
                        return jPaneToForceToOnlyCoincidencesInTheSearch;
1089
                }
1090

    
1091
                /**
1092
                 * This method initializes jPaneUseHighLight        
1093
                 *         
1094
                 * @return javax.swing.JPanel        
1095
                 */
1096
                private JPanel getJPaneUseHighLight() {
1097
                        if (jPaneUseHighLight == null) {
1098
                                FlowLayout flowLayout = new FlowLayout();
1099
                                flowLayout.setAlignment(FlowLayout.LEFT);
1100
                                jPaneUseHighLight = new JPanel();
1101
                                jPaneUseHighLight.setPreferredSize(new Dimension(subPanelWidth, subPanelHeight));
1102
                                jPaneUseHighLight.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
1103
                                jPaneUseHighLight.setLayout(flowLayout);
1104
                                jPaneUseHighLight.add(getJCheckBoxUseHighLight(), null);
1105
                                jPaneUseHighLight.add(getJLabelUseHighLight(), null);
1106
                        }
1107
                        return jPaneUseHighLight;
1108
                }
1109

    
1110
                /**
1111
                 * This method initializes jPaneSelectAnItemWhenLosesFocus        
1112
                 *         
1113
                 * @return javax.swing.JPanel        
1114
                 */
1115
                private JPanel getJPaneSelectAnItemWhenLosesFocus() {
1116
                        if (jPaneSelectAnItemWhenLosesFocus == null) {
1117
                                FlowLayout flowLayout = new FlowLayout();
1118
                                flowLayout.setAlignment(FlowLayout.LEFT);
1119
                                jPaneSelectAnItemWhenLosesFocus = new JPanel();
1120
                                jPaneSelectAnItemWhenLosesFocus.setPreferredSize(new Dimension(subPanelWidth, subPanelHeight));
1121
                                jPaneSelectAnItemWhenLosesFocus.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
1122
                                jPaneSelectAnItemWhenLosesFocus.setLayout(flowLayout);
1123
                                jPaneSelectAnItemWhenLosesFocus.add(getJCheckBoxSelectAnItemWhenLosesFocus(), null);
1124
                                jPaneSelectAnItemWhenLosesFocus.add(getJLabelSelectAnItemWhenLosesFocus(), null);
1125
                        }
1126
                        return jPaneSelectAnItemWhenLosesFocus;
1127
                }
1128
                
1129
                /**
1130
                 * This method initializes jPaneButtons        
1131
                 *         
1132
                 * @return javax.swing.JPanel        
1133
                 */
1134
                private JPanel getJPaneButtons() {
1135
                        if (jPaneButtons == null) {
1136
                                FlowLayout flowLayout = new FlowLayout();
1137
                                flowLayout.setAlignment(FlowLayout.RIGHT);
1138
                                jPaneButtons = new JPanel();
1139
                                jPaneButtons.setPreferredSize(new Dimension(subPanelWidth, subPanelHeight));
1140
                                jPaneButtons.setLayout(flowLayout);
1141
                                jPaneButtons.add(getJButtonReset(), null);
1142
                                jPaneButtons.add(getJButtonNew(), null);
1143
                        }
1144
                        return jPaneButtons;
1145
                }                
1146
                
1147
                /**
1148
                 * This method initializes jComboBoxConstructors        
1149
                 *         
1150
                 * @return javax.swing.JComboBox        
1151
                 */
1152
                private JComboBox getJComboBoxConstructors() {
1153
                        if (jComboBoxConstructors == null) {
1154
                                jComboBoxConstructors = new JComboBox();
1155
                                jComboBoxConstructors.setEditable(false);
1156
                                jComboBoxConstructors.setPreferredSize(new Dimension(jComboBoxConstructorsWidth, jComboBoxConstructorsHeight));
1157
                                jComboBoxConstructors.addPopupMenuListener(new PopupMenuListener() {
1158
                                        /*
1159
                                         * (non-Javadoc)
1160
                                         * @see javax.swing.event.PopupMenuListener#popupMenuCanceled(javax.swing.event.PopupMenuEvent)
1161
                                         */
1162
                                        public void popupMenuCanceled(PopupMenuEvent e) {
1163
                                        }
1164

    
1165
                                        /*
1166
                                         * (non-Javadoc)
1167
                                         * @see javax.swing.event.PopupMenuListener#popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent)
1168
                                         */
1169
                                        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
1170
                                                // If the user has selected another constructor -> enable/disable configuration options
1171
                                                Object item = jComboBoxConstructors.getSelectedItem();
1172
                                                if (item != null)
1173
                                                {
1174
                                                        if ((lastSelectedConstructor == null) || (!lastSelectedConstructor.equals(item)))
1175
                                                                configureConfigurationParametersPane(item);                                                        
1176
                                                }
1177
                                        }
1178

    
1179
                                        /*
1180
                                         * (non-Javadoc)
1181
                                         * @see javax.swing.event.PopupMenuListener#popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent)
1182
                                         */
1183
                                        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
1184
                                                lastSelectedConstructor = jComboBoxConstructors.getSelectedItem();
1185
                                        }                                
1186
                                });
1187
                        }
1188
                        return jComboBoxConstructors;
1189
                }
1190
                
1191
                /**
1192
                 * Enables or disables the configuration JCheckBoxes an JComboBoxes of this JPanel according to the selected constructor
1193
                 * 
1194
                 * @param item The selected constructor (as a item of the jComboBoxConstructors)
1195
                 */
1196
                private void configureConfigurationParametersPane(Object item) {
1197
                        int numberOfParameters = javaFileMethodsLoader.getMethodParametersType(item.toString()).size();
1198
                        
1199
                        // If its selected the constructor without parameters
1200
                        if (numberOfParameters == 0)
1201
                        {
1202
                                getJComboBoxStartBehavior().setEnabled(false);
1203
                                getJLabelStartBehavior().setEnabled(false);
1204
                                getJComboBoxSearchBehavior().setEnabled(false);
1205
                                getJLabelSearchBehavior().setEnabled(false);
1206
                                getJCheckBoxCaseSensitive().setEnabled(false);
1207
                                getJLabelCaseSensitive().setEnabled(false);
1208
                                getJCheckBoxOnlyOneColorOnText().setEnabled(false);
1209
                                getJLabelOnlyOneColorOnText().setEnabled(false);
1210
                                getJCheckBoxCompleteMatchedItem().setEnabled(false);
1211
                                getJLabelCompleteMatchedItem().setEnabled(false);
1212
                                getJCheckBoxUseBeep().setEnabled(false);
1213
                                getJLabelUseBeep().setEnabled(false);
1214
                                getJCheckBoxAllowedRepeatedItems().setEnabled(false);
1215
                                getJLabelAllowedRepeatedItems().setEnabled(false);
1216
                                getJCheckBoxAllowedMouseEditionPopupMenu().setEnabled(false);
1217
                                getJLabelAllowedMouseEditionPopupMenu().setEnabled(false);
1218
                                getJCheckBoxToForceToOnlyCoincidencesInTheSearch().setEnabled(false);
1219
                                getJLabelToForceToOnlyCoincidencesInTheSearch().setEnabled(false);
1220
                                getJCheckBoxUseHighLight().setEnabled(false);
1221
                                getJLabelUseHighLight().setEnabled(false);
1222
                                getJCheckBoxSelectAnItemWhenLosesFocus().setEnabled(false);
1223
                                getJLabelSelectAnItemWhenLosesFocus().setEnabled(false);
1224
                        }
1225
                        else
1226
                        {
1227
                                // If its selected the constructor parameters for all configuration attributes
1228
                                if (numberOfParameters == 11)
1229
                                {
1230
                                        getJComboBoxStartBehavior().setEnabled(true);
1231
                                        getJLabelStartBehavior().setEnabled(true);
1232
                                        getJComboBoxSearchBehavior().setEnabled(true);
1233
                                        getJLabelSearchBehavior().setEnabled(true);
1234
                                        getJCheckBoxCaseSensitive().setEnabled(true);
1235
                                        getJLabelCaseSensitive().setEnabled(true);
1236
                                        getJCheckBoxOnlyOneColorOnText().setEnabled(true);
1237
                                        getJLabelOnlyOneColorOnText().setEnabled(true);
1238
                                        getJCheckBoxCompleteMatchedItem().setEnabled(true);
1239
                                        getJLabelCompleteMatchedItem().setEnabled(true);
1240
                                        getJCheckBoxUseBeep().setEnabled(true);
1241
                                        getJLabelUseBeep().setEnabled(true);
1242
                                        getJCheckBoxAllowedRepeatedItems().setEnabled(true);
1243
                                        getJLabelAllowedRepeatedItems().setEnabled(true);
1244
                                        getJCheckBoxAllowedMouseEditionPopupMenu().setEnabled(true);
1245
                                        getJLabelAllowedMouseEditionPopupMenu().setEnabled(true);
1246
                                        getJCheckBoxToForceToOnlyCoincidencesInTheSearch().setEnabled(true);
1247
                                        getJLabelToForceToOnlyCoincidencesInTheSearch().setEnabled(true);
1248
                                        getJCheckBoxUseHighLight().setEnabled(true);
1249
                                        getJLabelUseHighLight().setEnabled(true);
1250
                                        getJCheckBoxSelectAnItemWhenLosesFocus().setEnabled(true);
1251
                                        getJLabelSelectAnItemWhenLosesFocus().setEnabled(true);
1252
                                }
1253
                                else
1254
                                {
1255
                                        // It's supposed that are only 3 parameters
1256
                                        // (If its selected the constructor parameters for all configuration attributes)
1257
                                        getJComboBoxStartBehavior().setEnabled(true);
1258
                                        getJLabelStartBehavior().setEnabled(true);
1259
                                        getJComboBoxSearchBehavior().setEnabled(true);
1260
                                        getJLabelSearchBehavior().setEnabled(true);
1261
                                        getJCheckBoxCaseSensitive().setEnabled(true);
1262
                                        getJLabelCaseSensitive().setEnabled(true);
1263
                                        getJCheckBoxOnlyOneColorOnText().setEnabled(false);
1264
                                        getJLabelOnlyOneColorOnText().setEnabled(false);
1265
                                        getJCheckBoxCompleteMatchedItem().setEnabled(false);
1266
                                        getJLabelCompleteMatchedItem().setEnabled(false);
1267
                                        getJCheckBoxUseBeep().setEnabled(false);
1268
                                        getJLabelUseBeep().setEnabled(false);
1269
                                        getJCheckBoxAllowedRepeatedItems().setEnabled(false);
1270
                                        getJLabelAllowedRepeatedItems().setEnabled(false);
1271
                                        getJCheckBoxAllowedMouseEditionPopupMenu().setEnabled(false);
1272
                                        getJLabelAllowedMouseEditionPopupMenu().setEnabled(false);
1273
                                        getJCheckBoxToForceToOnlyCoincidencesInTheSearch().setEnabled(false);
1274
                                        getJLabelToForceToOnlyCoincidencesInTheSearch().setEnabled(false);
1275
                                        getJCheckBoxUseHighLight().setEnabled(false);
1276
                                        getJLabelUseHighLight().setEnabled(false);
1277
                                        getJCheckBoxSelectAnItemWhenLosesFocus().setEnabled(false);
1278
                                        getJLabelSelectAnItemWhenLosesFocus().setEnabled(false);
1279
                                }
1280
                        }
1281
                }
1282

    
1283
                /**
1284
                 * This method initializes jComboBoxStartBehavior        
1285
                 *         
1286
                 * @return javax.swing.JComboBox        
1287
                 */
1288
                private JComboBox getJComboBoxStartBehavior() {
1289
                        if (jComboBoxStartBehavior == null) {
1290
                                jComboBoxStartBehavior = new JComboBox();
1291
                                jComboBoxStartBehavior.setEditable(false);
1292
                                jComboBoxStartBehavior.setPreferredSize(new Dimension(jComboBoxWidth, jComboBoxHeight));
1293
                                jComboBoxStartBehavior.addItem(new Item(Messages.getText("maintain_order")));
1294
                                jComboBoxStartBehavior.addItem(new Item(Messages.getText("ordered")));
1295
                                jComboBoxStartBehavior.addItem(new Item(Messages.getText("disordered")));
1296
                        }
1297
                        return jComboBoxStartBehavior;
1298
                }
1299

    
1300
                /**
1301
                 * This method initializes jComboBoxSearchBehavior        
1302
                 *         
1303
                 * @return javax.swing.JComboBox        
1304
                 */
1305
                private JComboBox getJComboBoxSearchBehavior() {
1306
                        if (jComboBoxSearchBehavior == null) {
1307
                                jComboBoxSearchBehavior = new JComboBox();
1308
                                jComboBoxSearchBehavior.setEditable(false);
1309
                                jComboBoxSearchBehavior.setPreferredSize(new Dimension(jComboBoxWidth, jComboBoxHeight));
1310
                                jComboBoxSearchBehavior.addItem(new Item(Messages.getText("all_and_maintain_order")));
1311
                                jComboBoxSearchBehavior.addItem(new Item(Messages.getText("all_and_ordered")));
1312
                                jComboBoxSearchBehavior.addItem(new Item(Messages.getText("all_and_disordered")));
1313
                                jComboBoxSearchBehavior.addItem(new Item(Messages.getText("dynamic_and_maintain_order")));
1314
                                jComboBoxSearchBehavior.addItem(new Item(Messages.getText("dynamic_and_ordered")));
1315
                                jComboBoxSearchBehavior.addItem(new Item(Messages.getText("dynamic_and_disordered")));
1316
                        }
1317
                        return jComboBoxSearchBehavior;
1318
                }
1319
                
1320
                /**
1321
                 *  Adds a constructor item to jComboBoxConstructors, and if it`s needed configures the configuration options of this JPanel
1322
                 *  
1323
                 * @param name Constructor name
1324
                 */
1325
                public void addConstructorItem(String name) {
1326
                        this.jComboBoxConstructors.addItem(name);
1327
                
1328
                        // Displays description of the first item added by default
1329
                        if (this.lastSelectedConstructor == null)
1330
                        {
1331
                                this.lastSelectedConstructor = getJComboBoxConstructors().getSelectedItem();
1332
                                this.configureConfigurationParametersPane(this.lastSelectedConstructor);
1333
                        }
1334
                }
1335
                
1336
                /**
1337
                 * @see JComboBox#getSelectedIndex()
1338
                 */
1339
                public int getSelectedBehaviorOfJComboBoxStartBehavior() {
1340
                        return jComboBoxStartBehavior.getSelectedIndex();
1341
                }
1342
                
1343
                /**
1344
                 * @see JComboBox#setSelectedIndex(int)
1345
                 */
1346
                public void setSelectedBehaviorForJComboBoxStartBehavior(int anIndex) {
1347
                        jComboBoxStartBehavior.setSelectedIndex(anIndex);
1348
                }
1349
                
1350
                /**
1351
                 * @see JComboBox#getSelectedIndex()
1352
                 */
1353
                public int getSelectedBehaviorOfJComboBoxSearchBehavior() {
1354
                        return jComboBoxSearchBehavior.getSelectedIndex();
1355
                }
1356
                
1357
                /**
1358
                 * @see JComboBox#setSelectedIndex(int)
1359
                 */
1360
                public void setSelectedBehaviorForJComboBoxSearchBehavior(int anIndex) {
1361
                        jComboBoxSearchBehavior.setSelectedIndex(anIndex);
1362
                }
1363

    
1364
                /**
1365
                 * This method initializes jButtonNew        
1366
                 *         
1367
                 * @return javax.swing.JButton        
1368
                 */
1369
                private JButton getJButtonNew() {
1370
                        if (jButtonNew == null) {
1371
                                jButtonNew = new JButton();
1372
                                jButtonNew.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
1373
                                jButtonNew.setText(Messages.getText("new"));
1374
                        }
1375
                        return jButtonNew;
1376
                }
1377
                
1378
                /**
1379
                 * Reset the configuration options of this pane to their default value
1380
                 */
1381
                private void resetConfigurationPanel(){
1382
                        
1383
                        // JComboBoxConstructors (The constructor selected)
1384
                        if (getJComboBoxConstructors().getItemCount() > 0)
1385
                        {
1386
                                getJComboBoxConstructors().setSelectedIndex(0);
1387
                                this.configureConfigurationParametersPane(this.lastSelectedConstructor);
1388
                        }
1389
                        else
1390
                                getJComboBoxConstructors().setSelectedIndex(-1);
1391
                        
1392
                        // Disable all options
1393
                        getJComboBoxStartBehavior().setEnabled(false);
1394
                        getJLabelStartBehavior().setEnabled(false);
1395
                        getJComboBoxSearchBehavior().setEnabled(false);
1396
                        getJLabelSearchBehavior().setEnabled(false);
1397
                        getJCheckBoxCaseSensitive().setEnabled(false);
1398
                        getJLabelCaseSensitive().setEnabled(false);
1399
                        getJCheckBoxOnlyOneColorOnText().setEnabled(false);
1400
                        getJLabelOnlyOneColorOnText().setEnabled(false);
1401
                        getJCheckBoxCompleteMatchedItem().setEnabled(false);
1402
                        getJLabelCompleteMatchedItem().setEnabled(false);
1403
                        getJCheckBoxUseBeep().setEnabled(false);
1404
                        getJLabelUseBeep().setEnabled(false);
1405
                        getJCheckBoxAllowedRepeatedItems().setEnabled(false);
1406
                        getJLabelAllowedRepeatedItems().setEnabled(false);
1407
                        getJCheckBoxAllowedMouseEditionPopupMenu().setEnabled(false);
1408
                        getJLabelAllowedMouseEditionPopupMenu().setEnabled(false);
1409
                        getJCheckBoxToForceToOnlyCoincidencesInTheSearch().setEnabled(false);
1410
                        getJLabelToForceToOnlyCoincidencesInTheSearch().setEnabled(false);
1411
                        getJCheckBoxUseHighLight().setEnabled(false);
1412
                        getJLabelUseHighLight().setEnabled(false);
1413
                        getJCheckBoxSelectAnItemWhenLosesFocus().setEnabled(false);
1414
                        getJLabelSelectAnItemWhenLosesFocus().setEnabled(false);
1415
                        
1416
                        // Start Behavior
1417
                        switch(AbstractDefaultComboBoxItemsSeekerConfigurableModel.DEFAULT_START_BEHAVIOR_CONFIGURATION)
1418
                        {
1419
                                case AbstractDefaultComboBoxItemsSeekerConfigurableModel.MAINTAIN_ORIGINAL_POSITION_START:
1420
                                        getJComboBoxStartBehavior().setSelectedIndex(0);
1421
                                        break;
1422
                                case AbstractDefaultComboBoxItemsSeekerConfigurableModel.ORDERED_START:
1423
                                        getJComboBoxStartBehavior().setSelectedIndex(1);
1424
                                        break;
1425
                                case AbstractDefaultComboBoxItemsSeekerConfigurableModel.DISORDERED_START:
1426
                                        getJComboBoxStartBehavior().setSelectedIndex(2);
1427
                                        break;
1428
                        }
1429
                        
1430
                        // Search Behavior
1431
                        switch(AbstractDefaultComboBoxItemsSeekerConfigurableModel.DEFAULT_SEARCH_BEHAVIOR_CONFIGURATION)
1432
                        {
1433
                                case AbstractDefaultComboBoxItemsSeekerConfigurableModel.MAINTAIN_ORIGINAL_POSITION_ALL_ITEMS_SEARCH:
1434
                                        getJComboBoxSearchBehavior().setSelectedIndex(0);
1435
                                        break;
1436
                                case AbstractDefaultComboBoxItemsSeekerConfigurableModel.ORDERED_ALL_ITEMS_SEARCH:
1437
                                        getJComboBoxSearchBehavior().setSelectedIndex(1);
1438
                                        break;
1439
                                case AbstractDefaultComboBoxItemsSeekerConfigurableModel.DISORDERED_ALL_ITEMS_SEARCH:
1440
                                        getJComboBoxSearchBehavior().setSelectedIndex(2);
1441
                                        break;
1442
                                case AbstractDefaultComboBoxItemsSeekerConfigurableModel.MAINTAIN_ORIGINAL_POSITION_DYNAMIC_SEARCH:
1443
                                        getJComboBoxSearchBehavior().setSelectedIndex(3);
1444
                                        break;
1445
                                case AbstractDefaultComboBoxItemsSeekerConfigurableModel.ORDERED_DYNAMIC_SEARCH:
1446
                                        getJComboBoxSearchBehavior().setSelectedIndex(4);
1447
                                        break;
1448
                                case AbstractDefaultComboBoxItemsSeekerConfigurableModel.DISORDERED_DYNAMIC_SEARCH:
1449
                                        getJComboBoxSearchBehavior().setSelectedIndex(5);
1450
                                        break;
1451
                        }
1452

    
1453
                        // Case Sensitive
1454
                        getJCheckBoxCaseSensitive().setSelected(AbstractDefaultComboBoxItemsSeekerConfigurableModel.DEFAULT_CASE_SENSITIVE_CONFIGURATION);
1455
                        
1456
                        // Only One Color
1457
                        getJCheckBoxOnlyOneColorOnText().setSelected(JComboBoxItemsSeekerConfigurable.DEFAULT_ONLY_ONE_COLOR_ON_TEXT_CONFIGURATION);
1458
                        
1459
                        // Complete Matched Item
1460
                        getJCheckBoxCompleteMatchedItem().setSelected(JComboBoxItemsSeekerConfigurable.DEFAULT_COMPLETE_MATCHED_ITEM_CONFIGURATION);
1461
                        
1462
                        // Beep Enabled
1463
                        getJCheckBoxUseBeep().setSelected(JComboBoxItemsSeekerConfigurable.DEFAULT_BEEP_ENABLED_CONFIGURATION);
1464
                        
1465
                        // Allowed Repeated items
1466
                        getJCheckBoxAllowedRepeatedItems().setSelected(JComboBoxItemsSeekerConfigurable.DEFAULT_ALLOWED_REPEATED_ITEMS_CONFIGURATION);
1467
                        
1468
                        // Allowed Mouse Edition Popup Menu
1469
                        getJCheckBoxAllowedMouseEditionPopupMenu().setSelected(JComboBoxItemsSeekerConfigurable.DEFAULT_ALLOWED_MOUSE_EDITION_POPUP_MENU_CONFIGURATION);
1470

    
1471
                        // To force to only coincidences in the search
1472
                        getJCheckBoxToForceToOnlyCoincidencesInTheSearch().setSelected(JComboBoxItemsSeekerConfigurable.DEFAULT_TO_FORCE_TO_ONLY_COINCIDENCES_IN_THE_SEARCH_CONFIGURATION);
1473

    
1474
                        // Use HighLight
1475
                        getJCheckBoxUseHighLight().setSelected(JComboBoxItemsSeekerConfigurable.DEFAULT_USE_HIGHLIGHT_CONFIGURATION);
1476
                        
1477
                        // Select an item when loses focus
1478
                        getJCheckBoxSelectAnItemWhenLosesFocus().setSelected(JComboBoxItemsSeekerConfigurable.DEFAULT_SELECT_AN_ITEM_WHEN_LOSES_FOCUS_CONFIGURATION);
1479
                }        
1480
        }
1481

    
1482
        
1483
        /**
1484
         * A JPanel for the configuration and create a new JComboBoxItemsSeekerConfigurable for testing
1485
         *  
1486
         * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
1487
         */
1488
        private class OtherTestsJPanel extends JPanel implements Serializable {
1489
                private static final long serialVersionUID = 5197361044977255568L;
1490
                private final int panelWidth = 410;
1491
                private final int panelHeight = 520;
1492
                private final int buttonWidth = 90;
1493
                private final int buttonHeight = 20;
1494
                private final int methodsPanelWidth = 390;
1495
                private final int methodsPanelHeight = 60;
1496
                private final int otherUtilitiesJTabbedPaneWidth = methodsPanelWidth;
1497
                private final int otherUtilitiesJTabbedPaneHeight = 385;
1498
                private final int columnsOfJTextAreaDescriptionInstructions = 34;
1499
                private final int rowsOfJTextAreaDescriptionInstructions = 20;
1500
                private final int jScrollPaneIncrementConstant = 10;
1501
                private final int jLabelWidth = 70;
1502
                private final int jLabelHeight = buttonHeight;
1503
                private final int parametersTextFieldWidth = methodsPanelWidth - jLabelWidth - 25; // -25 for the margins
1504
                private final int parametersTextFieldHeight = 20;
1505
                private final int buttonsPanelHeight = 30;
1506
                private final int buttonsPanelWidth = methodsPanelWidth;
1507
                private final int jComboBoxWidth = 180;
1508
                private final int jComboBoxHeigth = 20;
1509
                private JComboBox jComboBoxMethods = null;
1510
                private JTextField jTextField = null;
1511
                private JButton jButtonTest = null;
1512
                private JLabel jLabelMethod = null;
1513
                private JPanel jPanelMethods = null;
1514
                private JLabel jLabelComponents = null;
1515
                private JLabel jLabelParameters = null;
1516
                private JComboBox jComboBoxTestObjects = null;
1517
                private JTextArea jTextAreaDescriptionInstructions = null;
1518
                private JButton jButtonReset = null;
1519
                private JPanel jPanelButtons = null;
1520
                private Vector methods = null;
1521
                private Object lastSelectedMethod = null;
1522
                private Vector currentMethodTypes = null;
1523
                private JScrollPane jScrollPaneDescriptionInstructions = null;
1524
                private        String textHelp;
1525
                private String globalHelp;
1526
                private Map testObjects;
1527
                private JButton jButtonFill = null;
1528
                private JButton jButtonOtherTestsHelp = null;
1529
                private JTabbedPane jTabbedPaneOtherUtilities = null;
1530
                private JScrollPane jScrollPaneLog = null;
1531
                private JTextArea jTextAreaLog = null;
1532

    
1533
                /**
1534
                 * Default constructor without parameters
1535
                 */
1536
                public OtherTestsJPanel() {
1537
                        super();
1538
                }
1539
                
1540
                /**
1541
                 * Default constructor with 1 parameter
1542
                 */
1543
                public OtherTestsJPanel(String path) {
1544
                        super();
1545
                        javaFileMethodsLoader = new JavaFileMethodsLoader(path);
1546
                        this.initialize();
1547
                }
1548
                
1549
                /**
1550
                 * Initializes this pane
1551
                 */
1552
                private void initialize() {
1553
                        this.setPreferredSize(new Dimension(panelWidth, panelHeight));
1554
                        this.setBorder(BorderFactory.createTitledBorder(null, Messages.getText("proofs"), TitledBorder.LEFT, TitledBorder.TOP, new Font("Dialog", Font.BOLD, 12), Color.black));
1555
                        this.setSize(new Dimension(panelWidth, panelHeight));
1556
                        this.testObjects = new HashMap();
1557
                        
1558
                        this.add(getJPanelMethods(), null);
1559
                        this.add(getJTabbedPaneOtherUtilities(), null);
1560
                        this.add(getJPaneButtons(), null);
1561
                        textHelp = new String("AYUDA CON LOS PAR?METROS:\n\n" +                                                                        
1562
                                                                                "Se permiten 5 tipos de par?metros:\n" +
1563
                                                                                "   - Entero (int) (Ejemplo: 24)\n" +
1564
                                                                                "   - Real corto (float) (Ejemplo: 2.5)\n" +
1565
                                                                                "   - Real largo (double) (Ejemplo: 2.56869479346)\n" +
1566
                                                                                "   - Booleano (boolean) (Ejemplo valor true: T) (Ejemplo valor false: F)\n" +
1567
                                                                                "   - Cadena de caracteres (String) (Se deben usar comillas dobles) (Ejemplo: \"La casa.\")\n" +
1568
                                                                                "   - Car?cter (char) (Se deben usar comillas simples) (Ejemplo: 'a')\n\n" +
1569
                                                                                "Los par?metros se deben escribir separados por coma:\n" +
1570
                                                                                "   Ejemplo: 2, 3.5, true, \"El coche\", 'c'\n");
1571

    
1572
                        globalHelp = new String("   AYUDA CON LOS PAR?METROS:\n" +
1573
                                                                        "   ==========================\n" +                                                                        
1574
                                                                        "   Se permiten 5 tipos de par?metros:\n" +
1575
                                                                        "      - Entero (int) (Ejemplo: 24)\n" +
1576
                                                                        "      - Real corto (float) (Ejemplo: 2.5)\n" +
1577
                                                                        "      - Real largo (double) (Ejemplo: 2.56869479346)\n" +
1578
                                                                        "      - Booleano/Bandera (boolean) (Ejemplo valor cierto: true) (Ejemplo valor falso: false)\n" +
1579
                                                                        "      - Cadena de caracteres (String) (Se deben usar comillas dobles) (Ejemplo: \"La casa.\")\n" +
1580
                                                                        "      - Car?cter (char) (Se deben usar comillas simples) (Ejemplo: 'a')\n" +
1581
                                                                        "      - Objeto (Object) (Se considerar? como un item a a?adir o quitar a un JComboBox; se\n" +
1582
                                                                        "           escribir? como si fuese una cadena de caracteres (String)) (Ejemplo: \"El reloj\"\n\n" +                                                                        
1583
                                                                        "   Los par?metros se deben escribir separados por coma:\n" +
1584
                                                                        "      Ejemplo: 2, 3.5, true, \"El coche\", 'c', \"El reloj\"\n\n\n" +
1585
                                                                        "   AYUDA PANEL \"OTRAS PRUEBAS\" :\n" +
1586
                                                                        "   =============================\n" +
1587
                                                                        "   + JComboBox \"Operaci?n\" :\n" +
1588
                                                                        "      Puede seleccionar la operaci?n que desee realizar.\n\n" +
1589
                                                                        "   + JComboBox \"Objeto\" :\n" +
1590
                                                                        "      Puede seleccionar el objeto sobre el que realizar\n" +
1591
                                                                        "   la operaci?n seleccionada.\n\n" +
1592
                                                                        "   + Pesta?a \"Descripci?n\" :\n" +
1593
                                                                        "   - ?rea de texto \"Descripci?n\" :\n" +
1594
                                                                        "      Muestra informaci?n de la operaci?n seleccionada y\n" +
1595
                                                                        "   puede mostrar esta informaci?n de ayuda acerca del\n" +
1596
                                                                        "   manejo de esta aplicaci?n\n\n" +
1597
                                                                        "   - Campo de texto \"Par?metros\" :\n" +
1598
                                                                        "      Permite introducir par?metros para probar la operaci?n\n" +
1599
                                                                        "   seleccionada sobre el objeto seleccionado. Se debe introducir\n" +
1600
                                                                        "   par?metros del mismo tipo que los necesarios por la operaci?n,\n" +
1601
                                                                        "   y el mismo n?mero. En caso de que la operaci?n no necesite\n" +
1602
                                                                        "   par?metros de entrada, este campo estar? deshabilitado. Y en\n" +
1603
                                                                        "   en caso que no el usuario no pueda introducir un tipo de\n" +
1604
                                                                        "   par?metro (tipo distinto a los soportados), en caso de poderse\n" +
1605
                                                                        "   realizar la operaci?n, se usar?n valores por defecto desde la\n" +
1606
                                                                        "   aplicaci?n (y no escribir el par?metro).\n\n" +        
1607
                                                                        "   - Bot?n \"Rellenar\" :\n" +
1608
                                                                        "      A?ade un conjunto de items por defecto al objeto actual,\n" +
1609
                                                                        "   permite as? al usuario probar el objeto sin tener que introducir\n" +
1610
                                                                        "   datos manualmente.\n\n" +
1611
                                                                        "   - Bot?n \"Reset\" :\n" +
1612
                                                                        "      Puls?ndolo deja el panel \"Otras Pruebas\" tal y como\n" +
1613
                                                                        "   estaba inicialmente.\n\n" +
1614
                                                                        "   - Bot?n \"Test\" :\n" +
1615
                                                                        "      Puls?ndolo se intenta ejecutar un test de la operaci?n\n" +
1616
                                                                        "   seleccionada sobre el objeto seleccionado, y usando los\n" +
1617
                                                                        "   par?metros introducidos en caso necesario.\n" +
1618
                                                                        "      El test puede no ejecutarse si algo de lo anterior no es\n" +
1619
                                                                        "   correcto.\n\n" +
1620
                                                                        "   + Pesta?a \"Log\" :\n" +
1621
                                                                        "      Se va mostrando el resultado de las operaciones, as? como\n" +
1622
                                                                        "   texto de depuraci?n que puedan ir generando los objetos\n" +
1623
                                                                        "   objetos seg?n se usen.");
1624

    
1625
                        this.inializeMethods();
1626
                }
1627
                
1628
                /**
1629
                 * Pass a JavaFileMethodsLoader object that has been used for load a the JComboBoxItemsSeekerConfigurable class file
1630
                 * 
1631
                 * @param methodsLoader A JavaFileMethodsLoader object
1632
                 */
1633
                public void setJavaFileMethodsLoader(JavaFileMethodsLoader methodsLoader) {
1634
                        javaFileMethodsLoader = methodsLoader;
1635
                        this.initialize();
1636
                }
1637
                
1638
                /**
1639
                 * Add a method to a private Vector with all the methods that this pane will use
1640
                 */
1641
                private void inializeMethods() {
1642
                        methods = new Vector(0, 1);
1643
                        
1644
                        /* Create object without parameters */
1645
                        MethodsDescription description = new MethodsDescription();
1646
                        methods.add(description);
1647
                }
1648

    
1649
                /**
1650
                 * This method initializes jComboBoxMethods        
1651
                 *         
1652
                 * @return javax.swing.JComboBox        
1653
                 */
1654
                private JComboBox getJComboBoxMethods() {
1655
                        if (jComboBoxMethods == null) {
1656
                                jComboBoxMethods = new JComboBox();
1657
                                jComboBoxMethods.setPreferredSize(new Dimension(jComboBoxWidth, jComboBoxHeigth));
1658
                                jComboBoxMethods.addPopupMenuListener(new PopupMenuListener() {
1659

    
1660
                                        /*
1661
                                         * (non-Javadoc)
1662
                                         * @see javax.swing.event.PopupMenuListener#popupMenuCanceled(javax.swing.event.PopupMenuEvent)
1663
                                         */
1664
                                        public void popupMenuCanceled(PopupMenuEvent e) {
1665
                                        }
1666

    
1667
                                        /*
1668
                                         * (non-Javadoc)
1669
                                         * @see javax.swing.event.PopupMenuListener#popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent)
1670
                                         */
1671
                                        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
1672
                                                // If the user has selected another method -> show its description
1673
                                                Object item = jComboBoxMethods.getSelectedItem();
1674
                                                if (item != null)
1675
                                                {
1676
                                                        if ((lastSelectedMethod == null) || (!lastSelectedMethod.equals(item)))
1677
                                                        {
1678
                                                                displayMethodDescription(item);
1679
                                                                
1680
//                                                                System.out.println("method-item selected: " + item.toString());
1681
                                                                currentMethodTypes = javaFileMethodsLoader.getMethodParametersType(item.toString());
1682

    
1683
                                                                if (currentMethodTypes.size() == 0)
1684
                                                                        getJTextField().setEditable(false);
1685
                                                                else
1686
                                                                        getJTextField().setEditable(true);
1687
                                                        }
1688
                                                }
1689
                                        }
1690

    
1691
                                        /*
1692
                                         * (non-Javadoc)
1693
                                         * @see javax.swing.event.PopupMenuListener#popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent)
1694
                                         */
1695
                                        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
1696
                                                lastSelectedMethod = jComboBoxMethods.getSelectedItem();
1697
                                        }                                
1698
                                });
1699
                        }
1700

    
1701
                        return jComboBoxMethods;
1702
                }
1703
                
1704
                /**
1705
                 * Displays in the JTextAreaDescriptionInstructions information about a method
1706
                 * 
1707
                 * @param method A method
1708
                 */
1709
                private void displayMethodDescription(Object method) {
1710
                        // Adds the description text
1711
                        String methodHead = new String("public " + method);
1712
                        this.getJTextAreaDescriptionInstructions().setText(javaFileMethodsLoader.getMethodDocumentation(methodHead) + "\n" + method);
1713
                        
1714
                        // Adjusts the view (jTextAreaDescriptionInstructions) to the jtreeRoot-left corner
1715
                        this.getJTextAreaDescriptionInstructions().getCaret().setDot(0);
1716
                }        
1717

    
1718
                /**
1719
                 * Adds an method item to the jComboBoxMethods
1720
                 * 
1721
                 * @param name Name of the new method
1722
                 */
1723
                public void addMethodItem(String name) {
1724
                        this.jComboBoxMethods.addItem(name);                
1725
                        
1726
                        // Displays description of the first item added by default
1727
                        if (this.lastSelectedMethod == null)
1728
                        {
1729
                                this.lastSelectedMethod = getJComboBoxMethods().getSelectedItem();
1730
                                currentMethodTypes = javaFileMethodsLoader.getMethodParametersType((String)lastSelectedMethod);
1731
                                
1732
                                if (currentMethodTypes.size() == 0)
1733
                                        getJTextField().setEditable(false);
1734
                                else
1735
                                        getJTextField().setEditable(true);
1736
                                
1737
                                displayMethodDescription(name);
1738
                        }
1739
                }
1740
                
1741
                /**
1742
                 * Removes a method item from the jComboBoxMethods
1743
                 * 
1744
                 * @param name Name of a method to remove
1745
                 */
1746
                public void removeMethodItem(String name) {
1747
                        this.jComboBoxMethods.removeItem(name);
1748
                }
1749
                
1750
                /**
1751
                 * Removes all method items from the jComboBoxMethods
1752
                 */
1753
                public void removeAllMethodItems() {
1754
                        this.jComboBoxMethods.removeAll();
1755
                }
1756

    
1757
                /**
1758
                 * This method initializes jTextField        
1759
                 *         
1760
                 * @return javax.swing.JTextField        
1761
                 */
1762
                private JTextField getJTextField() {
1763
                        if (jTextField == null) {
1764
                                jTextField = new JTextField();
1765
                                jTextField.setPreferredSize(new Dimension(parametersTextFieldWidth, parametersTextFieldHeight));
1766
                        }
1767
                        return jTextField;
1768
                }
1769

    
1770
                /**
1771
                 * This method initializes jLabelMethod        
1772
                 *         
1773
                 * @return javax.swing.JLabel        
1774
                 */
1775
                private JLabel getJLabelMethod() {
1776
                        if (jLabelMethod == null) {
1777
                                jLabelMethod = new JLabel();
1778
                                jLabelMethod.setText(Messages.getText("method"));
1779
                        }
1780
                        return jLabelMethod;
1781
                }
1782

    
1783
                /**
1784
                 * This method initializes jLabelParameters        
1785
                 *         
1786
                 * @return javax.swing.JLabel        
1787
                 */
1788
                private JLabel getJLabelParameters() {
1789
                        if (jLabelParameters == null) {
1790
                                jLabelParameters = new JLabel();
1791
                                jLabelParameters.setPreferredSize(new Dimension(this.jLabelWidth, this.jLabelHeight));
1792
                                jLabelParameters.setText(Messages.getText("parameters"));
1793
                        }
1794
                        return jLabelParameters;
1795
                }
1796
                
1797
                /**
1798
                 * This method initializes jPanelMethods        
1799
                 *         
1800
                 * @return javax.swing.JPanel        
1801
                 */
1802
                private JPanel getJPanelMethods() {
1803
                        if (jPanelMethods == null) {
1804
                                jPanelMethods = new JPanel();                
1805
                                jPanelMethods.setPreferredSize(new Dimension(methodsPanelWidth, methodsPanelHeight));
1806
                                jPanelMethods.setSize(new Dimension(methodsPanelWidth, methodsPanelHeight));
1807
                                jPanelMethods.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
1808
                                
1809
                                GridLayout gridLayout = new GridLayout(2, 2);
1810
                                gridLayout.setHgap(4);
1811
                                gridLayout.setVgap(4);
1812
                                jPanelMethods.setLayout(gridLayout);
1813
                                
1814
                                jPanelMethods.add(getJLabelMethod());
1815
                                jPanelMethods.add(getJLabelComponents());
1816
                                jPanelMethods.add(getJComboBoxMethods());
1817
                                jPanelMethods.add(getJComboBoxTestObjects());
1818
                        }
1819
                        return jPanelMethods;
1820
                }
1821
                
1822
                /**
1823
                 * This method initializes jLabelComponents        
1824
                 *         
1825
                 * @return javax.swing.JLabel        
1826
                 */
1827
                private JLabel getJLabelComponents() {
1828
                        if (jLabelComponents == null) {
1829
                                jLabelComponents = new JLabel();
1830
                                jLabelComponents.setText(Messages.getText("object"));
1831
                        }
1832
                        return jLabelComponents;
1833
                }
1834

    
1835
                /**
1836
                 * This method initializes jComboBoxTestObjects        
1837
                 *         
1838
                 * @return javax.swing.JComboBox        
1839
                 */
1840
                private JComboBox getJComboBoxTestObjects() {
1841
                        if (jComboBoxTestObjects == null) {
1842
                                jComboBoxTestObjects = new JComboBox();
1843
                                jComboBoxTestObjects.setPreferredSize(new Dimension(jComboBoxWidth, jComboBoxHeigth));
1844
                                jComboBoxTestObjects.setSize(new Dimension(jComboBoxWidth, jComboBoxHeigth));
1845
                                jComboBoxTestObjects.setMaximumSize(new Dimension(jComboBoxWidth, jComboBoxHeigth));
1846
                        }
1847
                        return jComboBoxTestObjects;
1848
                }
1849
                
1850
                /**
1851
                 * Adds an object for testing
1852
                 * 
1853
                 * @param key A reference/name of the object
1854
                 * @param object The object
1855
                 */
1856
                public void addTestObject(Object key, Object object) {
1857
                        this.testObjects.put(key, object);
1858
                        this.jComboBoxTestObjects.addItem(key);
1859
                }
1860
                
1861
                /**
1862
                 * Removes a testing object
1863
                 * 
1864
                 * @param key A reference/name of the object
1865
                 */
1866
                public void removeTestObject(Object key) {
1867
                        this.testObjects.remove(key);
1868
                        this.jComboBoxTestObjects.removeItem(key);
1869
                }
1870
                
1871
                /**
1872
                 * Removes all testing objects
1873
                 */
1874
                public void removeAllTestObjects() {
1875
                        this.testObjects.clear();
1876
                        this.jComboBoxTestObjects.removeAllItems();
1877
                }
1878
                
1879
                /**
1880
                 * This method initializes jScrollPaneDescriptionInstructions        
1881
                 *         
1882
                 * @return javax.swing.JScrollPane        
1883
                 */
1884
                private JScrollPane getJScrollPaneDescriptionInstructions() {
1885
                        if (jScrollPaneDescriptionInstructions == null) {
1886
                                jScrollPaneDescriptionInstructions = new JScrollPane(getJTextAreaDescriptionInstructions());
1887
                                Dimension dimension = getJTextAreaDescriptionInstructions().getPreferredSize();
1888
                                dimension.height += jScrollPaneIncrementConstant;
1889
                                dimension.width += jScrollPaneIncrementConstant;
1890
                                jScrollPaneDescriptionInstructions.setPreferredSize(dimension);
1891
                        }
1892
                        return jScrollPaneDescriptionInstructions;
1893
                }
1894
                
1895
                /**
1896
                 * This method initializes jTextAreaDescriptionInstructions        
1897
                 *         
1898
                 * @return javax.swing.JTextArea        
1899
                 */
1900
                private JTextArea getJTextAreaDescriptionInstructions() {
1901
                        if (jTextAreaDescriptionInstructions == null) {
1902
                                jTextAreaDescriptionInstructions = new JTextArea(rowsOfJTextAreaDescriptionInstructions, columnsOfJTextAreaDescriptionInstructions);
1903
                                jTextAreaDescriptionInstructions.setEditable(false);
1904
                        }
1905
                        return jTextAreaDescriptionInstructions;
1906
                }
1907
                
1908
                /**
1909
                 * This method initializes jButtonTest        
1910
                 *         
1911
                 * @return javax.swing.JButton        
1912
                 */
1913
                private JButton getJButtonTest() {
1914
                        if (jButtonTest == null) {
1915
                                jButtonTest = new JButton();
1916
                                jButtonTest.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
1917
                                jButtonTest.setText(Messages.getText("test"));
1918
                                jButtonTest.addMouseListener(new MouseAdapter() {
1919
                                        /*
1920
                                         * (non-Javadoc)
1921
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
1922
                                         */
1923
                                        public void mouseClicked(MouseEvent arg0) {
1924
                                                try {
1925
                                                        String methodHead = (String)getJComboBoxMethods().getSelectedItem();
1926
                                                        if (methodHead == null)
1927
                                                        {
1928
                                                                JOptionPane.showMessageDialog(null, Messages.getText("selectAMethod"), Messages.getText("warning"), JOptionPane.WARNING_MESSAGE);
1929
                                                                return;
1930
                                                        }
1931
                                                        
1932
                                                        int selectedTestObjectIndex = getJComboBoxTestObjects().getSelectedIndex();
1933
                                                        if (selectedTestObjectIndex == -1)
1934
                                                        {
1935
                                                                JOptionPane.showMessageDialog(null, Messages.getText("selectAComponent"), Messages.getText("warning"), JOptionPane.WARNING_MESSAGE);
1936
                                                                return;
1937
                                                        }
1938
                                                        
1939
                                                        // If the method selected needs an special treatment
1940
                                                        if (javaFileMethodsLoader.hasTheMethodAnStrangeParameterType(methodHead) || javaFileMethodsLoader.hasTheMethodAnStrangeReturnParameterType(methodHead))
1941
                                                        {
1942
                                                                JOptionPane.showMessageDialog(null, Messages.getText("cantTestThisMethod"), Messages.getText("warning"), JOptionPane.WARNING_MESSAGE);
1943
                                                                return;
1944
                                                        }
1945
                                                        
1946
                                                        Vector parametersWritten = getParametersWritten();
1947
                                                        if (parametersWritten.size() != currentMethodTypes.size())
1948
                                                        {
1949
                                                                JOptionPane.showMessageDialog(null, Messages.getText("incorrectNumberOfParametersWritten"), Messages.getText("warning"), JOptionPane.WARNING_MESSAGE);
1950
                                                                return;
1951
                                                        }
1952
                                                        
1953
                                                        // Defines the type of parameters for the current selected method
1954
                                                        Class parameterTypes[] = new Class[currentMethodTypes.size()];
1955

    
1956
                                                        // Create the 'parameters' array
1957
                                                        Object parameters[] = new Object[currentMethodTypes.size()];
1958

    
1959
                                                        for (int i = 0; i < currentMethodTypes.size(); i++)
1960
                                                        {
1961
                                                                MethodParameter parameter = parametersTypeIsCorrect((String)parametersWritten.get(i), (Integer)currentMethodTypes.get(i));
1962
        
1963
                                                                if (parameter == null)
1964
                                                                {
1965
                                                                        JOptionPane.showMessageDialog(null, Messages.getText("incorrectParameter") + ": " + (String)parametersWritten.get(i), Messages.getText("warning"), JOptionPane.WARNING_MESSAGE);
1966
                                                                        return;
1967
                                                                }
1968
                                                                
1969
                                                                parameters[i] = parameter.getParameter();
1970
                                                                parameterTypes[i] = parameter.getType();
1971
                                                        }
1972
                                                        
1973
                                                        // Select the "log" tab of the jTabbedPane
1974
                                                        getJTabbedPaneOtherUtilities().setSelectedIndex(1);                                                        
1975
                                                        
1976
                                                        // Gets the frame of the object selected
1977
                                                        String objectName = getJComboBoxTestObjects().getSelectedItem().toString();
1978
                                                        JFrame jTestObjectFrame = ((JFrame)testObjects.get(objectName));
1979
                                                        
1980
                                                        // Sets the focus to the frame of the selected object
1981
                                                        ((JFrame)jTestObjectFrame).getRootPane().requestDefaultFocus();
1982
                                                        
1983
                                                        // Gets the selected object for test
1984
                                                        Object object = jTestObjectFrame.getContentPane().getComponent(0);
1985
                                                        
1986
                                                        // Gets the class of the current selected object
1987
                                                        Class testObjectClass = object.getClass();
1988
                                                                
1989
                                                        // Gets the method that corresponds with the selected method
1990
                                                        String methodName = javaFileMethodsLoader.getMethodName(methodHead);
1991
                                                        Method method = testObjectClass.getMethod(methodName, parameterTypes);
1992
                                                        
1993
                                                        // Show information about the next method to do 
1994
                                                        getJTextAreaLog().append(Messages.getText("invoke") +"(" + objectName + ", " + methodName + "):\n");
1995
                                                        
1996
                                                        // Invoke the selected method for the selected object
1997
                                                        Object objectReturned = method.invoke(object, parameters);
1998
                                                        
1999
                                                        // Show the results of the method
2000
                                                        if (objectReturned != null)
2001
                                                                getJTextAreaLog().append(Messages.getText("resultOf") +"(" + objectName + ", " + methodName + "): " + objectReturned.toString() + "\n");
2002
                                                }
2003
                                                catch(Exception e) {
2004
                                                        e.printStackTrace();
2005
                                                }
2006
                                        }
2007
                                });
2008
                        }
2009
                        return jButtonTest;
2010
                }
2011
                
2012
                /**
2013
                 * This method initializes jTabbedPaneOtherUtilities        
2014
                 *         
2015
                 * @return javax.swing.JTabbedPane        
2016
                 */
2017
                private JTabbedPane getJTabbedPaneOtherUtilities() {
2018
                        if (jTabbedPaneOtherUtilities == null) {
2019
                                jTabbedPaneOtherUtilities = new JTabbedPane();
2020
                                jTabbedPaneOtherUtilities.setPreferredSize(new Dimension(otherUtilitiesJTabbedPaneWidth, otherUtilitiesJTabbedPaneHeight));
2021
                                
2022
                                JPanel panel1 = new JPanel();
2023
                                panel1.setPreferredSize(new Dimension(otherUtilitiesJTabbedPaneWidth - 10, 30));
2024
                                panel1.add(getJLabelParameters());
2025
                                panel1.add(getJTextField());
2026
                                
2027
                                JPanel tab1Pane = new JPanel();
2028
                                tab1Pane.add(getJScrollPaneDescriptionInstructions());
2029
                                tab1Pane.add(panel1);
2030
                                jTabbedPaneOtherUtilities.addTab(Messages.getText("description"), tab1Pane);
2031
                                
2032
                                jTabbedPaneOtherUtilities.addTab(Messages.getText("log"), getJScrollPaneLog());
2033
                        }
2034
                        return jTabbedPaneOtherUtilities;
2035
                }
2036
                
2037
                /**
2038
                 * Verifies if a parameter is of one particular type: if true -> returns a MethodParameter object with
2039
                 * the type codification and the parameter as an object of its type; if false -> returns null
2040
                 * 
2041
                 * @param parameter A parameter as a name
2042
                 * @param type An Integer object with the codification of the type
2043
                 * @return Null or a MethodParameter object with an object of the same type as the parameter type, and
2044
                 *    the codification of the type.
2045
                 */
2046
                private MethodParameter parametersTypeIsCorrect(String parameter, Integer type) {
2047
                        MethodParameter methodParameter = new MethodParameter();
2048
                        
2049
                        switch (type.intValue()) {
2050
                        case JavaFileMethodsLoader.BOOLEAN_TYPE:
2051
                                if (parameter.compareTo("true") == 0)
2052
                                {
2053
                                        methodParameter.setParameter(new Boolean(true));
2054
                                        methodParameter.setType(Boolean.TYPE);                                
2055
                                }
2056
                                else
2057
                                {
2058
                                        if (parameter.compareTo("false") == 0)
2059
                                        {
2060
                                                methodParameter.setParameter(new Boolean(false));
2061
                                                methodParameter.setType(Boolean.TYPE);                                
2062
                                        }
2063
                                        else
2064
                                                return null;
2065
                                }
2066
                                return methodParameter;
2067
                        case JavaFileMethodsLoader.CHAR_TYPE:
2068
                                if ((parameter.length() == 3) && (parameter.charAt(0) == '\'') && (parameter.charAt(2) == '\''))
2069
                                {
2070
                                        methodParameter.setParameter(new Character(parameter.charAt(1)));
2071
                                        methodParameter.setType(Character.TYPE);                                
2072
                                }
2073
                                else
2074
                                        return null;
2075
                        case JavaFileMethodsLoader.FLOAT_TYPE:
2076
                                try        {
2077
                                        methodParameter.setParameter(new Float(parameter));
2078
                                        methodParameter.setType(Float.TYPE);
2079
                                        return methodParameter;
2080
                                }
2081
                                catch(Exception e) {
2082
                                        return null;
2083
                                }
2084
                        case JavaFileMethodsLoader.DOUBLE_TYPE:
2085
                                try        {
2086
                                        methodParameter.setParameter(new Double(parameter));
2087
                                        methodParameter.setType(Double.TYPE);
2088
                                        return methodParameter;
2089
                                }
2090
                                catch(Exception e) {
2091
                                        return null;
2092
                                }
2093
                        case JavaFileMethodsLoader.INT_TYPE:
2094
                                try        {
2095
                                        methodParameter.setParameter(new Integer(parameter));
2096
                                        methodParameter.setType(Integer.TYPE);
2097
                                        return methodParameter;
2098
                                }
2099
                                catch(Exception e) {
2100
                                        return null;
2101
                                }
2102
                        case JavaFileMethodsLoader.STRING_TYPE:
2103
                                // If the string is between "" simbols:
2104
                                if ((parameter.charAt(0) == '\"') && (parameter.charAt(parameter.length() - 1) == '\"'))
2105
                                {
2106
                                        methodParameter.setParameter(new String(parameter.substring(1, parameter.length() -1)));
2107
                                        methodParameter.setType(String.class);
2108
                                        return methodParameter;
2109
                                }
2110
                                else
2111
                                        return null;
2112
                        case JavaFileMethodsLoader.OBJECT_TYPE:
2113
                                // If the string written is between "" simbols:
2114
                                if ((parameter.charAt(0) == '\"') && (parameter.charAt(parameter.length() - 1) == '\"'))
2115
                                {
2116
                                        methodParameter.setParameter(new Item(parameter.substring(1, parameter.length() -1)));
2117
                                        methodParameter.setType(Object.class);
2118
                                        return methodParameter;
2119
                                }
2120
                                else
2121
                                        return null;
2122
                        default: // JavaFileMethodsLoader.OTHER_TYPE                        
2123
                                return null;
2124
                        }
2125
                }
2126
                
2127
                /**
2128
                 * Return a Vector with the parameters written as String
2129
                 * 
2130
                 * @return A Vector with the parameters written
2131
                 */
2132
                private Vector getParametersWritten() {
2133
                        Vector parameters = new Vector(0, 1);
2134
                        
2135
                        String parametersWritten = getJTextField().getText().trim();
2136
                        
2137
                        // If there is only one parameter
2138
                        if (parametersWritten.indexOf(',') == -1)
2139
                        {
2140
                                if (parametersWritten.length() > 0)
2141
                                        parameters.add(parametersWritten);
2142
                                else
2143
                                        return parameters;
2144
                        }
2145
                        else
2146
                        {
2147
                        StringTokenizer tokens = new StringTokenizer(parametersWritten, ",");
2148

    
2149
                                while(tokens.hasMoreTokens())
2150
                                        parameters.add(tokens.nextToken().trim());
2151
                        }
2152
                        
2153
                        return parameters;
2154
                }
2155
                
2156
                /**
2157
                 * This method initializes jButtonReset        
2158
                 *         
2159
                 * @return javax.swing.JButton        
2160
                 */
2161
                private JButton getJButtonReset() {
2162
                        if (jButtonReset == null) {
2163
                                jButtonReset = new JButton();
2164
                                jButtonReset.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
2165
                                jButtonReset.setText(Messages.getText("reset"));
2166
                                jButtonReset.addMouseListener(new MouseAdapter() {
2167
                                        /*
2168
                                         * (non-Javadoc)
2169
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
2170
                                         */
2171
                                        public void mouseClicked(MouseEvent arg0) {
2172
                                                resetOtherTestsPanel();
2173
                                        }
2174
                                });
2175
                        }
2176
                        return jButtonReset;
2177
                }
2178

    
2179
                /**
2180
                 * Resets this JPanel: all will be similas as at beginning except the log, that won't be reset
2181
                 */
2182
                private void resetOtherTestsPanel() {
2183
                        getJTextAreaDescriptionInstructions().setText("");
2184
                        
2185
                        getJTextField().setText("");
2186
                        
2187
                        if (getJComboBoxMethods().getItemCount() == 0)
2188
                        {
2189
                                getJComboBoxMethods().setSelectedIndex(-1);
2190
                                this.lastSelectedMethod = this.currentMethodTypes = null;
2191
                                getJTextField().setEditable(false);
2192
                        }
2193
                        else
2194
                        {
2195
                                this.getJComboBoxMethods().setSelectedIndex(0);
2196
                                this.lastSelectedMethod = getJComboBoxMethods().getSelectedItem();
2197
                                currentMethodTypes = javaFileMethodsLoader.getMethodParametersType((String)lastSelectedMethod);
2198
                                
2199
                                if (currentMethodTypes.size() == 0)
2200
                                        getJTextField().setEditable(false);
2201
                                else
2202
                                        getJTextField().setEditable(true);
2203
                                
2204
                                displayMethodDescription(this.lastSelectedMethod);
2205
                        }
2206

    
2207
                        // Removes all test objects (closing the JFrames that cointain them)
2208
                        Object[] objects = testObjects.keySet().toArray();
2209
                        for (int i = 0; i < objects.length; i++)
2210
                        {
2211
                                ((JFrame)testObjects.get(objects[i])).dispose();
2212
                                ((JFrame)testObjects.get(objects[i])).setVisible(false); // For complete de JFrame close method (it's necessary)
2213
                        }
2214

    
2215
                        // Set selected the firt tab
2216
                        getJTabbedPaneOtherUtilities().setSelectedIndex(0);
2217
                }
2218
                
2219
                /**
2220
                 * This method initializes jPaneButtons        
2221
                 *         
2222
                 * @return javax.swing.JPanel        
2223
                 */
2224
                private JPanel getJPaneButtons() {
2225
                        if (jPanelButtons == null) {
2226
                                FlowLayout flowLayout = new FlowLayout();
2227
                                flowLayout.setAlignment(FlowLayout.RIGHT);
2228
                                jPanelButtons = new JPanel();
2229
                                jPanelButtons.setPreferredSize(new Dimension(buttonsPanelWidth, buttonsPanelHeight));
2230
                                jPanelButtons.setLayout(flowLayout);
2231
                                jPanelButtons.add(getJButtonOtherTestsHelp(), null);
2232
                                jPanelButtons.add(getJButtonFill(), null);
2233
                                jPanelButtons.add(getJButtonReset(), null);
2234
                                jPanelButtons.add(getJButtonTest(), null);
2235
                        }
2236
                        return jPanelButtons;
2237
                }
2238

    
2239
                /**
2240
                 * Returns the number of testing objects that this panel has in this moments
2241
                 * 
2242
                 * @return Number of testing objects that this panel has in this moments
2243
                 */
2244
                public int getTestObjectsCount() {
2245
                        return this.getJComboBoxTestObjects().getItemCount();
2246
                }
2247

    
2248
                /**
2249
                 * This method initializes jButtonLog        
2250
                 *         
2251
                 * @return javax.swing.JButton        
2252
                 */
2253
                private JButton getJButtonFill() {
2254
                        if (jButtonFill == null) {
2255
                                jButtonFill = new JButton();
2256
                                jButtonFill.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
2257
                                jButtonFill.setText(Messages.getText("fill"));
2258
                                jButtonFill.addMouseListener(new MouseAdapter() {
2259
                                        /*
2260
                                         * (non-Javadoc)
2261
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
2262
                                         */
2263
                                        public void mouseClicked(MouseEvent arg0) {
2264
                                                try
2265
                                                {
2266
                                                        // It must be selected a component -> else: show a message dialog and don't fill with data the object
2267
                                                        int selectedTestObjectIndex = getJComboBoxTestObjects().getSelectedIndex();
2268
                                                        if (selectedTestObjectIndex == -1)
2269
                                                        {
2270
                                                                JOptionPane.showMessageDialog(null, Messages.getText("selectAComponent"), Messages.getText("warning"), JOptionPane.WARNING_MESSAGE);
2271
                                                                return;
2272
                                                        }                                                        
2273
                                                        
2274
                                                        JFrame jTestObjectFrame = ((JFrame)testObjects.get(getJComboBoxTestObjects().getSelectedItem().toString()));
2275
                                                        
2276
                                                        // Sets the focus to the frame of the selected object
2277
                                                        ((JFrame)jTestObjectFrame).getRootPane().requestDefaultFocus();
2278
                                                        
2279
                                                        // Gets the selected object for test
2280
                                                        Object object = jTestObjectFrame.getContentPane().getComponent(0);
2281
                                                        
2282
                                                        // Gets the class of the current selected object
2283
                                                        Class testObjectClass = object.getClass();
2284

    
2285
                                                        // Defines the type of parameter for the 'addItem' method
2286
                                                        Class addItemParameterTypes[] = new Class[1];
2287
                                                        addItemParameterTypes[0] = Object.class;
2288
                                                        
2289
                                                        // Gets the 'addItem' method of the current selected object
2290
                                                        Method addItemMethod = testObjectClass.getMethod("addItem", addItemParameterTypes);
2291
                                                        
2292
                                                        // ADDS SAMPLE DATA:
2293
                                                        addSampleData(object, addItemMethod);                                                
2294
                                                }
2295
                                                catch(Exception e) {
2296
                                                        e.printStackTrace();
2297
                                                }
2298
                                        }
2299
                                });
2300
                        }
2301
                        
2302
                        return jButtonFill;
2303
                }
2304
                
2305
                /**
2306
                 * This method add sample data (items) to the current selected object invoking the "addItem" method for the object
2307
                 * 
2308
                 * @param object Object where the items will be added
2309
                 * @param addItemMethod Method "addItem" to invoke
2310
                 */
2311
                private void addSampleData(Object object, Method addItemMethod) {
2312
                        try {
2313
                                // Create the 'parameters' array
2314
                                Object parameters[] = new Object[1];
2315
                                
2316
                                // Invokes the 'addItem' method of the object for adding sample items
2317
                                parameters[0] = (Object) new Item("_fwAndami");                
2318
                                addItemMethod.invoke(object, parameters);
2319
                                
2320
                                parameters[0] = (Object) new Item("appgvSIG");                
2321
                                addItemMethod.invoke(object, parameters);
2322

    
2323
                                parameters[0] = (Object) new Item("extAddEventTheme");                
2324
                                addItemMethod.invoke(object, parameters);
2325

    
2326
                                parameters[0] = (Object) new Item("extAddIDEELayers");                
2327
                                addItemMethod.invoke(object, parameters);
2328

    
2329
                                parameters[0] = (Object) new Item("extCAD");                
2330
                                addItemMethod.invoke(object, parameters);
2331

    
2332
                                parameters[0] = (Object) new Item("extCenterViewToPoint");                
2333
                                addItemMethod.invoke(object, parameters);
2334

    
2335
                                parameters[0] = (Object) new Item("extJDBC");                
2336
                                addItemMethod.invoke(object, parameters);
2337

    
2338
                                parameters[0] = (Object) new Item("extNomenclatorIGN");                
2339
                                addItemMethod.invoke(object, parameters);
2340

    
2341
                                parameters[0] = (Object) new Item("extScripting");                
2342
                                addItemMethod.invoke(object, parameters);
2343

    
2344
                                parameters[0] = (Object) new Item("extWCS");                
2345
                                addItemMethod.invoke(object, parameters);
2346

    
2347
                                parameters[0] = (Object) new Item("extWMS");                
2348
                                addItemMethod.invoke(object, parameters);
2349

    
2350
                                parameters[0] = (Object) new Item("libCorePlugin");                
2351
                                addItemMethod.invoke(object, parameters);
2352

    
2353
                                parameters[0] = (Object) new Item("libCq CMS for java");                
2354
                                addItemMethod.invoke(object, parameters);
2355

    
2356
                                parameters[0] = (Object) new Item("libDriverManager");                
2357
                                addItemMethod.invoke(object, parameters);
2358

    
2359
                                parameters[0] = (Object) new Item("libFMap");                
2360
                                addItemMethod.invoke(object, parameters);
2361

    
2362
                                parameters[0] = (Object) new Item("libGDBMS");                
2363
                                addItemMethod.invoke(object, parameters);
2364

    
2365
                                parameters[0] = (Object) new Item("libIverUtiles");                
2366
                                addItemMethod.invoke(object, parameters);
2367

    
2368
                                parameters[0] = (Object) new Item("libNomeclatorIGN");                
2369
                                addItemMethod.invoke(object, parameters);
2370

    
2371
                                parameters[0] = (Object) new Item("libNomenclatorIGN_GUI");                
2372
                                addItemMethod.invoke(object, parameters);
2373

    
2374
                                parameters[0] = (Object) new Item("libRemoteServices");                
2375
                                addItemMethod.invoke(object, parameters);
2376

    
2377
                                parameters[0] = (Object) new Item("libUI");                
2378
                                addItemMethod.invoke(object, parameters);
2379

    
2380
                                parameters[0] = (Object) new Item("May?scula1");                
2381
                                addItemMethod.invoke(object, parameters);
2382

    
2383
                                parameters[0] = (Object) new Item("MAY?SCULA2");                
2384
                                addItemMethod.invoke(object, parameters);
2385

    
2386
                                parameters[0] = (Object) new Item("Mayuscula3");                
2387
                                addItemMethod.invoke(object, parameters);
2388

    
2389
                                parameters[0] = (Object) new Item("mayuscula4?");                
2390
                                addItemMethod.invoke(object, parameters);
2391
                                
2392
                                parameters[0] = (Object) new Item("min?scula1");                
2393
                                addItemMethod.invoke(object, parameters);
2394

    
2395
                                parameters[0] = (Object) new Item("minuscula2");                
2396
                                addItemMethod.invoke(object, parameters);
2397

    
2398
                                parameters[0] = (Object) new Item("?and?");                
2399
                                addItemMethod.invoke(object, parameters);
2400

    
2401
                                parameters[0] = (Object) new Item("?AND?");                
2402
                                addItemMethod.invoke(object, parameters);
2403

    
2404
                                parameters[0] = (Object) new Item("a");                
2405
                                addItemMethod.invoke(object, parameters);
2406

    
2407
                                parameters[0] = (Object) new Item("aa");                
2408
                                addItemMethod.invoke(object, parameters);
2409

    
2410
                                parameters[0] = (Object) new Item("aaa");                
2411
                                addItemMethod.invoke(object, parameters);
2412

    
2413
                                parameters[0] = (Object) new Item("aaaa");                
2414
                                addItemMethod.invoke(object, parameters);
2415

    
2416
                                parameters[0] = (Object) new Item("aaaaa");                
2417
                                addItemMethod.invoke(object, parameters);
2418

    
2419
                                parameters[0] = (Object) new Item("af??=)(/?/");                
2420
                                addItemMethod.invoke(object, parameters);
2421

    
2422
                                parameters[0] = (Object) new Item(".");                
2423
                                addItemMethod.invoke(object, parameters);
2424

    
2425
                                parameters[0] = (Object) new Item("-a,malj'=)/");                
2426
                                addItemMethod.invoke(object, parameters);
2427

    
2428
                                parameters[0] = (Object) new Item("ZZZZZ");                
2429
                                addItemMethod.invoke(object, parameters);
2430

    
2431
                                parameters[0] = (Object) new Item("BLIUE? ");                
2432
                                addItemMethod.invoke(object, parameters);
2433

    
2434
                                parameters[0] = (Object) new Item("etye7yyy-er");                
2435
                                addItemMethod.invoke(object, parameters);
2436

    
2437
                                parameters[0] = (Object) new Item("_abcdefghijklmn?opqrstuvwxyz");                
2438
                                addItemMethod.invoke(object, parameters);
2439

    
2440
                                parameters[0] = (Object) new Item("_0123456789");                
2441
                                addItemMethod.invoke(object, parameters);
2442

    
2443
                                parameters[0] = (Object) new Item("...");                
2444
                                addItemMethod.invoke(object, parameters);
2445

    
2446
                                parameters[0] = (Object) new Item("gvSIG");                
2447
                                addItemMethod.invoke(object, parameters);
2448
                                
2449
                                parameters[0] = (Object) new Item("?LTIMO ITEM EN A?ADIRSE POR DEFECTO");                
2450
                                addItemMethod.invoke(object, parameters);
2451

    
2452
                        } catch (IllegalArgumentException e) {
2453
                                e.printStackTrace();
2454
                        } catch (IllegalAccessException e) {
2455
                                e.printStackTrace();
2456
                        } catch (InvocationTargetException e) {
2457
                                e.printStackTrace();
2458
                        }                
2459
                }
2460

    
2461
                /**
2462
                 * This method initializes jButtonOtherTestsHelp        
2463
                 *         
2464
                 * @return javax.swing.JButton        
2465
                 */
2466
                private JButton getJButtonOtherTestsHelp() {
2467
                        if (jButtonOtherTestsHelp == null) {
2468
                                jButtonOtherTestsHelp = new JButton();
2469
                                jButtonOtherTestsHelp.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
2470
                                jButtonOtherTestsHelp.setText(Messages.getText("help"));
2471
                                jButtonOtherTestsHelp.addMouseListener(new MouseAdapter() {
2472
                                        /*
2473
                                         * (non-Javadoc)
2474
                                         * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
2475
                                         */
2476
                                        public void mouseClicked(MouseEvent arg0) {
2477
                                                // Selects the 'description' tab pane
2478
                                                getJTabbedPaneOtherUtilities().setSelectedIndex(0);
2479
                                                
2480
                                                // Sets the help text
2481
                                                getJTextAreaDescriptionInstructions().setText(globalHelp);
2482
                                                
2483
                                                // Adjusts the view (jTextAreaDescriptionInstructions) to the jtreeRoot-left corner
2484
                                                getJTextAreaDescriptionInstructions().getCaret().setDot(0);
2485
                                                
2486
                                                // Reset the current method selected
2487
                                                lastSelectedMethod = null;
2488
                                                getJTextField().setEditable(false);
2489
                                                currentMethodTypes = null;
2490
                                                getJComboBoxMethods().setSelectedIndex(-1);
2491
                                        }                                        
2492
                                });
2493

    
2494
                        }
2495
                        return jButtonOtherTestsHelp;
2496
                }
2497
                
2498
                /**
2499
                 * This method initializes jScrollPaneLog        
2500
                 *         
2501
                 * @return javax.swing.JScrollPane        
2502
                 */
2503
                private JScrollPane getJScrollPaneLog() {
2504
                        if (jScrollPaneLog == null) {
2505
                                jScrollPaneLog = new JScrollPane(getJTextAreaLog());
2506
                        }
2507
                        return jScrollPaneLog;
2508
                }
2509

    
2510
                /**
2511
                 * This method initializes jTextAreaLog        
2512
                 *         
2513
                 * @return javax.swing.JTextArea        
2514
                 */
2515
                private JTextArea getJTextAreaLog() {
2516
                        if (jTextAreaLog == null) {
2517
                                jTextAreaLog = new JTextArea();
2518
                                jTextAreaLog.setEditable(false);
2519
                        }
2520
                        return jTextAreaLog;
2521
                }
2522
                
2523
                /**
2524
                 * This class has information about a parameter of a method of a class
2525
                 * 
2526
                 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
2527
                 */
2528
                private class MethodParameter implements Serializable{
2529
                        private static final long serialVersionUID = 405945870334316541L;
2530
                        private Object parameter;
2531
                        private Class type;
2532
                        
2533
                        /**
2534
                         * Default constructor without parameters
2535
                         */
2536
                        public MethodParameter() {
2537
                                super();
2538
                        }
2539
                        
2540
                        /**
2541
                         * Default constructor with 2 parameters
2542
                         * 
2543
                         * @param parameter The parameter object
2544
                         * @param type The type of the parameter
2545
                         */
2546
                        public MethodParameter(Object parameter, Class type) {
2547
                                super();
2548
                                this.parameter = parameter;
2549
                                this.type = type;
2550
                        }
2551
                        
2552
                        /**
2553
                         * Returns the parameter object
2554
                         * 
2555
                         * @return Parameter object
2556
                         */
2557
                        public Object getParameter() {
2558
                                return parameter;
2559
                        }
2560
                        
2561
                        /**
2562
                         * Sets the parameter object
2563
                         * 
2564
                         * @param parameter Parameter object
2565
                         */
2566
                        public void setParameter(Object parameter) {
2567
                                this.parameter = parameter;
2568
                        }
2569
                        
2570
                        /**
2571
                         * Returns the type of the parameter
2572
                         * 
2573
                         * @return Type of the parameter
2574
                         */
2575
                        public Class getType() {
2576
                                return type;
2577
                        }
2578
                        
2579
                        /**
2580
                         * Sets the type of the parameter
2581
                         * 
2582
                         * @param type Type of the parameter
2583
                         */
2584
                        public void setType(Class type) {
2585
                                this.type = type;
2586
                        }        
2587
                }
2588
        }
2589
        
2590
        
2591
        /**
2592
         * This class loads from a java file the methods of the class defined, and has some methods for get or manipulate them
2593
         * (It's supposed that the file to load has a determinated structure).
2594
         *  
2595
         * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
2596
         */
2597
        private class JavaFileMethodsLoader implements Serializable{
2598
                private static final long serialVersionUID = -7952535122218658121L;
2599
                private String className;
2600
                private Map methods;
2601
                private Vector methodHeads;
2602
                private String filePath;
2603
                private File file;
2604
                
2605
                public static final int BOOLEAN_TYPE = 0;
2606
                public static final int STRING_TYPE = 1;
2607
                public static final int INT_TYPE = 2;
2608
                public static final int FLOAT_TYPE = 3;
2609
                public static final int DOUBLE_TYPE = 4;
2610
                public static final int CHAR_TYPE = 5;
2611
                public static final int VOID_TYPE = 6;
2612
                public static final int OBJECT_TYPE = 7;
2613
                public static final int OTHER_TYPE = 8;
2614
                
2615
                /**
2616
                 * Default constructor without parameters
2617
                 */
2618
                public JavaFileMethodsLoader() {
2619
                        methods = new HashMap();
2620
                        methodHeads = new Vector(0, 1); // Initial capacity = 0; Increment capacity = 1
2621
                }
2622
                
2623
                /**
2624
                 * Default constructor with a parameter: the path for the file to load.
2625
                 * Loads that file.
2626
                 * 
2627
                 * @param path The path for the file to load
2628
                 */
2629
                public JavaFileMethodsLoader(String path) {
2630
                        methods = new HashMap();
2631
                        methodHeads = new Vector(0, 1); // Initial capacity = 0; Increment capacity = 1
2632

    
2633
                        this.filePath = path;
2634
                        this.file = new File(this.filePath);
2635
                        this.className = this.obteinClassName();
2636
                        this.processFile();                                
2637
                }
2638
                
2639
                /**
2640
                 * Obtains the name of the class
2641
                 * 
2642
                 * @return Name of the main class of the file loaded
2643
                 */
2644
                private String obteinClassName() {
2645
                        return file.getName().substring(0, file.getName().lastIndexOf('.'));
2646
                }
2647
                
2648
                /**
2649
                 * Returns the name of the main class of the file loaded
2650
                 * 
2651
                 * @return Name of the main class of the file loaded
2652
                 */
2653
                public String getClassName() {
2654
                        return this.className;
2655
                }
2656
                
2657
                /**
2658
                 * Returns the name of the file loaded
2659
                 * 
2660
                 * @return Name of the file loaded
2661
                 */
2662
                public String getClassFileName() {
2663
                        return this.file.getName();
2664
                }
2665
                
2666
                /**
2667
                 * Returns a method head in order as it was declared/defined in the file loaded
2668
                 * 
2669
                 * @param position Order of the method in the file, for return its head
2670
                 * @return A method head
2671
                 */
2672
                public String getMethodHead(int position) {
2673
                        return (String)methodHeads.get(position);
2674
                }
2675

    
2676
                /**
2677
                 * Returns the documentation of a method
2678
                 * 
2679
                 * @param methodHead A method head
2680
                 * @return Documentation of a method
2681
                 */
2682
                public String getMethodDocumentation(String methodHead) {
2683
                        return (String)methods.get(methodHead);
2684
                }
2685
                
2686
                /**
2687
                 * Returns only the name from a method head
2688
                 * 
2689
                 * @param methodHead A method head
2690
                 * @return A name of a method
2691
                 */
2692
                public String getMethodName(String methodHead) {
2693
                        int endPosition = methodHead.indexOf('(');
2694

    
2695
                        StringTokenizer tokens = new StringTokenizer(methodHead.substring(0, endPosition), " ");
2696

    
2697
                        int numberOfTokens = tokens.countTokens();
2698
                        
2699
                        if (numberOfTokens == 0)
2700
                                return null;
2701
                        else
2702
                        {
2703
                                // Get the last token -> which is the name of the method
2704
                                for (int i = 0; i < (numberOfTokens - 1); i++)
2705
                                        tokens.nextToken();
2706
                                
2707
                                return tokens.nextToken();
2708
                        }
2709
                }
2710
                
2711
                /**
2712
                 * Returns a vector with the codes of the parameter types of a method from its method head
2713
                 * 
2714
                 * @param methodHead A method head
2715
                 * @return A vector with the parameter types of a method. Each element in the vector is an Integer object
2716
                 */
2717
                public Vector getMethodParametersType(String methodHead) {
2718
                        Vector types = new Vector(0, 1);
2719
                        
2720
                        int startPosition = methodHead.indexOf('(') + 1;
2721
                        int endPosition = methodHead.lastIndexOf(')');
2722
                        
2723
                        StringTokenizer tokens = new StringTokenizer(methodHead.substring(startPosition, endPosition).trim(), ",");
2724
                        
2725
                        a: while(tokens.hasMoreTokens()) {
2726
                                String token = tokens.nextToken().trim();
2727
                                
2728
                                if (token.startsWith("boolean "))
2729
                                {
2730
                                        types.add(new Integer(JavaFileMethodsLoader.BOOLEAN_TYPE));
2731
                                        continue a;
2732
                                }
2733
                                
2734
                                if (token.startsWith("int "))
2735
                                {
2736
                                        types.add(new Integer(JavaFileMethodsLoader.INT_TYPE));
2737
                                        continue a;
2738
                                }
2739
                        
2740
                                if (token.startsWith("double "))
2741
                                {
2742
                                        types.add(new Integer(JavaFileMethodsLoader.DOUBLE_TYPE));
2743
                                        continue a;
2744
                                }
2745
                
2746
                                if (token.startsWith("String "))
2747
                                {
2748
                                        types.add(new Integer(JavaFileMethodsLoader.STRING_TYPE));
2749
                                        continue a;
2750
                                }
2751
        
2752
                                if (token.startsWith("char "))
2753
                                {
2754
                                        types.add(new Integer(JavaFileMethodsLoader.CHAR_TYPE));
2755
                                        continue a;
2756
                                }
2757

    
2758
                                if (token.startsWith("float "))
2759
                                {
2760
                                        types.add(new Integer(JavaFileMethodsLoader.FLOAT_TYPE));
2761
                                        continue a;
2762
                                }
2763
                                
2764
                                if (token.startsWith("Object "))
2765
                                {
2766
                                        types.add(new Integer(JavaFileMethodsLoader.OBJECT_TYPE));
2767
                                        continue a;
2768
                                }
2769
                                
2770
                                // Other type of parameters
2771
                                types.add(new Integer(JavaFileMethodsLoader.OTHER_TYPE));
2772
                        }
2773
                        
2774
                        return types;
2775
                }
2776
                
2777
                /**
2778
                 * Returns the return type name of a method
2779
                 * 
2780
                 * @param methodHead A method head
2781
                 * @return A return type name
2782
                 */
2783
                public String getMethodReturnTypeName(String methodHead) {
2784
                        int endPosition = methodHead.indexOf('(');
2785
                        String aux = methodHead.substring(0, endPosition);
2786
                        endPosition = aux.lastIndexOf(' ');
2787
                        return methodHead.substring(0, endPosition);
2788
                }
2789
                
2790
                /**
2791
                 * Returns the code of the return type of a method from its method head
2792
                 * 
2793
                 * @param methodHead A method head
2794
                 * @return An Integer object with the code
2795
                 */
2796
                public Integer getMethodReturnType(String methodHead) {
2797
                        String returnType = getMethodReturnTypeName(methodHead);
2798
                        
2799
                        if (returnType.compareTo("boolean") == 0)
2800
                                return new Integer(JavaFileMethodsLoader.BOOLEAN_TYPE);
2801
                        
2802
                        if (returnType.compareTo("int") == 0)
2803
                                return new Integer(JavaFileMethodsLoader.INT_TYPE);
2804
                
2805
                        if (returnType.compareTo("double") == 0)
2806
                                return new Integer(JavaFileMethodsLoader.DOUBLE_TYPE);
2807
        
2808
                        if (returnType.compareTo("String") == 0)
2809
                                return new Integer(JavaFileMethodsLoader.STRING_TYPE);
2810

    
2811
                        if (returnType.compareTo("char") == 0)
2812
                                return new Integer(JavaFileMethodsLoader.CHAR_TYPE);
2813

    
2814
                        if (returnType.compareTo("float") == 0)
2815
                                return new Integer(JavaFileMethodsLoader.FLOAT_TYPE);
2816
                        
2817
                        if (returnType.compareTo("void") == 0)
2818
                                return new Integer(JavaFileMethodsLoader.VOID_TYPE);
2819
                        
2820
                        if (returnType.compareTo("Object") == 0)
2821
                                return new Integer(JavaFileMethodsLoader.OBJECT_TYPE);
2822
                        
2823
                        // Other type of parameters
2824
                        return new Integer(JavaFileMethodsLoader.OTHER_TYPE);
2825
                        
2826
                }
2827
                
2828
                /**
2829
                 * Returns true if the method has almost one parameter that its type is unkwown (JavaFileMethodsLoader.OTHER_TYPE)
2830
                 * 
2831
                 * @param methodHead A method head
2832
                 * @return true or false
2833
                 */
2834
                public boolean hasTheMethodAnStrangeParameterType(String methodHead) {
2835
                        Vector types = this.getMethodParametersType(methodHead);
2836
                        Integer otherType = new Integer(JavaFileMethodsLoader.OTHER_TYPE);
2837
                        
2838
                        for (int i = 0; i < types.size(); i++) {
2839
                                if (((Integer)types.get(i)).intValue() == otherType.intValue())
2840
                                        return true;
2841
                        }
2842
                        
2843
                        return false;                        
2844
                }
2845
                
2846
                /**
2847
                 * Returns true if the method has a return parameter that its type is unkwown (JavaFileMethodsLoader.OTHER_TYPE)
2848
                 * 
2849
                 * @param methodHead A method head
2850
                 * @return true or false
2851
                 */
2852
                public boolean hasTheMethodAnStrangeReturnParameterType(String methodHead) {
2853
                        Integer otherType = new Integer(JavaFileMethodsLoader.OTHER_TYPE);
2854
                        
2855
                        if (((Integer)getMethodReturnType(methodHead)).intValue() == otherType.intValue())
2856
                                return true;
2857
                        
2858
                        return false;
2859
                }
2860
                
2861
                /**
2862
                 * Returns the number of methods loaded
2863
                 * 
2864
                 * @return Number of methods loaded
2865
                 */
2866
                public int size() {
2867
                        return methodHeads.size();
2868
                }
2869
                
2870
                /**
2871
                 * Returns the path of the file loaded
2872
                 * 
2873
                 * @return The path of the file loaded
2874
                 */
2875
                public String getPath() {
2876
                        return filePath;
2877
                }
2878

    
2879
                /**
2880
                 * Sets a path for a file to load, and loads it
2881
                 * 
2882
                 * @param aPath A path for a file to load
2883
                 */
2884
                public void setPath(String aPath) {
2885
                        this.filePath = aPath;
2886
                        file = new File(this.filePath);
2887
                        this.className = this.obteinClassName();
2888
                        this.processFile();
2889
                }                
2890

    
2891
                /**
2892
                 * Verifies if can read the file and invokes a method for analyze it
2893
                 */
2894
                private void processFile() {
2895
                        try
2896
                        {
2897
                                // Verify if exists the file
2898
                                if (!file.exists())
2899
                                {
2900
                                     // File doesn't exists
2901
                                         JOptionPane.showMessageDialog(null, Messages.getText("jOPMessageFileDoesntExists"), Messages.getText("error"), JOptionPane.ERROR_MESSAGE);
2902
                                         return;
2903
                                }
2904
                                
2905
                                // Verify if it's a file
2906
                                if (!file.isFile())
2907
                                {
2908
                                         JOptionPane.showMessageDialog(null, Messages.getText("jOPMessageIncorrectFile"), Messages.getText("error"), JOptionPane.ERROR_MESSAGE);
2909
                                         return;
2910
                                }
2911
                                
2912
                                // Verify if it can be read
2913
                                if (!file.canRead())
2914
                                {
2915
                                         JOptionPane.showMessageDialog(null, Messages.getText("jOPMessageFileWithoutReadPermissions"), Messages.getText("error"), JOptionPane.ERROR_MESSAGE);
2916
                                         return;
2917
                                }
2918
                                
2919
                                analyzeFile();
2920
                        }
2921
                        catch(Exception e)
2922
                        {
2923
                                e.printStackTrace();
2924
                        }
2925
                }
2926
                
2927
                /**
2928
                 * Analyes/loads a file, obtaining its methods and other information
2929
                 * 
2930
                 * @throws IOException 
2931
                 */
2932
                private void analyzeFile() throws IOException {
2933
                        String line, commentary, methodHead;
2934
                        int pos;
2935
                        
2936
                        // Process:
2937
                        // Associates a buffered-reader to the file-reader of the file
2938
                        BufferedReader input = new BufferedReader(new FileReader(file));
2939

    
2940
                        while(input.ready())
2941
                        {
2942
                                // Tries to read a commentary
2943
                                line = input.readLine();
2944

    
2945
                                if (line.startsWith("\t/*")) // This include the "\t/**" and "\t/*" commentary starts
2946
                                {
2947
                                        commentary = new String(line.trim());
2948
                                        
2949
                                        while((pos = (line = input.readLine()).indexOf("*/")) == -1)
2950
                                                commentary += "\n " + line.trim();
2951
                                        
2952
                                        commentary += "\n " + line.substring(0, pos+2).trim();
2953
                                        
2954
                                        // Tries to read the head of a method
2955
                                        line = input.readLine();
2956

    
2957
                                        if (line.startsWith("\tpublic ") || line.startsWith("\tprivate ") || line.startsWith("\tprotected "))
2958
                                        {
2959
                                                // Ignore inner/nested classes
2960
                                                if (line.indexOf(" class ") == -1)
2961
                                                {
2962
                                                        // Removes the '{' character if exists and does a trim:
2963
                                                        if ((pos = line.indexOf("{")) != -1)
2964
                                                                line = line.substring(0, pos);
2965
                                                        
2966
                                                        methodHead = new String(line.trim());
2967
                                                        commentary = commentary.trim();
2968

    
2969
                                                        // Adds needed information of the new method
2970
                                                        this.methodHeads.add(methodHead);
2971
                                                        this.methods.put(methodHead, commentary);
2972
                                                }
2973
                                        }
2974
                                }
2975
                        }
2976
                        
2977
                        // Closes the buffered-reader
2978
                        input.close();
2979
                }
2980
        }
2981
        
2982
        /**
2983
         * This class stores for a method, its previous commentary description
2984
         * 
2985
         * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
2986
         */
2987
        private class MethodsDescription implements Serializable{
2988
                private static final long serialVersionUID = 6939194736369543054L;
2989
                private String methodName;
2990
                private String description;
2991

    
2992
                /**
2993
                 * Default Constructor without parameters
2994
                 */
2995
                public MethodsDescription() {
2996
                        super();
2997
                }
2998

    
2999
                /**
3000
                 * Default Constructor with 2 parameters
3001
                 * 
3002
                 * @param methodName Name of a method
3003
                 * @param description Description (commentary) of the method
3004
                 */
3005
                public MethodsDescription(String methodName, String description) {
3006
                        super();
3007
                        this.methodName = methodName;
3008
                        this.description = description;
3009
                }
3010

    
3011
                /**
3012
                 * Returns the description of this method
3013
                 * 
3014
                 * @return Description of this method
3015
                 */
3016
                public String getDescription() {
3017
                        return description;
3018
                }
3019

    
3020
                /**
3021
                 * Sets a description for this method
3022
                 * 
3023
                 * @param description A description for this method
3024
                 */
3025
                public void setDescription(String description) {
3026
                        this.description = description;
3027
                }
3028

    
3029
                /**
3030
                 * Returns the name of this method
3031
                 * 
3032
                 * @return The name of this method
3033
                 */
3034
                public String getMethodName() {
3035
                        return methodName;
3036
                }
3037

    
3038
                /**
3039
                 * Sets a name of this method
3040
                 * 
3041
                 * @param methodName A name for this method
3042
                 */
3043
                public void setMethodName(String methodName) {
3044
                        this.methodName = methodName;
3045
                }
3046
        }
3047
}