Statistics
| Revision:

root / trunk / libraries / libUIComponent / src / org / gvsig / gui / beans / filterPanel / AbstractFilterQueryJPanel.java @ 17812

History | View | Annotate | Download (22.6 KB)

1
package org.gvsig.gui.beans.filterPanel;
2

    
3
import java.awt.Component;
4
import java.awt.Dimension;
5
import java.awt.GridBagConstraints;
6
import java.awt.GridBagLayout;
7
import java.awt.LayoutManager;
8
import java.beans.PropertyChangeEvent;
9
import java.beans.PropertyChangeListener;
10
import java.io.Serializable;
11
import java.util.HashSet;
12
import java.util.Hashtable;
13
import java.util.Set;
14
import java.util.Vector;
15

    
16
import javax.swing.Action;
17
import javax.swing.DefaultListModel;
18
import javax.swing.Icon;
19
import javax.swing.JButton;
20
import javax.swing.JCheckBox;
21
import javax.swing.JLabel;
22
import javax.swing.JList;
23
import javax.swing.JPanel;
24
import javax.swing.JScrollPane;
25
import javax.swing.JTextArea;
26
import javax.swing.JToolTip;
27
import javax.swing.JTree;
28
import javax.swing.ListModel;
29
import javax.swing.text.Document;
30
import javax.swing.tree.DefaultTreeCellRenderer;
31
import javax.swing.tree.DefaultTreeModel;
32
import javax.swing.tree.TreeModel;
33
import javax.swing.tree.TreeNode;
34

    
35
import org.gvsig.gui.beans.Messages;
36
import org.gvsig.gui.beans.controls.MultiLineToolTip;
37
import org.gvsig.gui.beans.editabletextcomponent.JEditableTextArea;
38
import org.gvsig.gui.beans.filterPanel.filterButtons.FilterButtonsJPanel;
39
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel;
40

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

    
82
/**
83
 * This abstract class represents the common components of the FilterQuery panels
84
 * 
85
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
86
 */
