Normand Briere
2018-07-07 e416acb9b012b17d1efe49ad2199ea7132d874d1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package timeflow.app.ui.filter;
 
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
 
import javax.swing.*;
 
import timeflow.app.ui.DottedLine;
import timeflow.data.db.Field;
import timeflow.model.ModelPanel;
 
import timeflow.util.*;
 
public class FilterTitle extends JPanel {
   public FilterTitle(final Field field, final ModelPanel parent, boolean dots)
   {
       this(field.getName(), field, parent, dots);
   }
   public FilterTitle(String title, final Field field, final ModelPanel parent, boolean dots)
   {
       JPanel top=new JPanel();
       top.setBackground(Color.white);
       top.setLayout(new BorderLayout());
       JLabel label=new JLabel(title);
       JPanel pad=new Pad(30,30);
       pad.setBackground(Color.white);
       top.add(pad, BorderLayout.NORTH);
       top.add(label, BorderLayout.CENTER);
       label.setBackground(Color.white);
       
       if (parent instanceof FilterControlPanel)
       {
           ImageIcon redX=new ImageIcon("images/red_circle.gif");
           JLabel close=new JLabel(redX);
           close.setBackground(Color.white);
           top.add(close, BorderLayout.EAST);
           close.addMouseListener(new MouseAdapter() {
               @Override
               public void mousePressed(MouseEvent e) {
                   ((FilterControlPanel)parent).setFacet(field, false);
               }
               });
       }
       setLayout(new BorderLayout());
       add(top, BorderLayout.CENTER);
       
       if (dots)
           add(new DottedLine(), BorderLayout.SOUTH);
   }
}