Revision 21684 trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/saveas/SaveAsActions.java
SaveAsActions.java | ||
---|---|---|
18 | 18 |
*/ |
19 | 19 |
package org.gvsig.rastertools.saveas; |
20 | 20 |
|
21 |
import java.io.File; |
|
22 |
|
|
23 |
import javax.swing.JFrame; |
|
24 |
|
|
25 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
|
26 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
|
27 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
|
28 | 21 |
import org.gvsig.raster.IProcessActions; |
29 |
import org.gvsig.raster.util.RasterToolsUtil; |
|
30 |
import org.gvsig.raster.util.RasterUtilities; |
|
31 |
import org.gvsig.rastertools.saveraster.ui.info.EndInfoPanel; |
|
22 |
import org.gvsig.rastertools.saveraster.ui.info.EndInfoDialog; |
|
32 | 23 |
/** |
33 | 24 |
* Acciones que ejecuta el proceso de salvado. |
34 | 25 |
* |
35 | 26 |
* @version 26/09/2007 |
36 | 27 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
37 | 28 |
*/ |
38 |
public class SaveAsActions implements IProcessActions, ButtonsPanelListener { |
|
39 |
private EndInfoPanel endInfoPanel = null; |
|
40 |
private JFrame endJFrame = null; |
|
29 |
public class SaveAsActions implements IProcessActions { |
|
41 | 30 |
|
42 | 31 |
/* |
43 | 32 |
* (non-Javadoc) |
44 |
* @see org.gvsig.rastertools.IProcessActions#end(java.lang.Object)
|
|
33 |
* @see org.gvsig.raster.IProcessActions#end(java.lang.Object) |
|
45 | 34 |
*/ |
46 | 35 |
public void end(Object params) { |
47 | 36 |
if (params instanceof Object[] && |
... | ... | |
52 | 41 |
String fName = (String) ((Object[]) params)[0]; |
53 | 42 |
long milis = ((Long) ((Object[]) params)[1]).longValue(); |
54 | 43 |
|
55 |
setEndInfo(fName, milis);
|
|
44 |
EndInfoDialog.show(fName, milis);
|
|
56 | 45 |
} |
57 | 46 |
} |
58 | 47 |
|
59 |
/** |
|
60 |
* Lanza la ventana de informaci?n cuando acaba el proceso de |
|
61 |
* guardado |
|
62 |
* @param fName Nombre del archivo |
|
63 |
* @param milis Tiempo que ha tardado el proceso en milisegundos |
|
64 |
*/ |
|
65 |
private void setEndInfo(String fName, long milis){ |
|
66 |
String compression; |
|
67 |
File f = new File(fName); |
|
68 |
if (fName.endsWith("ecw") || |
|
69 |
fName.endsWith("jp2") || |
|
70 |
fName.endsWith("jpg") || |
|
71 |
fName.endsWith("jpeg")) { |
|
72 |
compression = "Yes"; |
|
73 |
} else { |
|
74 |
compression = "No"; |
|
75 |
} |
|
76 |
|
|
77 |
getEndInfoDialog().addFile(fName, RasterUtilities.formatTime(milis), RasterUtilities.formatFileSize(f.length()), compression); |
|
78 |
getEndJFrame().pack(); |
|
79 |
getEndJFrame().setVisible(true); |
|
80 |
} |
|
81 |
|
|
82 |
public EndInfoPanel getEndInfoDialog() { |
|
83 |
if (endInfoPanel == null) { |
|
84 |
endInfoPanel = new EndInfoPanel(); |
|
85 |
getEndJFrame().add(endInfoPanel); |
|
86 |
endInfoPanel.addButtonPressedListener(this); |
|
87 |
} |
|
88 |
return endInfoPanel; |
|
89 |
} |
|
90 |
|
|
91 |
public JFrame getEndJFrame() { |
|
92 |
if (endJFrame == null) { |
|
93 |
endJFrame = new JFrame(RasterToolsUtil.getText(this, "stats")); |
|
94 |
endJFrame.setResizable(false); |
|
95 |
endJFrame.setAlwaysOnTop(true); |
|
96 |
} |
|
97 |
return endJFrame; |
|
98 |
} |
|
99 |
|
|
100 |
public void actionButtonPressed(ButtonsPanelEvent e) { |
|
101 |
if (e.getButton() == ButtonsPanel.BUTTON_ACCEPT) { |
|
102 |
if (e.getSource() == getEndInfoDialog().getButtonsPanel()) { |
|
103 |
getEndJFrame().setVisible(false); |
|
104 |
return; |
|
105 |
} |
|
106 |
} |
|
107 |
} |
|
108 |
|
|
109 | 48 |
public void interrupted() {} |
110 | 49 |
} |
Also available in: Unified diff