Statistics
| Revision:

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

History | View | Annotate | Download (20 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.filterButtons;
25

    
26
import java.awt.Dimension;
27
import java.awt.GridBagConstraints;
28
import java.awt.GridBagLayout;
29
import java.awt.LayoutManager;
30
import java.awt.event.ActionEvent;
31
import java.awt.event.ActionListener;
32
import java.awt.event.ComponentAdapter;
33
import java.awt.event.ComponentEvent;
34
import java.awt.event.MouseAdapter;
35
import java.awt.event.MouseEvent;
36
import java.io.Serializable;
37
import java.text.DateFormat;
38
import java.util.Date;
39
import java.util.HashMap;
40

    
41
import javax.swing.Action;
42
import javax.swing.Icon;
43
import javax.swing.JButton;
44
import javax.swing.JPanel;
45
import javax.swing.JToolTip;
46

    
47
import org.gvsig.gui.beans.Messages;
48
import org.gvsig.gui.beans.controls.MultiLineToolTip;
49
import org.gvsig.gui.beans.swing.textBoxWithCalendar.JCalendarDateDialog;
50

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

    
92
/**
93
 * This class is a panel with buttons for filter operations: AND, OR, NOT, >, <, ...
94
 * 
95
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
96
 */
97
public class FilterButtonsJPanel extends JPanel implements Serializable {
98
        private static final long serialVersionUID = -6976915487897365666L;
99

    
100
        public static final int default_FilterButtonsJPanelWidth = 190;
101
        public static final int default_FilterButtonsJPanelHeight = 104;
102
        private final int buttonsGroupJPanelWidth = default_FilterButtonsJPanelWidth;
103
        private final int buttonsGroupJPanelHeight = default_FilterButtonsJPanelHeight;
104
        private final int buttonHeight = 20;
105
        private final int buttonWidthUnit = 40;
106

    
107
        private JButtonML btnEqual = null;
108
        private JButtonML btnDistinct = null;
109
        private JButtonML btnGreater = null;
110
        private JButtonML btnSmaller = null;
111
        private JButtonML btnEqualGreater = null;
112
        private JButtonML btnEqualSmaller = null;
113
        private JButtonML btnAnd = null;
114
        private JButtonML btnOr = null;
115
        private JButtonML btnNot = null;
116
        private JButtonML btnDate = null;
117
        private JButtonML btnParenthesis = null;
118
        private JButtonML btnDeleteText = null;
119
        private JPanelML buttonsJPanel = null;        
120

    
121
        // Last selected date
122
        private DateFormat dateFormat = DateFormat.getDateInstance();
123
        private Date lastSelectedDate = null;
124

    
125
        private JCalendarDateDialog jCalendarDateDialog = null;
126
        
127
        // Values of the events fired when has been clicked a button
128
        public static final int DEFAULT = 0;
129
        public static final int EQUAL = 1;
130
        public static final int DISTINCT = 2;
131
        public static final int GREATER = 3;
132
        public static final int SMALLER = 4;
133
        public static final int EQUALGREATER = 5;
134
        public static final int EQUALSMALLER = 6;
135
        public static final int AND = 7;
136
        public static final int OR = 8;
137
        public static final int NOT = 9;
138
        public static final int DATE = 10;
139
        public static final int PARENTHESIS = 11;
140
        public static final int DELETE_TEXT = 12;
141
        
142
        // Values of the type of event fired
143
        public static final int BUTTON_CLICKED_ACTION_ID = 13;
144
        public static final String BUTTON_CLICKED_ACTION_COMMAND = "Button Clicked";
145
        
146
        // Hash map for the items
147
        private HashMap<String, String> map;
148
        
149
        // Action listener for notify (fire) some events that had happened to this component
150
        private ActionListener actionListener = null;
151

    
152
        /**
153
         * @see JPanel#JPanel()
154
         */
155
        public FilterButtonsJPanel() {
156
                super();
157
                initialize();
158
        }
159

    
160
        /**
161
         * @see JPanel#JPanel(boolean)
162
         */
163
        public FilterButtonsJPanel(boolean isDoubleBuffered) {
164
                super(isDoubleBuffered);
165
                initialize();
166
        }
167

    
168
        /**
169
         * @see JPanel#JPanel(java.awt.LayoutManager, boolean)
170
         */
171
        public FilterButtonsJPanel(LayoutManager layout, boolean isDoubleBuffered) {
172
                super(layout, isDoubleBuffered);
173
                initialize();
174
        }
175

    
176
        /**
177
         * @see JPanel#JPanel(java.awt.LayoutManager)
178
         */
179
        public FilterButtonsJPanel(LayoutManager layout) {
180
                super(layout);
181
                initialize();
182
        }
183
        
184
        /**
185
         * This method initializes this
186
         */
187
        private void initialize() {
188
                map = new HashMap<String, String>();
189
                
190
                this.setPreferredSize(new Dimension(default_FilterButtonsJPanelWidth, default_FilterButtonsJPanelHeight));
191
                this.setLayout(new GridBagLayout());
192
                
193
                // Vertical center
194
                GridBagConstraints gridBagConstraints = new GridBagConstraints();
195
                gridBagConstraints.fill = GridBagConstraints.BOTH;
196
                gridBagConstraints.anchor = GridBagConstraints.CENTER;
197

    
198
                this.add(getButtonsJPanel(), gridBagConstraints);
199
        }
200
        
201
        /**
202
         * This method initializes buttonsJPanel
203
         *
204
         * @return javax.swing.JPanel
205
         */        
206
        private javax.swing.JPanel getButtonsJPanel() {
207
                if (buttonsJPanel == null) {
208
                        buttonsJPanel = new JPanelML();
209
                        
210
                        buttonsJPanel.setPreferredSize(new Dimension(buttonsGroupJPanelWidth, buttonsGroupJPanelHeight));
211
                        buttonsJPanel.add(getBtnEqual());
212
                        buttonsJPanel.add(getBtnDistinct());
213
                        buttonsJPanel.add(getBtnDate());
214
                        buttonsJPanel.add(getBtnSmaller());
215
                        buttonsJPanel.add(getBtnGreater());
216
                        buttonsJPanel.add(getBtnEqualSmaller());
217
                        buttonsJPanel.add(getBtnEqualGreater());
218
                        buttonsJPanel.add(getBtnAnd());
219
                        buttonsJPanel.add(getBtnOr());
220
                        buttonsJPanel.add(getBtnNot());
221
                        buttonsJPanel.add(getBtnParenthesis());                        
222
                        buttonsJPanel.add(getBtnDeleteText());
223
                }
224
                
225
                return buttonsJPanel;
226
        }
227

    
228
        /**
229
         * This method initializes btnDistinct
230
         *
231
         * @return javax.swing.JButton
232
         */
233
        private javax.swing.JButton getBtnDistinct() {
234
                if (btnDistinct == null) {
235
                        btnDistinct = new JButtonML();
236
                        btnDistinct.setText("!=");
237
                        btnDistinct.setMargin(new java.awt.Insets(2, 2, 2, 2));
238
                        btnDistinct.setPreferredSize(new java.awt.Dimension(buttonWidthUnit, buttonHeight));
239
                        btnDistinct.setToolTipText(Messages.getText("operator_distinct_explanation"));
240
                        map.put("!=", Integer.toString(FilterButtonsJPanel.DISTINCT));
241
                        
242
                        btnDistinct.addActionListener(this.getActionListener());
243
                }
244
                
245
                return btnDistinct;
246
        }
247
        
248
        
249
        /**
250
         * This method initializes btnEqua
251
         *
252
         * @return javax.swing.JButton
253
         */
254
        private javax.swing.JButton getBtnEqual() {
255
                if (btnEqual == null) {
256
                        btnEqual = new JButtonML();
257
                        btnEqual.setText("=");
258
                        btnEqual.setMargin(new java.awt.Insets(2, 2, 2, 2));
259
                        btnEqual.setPreferredSize(new java.awt.Dimension(buttonWidthUnit, buttonHeight));
260
                        btnEqual.setToolTipText(Messages.getText("operator_equal_explanation"));
261
                        map.put("=", Integer.toString(FilterButtonsJPanel.EQUAL));
262

    
263
                        btnEqual.addActionListener(this.getActionListener());
264
                }
265

    
266
                return btnEqual;
267
        }
268

    
269
        /**
270
         * This method initializes btnGreater
271
         *
272
         * @return javax.swing.JButton
273
         */
274
        private javax.swing.JButton getBtnGreater() {
275
                if (btnGreater == null) {
276
                        btnGreater = new JButtonML();
277
                        btnGreater.setText(">");
278
                        btnGreater.setMargin(new java.awt.Insets(2, 2, 2, 2));
279
                        btnGreater.setPreferredSize(new java.awt.Dimension(buttonWidthUnit, buttonHeight));
280
                        btnGreater.setToolTipText(Messages.getText("operator_greater_explanation"));
281
                        map.put(">", Integer.toString(FilterButtonsJPanel.GREATER));
282
                        
283
                        btnGreater.addActionListener(this.getActionListener());
284
                }
285

    
286
                return btnGreater;
287
        }
288

    
289
        /**
290
         * This method initializes btnEqualGreater
291
         *
292
         * @return javax.swing.JButton
293
         */
294
        private javax.swing.JButton getBtnEqualGreater() {
295
                if (btnEqualGreater == null) {
296
                        btnEqualGreater = new JButtonML();
297
                        btnEqualGreater.setText(">=");
298
                        btnEqualGreater.setMargin(new java.awt.Insets(2, 2, 2, 2));
299
                        btnEqualGreater.setPreferredSize(new java.awt.Dimension(buttonWidthUnit, buttonHeight));
300
                        btnEqualGreater.setToolTipText(Messages.getText("operator_equal_greater_explanation"));
301
                        map.put(">=", Integer.toString(FilterButtonsJPanel.EQUALGREATER));
302
                        
303
                        btnEqualGreater.addActionListener(this.getActionListener());
304
                }
305

    
306
                return btnEqualGreater;
307
        }
308

    
309
        /**
310
         * This method initializes btnSmaller
311
         *
312
         * @return javax.swing.JButton
313
         */
314
        private javax.swing.JButton getBtnSmaller() {
315
                if (btnSmaller == null) {
316
                        btnSmaller = new JButtonML();
317
                        btnSmaller.setText("<");
318
                        btnSmaller.setMargin(new java.awt.Insets(2, 2, 2, 2));
319
                        btnSmaller.setPreferredSize(new java.awt.Dimension(buttonWidthUnit, buttonHeight));
320
                        btnSmaller.setToolTipText(Messages.getText("operator_smaller_explanation"));
321
                        map.put("<", Integer.toString(FilterButtonsJPanel.SMALLER));
322
                        
323
                        btnSmaller.addActionListener(this.getActionListener());
324
                }
325

    
326
                return btnSmaller;
327
        }
328

    
329
        /**
330
         * This method initializes btnEqualSmaller
331
         *
332
         * @return javax.swing.JButton
333
         */
334
        private javax.swing.JButton getBtnEqualSmaller() {
335
                if (btnEqualSmaller == null) {
336
                        btnEqualSmaller = new JButtonML();
337
                        btnEqualSmaller.setText("<=");
338
                        btnEqualSmaller.setMargin(new java.awt.Insets(2, 2, 2, 2));
339
                        btnEqualSmaller.setPreferredSize(new java.awt.Dimension(buttonWidthUnit, buttonHeight));
340
                        btnEqualSmaller.setToolTipText(Messages.getText("operator_equal_smaller_explanation"));
341
                        map.put("<=", Integer.toString(FilterButtonsJPanel.EQUALSMALLER));
342
                        
343
                        btnEqualSmaller.addActionListener(this.getActionListener());
344
                }
345

    
346
                return btnEqualSmaller;
347
        }
348

    
349
        /**
350
         * This method initializes btnDate
351
         *
352
         * @return javax.swing.JButton
353
         */
354
        private javax.swing.JButton getBtnDate() {
355
                if (btnDate == null) {
356
                        btnDate = new JButtonML();
357
                        btnDate.setText("Date");
358
                        btnDate.setMargin(new java.awt.Insets(2, 2, 2, 2));
359
                        btnDate.setPreferredSize(new java.awt.Dimension(86, buttonHeight));
360
                        btnDate.setToolTipText(Messages.getText("date_button_explanation"));
361
                        map.put("Date", Integer.toString(FilterButtonsJPanel.DATE));
362
                        
363
                        btnDate.addMouseListener(new MouseAdapter() {
364
                                /*
365
                                 *  (non-Javadoc)
366
                                 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
367
                                 */
368
                                public void mouseClicked(MouseEvent e) {
369
                                        getCDD().setVisible(true);
370
                                }                                
371
                        });                        
372
                }
373

    
374
                return btnDate;
375
        }
376

    
377
        /**
378
         * This method initializes a JCalendarDateDialog        
379
         *         
380
         * @return A JCalendarDateDialog
381
         */
382
        protected JCalendarDateDialog getCDD() {
383
                if (jCalendarDateDialog == null) {
384
                        jCalendarDateDialog = new JCalendarDateDialog(350, 230);
385
                        jCalendarDateDialog.setModal(true);
386
                        jCalendarDateDialog.setLocationRelativeTo(btnDate);
387
                        jCalendarDateDialog.setMinimumWidth(350);
388
                        jCalendarDateDialog.setMinimumHeight(170);
389
                        jCalendarDateDialog.setMaximumWidth(500);
390
                        jCalendarDateDialog.setMaximumHeight(400);
391
        
392
                        // Adds a listener for get the date when the 
393
                        jCalendarDateDialog.addComponentListener(new ComponentAdapter() {
394
                                /*
395
                                 *  (non-Javadoc)
396
                                 * @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
397
                                 */
398
                                public void componentHidden(ComponentEvent e) {
399
                                        lastSelectedDate = jCalendarDateDialog.getDate();
400
                                        
401
                                        actionListener.actionPerformed(new ActionEvent(btnDate, FilterButtonsJPanel.BUTTON_CLICKED_ACTION_ID, FilterButtonsJPanel.BUTTON_CLICKED_ACTION_COMMAND));
402

    
403
                                }                        
404
                        });
405
                
406
                }
407
                
408
                return jCalendarDateDialog;
409
        }
410

    
411
        /**
412
         * This method initializes btnAnd
413
         *
414
         * @return javax.swing.JButton
415
         */        
416
        private javax.swing.JButton getBtnAnd() {
417
                if (btnAnd == null) {
418
                        btnAnd = new JButtonML();
419
                        btnAnd.setText("And");
420
                        btnAnd.setMargin(new java.awt.Insets(2, 2, 2, 2));
421
                        btnAnd.setPreferredSize(new java.awt.Dimension(buttonWidthUnit, buttonHeight));
422
                        btnAnd.setToolTipText(Messages.getText("operator_and_explanation"));
423
                        map.put("And", Integer.toString(FilterButtonsJPanel.AND));
424
                        
425
                        btnAnd.addActionListener(this.getActionListener());
426
                }
427

    
428
                return btnAnd;
429
        }
430

    
431
        /**
432
         * This method initializes btnNot
433
         *
434
         * @return javax.swing.JButton
435
         */
436
        private javax.swing.JButton getBtnNot() {
437
                if (btnNot == null) {
438
                        btnNot = new JButtonML();
439
                        btnNot.setText("Not");
440
                        btnNot.setMargin(new java.awt.Insets(2, 2, 2, 2));
441
                        btnNot.setPreferredSize(new java.awt.Dimension(buttonWidthUnit, buttonHeight));
442
                        btnNot.setToolTipText(Messages.getText("operator_not_explanation"));
443
                        map.put("Not", Integer.toString(FilterButtonsJPanel.NOT));
444
                        
445
                        btnNot.addMouseListener(new MouseAdapter() {
446
                                /*
447
                                 *  (non-Javadoc)
448
                                 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
449
                                 */
450
                                public void mouseClicked(MouseEvent e) {
451
                                        new ActionEvent(this, FilterButtonsJPanel.BUTTON_CLICKED_ACTION_ID, FilterButtonsJPanel.BUTTON_CLICKED_ACTION_COMMAND);
452
                                }                                
453
                        });
454
                        
455
                        btnNot.addActionListener(this.getActionListener());
456

    
457
                }
458

    
459
                return btnNot;
460
        }
461

    
462
        /**
463
         * This method initializes btnOr
464
         *
465
         * @return javax.swing.JButton
466
         */
467
        private javax.swing.JButton getBtnOr() {
468
                if (btnOr == null) {
469
                        btnOr = new JButtonML();
470
                        btnOr.setText("Or");
471
                        btnOr.setMargin(new java.awt.Insets(2, 2, 2, 2));
472
                        btnOr.setPreferredSize(new java.awt.Dimension(buttonWidthUnit, buttonHeight));
473
                        btnOr.setToolTipText(Messages.getText("operator_or_explanation"));
474
                        map.put("Or", Integer.toString(FilterButtonsJPanel.OR));
475
                        
476
                        btnOr.addMouseListener(new MouseAdapter() {
477
                                /*
478
                                 *  (non-Javadoc)
479
                                 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
480
                                 */
481
                                public void mouseClicked(MouseEvent e) {
482
                                        new ActionEvent(this, FilterButtonsJPanel.BUTTON_CLICKED_ACTION_ID, FilterButtonsJPanel.BUTTON_CLICKED_ACTION_COMMAND);
483
                                }                                
484
                        });
485
                        
486
                        btnOr.addActionListener(this.getActionListener());
487
                }
488

    
489
                return btnOr;
490
        }
491

    
492
        /**
493
         * This method initializes btnParenthesis
494
         *
495
         * @return javax.swing.JButton
496
         */
497
        private javax.swing.JButton getBtnParenthesis() {
498
                if (btnParenthesis == null) {
499
                        btnParenthesis = new JButtonML();
500
                        btnParenthesis.setText("()");
501
                        btnParenthesis.setMargin(new java.awt.Insets(2, 2, 2, 2));
502
                        btnParenthesis.setPreferredSize(new java.awt.Dimension(buttonWidthUnit, buttonHeight));
503
                        btnParenthesis.setToolTipText(Messages.getText("parenthesis_explanation"));
504
                        map.put("()", Integer.toString(FilterButtonsJPanel.PARENTHESIS));
505
                        
506
                        btnParenthesis.addMouseListener(new MouseAdapter() {
507
                                /*
508
                                 *  (non-Javadoc)
509
                                 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
510
                                 */
511
                                public void mouseClicked(MouseEvent e) {
512
                                        new ActionEvent(this, FilterButtonsJPanel.BUTTON_CLICKED_ACTION_ID, FilterButtonsJPanel.BUTTON_CLICKED_ACTION_COMMAND);
513
                                }                                
514
                        });
515
                        
516
                        btnParenthesis.addActionListener(this.getActionListener());
517
                }
518

    
519
                return btnParenthesis;
520
        }
521
        
522
        /**
523
         * This method initializes btnDeleteText
524
         * 
525
         * @return javax.swing.JButton
526
         */
527
        private javax.swing.JButton getBtnDeleteText() {
528
                if (btnDeleteText == null) {
529
                        btnDeleteText = new JButtonML();
530
                        btnDeleteText.setText(Messages.getText("deleteText"));
531
                        btnDeleteText.setMargin(new java.awt.Insets(2, 2, 2, 2));
532
                        btnDeleteText.setPreferredSize(new java.awt.Dimension(176, buttonHeight));
533
                        btnDeleteText.setToolTipText(Messages.getText("deleteText_on_filter_use_explanation"));
534
                        map.put(Messages.getText("deleteText"), Integer.toString(FilterButtonsJPanel.DELETE_TEXT));
535
                        
536
                        btnDeleteText.addMouseListener(new MouseAdapter() {
537
                                /*
538
                                 *  (non-Javadoc)
539
                                 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
540
                                 */
541
                                public void mouseClicked(MouseEvent e) {
542
                                        new ActionEvent(this, FilterButtonsJPanel.BUTTON_CLICKED_ACTION_ID, FilterButtonsJPanel.BUTTON_CLICKED_ACTION_COMMAND);
543
                                }                                
544
                        });
545
                        
546
                        btnDeleteText.addActionListener(this.getActionListener());
547
                }
548
                        
549
                return btnDeleteText;        
550
        }
551
        
552
        /**
553
         * This method initializes the "actionListener" ActionListener
554
         * 
555
         * @return ActionListener
556
         */
557
        private ActionListener getActionListener() {
558
                if (actionListener == null) {
559
                        actionListener = new ActionListener() {
560
                                /*
561
                                 *  (non-Javadoc)
562
                                 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
563
                                 */
564
                                public void actionPerformed(ActionEvent event) {
565
                                           // Notifies that has been clicked a button
566
                                        firePropertyChange(
567
                                                        FilterButtonsJPanel.BUTTON_CLICKED_ACTION_COMMAND,
568
                                                        FilterButtonsJPanel.DEFAULT,
569
                                                        map.get(((javax.swing.JButton) event.getSource())
570
                                                                        .getText()));
571
                        }
572
                    };
573
                }
574
                return actionListener;
575
        }
576
        
577
        /**
578
         * Returns the las selected date, formatted
579
         * 
580
         * @return A formatted date
581
         */
582
        public String getLastSelectedDate() {
583
                if (lastSelectedDate == null)
584
                        return "";
585
                else
586
                        return "Date(" + dateFormat.format(lastSelectedDate) + ")"; 
587
        }
588
        
589
        /**
590
         * Returns the 'DateFormat' private attribute
591
         * 
592
         * @return A 'DateFormat' reference
593
         */
594
        public DateFormat getDateFormat() {
595
                return dateFormat;
596
        }
597

    
598
        /**
599
         * JButton with multi line tool tip text.
600
         * 
601
         * @see JButton
602
         * 
603
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
604
         */
605
    protected class JButtonML extends JButton {
606
                private static final long serialVersionUID = -6052122756677251026L;
607

    
608
                /**
609
                 * @see JButton#JButton()
610
                 */
611
                public JButtonML() {
612
                        super();
613
                }
614

    
615
                /**
616
                 * @see JButton#JButton(Action)
617
                 */
618
                public JButtonML(Action a) {
619
                        super(a);
620
                }
621

    
622
                /**
623
                 * @see JButton#JButton(Icon)
624
                 */
625
                public JButtonML(Icon icon) {
626
                        super(icon);
627
                }
628

    
629
                /**
630
                 * @see JButton#JButton(String, Icon)
631
                 */
632
                public JButtonML(String text, Icon icon) {
633
                        super(text, icon);
634
                }
635

    
636
                /**
637
                 * @see JButton#JButton(String)
638
                 */
639
                public JButtonML(String text) {
640
                        super(text);
641
                }
642

    
643
                /*
644
             * (non-Javadoc)
645
             * @see javax.swing.JComponent#createToolTip()
646
             */
647
        public JToolTip createToolTip() {
648
                // Multiline support
649
                MultiLineToolTip tip = new MultiLineToolTip();
650
                tip.setComponent(this);
651
                return tip;
652
        }                
653
    }
654

    
655
        /**
656
         * JPanel with multi line tool tip text.
657
         * 
658
         * @see JPanel
659
         * 
660
         * @author Pablo Piqueras Bartolome (pablo.piqueras@iver.es)
661
         */
662
    protected class JPanelML extends JPanel {
663
                private static final long serialVersionUID = -5282313934096892711L;
664

    
665
                /**
666
                 * @see JPanel#JPanel()
667
                 */
668
                public JPanelML() {
669
                        super();
670
                }
671

    
672
                /**
673
                 * @see JPanel#JPanel(boolean)
674
                 */
675
                public JPanelML(boolean isDoubleBuffered) {
676
                        super(isDoubleBuffered);
677
                }
678

    
679
                /**
680
                 * @see JPanel#JPanel(LayoutManager, boolean)
681
                 */
682
                public JPanelML(LayoutManager layout, boolean isDoubleBuffered) {
683
                        super(layout, isDoubleBuffered);
684
                }
685

    
686
                /**
687
                 * @see JPanel#JPanel(LayoutManager)
688
                 */
689
                public JPanelML(LayoutManager layout) {
690
                        super(layout);
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
}