Statistics
| Revision:

gvsig-raster / org.gvsig.raster / branches / org.gvsig.raster_dataaccess_refactoring / org.gvsig.raster.swing / org.gvsig.raster.swing.impl / src / main / java / org / gvsig / raster / swing / impl / sumaryprocess / SummaryProcessDialog.java @ 2365

History | View | Annotate | Download (2.96 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
package org.gvsig.raster.swing.impl.sumaryprocess;
23

    
24
import java.io.File;
25

    
26
import javax.swing.JFrame;
27

    
28
import org.gvsig.i18n.Messages;
29
import org.gvsig.raster.swing.basepanel.ButtonsPanelEvent;
30
import org.gvsig.raster.swing.basepanel.ButtonsPanelListener;
31
import org.gvsig.raster.swing.impl.basepanel.ButtonsPanel;
32

    
33
/**
34
 * Panel principal del dialogo de finalizaci?n del salvado a raster. En el se
35
 * muestra la informaci?n de nombre de fichero, tama?o de este, tiempo de la
36
 * operaci?n, etc...
37
 * 
38
 * Para mostrar un fichero solo hay que usar el metodo estatico show.
39
 *
40
 * @version 19/06/2008
41
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
42
 */
43
public class SummaryProcessDialog implements ButtonsPanelListener {
44
        private JFrame                      frame         = null;
45
        private SummaryProcessPanel         infoPanel     = null;
46
        static private SummaryProcessDialog endInfoDialog = null;
47

    
48
        /**
49
         * Obtiene el panel con la informaci?n de finalizaci?n
50
         * @return EndInfoPanel
51
         */
52
        private SummaryProcessPanel getInfoPanel() {
53
                if (infoPanel == null) {
54
                        infoPanel = new SummaryProcessPanel();
55
                        getFrame().add(infoPanel);
56
                        infoPanel.addButtonPressedListener(this);
57
                }
58
                return infoPanel;
59
        }
60

    
61
        private JFrame getFrame() {
62
                if (frame == null) {
63
                        frame = new JFrame(Messages.getText("stats"));
64
                        frame.setResizable(false);
65
                        frame.setAlwaysOnTop(true);
66
                }
67
                return frame;
68
        }
69
        
70
        static public void show(String fileName, long time) {
71
                if (fileName == null || !new File(fileName).exists())
72
                        return;
73
                
74
                if ((endInfoDialog == null) || (!endInfoDialog.getFrame().isVisible()))
75
                        endInfoDialog = new SummaryProcessDialog();
76
                endInfoDialog.getInfoPanel().addFile(fileName, time);
77
                endInfoDialog.getFrame().setContentPane(endInfoDialog.getInfoPanel());
78
                endInfoDialog.getFrame().pack();
79
                endInfoDialog.getFrame().setVisible(true);
80
        }
81

    
82
        public void actionButtonPressed(ButtonsPanelEvent e) {
83
                if (e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
84
                        getFrame().setVisible(false);
85
                        endInfoDialog = null;
86
                }
87
        }
88
}