Revision 44386 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.impl/src/main/java/org/gvsig/export/swing/impl/panels/SelectOutputFilePanel.java
SelectOutputFilePanel.java | ||
---|---|---|
3 | 3 |
import java.io.File; |
4 | 4 |
import javax.swing.JComponent; |
5 | 5 |
import javax.swing.JOptionPane; |
6 |
import static org.geotools.resources.TestData.file; |
|
6 | 7 |
import org.gvsig.export.ExportParameters; |
7 | 8 |
import org.gvsig.export.swing.JExportProcessPanel; |
8 | 9 |
import org.gvsig.export.swing.spi.ExportPanel; |
... | ... | |
16 | 17 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
17 | 18 |
import org.gvsig.tools.util.HasAFile; |
18 | 19 |
|
19 |
|
|
20 | 20 |
/** |
21 | 21 |
* |
22 | 22 |
* @author jjdelcerro |
23 | 23 |
*/ |
24 |
public class SelectOutputFilePanel
|
|
24 |
public class SelectOutputFilePanel |
|
25 | 25 |
extends SelectOutputFilePanelView |
26 |
implements ExportPanel |
|
27 |
{ |
|
26 |
implements ExportPanel { |
|
28 | 27 |
|
29 | 28 |
private FilePickerController fileController; |
30 | 29 |
private final HasAFile parameters; |
31 | 30 |
private final JExportProcessPanel processPanel; |
32 |
|
|
33 |
|
|
31 |
|
|
34 | 32 |
public SelectOutputFilePanel( |
35 | 33 |
JExportProcessPanel processPanel, |
36 | 34 |
ExportParameters parameters |
37 |
) {
|
|
35 |
) { |
|
38 | 36 |
this.processPanel = processPanel; |
39 |
this.parameters = (HasAFile)parameters; |
|
37 |
this.parameters = (HasAFile) parameters;
|
|
40 | 38 |
this.initComponents(); |
41 | 39 |
} |
42 | 40 |
|
... | ... | |
48 | 46 |
@Override |
49 | 47 |
public String getTitlePanel() { |
50 | 48 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
51 |
return i18n.getTranslation("Seleccionar_fichero");
|
|
49 |
return i18n.getTranslation("Seleccionar_fichero"); |
|
52 | 50 |
} |
53 | 51 |
|
54 | 52 |
@Override |
55 | 53 |
public boolean validatePanel() throws ExportPanelValidationException { |
56 | 54 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
57 | 55 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
58 |
|
|
59 |
if( this.fileController.isEmpty() ) {
|
|
56 |
|
|
57 |
if (this.fileController.isEmpty()) {
|
|
60 | 58 |
throw new ExportPanelValidationException( |
61 |
i18n.getTranslation("_File_cannot_be_empty")); |
|
59 |
i18n.getTranslation("_File_cannot_be_empty"));
|
|
62 | 60 |
} |
63 | 61 |
File file = this.fileController.get(); |
64 | 62 |
if (file.exists()) { |
65 | 63 |
int resp = dialogs.confirmDialog( |
66 | 64 |
i18n.getTranslation("fichero_ya_existe_seguro_desea_guardarlo"), |
67 | 65 |
i18n.getTranslation("guardar"), |
68 |
JOptionPane.YES_NO_OPTION,
|
|
69 |
JOptionPane.QUESTION_MESSAGE,
|
|
66 |
JOptionPane.YES_NO_OPTION, |
|
67 |
JOptionPane.QUESTION_MESSAGE, |
|
70 | 68 |
"OverwriteFileOnExport" |
71 | 69 |
); |
72 | 70 |
if (resp == JOptionPane.NO_OPTION) { |
... | ... | |
89 | 87 |
|
90 | 88 |
@Override |
91 | 89 |
public void enterPanel() { |
92 |
// Default do nothing |
|
90 |
File file = this.parameters.getFile(); |
|
91 |
if (file != null) { |
|
92 |
this.fileController.set(file); |
|
93 |
} |
|
93 | 94 |
} |
94 | 95 |
|
95 | 96 |
@Override |
... | ... | |
98 | 99 |
} |
99 | 100 |
|
100 | 101 |
private void initComponents() { |
102 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
103 |
File initialPath = null; |
|
104 |
if (this.parameters.getFile()!=null) { |
|
105 |
initialPath = this.parameters.getFile(); |
|
106 |
} |
|
101 | 107 |
this.fileController = ToolsSwingLocator.getToolsSwingManager() |
102 |
.createFilePickerController(txtFile, btnSelectFile); |
|
108 |
.createFilePickerController(txtFile, |
|
109 |
btnSelectFile, |
|
110 |
null, |
|
111 |
null, initialPath, true); |
|
103 | 112 |
this.translate(); |
104 | 113 |
} |
105 |
|
|
114 |
|
|
106 | 115 |
private void translate() { |
107 | 116 |
ToolsSwingManager i18nc = ToolsSwingLocator.getToolsSwingManager(); |
108 | 117 |
i18nc.translate(this.lblFile); |
Also available in: Unified diff