Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / main / java / org / gvsig / gui / beans / filterPanel / AbstractFilterQueryJPanel.java @ 40561

History | View | Annotate | Download (23.6 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.gui.beans.filterPanel;
25

    
26
import java.awt.Component;
27
import java.awt.Dimension;
28
import java.awt.GridBagConstraints;
29
import java.awt.GridBagLayout;
30
import java.awt.LayoutManager;
31
import java.beans.PropertyChangeEvent;
32
import java.beans.PropertyChangeListener;
33
import java.io.Serializable;
34
import java.util.HashSet;
35
import java.util.Hashtable;
36
import java.util.Set;
37
import java.util.Vector;
38

    
39
import javax.swing.Action;
40
import javax.swing.DefaultListModel;
41
import javax.swing.Icon;
42
import javax.swing.JButton;
43
import javax.swing.JCheckBox;
44
import javax.swing.JLabel;
45
import javax.swing.JList;
46
import javax.swing.JPanel;
47
import javax.swing.JScrollPane;
48
import javax.swing.JTextArea;
49
import javax.swing.JToolTip;
50
import javax.swing.JTree;
51
import javax.swing.ListModel;
52
import javax.swing.text.Document;
53
import javax.swing.tree.DefaultTreeCellRenderer;
54
import javax.swing.tree.DefaultTreeModel;
55
import javax.swing.tree.TreeModel;
56
import javax.swing.tree.TreeNode;
57

    
58
import org.gvsig.gui.beans.Messages;
59
import org.gvsig.gui.beans.controls.MultiLineToolTip;
60
import org.gvsig.gui.beans.editabletextcomponent.JEditableTextArea;
61
import org.gvsig.gui.beans.filterPanel.filterButtons.FilterButtonsJPanel;
62
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel;
63

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

    
105
/**
106
 * This abstract class represents the common components of the FilterQuery panels
107
 * 
108
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
109
 */
110
public abstract class AbstractFilterQueryJPanel extends AbstractPanel implements Serializable {
111
        public static final int DefaultHeight = 280;
112
        public static final int DefaultWidth = 490; 
113
        
114
        protected final int fieldsJPanelHeight = 145;
115
        protected final int fieldsJPanelWidth = 145;
116
        protected final int valuesJPanelHeight = fieldsJPanelHeight;
117
        protected final int valuesJPanelWidth = fieldsJPanelWidth;
118
        protected final int defaultBottomJPanelWidth = 480;
119
        protected final int defaultBottomJPanelHeight = 110;
120
        protected int filterJScrollPaneHeight;
121
        protected int filterJScrollPanelWidth;
122
        protected final int filterButtonsPanelHeight = FilterButtonsJPanel.default_FilterButtonsJPanelHeight;
123
        protected final int filterButtonsPanelWidth = FilterButtonsJPanel.default_FilterButtonsJPanelWidth;
124
        protected final int defaultTopJPanelWidth = defaultBottomJPanelWidth;
125
        protected final int defaultTopJPanelHeight = 145;
126
        protected int fieldsAndValuesJScrollPaneHeight = 110;
127
        protected int fieldsAndValuesJScrollPaneWidth = fieldsJPanelWidth;
128
        
129
        protected JLabelML fieldsJLabel = null;
130
        protected JLabelML valuesJLabel = null;
131
        protected JPanelML fieldsJPanel = null;
132
        protected JPanelML valuesJPanel = null;
133
        protected FilterButtonsJPanel filterButtonsJPanel = null;
134
        protected JScrollPaneML filterJScrollPane = null;
135
        protected JPanelML topJPanel = null;
136
        protected JPanelML bottomJPanel = null;
137
        protected JEditableTextAreaML txtExpression = null;
138
        protected JTreeML fieldsJTree = null;
139
        protected JListML valuesJList = null;
140
        protected JScrollPaneML fieldsJScrollPane = null;
141
        protected JScrollPaneML valuesJScrollPane = null;                
142

    
143
        protected String title;
144
        
145
        protected DefaultTreeModel defaultTreeModel;
146
        protected DefaultListModel valuesListModel;
147
                
148
        // A set with all simbols or operator names used
149
        private Set<String> operatorSymbols;
150
        
151
        
152
        /**
153
         * This is the default constructor
154
         */
155
        public AbstractFilterQueryJPanel(String _title) {                
156
                super();
157
                title = _title;
158
        }
159
        /**
160
         * This is the default constructor
161
         */
162
        public AbstractFilterQueryJPanel() {                
163
                super();
164
        }
165
        
166
        /**
167
         * This method initializes this
168
         */
169
        protected void initialize() {
170
                operatorSymbols = new HashSet<String>();
171
                        
172
                operatorSymbols.add("and");
173
//                operatorSymbols.add("Date");
174
                operatorSymbols.add("<>"); // In SQL this is the formal operator
175
                operatorSymbols.add("!="); // This operator is also supported
176
                operatorSymbols.add("=");
177
                operatorSymbols.add(">=");
178
                operatorSymbols.add("<=");
179
                operatorSymbols.add(">");
180
                operatorSymbols.add("not");
181
                operatorSymbols.add("or");
182
                operatorSymbols.add("(");
183
                operatorSymbols.add(")");
184
                operatorSymbols.add("<");
185

    
186
                this.setPreferredSize(new Dimension(DefaultWidth, DefaultHeight));
187
                
188
                this.setLayout(new GridBagLayout());
189
                GridBagConstraints gridBagConstraints = new GridBagConstraints();
190
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
191
                gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
192

    
193
                gridBagConstraints.anchor = GridBagConstraints.NORTH;
194
                this.add(getTopJPanel(), gridBagConstraints);
195

    
196
                gridBagConstraints.anchor = GridBagConstraints.SOUTH;
197
                this.add(getBottomJPanel(), gridBagConstraints);
198
        }
199
        
200
        /**
201
         * This method initializes topJPanel
202
         * 
203
         * @return javax.swing.JPanel
204
         */
205
        protected abstract javax.swing.JPanel getTopJPanel();
206
        
207
        /**
208
         * This method initializes bottomJPanel
209
         * 
210
         * @return javax.swing.JPanel
211
         */
212
        protected abstract JPanel getBottomJPanel();        
213
        
214
        /**
215
         * This method initializes fieldsJLabel
216
         *
217
         * @return javax.swing.JLabel
218
         */
219
        protected JLabel getFieldsJLabel() {
220
                if (fieldsJLabel == null) {
221
                        fieldsJLabel = new JLabelML();
222
                        fieldsJLabel.setText(Messages.getText("fields_uppercase_first") + ":");
223
                }
224

    
225
                return fieldsJLabel;
226
        }        
227

    
228
        /**
229
         * This method initializes valuesJList
230
         *
231
         * @return javax.swing.JList
232
         */
233
        protected abstract javax.swing.JList getValuesJList();
234
        
235
        /**
236
         * This method initializes fieldsJPanel
237
         *
238
         * @return javax.swing.JPanel
239
         */
240
        protected abstract JPanel getFieldsJPanel();
241

    
242
        /**
243
         * This method initializes jScrollPane
244
         *
245
         * @return javax.swing.JScrollPane
246
         */
247
        protected abstract javax.swing.JScrollPane getFieldsJScrollPane();
248

    
249
        /**
250
         * This method initializes valuesJLabel
251
         *
252
         * @return javax.swing.JLabel
253
         */
254
        protected javax.swing.JLabel getValuesJLabel() {
255
                if (valuesJLabel == null) {
256
                        valuesJLabel = new JLabelML();
257
                        valuesJLabel.setText(Messages.getText("known_values") + ":");
258
                }
259

    
260
                return valuesJLabel;
261
        }
262
        
263
        /**
264
         * This method initializes valuesJPanel
265
         *
266
         * @return javax.swing.JPanel
267
         */
268
        protected abstract JPanel getValuesJPanel();
269
        
270
        /**
271
         * This method initializes jScrollPane1
272
         *
273
         * @return javax.swing.JScrollPane
274
         */
275
        protected abstract javax.swing.JScrollPane getValuesJScrollPane();
276
        
277
        /**
278
         * This method initializes filterJScrollPane
279
         *
280
         * @return javax.swing.JScrollPane
281
         */
282
        protected abstract javax.swing.JScrollPane getFilterJScrollPane();
283

    
284
        /**
285
         * This method initializes txtExpression
286
         *
287
         * @return javax.swing.JTextArea
288
         */
289
        protected abstract javax.swing.JTextArea getTxtExpression();
290
        
291
        /**
292
         * Adds a symbol to the filter expression.
293
         *
294
         * @param symbol symbol to add
295
         */
296
        protected void putSymbol(String symbol) {
297
                int position = getTxtExpression().getCaretPosition();
298
                
299
                getTxtExpression().setText(insert(getTxtExpression().getText(), position, symbol));
300

    
301
                if (symbol.equals(" () ")) {
302
                        position = position + 2;
303
                } else {
304
                        position = position + symbol.length();
305
                }
306

    
307
                getTxtExpression().setCaretPosition(position);
308
        }
309
        
310
        /**
311
         * This method initializes fieldsJTree
312
         *
313
         * @return org.gvsig.gui.beans.swing.jTree
314
         */
315
        protected javax.swing.JTree getFieldsJTree() {
316
                if (fieldsJTree == null) {
317
                        fieldsJTree = new JTreeML(new Vector(0,1));
318
                        
319
                        // Remove icons:
320
                        DefaultTreeCellRenderer defaultTreeCellRenderer = new DefaultTreeCellRenderer();
321
                        defaultTreeCellRenderer.setOpenIcon(null);
322
                        defaultTreeCellRenderer.setClosedIcon(null);
323
                        defaultTreeCellRenderer.setLeafIcon(null);
324
                        
325
                        // Root not visible
326
                        fieldsJTree.setRootVisible(false);
327
                        fieldsJTree.setCellRenderer(defaultTreeCellRenderer);
328
                }
329

    
330
                return fieldsJTree;
331
        }
332
        
333
    /**
334
     * Inserts an <i>string</i> at a position of another one.
335
     *
336
     * @param base original <i>string</i> where will be inserted
337
     * @param position position at the <i>string</i> where will be inserted
338
     * @param graft <i>string</i> to insert
339
     *
340
     * @return the new <i>string</i> with the graft inserted in
341
     */
342
    protected static String insert(String base, int position, String graft) {
343
        return base.substring(0, position) + graft + base.substring(position);
344
    }
345

    
346
        /**
347
         * This method initializes filterButtonsJPanel
348
         *
349
         * @return javax.swing.JPanel
350
         */
351
        protected JPanel getFilterButtonsJPanel() {
352
                if (filterButtonsJPanel == null) {
353
                        filterButtonsJPanel = new FilterButtonsJPanel();
354
                        filterButtonsJPanel.setPreferredSize(new Dimension(filterButtonsPanelWidth, filterButtonsPanelHeight));
355
                        filterButtonsJPanel.addPropertyChangeListener(new PropertyChangeListener() {
356
                                /*
357
                                 *  (non-Javadoc)
358
                                 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
359
                                 */
360
                                public void propertyChange(PropertyChangeEvent arg0) {
361
                                        if (arg0.getPropertyName().equals(FilterButtonsJPanel.BUTTON_CLICKED_ACTION_COMMAND)) {
362
                                    
363
                                                switch(Integer.parseInt(arg0.getNewValue().toString()))        {
364
                                                        case FilterButtonsJPanel.AND:
365
                                                                putSymbol(" and ");
366
                                                                break;
367
                                                        case FilterButtonsJPanel.DATE:
368
                                                                putSymbol( ((FilterButtonsJPanel)arg0.getSource()).getLastSelectedDate() );
369
                                                                break;
370
                                                        case FilterButtonsJPanel.DISTINCT:
371
                                                                putSymbol(" != ");
372
                                                                break;
373
                                                        case FilterButtonsJPanel.EQUAL:
374
                                                                putSymbol(" = ");
375
                                                                break;
376
                                                        case FilterButtonsJPanel.EQUALGREATER:
377
                                                                putSymbol(" >= ");
378
                                                                break;
379
                                                        case FilterButtonsJPanel.EQUALSMALLER:
380
                                                                putSymbol(" <= ");
381
                                                                break;
382
                                                        case FilterButtonsJPanel.GREATER:
383
                                                                putSymbol(" > ");
384
                                                                break;
385
                                                        case FilterButtonsJPanel.NOT:
386
                                                                putSymbol(" not ");
387
                                                                break;
388
                                                        case FilterButtonsJPanel.OR:
389
                                                                putSymbol(" or ");
390
                                                                break;
391
                                                        case FilterButtonsJPanel.PARENTHESIS:
392
                                                                putSymbol(" () ");
393
                                                                break;
394
                                                        case FilterButtonsJPanel.SMALLER:
395
                                                                putSymbol(" < ");
396
                                                                break;
397
                                                        case FilterButtonsJPanel.DELETE_TEXT:
398
                                                                txtExpression.setText("");
399
                                                                break;
400
                                                        default: // do anything
401
                                        }
402
                                        }
403
                                }                        
404
                        });
405
                }
406
                
407
                return filterButtonsJPanel;
408
        }
409

    
410
        /**
411
         * Returns a set with all symbols used as operators
412
         * 
413
         * @return A set
414
         */
415
        protected Set<String> getAllOperatorSymbols() {
416
                return operatorSymbols;                
417
        }
418

    
419
        /**
420
         * Sets new height to the 'topJPanel', (new Height must be bigger than default, else do nothing)
421
         * 
422
         * @param new_Height New height
423
         */
424
        public void resizeHeight(int new_Height) {
425
                int difference = new_Height - DefaultHeight;
426
                
427
                if (difference > 0) {
428
                        this.setPreferredSize(new Dimension(this.getPreferredSize().width, this.getPreferredSize().height + difference));
429
                        getTopJPanel().setPreferredSize(new Dimension(getTopJPanel().getPreferredSize().width, getTopJPanel().getPreferredSize().height + difference));
430
                        
431
                        getFieldsJPanel().setPreferredSize(new Dimension(getFieldsJPanel().getPreferredSize().width, getFieldsJPanel().getPreferredSize().height + difference));
432
                        getFieldsJScrollPane().setPreferredSize(new Dimension(getFieldsJScrollPane().getPreferredSize().width, getFieldsJScrollPane().getPreferredSize().height + difference));
433
                
434
                        getValuesJPanel().setPreferredSize(new Dimension(getValuesJPanel().getPreferredSize().width, getValuesJPanel().getPreferredSize().height + difference));
435
                        getValuesJScrollPane().setPreferredSize(new Dimension(getValuesJScrollPane().getPreferredSize().width, getValuesJScrollPane().getPreferredSize().height + difference));
436
                }
437
        }
438

    
439
        /**
440
         * Sets the width to this JPanel
441
         * 
442
         * @param new_Width New width
443
         */
444
        public abstract void resizeWidth(int new_Width);
445

    
446
        /*
447
         *  (non-Javadoc)
448
         * @see java.awt.Component#resize(int, int)
449
         */
450
        public void resize(int width, int height) {
451
                int difference = height - DefaultHeight;
452

    
453
                if (difference != 0)
454
                        this.resizeHeight(height);
455
                
456
                this.resizeWidth(width);
457
        }
458

    
459
        /*
460
         *  (non-Javadoc)
461
         * @see java.awt.Component#resize(java.awt.Dimension)
462
         */
463
        public void resize(Dimension d) {
464
                int difference = d.height - DefaultHeight;
465

    
466
                if (difference != 0)
467
                        this.resizeHeight(d.height);
468
                
469
                this.resizeWidth(d.width);
470
        }
471

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

    
479
        /*
480
         * (non-Javadoc)
481
         * @see org.gvsig.gui.beans.panelGroup.panels.AbstractPanel#apply()
482
         */
483
        public void apply() {
484
        }
485

    
486
        /*
487
         * (non-Javadoc)
488
         * @see org.gvsig.gui.beans.panelGroup.panels.AbstractPanel#cancel()
489
         */
490
        public void cancel() {
491
        }        
492

    
493
        /*
494
         * (non-Javadoc)
495
         * @see org.gvsig.gui.beans.panelGroup.panels.AbstractPanel#selected()
496
         */
497
        public void selected() {                
498
        }
499

    
500
        /**
501
         * JCrollPane with multi line tool tip text.
502
         * 
503
         * @see JScrollPane
504
         * 
505
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
506
         */
507
        protected class JScrollPaneML extends JScrollPane {
508
                private static final long serialVersionUID = 5222187234181725243L;
509

    
510
                /**
511
                 * @see JScrollPane#JScrollPane()
512
                 */
513
                public JScrollPaneML() {
514
                        super();
515
                }
516

    
517
                /**
518
                 * @see JScrollPane#JScrollPane(Component, int, int)
519
                 */
520
                public JScrollPaneML(Component view, int vsbPolicy, int hsbPolicy) {
521
                        super(view, vsbPolicy, hsbPolicy);
522
                }
523

    
524
                /**
525
                 * @see JScrollPane#JScrollPane(Component)
526
                 */
527
                public JScrollPaneML(Component view) {
528
                        super(view);
529
                }
530

    
531
                /**
532
                 * @see JScrollPane#JScrollPane(int, int)
533
                 */
534
                public JScrollPaneML(int vsbPolicy, int hsbPolicy) {
535
                        super(vsbPolicy, hsbPolicy);
536
                }
537
                
538
                /*
539
                 * (non-Javadoc)
540
                 * @see javax.swing.JComponent#createToolTip()
541
                 */
542
            public JToolTip createToolTip() {
543
                    // Multiline support
544
                    MultiLineToolTip tip = new MultiLineToolTip();
545
                    tip.setComponent(this);
546
                    return tip;
547
            }
548
        }
549

    
550
        /**
551
         * JLabel with multi line tool tip text.
552
         * 
553
         * @see JLabel
554
         * 
555
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
556
         */
557
        protected class JLabelML extends JLabel {
558
                private static final long serialVersionUID = 525349503578470487L;
559

    
560
                /**
561
                 * @see JLabel#JLabel()
562
                 */
563
                public JLabelML() {
564
                        super();
565
                }
566

    
567
                /**
568
                 * @see JLabel#JLabel(Icon, int)
569
                 */
570
                public JLabelML(Icon image, int horizontalAlignment) {
571
                        super(image, horizontalAlignment);
572
                }
573

    
574
                /**
575
                 * @see JLabel#JLabel(Icon)
576
                 */
577
                public JLabelML(Icon image) {
578
                        super(image);
579
                }
580

    
581
                /**
582
                 * @see JLabel#JLabel(String, Icon, int)
583
                 */
584
                public JLabelML(String text, Icon icon, int horizontalAlignment) {
585
                        super(text, icon, horizontalAlignment);
586
                }
587

    
588
                /**
589
                 * @see JLabel#JLabel(String, int)
590
                 */
591
                public JLabelML(String text, int horizontalAlignment) {
592
                        super(text, horizontalAlignment);
593
                }
594

    
595
                /**
596
                 * @see JLabel#JLabel(String)
597
                 */
598
                public JLabelML(String text) {
599
                        super(text);
600
                }
601

    
602
                /*
603
                 * (non-Javadoc)
604
                 * @see javax.swing.JComponent#createToolTip()
605
                 */
606
            public JToolTip createToolTip() {
607
                    // Multiline support
608
                    MultiLineToolTip tip = new MultiLineToolTip();
609
                    tip.setComponent(this);
610
                    return tip;
611
            }
612
        }
613
        
614
        /**
615
         * JPanel with multi line tool tip text.
616
         * 
617
         * @see JPanel
618
         * 
619
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
620
         */
621
        protected class JPanelML extends JPanel {
622
                private static final long serialVersionUID = 5951860640473906815L;
623

    
624
                /**
625
                 * @see JPanel#JPanel()
626
                 */
627
                public JPanelML() {
628
                        super();
629
                }
630

    
631
                /**
632
                 * @see JPanel#JPanel(boolean)
633
                 */
634
                public JPanelML(boolean isDoubleBuffered) {
635
                        super(isDoubleBuffered);
636
                }
637

    
638
                /**
639
                 * @see JPanel#JPanel(LayoutManager, boolean)
640
                 */
641
                public JPanelML(LayoutManager layout, boolean isDoubleBuffered) {
642
                        super(layout, isDoubleBuffered);
643
                }
644

    
645
                /**
646
                 * @see JPanel#JPanel(LayoutManager)
647
                 */
648
                public JPanelML(LayoutManager layout) {
649
                        super(layout);
650
                }
651

    
652
                /*
653
                 * (non-Javadoc)
654
                 * @see javax.swing.JComponent#createToolTip()
655
                 */
656
            public JToolTip createToolTip() {
657
                    // Multiline support
658
                    MultiLineToolTip tip = new MultiLineToolTip();
659
                    tip.setComponent(this);
660
                    return tip;
661
            }
662
        }
663

    
664
        /**
665
         * Editable text area with multi line tool tip text.
666
         * 
667
         * @see JEditableTextArea
668
         * 
669
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
670
         */
671
        protected class JEditableTextAreaML extends JEditableTextArea {
672
                private static final long serialVersionUID = -6963953475368014077L;
673

    
674
                /**
675
                 * @see JTextArea#JTextArea()
676
                 */
677
                public JEditableTextAreaML() {
678
                        super();
679
                }
680

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

    
688
                /**
689
                 * @see JTextArea#JTextArea(Document)
690
                 */
691
                public JEditableTextAreaML(Document doc) {
692
                        super(doc);
693
                }
694

    
695
                /**
696
                 * @see JTextArea#JTextArea(int, int)
697
                 */
698
                public JEditableTextAreaML(int rows, int columns) {
699
                        super(rows, columns);
700
                }
701

    
702
                /**
703
                 * @see JTextArea#JTextArea(String, int, int)
704
                 */
705
                public JEditableTextAreaML(String text, int rows, int columns) {
706
                        super(text, rows, columns);
707
                }
708

    
709
                /**
710
                 * @see JTextArea#JTextArea(String)
711
                 */
712
                public JEditableTextAreaML(String text) {
713
                        super(text);
714
                }
715

    
716
                /*
717
                 * (non-Javadoc)
718
                 * @see javax.swing.JComponent#createToolTip()
719
                 */
720
            public JToolTip createToolTip() {
721
                    // Multiline support
722
                    MultiLineToolTip tip = new MultiLineToolTip();
723
                    tip.setComponent(this);
724
                    return tip;
725
            }        
726
        }
727

    
728
        /**
729
         * JTree with multi line tool tip text.
730
         * 
731
         * @see JTree
732
         * 
733
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
734
         */
735
        protected class JTreeML extends JTree {
736
                private static final long serialVersionUID = -8619256256346496435L;
737

    
738
                /**
739
                 * @see JTree#JTree()
740
                 */
741
                public JTreeML() {
742
                        super();
743
                }
744

    
745
                /**
746
                 * @see JTree#JTree(Hashtable)
747
                 */
748
                public JTreeML(Hashtable<?, ?> value) {
749
                        super(value);
750
                }
751

    
752
                /**
753
                 * @see JTree#JTree(Object[])
754
                 */
755
                public JTreeML(Object[] value) {
756
                        super(value);
757
                }
758

    
759
                /**
760
                 * @see JTree#JTree(TreeModel)
761
                 */
762
                public JTreeML(TreeModel newModel) {
763
                        super(newModel);
764
                }
765

    
766
                /**
767
                 * @see JTree#JTree(TreeNode, boolean)
768
                 */
769
                public JTreeML(TreeNode root, boolean asksAllowsChildren) {
770
                        super(root, asksAllowsChildren);
771
                }
772

    
773
                /**
774
                 * @see JTree#JTree(TreeNode)
775
                 */
776
                public JTreeML(TreeNode root) {
777
                        super(root);
778
                }
779

    
780
                /**
781
                 * @see JTree#JTree(Vector)
782
                 */
783
                public JTreeML(Vector<?> value) {
784
                        super(value);
785
                }
786

    
787
                /*
788
                 * (non-Javadoc)
789
                 * @see javax.swing.JComponent#createToolTip()
790
                 */
791
            public JToolTip createToolTip() {
792
                    // Multiline support
793
                    MultiLineToolTip tip = new MultiLineToolTip();
794
                    tip.setComponent(this);
795
                    return tip;
796
            }                
797
        }
798

    
799
        /**
800
         * JList with multi line tool tip text.
801
         * 
802
         * @see JList
803
         * 
804
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
805
         */
806
        protected class JListML extends JList {
807
                private static final long serialVersionUID = 5316332987144988365L;
808

    
809
                /**
810
                 * @see JList#JList()
811
                 */
812
                public JListML() {
813
                        super();
814
                }
815

    
816
                /**
817
                 * @see JList#JList(ListModel)
818
                 */
819
                public JListML(ListModel dataModel) {
820
                        super(dataModel);
821
                }
822

    
823
                /**
824
                 * @see JList#JList(Object[])
825
                 */
826
                public JListML(Object[] listData) {
827
                        super(listData);
828
                }
829

    
830
                /**
831
                 * @see JTree#JTree(Vector)
832
                 */
833
                public JListML(Vector<?> listData) {
834
                        super(listData);
835
                }
836

    
837
                /*
838
                 * (non-Javadoc)
839
                 * @see javax.swing.JComponent#createToolTip()
840
                 */
841
            public JToolTip createToolTip() {
842
                    // Multiline support
843
                    MultiLineToolTip tip = new MultiLineToolTip();
844
                    tip.setComponent(this);
845
                    return tip;
846
            }                
847
        }
848

    
849
        /**
850
         * JCheckBox with multi line tool tip text.
851
         * 
852
         * @see JCheckBox
853
         * 
854
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
855
         */
856
        protected class JCheckBoxML extends JCheckBox {
857
                private static final long serialVersionUID = 2610142188236840664L;
858

    
859
                /**
860
                 * @see JCheckBox#JCheckBox()
861
                 */
862
                public JCheckBoxML() {
863
                        super();
864
                }
865

    
866
                /**
867
                 * @see JCheckBox#JCheckBox(Action)
868
                 */
869
                public JCheckBoxML(Action a) {
870
                        super(a);
871
                }
872

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

    
880
                /**
881
                 * @see JCheckBox#JCheckBox(Icon)
882
                 */
883
                public JCheckBoxML(Icon icon) {
884
                        super(icon);
885
                }
886

    
887
                /**
888
                 * @see JCheckBox#JCheckBox(String, boolean)
889
                 */
890
                public JCheckBoxML(String text, boolean selected) {
891
                        super(text, selected);
892
                }
893

    
894
                /**
895
                 * @see JCheckBox#JCheckBox(String, Icon, boolean)
896
                 */
897
                public JCheckBoxML(String text, Icon icon, boolean selected) {
898
                        super(text, icon, selected);
899
                }
900

    
901
                /**
902
                 *@see JCheckBox#JCheckBox(String, Icon)
903
                 */
904
                public JCheckBoxML(String text, Icon icon) {
905
                        super(text, icon);
906
                }
907

    
908
                /**
909
                 * @see JCheckBox#JCheckBox(String)
910
                 */
911
                public JCheckBoxML(String text) {
912
                        super(text);
913
                }
914

    
915
                /*
916
                 * (non-Javadoc)
917
                 * @see javax.swing.JComponent#createToolTip()
918
                 */
919
            public JToolTip createToolTip() {
920
                    // Multiline support
921
                    MultiLineToolTip tip = new MultiLineToolTip();
922
                    tip.setComponent(this);
923
                    return tip;
924
            }                
925
        }
926

    
927
        /**
928
         * JButton with multi line tool tip text.
929
         * 
930
         * @see JButton
931
         * 
932
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
933
         */
934
    protected class JButtonML extends JButton {
935
                private static final long serialVersionUID = -6052122756677251026L;
936

    
937
                /**
938
                 * @see JButton#JButton()
939
                 */
940
                public JButtonML() {
941
                        super();
942
                }
943

    
944
                /**
945
                 * @see JButton#JButton(Action)
946
                 */
947
                public JButtonML(Action a) {
948
                        super(a);
949
                }
950

    
951
                /**
952
                 * @see JButton#JButton(Icon)
953
                 */
954
                public JButtonML(Icon icon) {
955
                        super(icon);
956
                }
957

    
958
                /**
959
                 * @see JButton#JButton(String, Icon)
960
                 */
961
                public JButtonML(String text, Icon icon) {
962
                        super(text, icon);
963
                }
964

    
965
                /**
966
                 * @see JButton#JButton(String)
967
                 */
968
                public JButtonML(String text) {
969
                        super(text);
970
                }
971

    
972
                /*
973
             * (non-Javadoc)
974
             * @see javax.swing.JComponent#createToolTip()
975
             */
976
        public JToolTip createToolTip() {
977
                // Multiline support
978
                MultiLineToolTip tip = new MultiLineToolTip();
979
                tip.setComponent(this);
980
                return tip;
981
        }                
982
    }
983
}