OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev Author Line No. Line
41 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
182 ilm 4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
41 ilm 5
 *
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.erp.config;
15
 
16
import org.openconcerto.ui.ReloadPanel;
17
 
182 ilm 18
import java.awt.Color;
41 ilm 19
import java.awt.FlowLayout;
182 ilm 20
import java.awt.Font;
21
import java.awt.Graphics2D;
22
import java.awt.RenderingHints;
23
import java.awt.SplashScreen;
41 ilm 24
 
25
import javax.swing.JDialog;
26
import javax.swing.JLabel;
27
import javax.swing.JPanel;
28
 
29
public class InProgressFrame extends JDialog {
30
    public InProgressFrame() {
31
 
32
    }
33
 
34
    public void show(String title) {
182 ilm 35
        try {
36
            final SplashScreen splash = SplashScreen.getSplashScreen();
37
            if (splash != null) {
38
                Graphics2D g = splash.createGraphics();
39
                g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
40
                g.setColor(Color.WHITE);
41
                g.fillRect(0, (int) splash.getSize().getHeight() - 24, (int) splash.getSize().getWidth(), 24);
42
                g.setFont(g.getFont().deriveFont(Font.BOLD).deriveFont(11f));
43
                g.setColor(Color.DARK_GRAY);
44
                g.drawString(title, 20, ((int) splash.getSize().getHeight()) - 8);
45
 
46
                splash.update();
47
                return;
48
            }
49
        } catch (Throwable e) {
50
            // OpenJDK bug on linux
51
            e.printStackTrace();
52
        }
53
 
41 ilm 54
        setTitle("Veuillez patienter");
55
        JPanel p = new JPanel();
56
        p.setLayout(new FlowLayout(FlowLayout.LEADING, 5, 5));
57
        final ReloadPanel rlPanel = new ReloadPanel();
58
        rlPanel.setMode(ReloadPanel.MODE_ROTATE);
59
        p.add(new JLabel(title));
60
        p.add(rlPanel);
61
        setContentPane(p);
62
        pack();
63
        setLocationRelativeTo(null);
64
        setVisible(true);
65
    }
66
}