Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / saveas / SaveAsActions.java @ 18014

History | View | Annotate | Download (2.55 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.rastertools.saveas;
20

    
21
import java.io.File;
22

    
23
import javax.swing.JFrame;
24

    
25
import org.gvsig.raster.util.RasterToolsUtil;
26
import org.gvsig.raster.util.RasterUtilities;
27
import org.gvsig.rastertools.IProcessActions;
28
import org.gvsig.rastertools.saveraster.ui.info.EndInfoPanel;
29
/**
30
 * Acciones que ejecuta el proceso de salvado.
31
 *
32
 * @version 26/09/2007
33
 * @author Nacho Brodin (nachobrodin@gmail.com)
34
 */
35
public class SaveAsActions implements IProcessActions {
36
        /*
37
         * (non-Javadoc)
38
         * @see org.gvsig.rastertools.IProcessActions#end(java.lang.Object)
39
         */
40
        public void end(Object params) {
41
                if (params instanceof Object[] &&
42
                                ((Object[]) params).length == 2 &&
43
                                ((Object[]) params)[0] instanceof String &&
44
                                ((Object[]) params)[1] instanceof Long) {
45

    
46
                        String fName = (String) ((Object[]) params)[0];
47
                        long milis = ((Long) ((Object[]) params)[1]).longValue();
48

    
49
                        setEndInfo(fName, milis);
50
                }
51
        }
52

    
53
        /**
54
         * Lanza la ventana de informaci?n cuando acaba el proceso de
55
         * guardado
56
         * @param fName Nombre del archivo
57
         * @param milis Tiempo que ha tardado el proceso en milisegundos
58
         */
59
        private void setEndInfo(String fName, long milis){
60
                String compression;
61
                File f = new File(fName);
62
                if (fName.endsWith("ecw") ||
63
                                fName.endsWith("jp2") ||
64
                                fName.endsWith("jpg") ||
65
                                fName.endsWith("jpeg")) {
66
                        compression = "Yes";
67
                } else {
68
                        compression = "No";
69
                }
70

    
71
                EndInfoPanel info = new EndInfoPanel();
72
                info.addFile(fName, RasterUtilities.formatTime(milis), RasterUtilities.formatFileSize(f.length()), compression);
73

    
74
                JFrame endJFrame = new JFrame(RasterToolsUtil.getText(this, "Stats"));
75
                endJFrame.setResizable(false);
76
                endJFrame.setAlwaysOnTop(true);
77
                endJFrame.add(info);
78
        }
79

    
80
        public void interrupted() {}
81
}