OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 174 | Rev 182 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 174 Rev 177
Line 38... Line 38...
38
 
38
 
39
    public DecoratedGridPanel(JComponent header, int columnCount, int rowHeight, List<JComponent> rowHeader) {
39
    public DecoratedGridPanel(JComponent header, int columnCount, int rowHeight, List<JComponent> rowHeader) {
40
        this.setBackground(Color.WHITE);
40
        this.setBackground(Color.WHITE);
41
        this.setLayout(new GridBagLayout());
41
        this.setLayout(new GridBagLayout());
42
        JPanel topLeft = new JPanel();
42
        JPanel topLeft = new JPanel();
-
 
43
        topLeft.setMinimumSize(new Dimension(0, 0));
-
 
44
 
43
        this.grid = new GridPanel(columnCount, rowHeader.size(), rowHeight);
45
        this.grid = new GridPanel(columnCount, rowHeader.size(), rowHeight);
44
        header.setPreferredSize(new Dimension(this.grid.getPreferredSize().width, header.getMinimumSize().height));
46
        header.setPreferredSize(new Dimension(this.grid.getPreferredSize().width, header.getMinimumSize().height));
45
        header.setMaximumSize(new Dimension(this.grid.getPreferredSize().width, header.getMinimumSize().height));
47
        header.setMaximumSize(new Dimension(this.grid.getPreferredSize().width, header.getMinimumSize().height));
46
        header.setMinimumSize(new Dimension(this.grid.getPreferredSize().width, header.getMinimumSize().height));
48
        header.setMinimumSize(new Dimension(this.grid.getPreferredSize().width, header.getMinimumSize().height));
47
        GridBagConstraints c = new GridBagConstraints();
49
        GridBagConstraints c = new GridBagConstraints();
Line 52... Line 54...
52
        c.fill = GridBagConstraints.BOTH;
54
        c.fill = GridBagConstraints.BOTH;
53
        this.add(topLeft, c);
55
        this.add(topLeft, c);
54
        c.gridx++;
56
        c.gridx++;
55
        c.weightx = 0;
57
        c.weightx = 0;
56
        this.add(header, c);
58
        this.add(header, c);
-
 
59
        c.gridx++;
-
 
60
        c.weightx = 0;
-
 
61
        JPanel spacerScroll = new JPanel();
-
 
62
        int wScroll = ((Integer) UIManager.get("ScrollBar.width")).intValue();
-
 
63
        spacerScroll.setMinimumSize(new Dimension(wScroll, header.getHeight()));
-
 
64
        spacerScroll.setPreferredSize(new Dimension(wScroll, header.getHeight()));
-
 
65
        spacerScroll.setMaximumSize(new Dimension(wScroll, header.getHeight()));
-
 
66
        spacerScroll.setSize(new Dimension(wScroll, header.getHeight()));
-
 
67
        this.add(spacerScroll, c);
-
 
68
 
57
        //
69
        //
58
        c.gridwidth = 2;
70
        c.gridwidth = 3;
59
        c.weightx = 1;
71
        c.weightx = 1;
60
        c.weighty = 1;
72
        c.weighty = 1;
61
        c.gridx = 0;
73
        c.gridx = 0;
62
        c.gridy++;
74
        c.gridy++;
63
        JPanel panel = new JPanel();
75
        JPanel panel = new ScrollablePanel() {
-
 
76
            @Override
-
 
77
            public boolean getScrollableTracksViewportWidth() {
-
 
78
                return true;
-
 
79
            }
-
 
80
 
-
 
81
            @Override
-
 
82
            public boolean getScrollableTracksViewportHeight() {
-
 
83
                return false;
-
 
84
            }
-
 
85
        };
64
        panel.setLayout(new GridBagLayout());
86
        panel.setLayout(new GridBagLayout());
65
        GridBagConstraints c2 = new GridBagConstraints();
87
        GridBagConstraints c2 = new GridBagConstraints();
66
        c2.gridx = 0;
88
        c2.gridx = 0;
67
        c2.gridy = 0;
89
        c2.gridy = 0;
68
        c2.weightx = 1;
90
        c2.weightx = 1;
Line 73... Line 95...
73
        c2.weightx = 0;
95
        c2.weightx = 0;
74
        c2.weighty = 1;
96
        c2.weighty = 1;
75
        panel.add(this.grid, c2);
97
        panel.add(this.grid, c2);
76
 
98
 
77
        final JScrollPane scroll = new JScrollPane(panel);
99
        final JScrollPane scroll = new JScrollPane(panel);
-
 
100
        scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
78
        scroll.setBorder(null);
101
        scroll.setBorder(null);
79
        this.add(scroll, c);
102
        this.add(scroll, c);
80
 
103
 
81
    }
104
    }
82
 
105