Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / org.gvsig.installer / org.gvsig.installer.swing / org.gvsig.installer.swing.impl / src / main / java / org / gvsig / installer / swing / impl / panel / ProgressPanel.java @ 32451

History | View | Annotate | Download (3.55 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

    
28
package org.gvsig.installer.swing.impl.panel;
29

    
30
import java.awt.Font;
31
import java.awt.GridBagConstraints;
32
import java.awt.GridBagLayout;
33
import java.awt.Insets;
34

    
35
import javax.swing.JLabel;
36
import javax.swing.JPanel;
37
import javax.swing.JProgressBar;
38

    
39
import org.gvsig.installer.swing.api.SwingInstallerLocator;
40
import org.gvsig.installer.swing.impl.DefaultSwingInstallerManager;
41

    
42
/**
43
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
44
 */
45
public class ProgressPanel extends JPanel {
46
        protected DefaultSwingInstallerManager swingInstallerManager = null;
47
        private JLabel pluginLabel;
48
        private JProgressBar progressBar;
49
        private JLabel progressLabel;
50

    
51
        public ProgressPanel() {
52
                super();
53
                swingInstallerManager = (DefaultSwingInstallerManager)SwingInstallerLocator.getSwingInstallerManager();
54
                initComponents();
55
                initLabels();
56
        }
57

    
58
        private void initLabels() {
59
                progressLabel.setText(swingInstallerManager.getText("initializing"));                        
60
        }
61

    
62
        private void initComponents() {
63
                java.awt.GridBagConstraints gridBagConstraints;
64

    
65
                progressBar = new JProgressBar();
66
                progressLabel = new JLabel();
67
                pluginLabel = new JLabel();
68

    
69
                setLayout(new GridBagLayout());
70
                gridBagConstraints = new GridBagConstraints();
71
                gridBagConstraints.gridx = 0;
72
                gridBagConstraints.gridy = 2;
73
                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
74
                gridBagConstraints.weightx = 1.0;
75
                gridBagConstraints.insets = new Insets(2, 2, 2, 2);
76
                add(progressBar, gridBagConstraints);
77

    
78
                progressLabel.setFont(new Font("DejaVu Sans", 0, 11)); // NOI18N
79
                progressLabel.setText("task");
80
                gridBagConstraints = new GridBagConstraints();
81
                gridBagConstraints.gridx = 0;
82
                gridBagConstraints.gridy = 1;
83
                gridBagConstraints.anchor = GridBagConstraints.WEST;
84
                gridBagConstraints.insets = new Insets(5, 2, 2, 2);
85
                add(progressLabel, gridBagConstraints);
86

    
87
                pluginLabel.setText("plugin");
88
                gridBagConstraints = new GridBagConstraints();
89
                gridBagConstraints.anchor = GridBagConstraints.WEST;
90
                gridBagConstraints.insets = new Insets(5, 2, 2, 2);
91
                add(pluginLabel, gridBagConstraints);
92
        }
93

    
94
        /**
95
         * @param plugin the plugin to set
96
         */
97
        public void setPluginText(String plugin) {
98
                this.pluginLabel.setText(plugin);
99
        }        
100
        
101
        public void setCompressingText(){
102
                progressLabel.setText(swingInstallerManager.getText("compressing"));        
103
        }
104
        
105
        public void setFinishedText(){
106
                progressLabel.setText(swingInstallerManager.getText("finished"));        
107
        }
108
        
109
        public void setProgress(int progress){
110
                progressBar.setValue(progress);
111
        }
112
        
113
        public void setExceptionText(Exception e) {
114
                progressLabel.setText(swingInstallerManager.getText("create_output_file_exception"));                
115
        }
116
}
117