~ubuntu-branches/ubuntu/raring/scilab/raring-proposed

« back to all changes in this revision

Viewing changes to modules/gui/src/java/org/scilab/modules/gui/bridge/waitbar/SwingScilabWaitBar.java

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-08-30 14:42:38 UTC
  • mfrom: (1.4.7)
  • Revision ID: package-import@ubuntu.com-20120830144238-c1y2og7dbm7m9nig
Tags: 5.4.0-beta-3-1~exp1
* New upstream release
* Update the scirenderer dep
* Get ride of libjhdf5-java dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3
3
 * Copyright (C) 2008 - INRIA - Vincent Couvert
4
 
 * 
 
4
 *
5
5
 * This file must be used under the terms of the CeCILL.
6
6
 * This source file is licensed as described in the file COPYING, which
7
7
 * you should have received as part of this distribution.  The terms
8
 
 * are also available at    
 
8
 * are also available at
9
9
 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
10
10
 *
11
11
 */
15
15
import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MESSAGE__;
16
16
import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
17
17
 
 
18
import java.awt.Color;
 
19
import java.awt.Component;
 
20
import java.awt.Dimension;
18
21
import java.awt.GridBagConstraints;
19
22
import java.awt.GridBagLayout;
 
23
import java.awt.Insets;
20
24
 
21
25
import javax.swing.ImageIcon;
22
26
import javax.swing.JFrame;
25
29
import javax.swing.JProgressBar;
26
30
 
27
31
import org.scilab.modules.gui.SwingViewObject;
 
32
import org.scilab.modules.gui.console.ScilabConsole;
28
33
import org.scilab.modules.gui.utils.ScilabSwingUtilities;
29
34
import org.scilab.modules.gui.waitbar.SimpleWaitBar;
30
35
 
36
41
 
37
42
    private static final long serialVersionUID = -5208590743368628657L;
38
43
 
39
 
    private static final String SPACE = " ";
40
 
 
41
 
    private static final int WIDTH = 200;
 
44
    private static final int WIDTH = 400;
42
45
    private static final int HEIGHT = 150;
43
46
 
44
47
    private String uid;
60
63
        setIconImage(scilabIcon.getImage());
61
64
 
62
65
        GridBagLayout gridbag = new GridBagLayout();
63
 
        GridBagConstraints c = new GridBagConstraints();
64
 
 
65
 
        JPanel pane = new JPanel();
66
 
        pane.setLayout(gridbag);
 
66
 
 
67
        Insets insets = new Insets(8, 4, 8, 4);
 
68
 
 
69
        JPanel pane = new JPanel(gridbag);
 
70
        pane.setOpaque(true);
67
71
        setContentPane(pane);
68
72
 
 
73
 
69
74
        /* Scilab icon */
70
 
        c.gridwidth = 2;
71
 
        c.gridheight = 2;
72
 
        c.weighty = 1.0;
 
75
        GridBagConstraints iconConstraints = new GridBagConstraints();
 
76
        iconConstraints.gridx = 0; // Top Left
 
77
        iconConstraints.gridy = 0;
 
78
        iconConstraints.fill = GridBagConstraints.BOTH;
 
79
        iconConstraints.anchor = GridBagConstraints.FIRST_LINE_START;
 
80
        iconConstraints.insets = insets;
73
81
        JLabel icon = new JLabel();
74
 
        gridbag.setConstraints(icon, c);
 
82
        gridbag.setConstraints(icon, iconConstraints);
75
83
        icon.setIcon(scilabIcon);
76
84
        pane.add(icon);
77
 
 
78
 
        /* Space between icon and text */
79
 
        JLabel emptySpace = new JLabel(SPACE);
80
 
        c.gridheight = 1;
81
 
        c.gridwidth = 1;
82
 
        gridbag.setConstraints(emptySpace, c);
83
 
        pane.add(emptySpace);
 
85
        icon.setVisible(true);
84
86
 
85
87
        /* Message */
86
 
        c.gridwidth = GridBagConstraints.REMAINDER;     
87
 
        c.gridheight = 2;
88
 
        c.weighty = 0.0;
 
88
        GridBagConstraints messageConstraints = new GridBagConstraints();
 
89
        messageConstraints.gridx = 1;
 
90
        messageConstraints.gridy = 0;
 
91
        messageConstraints.insets = insets;
89
92
        messageLabel = new JLabel();
90
 
        gridbag.setConstraints(messageLabel, c);
 
93
        gridbag.setConstraints(messageLabel, messageConstraints);
91
94
        pane.add(messageLabel);
 
95
        messageLabel.setVisible(true);
92
96
 
93
 
        /* Empty space between message and progress bar */
94
 
        emptySpace = new JLabel(SPACE);
95
 
        c.gridheight = 1;
96
 
        c.gridwidth = GridBagConstraints.REMAINDER;
97
 
        gridbag.setConstraints(emptySpace, c);
98
 
        pane.add(emptySpace);
99
97
 
100
98
        /* ProgressBar */
101
99
        progressBar = new JProgressBar();
102
 
 
103
 
        c.gridwidth = GridBagConstraints.REMAINDER;
104
 
        gridbag.setConstraints(progressBar, c);
 
100
        GridBagConstraints progressBarConstraints = new GridBagConstraints();
 
101
        progressBarConstraints.gridx = 0;
 
102
        progressBarConstraints.gridy = 1;
 
103
        progressBarConstraints.gridwidth = 2;
 
104
        progressBarConstraints.fill = GridBagConstraints.BOTH;
 
105
        progressBarConstraints.insets = insets;
 
106
        progressBarConstraints.weightx = 1.0;
 
107
        gridbag.setConstraints(progressBar, progressBarConstraints);
105
108
        pane.add(progressBar);
 
109
        progressBar.setVisible(true);
106
110
 
107
 
        /* Bottom empty space */
108
 
        JLabel bottomEmptySpace = new JLabel(SPACE);
109
 
        c.gridwidth = GridBagConstraints.REMAINDER;
110
 
        gridbag.setConstraints(bottomEmptySpace, c);
111
 
        pane.add(bottomEmptySpace);
 
111
        pane.setVisible(true);
 
112
        pane.doLayout();
112
113
 
113
114
        this.setSize(WIDTH, HEIGHT);
 
115
        this.setPreferredSize(new Dimension(WIDTH, HEIGHT));
 
116
        this.setMinimumSize(new Dimension(WIDTH, HEIGHT));
 
117
 
 
118
        if (ScilabConsole.isExistingConsole()) {
 
119
            setLocationRelativeTo((Component) ScilabConsole.getConsole().getAsSimpleConsole());
 
120
        }
 
121
 
114
122
        this.setVisible(true);
115
123
        this.doLayout();
 
124
        this.pack();
116
125
 
117
126
    }
118
127