87
public abstract class AbstractFilterQueryJPanel extends AbstractPanel implements Serializable {
88
        public static final int DefaultHeight = 280;
89
        public static final int DefaultWidth = 490; 
90
        
91
        protected final int fieldsJPanelHeight = 145;
92
        protected final int fieldsJPanelWidth = 145;
93
        protected final int valuesJPanelHeight = fieldsJPanelHeight;
94
        protected final int valuesJPanelWidth = fieldsJPanelWidth;
95
        protected final int defaultBottomJPanelWidth = 480;
96
        protected final int defaultBottomJPanelHeight = 110;
97
        protected int filterJScrollPaneHeight;
98
        protected int filterJScrollPanelWidth;
99
        protected final int filterButtonsPanelHeight = FilterButtonsJPanel.default_FilterButtonsJPanelHeight;
100
        protected final int filterButtonsPanelWidth = FilterButtonsJPanel.default_FilterButtonsJPanelWidth;
101
        protected final int defaultTopJPanelWidth = defaultBottomJPanelWidth;
102
        protected final int defaultTopJPanelHeight = 145;
103
        protected int fieldsAndValuesJScrollPaneHeight = 110;
104
        protected int fieldsAndValuesJScrollPaneWidth = fieldsJPanelWidth;
105
        
106
        protected JLabelML fieldsJLabel = null;
107
        protected JLabelML valuesJLabel = null;
108
        protected JPanelML fieldsJPanel = null;
109
        protected JPanelML valuesJPanel = null;
110
        protected FilterButtonsJPanel filterButtonsJPanel = null;
111
        protected JScrollPaneML filterJScrollPane = null;
112
        protected JPanelML topJPanel = null;
113
        protected JPanelML bottomJPanel = null;
114
        protected JEditableTextAreaML txtExpression = null;
115
        protected JTreeML fieldsJTree = null;
116
        protected JListML valuesJList = null;
117
        protected JScrollPaneML fieldsJScrollPane = null;
118
        protected JScrollPaneML valuesJScrollPane = null;                
119

    
120
        protected String title;
121
        
122
        protected DefaultTreeModel defaultTreeModel;
123
        protected DefaultListModel valuesListModel;
124
                
125
        // A set with all simbols or operator names used
126
        private Set<String> operatorSymbols;
127
        
128
        
129
        /**
130
         * This is the default constructor
131
         */
132
        public AbstractFilterQueryJPanel(String _title) {                
133
                super();
134
                title = _title;
135
        }
136
        /**
137
         * This is the default constructor
138
         */
139
        public AbstractFilterQueryJPanel() {                
140
                super();
141
        }
142
        
143
        /**
144
         * This method initializes this
145
         */
146
        protected void initialize() {
147
                operatorSymbols = new HashSet<String>();
148
                        
149
                operatorSymbols.add("and");
150
//                operatorSymbols.add("Date");
151
                operatorSymbols.add("<>"); // In SQL this is the formal operator
152
                operatorSymbols.add("!="); // This operator is also supported
153
                operatorSymbols.add("=");
154
                operatorSymbols.add(">=");
155
                operatorSymbols.add("<=");
156
                operatorSymbols.add(">");
157
                operatorSymbols.add("not");
158
                operatorSymbols.add("or");
159
                operatorSymbols.add("(");
160
                operatorSymbols.add(")");
161
                operatorSymbols.add("<");
162

    
163
                this.setPreferredSize(new Dimension(DefaultWidth, DefaultHeight));
164
                
165
                this.setLayout(new GridBagLayout());
166
                GridBagConstraints gridBagConstraints = new GridBagConstraints();
167
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
168
                gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
169

    
170
                gridBagConstraints.anchor = GridBagConstraints.NORTH;
171
                this.add(getTopJPanel(), gridBagConstraints);
172

    
173
                gridBagConstraints.anchor = GridBagConstraints.SOUTH;
174
                this.add(getBottomJPanel(), gridBagConstraints);
175
        }
176
        
177
        /**
178
         * This method initializes topJPanel
179
         * 
180
         * @return javax.swing.JPanel
181
         */
182
        protected abstract javax.swing.JPanel getTopJPanel();
183
        
184
        /**
185
         * This method initializes bottomJPanel
186
         * 
187
         * @return javax.swing.JPanel
188
         */
189
        protected abstract JPanel getBottomJPanel();        
190
        
191
        /**
192
         * This method initializes fieldsJLabel
193
         *
194
         * @return javax.swing.JLabel
195
         */
196
        protected JLabel getFieldsJLabel() {
197
                if (fieldsJLabel == null) {
198
                        fieldsJLabel = new JLabelML();
199
                        fieldsJLabel.setText(Messages.getText("fields_uppercase_first") + ":");
200
                }
201

    
202
                return fieldsJLabel;
203
        }        
204

    
205
        /**
206
         * This method initializes valuesJList
207
         *
208
         * @return javax.swing.JList
209
         */
210
        protected abstract javax.swing.JList getValuesJList();
211
        
212
        /**
213
         * This method initializes fieldsJPanel
214
         *
215
         * @return javax.swing.JPanel
216
         */
217
        protected abstract JPanel getFieldsJPanel();
218

    
219
        /**
220
         * This method initializes jScrollPane
221
         *
222
         * @return javax.swing.JScrollPane
223
         */
224
        protected abstract javax.swing.JScrollPane getFieldsJScrollPane();
225

    
226
        /**
227
         * This method initializes valuesJLabel
228
         *
229
         * @return javax.swing.JLabel
230
         */
231
        protected javax.swing.JLabel getValuesJLabel() {
232
                if (valuesJLabel == null) {
233
                        valuesJLabel = new JLabelML();
234
                        valuesJLabel.setText(Messages.getText("known_values") + ":");
235
                }
236

    
237
                return valuesJLabel;
238
        }
239
        
240
        /**
241
         * This method initializes valuesJPanel
242
         *
243
         * @return javax.swing.JPanel
244
         */
245
        protected abstract JPanel getValuesJPanel();
246
        
247
        /**
248
         * This method initializes jScrollPane1
249
         *
250
         * @return javax.swing.JScrollPane
251
         */
252
        protected abstract javax.swing.JScrollPane getValuesJScrollPane();
253
        
254
        /**
255
         * This method initializes filterJScrollPane
256
         *
257
         * @return javax.swing.JScrollPane
258
         */
259
        protected abstract javax.swing.JScrollPane getFilterJScrollPane();
260

    
261
        /**
262
         * This method initializes txtExpression
263
         *
264
         * @return javax.swing.JTextArea
265
         */
266
        protected abstract javax.swing.JTextArea getTxtExpression();
267
        
268
        /**
269
         * Adds a symbol to the filter expression.
270
         *
271
         * @param symbol symbol to add
272
         */
273
        protected void putSymbol(String symbol) {
274
                int position = getTxtExpression().getCaretPosition();
275
                
276
                getTxtExpression().setText(insert(getTxtExpression().getText(), position, symbol));
277

    
278
                if (symbol.equals(" () ")) {
279
                        position = position + 2;
280
                } else {
281
                        position = position + symbol.length();
282
                }
283

    
284
                getTxtExpression().setCaretPosition(position);
285
        }
286
        
287
        /**
288
         * This method initializes fieldsJTree
289
         *
290
         * @return org.gvsig.gui.beans.swing.jTree
291
         */
292
        protected javax.swing.JTree getFieldsJTree() {
293
                if (fieldsJTree == null) {
294
                        fieldsJTree = new JTreeML(new Vector(0,1));
295
                        
296
                        // Remove icons:
297
                        DefaultTreeCellRenderer defaultTreeCellRenderer = new DefaultTreeCellRenderer();
298
                        defaultTreeCellRenderer.setOpenIcon(null);
299
                        defaultTreeCellRenderer.setClosedIcon(null);
300
                        defaultTreeCellRenderer.setLeafIcon(null);
301
                        
302
                        // Root not visible
303
                        fieldsJTree.setRootVisible(false);
304
                        fieldsJTree.setCellRenderer(defaultTreeCellRenderer);
305
                }
306

    
307
                return fieldsJTree;
308
        }
309
        
310
    /**
311
     * Inserts an <i>string</i> at a position of another one.
312
     *
313
     * @param base original <i>string</i> where will be inserted
314
     * @param position position at the <i>string</i> where will be inserted
315
     * @param graft <i>string</i> to insert
316
     *
317
     * @return the new <i>string</i> with the graft inserted in
318
     */
319
    protected static String insert(String base, int position, String graft) {
320
        return base.substring(0, position) + graft + base.substring(position);
321
    }
322

    
323
        /**
324
         * This method initializes filterButtonsJPanel
325
         *
326
         * @return javax.swing.JPanel
327
         */
328
        protected JPanel getFilterButtonsJPanel() {
329
                if (filterButtonsJPanel == null) {
330
                        filterButtonsJPanel = new FilterButtonsJPanel();
331
                        filterButtonsJPanel.setPreferredSize(new Dimension(filterButtonsPanelWidth, filterButtonsPanelHeight));
332
                        filterButtonsJPanel.addPropertyChangeListener(new PropertyChangeListener() {
333
                                /*
334
                                 *  (non-Javadoc)
335
                                 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
336
                                 */
337
                                public void propertyChange(PropertyChangeEvent arg0) {
338
                                        if (arg0.getPropertyName().equals(FilterButtonsJPanel.BUTTON_CLICKED_ACTION_COMMAND)) {
339
                                    
340
                                                switch(Integer.parseInt(arg0.getNewValue().toString()))        {
341
                                                        case FilterButtonsJPanel.AND:
342
                                                                putSymbol(" and ");
343
                                                                break;
344
                                                        case FilterButtonsJPanel.DATE:
345
                                                                putSymbol( ((FilterButtonsJPanel)arg0.getSource()).getLastSelectedDate() );
346
                                                                break;
347
                                                        case FilterButtonsJPanel.DISTINCT:
348
                                                                putSymbol(" <> ");
349
                                                                break;
350
                                                        case FilterButtonsJPanel.EQUAL:
351
                                                                putSymbol(" = ");
352
                                                                break;
353
                                                        case FilterButtonsJPanel.EQUALGREATER:
354
                                                                putSymbol(" >= ");
355
                                                                break;
356
                                                        case FilterButtonsJPanel.EQUALSMALLER:
357
                                                                putSymbol(" <= ");
358
                                                                break;
359
                                                        case FilterButtonsJPanel.GREATER:
360
                                                                putSymbol(" > ");
361
                                                                break;
362
                                                        case FilterButtonsJPanel.NOT:
363
                                                                putSymbol(" not ");
364
                                                                break;
365
                                                        case FilterButtonsJPanel.OR:
366
                                                                putSymbol(" or ");
367
                                                                break;
368
                                                        case FilterButtonsJPanel.PARENTHESIS:
369
                                                                putSymbol(" () ");
370
                                                                break;
371
                                                        case FilterButtonsJPanel.SMALLER:
372
                                                                putSymbol(" < ");
373
                                                                break;
374
                                                        case FilterButtonsJPanel.DELETE_TEXT:
375
                                                                txtExpression.setText("");
376
                                                                break;
377
                                                        default: // do anything
378
                                        }
379
                                        }
380
                                }                        
381
                        });
382
                }
383
                
384
                return filterButtonsJPanel;
385
        }
386

    
387
        /**
388
         * Returns a set with all symbols used as operators
389
         * 
390
         * @return A set
391
         */
392
        protected Set<String> getAllOperatorSymbols() {
393
                return operatorSymbols;                
394
        }
395

    
396
        /**
397
         * Sets new height to the 'topJPanel', (new Height must be bigger than default, else do nothing)
398
         * 
399
         * @param new_Height New height
400
         */
401
        public void resizeHeight(int new_Height) {
402
                int difference = new_Height - DefaultHeight;
403
                
404
                if (difference > 0) {
405
                        this.setPreferredSize(new Dimension(this.getPreferredSize().width, this.getPreferredSize().height + difference));
406
                        getTopJPanel().setPreferredSize(new Dimension(getTopJPanel().getPreferredSize().width, getTopJPanel().getPreferredSize().height + difference));
407
                        
408
                        getFieldsJPanel().setPreferredSize(new Dimension(getFieldsJPanel().getPreferredSize().width, getFieldsJPanel().getPreferredSize().height + difference));
409
                        getFieldsJScrollPane().setPreferredSize(new Dimension(getFieldsJScrollPane().getPreferredSize().width, getFieldsJScrollPane().getPreferredSize().height + difference));
410
                
411
                        getValuesJPanel().setPreferredSize(new Dimension(getValuesJPanel().getPreferredSize().width, getValuesJPanel().getPreferredSize().height + difference));
412
                        getValuesJScrollPane().setPreferredSize(new Dimension(getValuesJScrollPane().getPreferredSize().width, getValuesJScrollPane().getPreferredSize().height + difference));
413
                }
414
        }
415

    
416
        /**
417
         * Sets the width to this JPanel
418
         * 
419
         * @param new_Width New width
420
         */
421
        public abstract void resizeWidth(int new_Width);
422

    
423
        /*
424
         *  (non-Javadoc)
425
         * @see java.awt.Component#resize(int, int)
426
         */
427
        public void resize(int width, int height) {
428
                int difference = height - DefaultHeight;
429

    
430
                if (difference != 0)
431
                        this.resizeHeight(height);
432
                
433
                this.resizeWidth(width);
434
        }
435

    
436
        /*
437
         *  (non-Javadoc)
438
         * @see java.awt.Component#resize(java.awt.Dimension)
439
         */
440
        public void resize(Dimension d) {
441
                int difference = d.height - DefaultHeight;
442

    
443
                if (difference != 0)
444
                        this.resizeHeight(d.height);
445
                
446
                this.resizeWidth(d.width);
447
        }
448

    
449
        /*
450
         * (non-Javadoc)
451
         * @see org.gvsig.gui.beans.panelGroup.panels.AbstractPanel#accept()
452
         */
453
        public void accept() {
454
        }
455

    
456
        /*
457
         * (non-Javadoc)
458
         * @see org.gvsig.gui.beans.panelGroup.panels.AbstractPanel#apply()
459
         */
460
        public void apply() {
461
        }
462

    
463
        /*
464
         * (non-Javadoc)
465
         * @see org.gvsig.gui.beans.panelGroup.panels.AbstractPanel#cancel()
466
         */
467
        public void cancel() {
468
        }        
469

    
470
        /*
471
         * (non-Javadoc)
472
         * @see org.gvsig.gui.beans.panelGroup.panels.AbstractPanel#selected()
473
         */
474
        public void selected() {                
475
        }
476

    
477
        /**
478
         * JCrollPane with multi line tool tip text.
479
         * 
480
         * @see JScrollPane
481
         * 
482
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
483
         */
484
        protected class JScrollPaneML extends JScrollPane {
485
                private static final long serialVersionUID = 5222187234181725243L;
486

    
487
                /**
488
                 * @see JScrollPane#JScrollPane()
489
                 */
490
                public JScrollPaneML() {
491
                        super();
492
                }
493

    
494
                /**
495
                 * @see JScrollPane#JScrollPane(Component, int, int)
496
                 */
497
                public JScrollPaneML(Component view, int vsbPolicy, int hsbPolicy) {
498
                        super(view, vsbPolicy, hsbPolicy);
499
                }
500

    
501
                /**
502
                 * @see JScrollPane#JScrollPane(Component)
503
                 */
504
                public JScrollPaneML(Component view) {
505
                        super(view);
506
                }
507

    
508
                /**
509
                 * @see JScrollPane#JScrollPane(int, int)
510
                 */
511
                public JScrollPaneML(int vsbPolicy, int hsbPolicy) {
512
                        super(vsbPolicy, hsbPolicy);
513
                }
514
                
515
                /*
516
                 * (non-Javadoc)
517
                 * @see javax.swing.JComponent#createToolTip()
518
                 */
519
            public JToolTip createToolTip() {
520
                    // Multiline support
521
                    MultiLineToolTip tip = new MultiLineToolTip();
522
                    tip.setComponent(this);
523
                    return tip;
524
            }
525
        }
526

    
527
        /**
528
         * JLabel with multi line tool tip text.
529
         * 
530
         * @see JLabel
531
         * 
532
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
533
         */
534
        protected class JLabelML extends JLabel {
535
                private static final long serialVersionUID = 525349503578470487L;
536

    
537
                /**
538
                 * @see JLabel#JLabel()
539
                 */
540
                public JLabelML() {
541
                        super();
542
                }
543

    
544
                /**
545
                 * @see JLabel#JLabel(Icon, int)
546
                 */
547
                public JLabelML(Icon image, int horizontalAlignment) {
548
                        super(image, horizontalAlignment);
549
                }
550

    
551
                /**
552
                 * @see JLabel#JLabel(Icon)
553
                 */
554
                public JLabelML(Icon image) {
555
                        super(image);
556
                }
557

    
558
                /**
559
                 * @see JLabel#JLabel(String, Icon, int)
560
                 */
561
                public JLabelML(String text, Icon icon, int horizontalAlignment) {
562
                        super(text, icon, horizontalAlignment);
563
                }
564

    
565
                /**
566
                 * @see JLabel#JLabel(String, int)
567
                 */
568
                public JLabelML(String text, int horizontalAlignment) {
569
                        super(text, horizontalAlignment);
570
                }
571

    
572
                /**
573
                 * @see JLabel#JLabel(String)
574
                 */
575
                public JLabelML(String text) {
576
                        super(text);
577
                }
578

    
579
                /*
580
                 * (non-Javadoc)
581
                 * @see javax.swing.JComponent#createToolTip()
582
                 */
583
            public JToolTip createToolTip() {
584
                    // Multiline support
585
                    MultiLineToolTip tip = new MultiLineToolTip();
586
                    tip.setComponent(this);
587
                    return tip;
588
            }
589
        }
590
        
591
        /**
592
         * JPanel with multi line tool tip text.
593
         * 
594
         * @see JPanel
595
         * 
596
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
597
         */
598
        protected class JPanelML extends JPanel {
599
                private static final long serialVersionUID = 5951860640473906815L;
600

    
601
                /**
602
                 * @see JPanel#JPanel()
603
                 */
604
                public JPanelML() {
605
                        super();
606
                }
607

    
608
                /**
609
                 * @see JPanel#JPanel(boolean)
610
                 */
611
                public JPanelML(boolean isDoubleBuffered) {
612
                        super(isDoubleBuffered);
613
                }
614

    
615
                /**
616
                 * @see JPanel#JPanel(LayoutManager, boolean)
617
                 */
618
                public JPanelML(LayoutManager layout, boolean isDoubleBuffered) {
619
                        super(layout, isDoubleBuffered);
620
                }
621

    
622
                /**
623
                 * @see JPanel#JPanel(LayoutManager)
624
                 */
625
                public JPanelML(LayoutManager layout) {
626
                        super(layout);
627
                }
628

    
629
                /*
630
                 * (non-Javadoc)
631
                 * @see javax.swing.JComponent#createToolTip()
632
                 */
633
            public JToolTip createToolTip() {
634
                    // Multiline support
635
                    MultiLineToolTip tip = new MultiLineToolTip();
636
                    tip.setComponent(this);
637
                    return tip;
638
            }
639
        }
640

    
641
        /**
642
         * Editable text area with multi line tool tip text.
643
         * 
644
         * @see JEditableTextArea
645
         * 
646
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
647
         */
648
        protected class JEditableTextAreaML extends JEditableTextArea {
649
                private static final long serialVersionUID = -6963953475368014077L;
650

    
651
                /**
652
                 * @see JTextArea#JTextArea()
653
                 */
654
                public JEditableTextAreaML() {
655
                        super();
656
                }
657

    
658
                /**
659
                 * @see JTextArea#JTextArea(Document, String, int, int)
660
                 */
661
                public JEditableTextAreaML(Document doc, String text, int rows, int columns) {
662
                        super(doc, text, rows, columns);
663
                }
664

    
665
                /**
666
                 * @see JTextArea#JTextArea(Document)
667
                 */
668
                public JEditableTextAreaML(Document doc) {
669
                        super(doc);
670
                }
671

    
672
                /**
673
                 * @see JTextArea#JTextArea(int, int)
674
                 */
675
                public JEditableTextAreaML(int rows, int columns) {
676
                        super(rows, columns);
677
                }
678

    
679
                /**
680
                 * @see JTextArea#JTextArea(String, int, int)
681
                 */
682
                public JEditableTextAreaML(String text, int rows, int columns) {
683
                        super(text, rows, columns);
684
                }
685

    
686
                /**
687
                 * @see JTextArea#JTextArea(String)
688
                 */
689
                public JEditableTextAreaML(String text) {
690
                        super(text);
691
                }
692

    
693
                /*
694
                 * (non-Javadoc)
695
                 * @see javax.swing.JComponent#createToolTip()
696
                 */
697
            public JToolTip createToolTip() {
698
                    // Multiline support
699
                    MultiLineToolTip tip = new MultiLineToolTip();
700
                    tip.setComponent(this);
701
                    return tip;
702
            }        
703
        }
704

    
705
        /**
706
         * JTree with multi line tool tip text.
707
         * 
708
         * @see JTree
709
         * 
710
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
711
         */
712
        protected class JTreeML extends JTree {
713
                private static final long serialVersionUID = -8619256256346496435L;
714

    
715
                /**
716
                 * @see JTree#JTree()
717
                 */
718
                public JTreeML() {
719
                        super();
720
                }
721

    
722
                /**
723
                 * @see JTree#JTree(Hashtable)
724
                 */
725
                public JTreeML(Hashtable<?, ?> value) {
726
                        super(value);
727
                }
728

    
729
                /**
730
                 * @see JTree#JTree(Object[])
731
                 */
732
                public JTreeML(Object[] value) {
733
                        super(value);
734
                }
735

    
736
                /**
737
                 * @see JTree#JTree(TreeModel)
738
                 */
739
                public JTreeML(TreeModel newModel) {
740
                        super(newModel);
741
                }
742

    
743
                /**
744
                 * @see JTree#JTree(TreeNode, boolean)
745
                 */
746
                public JTreeML(TreeNode root, boolean asksAllowsChildren) {
747
                        super(root, asksAllowsChildren);
748
                }
749

    
750
                /**
751
                 * @see JTree#JTree(TreeNode)
752
                 */
753
                public JTreeML(TreeNode root) {
754
                        super(root);
755
                }
756

    
757
                /**
758
                 * @see JTree#JTree(Vector)
759
                 */
760
                public JTreeML(Vector<?> value) {
761
                        super(value);
762
                }
763

    
764
                /*
765
                 * (non-Javadoc)
766
                 * @see javax.swing.JComponent#createToolTip()
767
                 */
768
            public JToolTip createToolTip() {
769
                    // Multiline support
770
                    MultiLineToolTip tip = new MultiLineToolTip();
771
                    tip.setComponent(this);
772
                    return tip;
773
            }                
774
        }
775

    
776
        /**
777
         * JList with multi line tool tip text.
778
         * 
779
         * @see JList
780
         * 
781
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
782
         */
783
        protected class JListML extends JList {
784
                private static final long serialVersionUID = 5316332987144988365L;
785

    
786
                /**
787
                 * @see JList#JList()
788
                 */
789
                public JListML() {
790
                        super();
791
                }
792

    
793
                /**
794
                 * @see JList#JList(ListModel)
795
                 */
796
                public JListML(ListModel dataModel) {
797
                        super(dataModel);
798
                }
799

    
800
                /**
801
                 * @see JList#JList(Object[])
802
                 */
803
                public JListML(Object[] listData) {
804
                        super(listData);
805
                }
806

    
807
                /**
808
                 * @see JTree#JTree(Vector)
809
                 */
810
                public JListML(Vector<?> listData) {
811
                        super(listData);
812
                }
813

    
814
                /*
815
                 * (non-Javadoc)
816
                 * @see javax.swing.JComponent#createToolTip()
817
                 */
818
            public JToolTip createToolTip() {
819
                    // Multiline support
820
                    MultiLineToolTip tip = new MultiLineToolTip();
821
                    tip.setComponent(this);
822
                    return tip;
823
            }                
824
        }
825

    
826
        /**
827
         * JCheckBox with multi line tool tip text.
828
         * 
829
         * @see JCheckBox
830
         * 
831
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
832
         */
833
        protected class JCheckBoxML extends JCheckBox {
834
                private static final long serialVersionUID = 2610142188236840664L;
835

    
836
                /**
837
                 * @see JCheckBox#JCheckBox()
838
                 */
839
                public JCheckBoxML() {
840
                        super();
841
                }
842

    
843
                /**
844
                 * @see JCheckBox#JCheckBox(Action)
845
                 */
846
                public JCheckBoxML(Action a) {
847
                        super(a);
848
                }
849

    
850
                /**
851
                 * @see JCheckBox#JCheckBox(Icon, boolean)
852
                 */
853
                public JCheckBoxML(Icon icon, boolean selected) {
854
                        super(icon, selected);
855
                }
856

    
857
                /**
858
                 * @see JCheckBox#JCheckBox(Icon)
859
                 */
860
                public JCheckBoxML(Icon icon) {
861
                        super(icon);
862
                }
863

    
864
                /**
865
                 * @see JCheckBox#JCheckBox(String, boolean)
866
                 */
867
                public JCheckBoxML(String text, boolean selected) {
868
                        super(text, selected);
869
                }
870

    
871
                /**
872
                 * @see JCheckBox#JCheckBox(String, Icon, boolean)
873
                 */
874
                public JCheckBoxML(String text, Icon icon, boolean selected) {
875
                        super(text, icon, selected);
876
                }
877

    
878
                /**
879
                 *@see JCheckBox#JCheckBox(String, Icon)
880
                 */
881
                public JCheckBoxML(String text, Icon icon) {
882
                        super(text, icon);
883
                }
884

    
885
                /**
886
                 * @see JCheckBox#JCheckBox(String)
887
                 */
888
                public JCheckBoxML(String text) {
889
                        super(text);
890
                }
891

    
892
                /*
893
                 * (non-Javadoc)
894
                 * @see javax.swing.JComponent#createToolTip()
895
                 */
896
            public JToolTip createToolTip() {
897
                    // Multiline support
898
                    MultiLineToolTip tip = new MultiLineToolTip();
899
                    tip.setComponent(this);
900
                    return tip;
901
            }                
902
        }
903

    
904
        /**
905
         * JButton with multi line tool tip text.
906
         * 
907
         * @see JButton
908
         * 
909
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
910
         */
911
    protected class JButtonML extends JButton {
912
                private static final long serialVersionUID = -6052122756677251026L;
913

    
914
                /**
915
                 * @see JButton#JButton()
916
                 */
917
                public JButtonML() {
918
                        super();
919
                }
920

    
921
                /**
922
                 * @see JButton#JButton(Action)
923
                 */
924
                public JButtonML(Action a) {
925
                        super(a);
926
                }
927

    
928
                /**
929
                 * @see JButton#JButton(Icon)
930
                 */
931
                public JButtonML(Icon icon) {
932
                        super(icon);
933
                }
934

    
935
                /**
936
                 * @see JButton#JButton(String, Icon)
937
                 */
938
                public JButtonML(String text, Icon icon) {
939
                        super(text, icon);
940
                }
941

    
942
                /**
943
                 * @see JButton#JButton(String)
944
                 */
945
                public JButtonML(String text) {
946
                        super(text);
947
                }
948

    
949
                /*
950
             * (non-Javadoc)
951
             * @see javax.swing.JComponent#createToolTip()
952
             */
953
        public JToolTip createToolTip() {
954
                // Multiline support
955
                MultiLineToolTip tip = new MultiLineToolTip();
956
                tip.setComponent(this);
957
                return tip;
958
        }                
959
    }
960
}