OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 110 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
110 ilm 1
package org.openconcerto.modules.reports.olap;
159 ilm 2
 
110 ilm 3
import java.awt.Color;
4
import java.awt.Dimension;
5
import java.awt.GridBagConstraints;
6
import java.awt.GridBagLayout;
7
 
8
import javax.swing.BorderFactory;
9
import javax.swing.JPanel;
10
import javax.swing.JScrollPane;
11
 
12
import org.olap4j.CellSet;
13
import org.openconcerto.modules.reports.olap.renderer.CellSetRenderer;
159 ilm 14
import org.openconcerto.modules.reports.olap.renderer.Matrix;
110 ilm 15
import org.openconcerto.ui.DefaultGridBagConstraints;
16
import org.openconcerto.ui.ReloadPanel;
17
 
18
public class OLAPRenderer extends JPanel {
19
    final CellSetRenderer cellSetRenderer;
20
    final ReloadPanel reload;
21
 
22
    public OLAPRenderer() {
23
        this.cellSetRenderer = new CellSetRenderer();
24
 
25
        this.reload = new ReloadPanel();
26
        this.reload.setOpaque(false);
27
        this.setLayout(new GridBagLayout());
28
        GridBagConstraints c = new DefaultGridBagConstraints();
29
        c.fill = GridBagConstraints.BOTH;
30
        this.add(reload, c);
31
 
32
        final JScrollPane comp = new JScrollPane(cellSetRenderer);
33
        comp.setViewportBorder(BorderFactory.createLineBorder(Color.WHITE, 5));
34
 
35
        c.gridy++;
36
        c.weightx = 1;
37
        c.weighty = 1;
38
        c.fill = GridBagConstraints.BOTH;
39
        this.add(comp, c);
40
        this.setPreferredSize(new Dimension(640, 480));
41
        this.setPreferredSize(new Dimension(512, 320));
42
    }
43
 
44
    public void setCellSet(CellSet set) {
45
        setWaitState(false);
46
        cellSetRenderer.setCellSet(set);
47
    }
48
 
49
    public void setWaitState(boolean b) {
50
        if (b) {
51
            reload.setMode(ReloadPanel.MODE_ROTATE);
52
        } else {
53
            reload.setMode(ReloadPanel.MODE_EMPTY);
54
        }
55
 
56
    }
159 ilm 57
 
58
    public Matrix getMatrix() {
59
        return this.cellSetRenderer.getMatrix();
60
    }
61
 
62
    public void setMatrix(Matrix matrix) {
63
        setWaitState(false);
64
        cellSetRenderer.setMatrix(matrix);
65
    }
110 ilm 66
}