Revision 37780 branches/v2_0_0_prep/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.file/src/main/java/org/gvsig/exportto/swing/prov/file/panel/SelectFileOptionPanel.java

View differences:

SelectFileOptionPanel.java
37 37
/**
38 38
 * @author gvSIG Team
39 39
 * @version $Id$
40
 *
40
 * 
41 41
 */
42
public class SelectFileOptionPanel extends ExporttoSwingProviderPanel{
42
public class SelectFileOptionPanel extends ExporttoSwingProviderPanel {
43

  
43 44
    private static final long serialVersionUID = -7417782279157857962L;
44 45
    private JPanel optionsPanel;
45
    
46

  
46 47
    private static final ExporttoSwingManager EXPORTTO_SWING_MANAGER =
47 48
        ExporttoSwingLocator.getSwingManager();
48 49

  
49 50
    private org.gvsig.gui.beans.wizard.panel.SelectFileOptionPanel selectFileOptionPanel;
50
    
51

  
51 52
    /**
52 53
     * @param fileText
53 54
     */
54 55
    public SelectFileOptionPanel() {
55
        this(null);        
56
        this(null);
56 57
    }
57
    
58

  
58 59
    public SelectFileOptionPanel(JPanel optionsPanel) {
59 60
        super();
60 61
        this.setLayout(new BorderLayout());
61
        selectFileOptionPanel = new org.gvsig.gui.beans.wizard.panel.SelectFileOptionPanel(null);
62
        selectFileOptionPanel =
63
            new org.gvsig.gui.beans.wizard.panel.SelectFileOptionPanel(null);
62 64
        add(selectFileOptionPanel, BorderLayout.NORTH);
63
        if (optionsPanel != null){            
64
            optionsPanel.setBorder(
65
                javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createTitledBorder(Messages.getText("options")),
66
                javax.swing.BorderFactory.createEmptyBorder(10, 5, 5, 5)));
65
        if (optionsPanel != null) {
66
            optionsPanel.setBorder(javax.swing.BorderFactory
67
                .createCompoundBorder(javax.swing.BorderFactory
68
                    .createTitledBorder(Messages.getText("options")),
69
                    javax.swing.BorderFactory.createEmptyBorder(10, 5, 5, 5)));
67 70
            add(optionsPanel, BorderLayout.CENTER);
68 71
            this.optionsPanel = optionsPanel;
69 72
        }
70 73
    }
71 74

  
72 75
    @Override
73
    public String getPanelTitle() {    
76
    public String getPanelTitle() {
74 77
        return EXPORTTO_SWING_MANAGER.getTranslation("Seleccionar_fichero");
75 78
    }
76
    
77
    public File getSelectedFile(){
79

  
80
    public File getSelectedFile() {
78 81
        return selectFileOptionPanel.getSelectedFile();
79 82
    }
80 83

  
81 84
    @Override
82 85
    public boolean isValidPanel() throws ExporttoPanelValidationException {
83 86
        File file = selectFileOptionPanel.getSelectedFile();
84
        if ((file == null) || (file.equals(""))){
85
            throw new ExporttoPanelValidationException("The file can not be empty");
87
        if ((file == null) || (file.equals(""))) {
88
            throw new ExporttoPanelValidationException(
89
                "The file can not be empty");
86 90
        }
87
        if( file.exists()){
88
            int resp = JOptionPane.showConfirmDialog((Component)selectFileOptionPanel, 
89
                EXPORTTO_SWING_MANAGER.getTranslation("fichero_ya_existe_seguro_desea_guardarlo"),
90
                EXPORTTO_SWING_MANAGER.getTranslation("guardar"), JOptionPane.YES_NO_OPTION);
91
        if (file.exists()) {
92
            int resp =
93
                JOptionPane
94
                    .showConfirmDialog(
95
                        (Component) selectFileOptionPanel,
96
                        EXPORTTO_SWING_MANAGER
97
                            .getTranslation("fichero_ya_existe_seguro_desea_guardarlo"),
98
                        EXPORTTO_SWING_MANAGER.getTranslation("guardar"),
99
                        JOptionPane.YES_NO_OPTION);
91 100
            if (resp == JOptionPane.NO_OPTION) {
92 101
                return false;
93 102
            }
94 103
        }
95 104
        return true;
96
    }    
97
    
105
    }
106

  
98 107
    /**
99 108
     * @return the optionsPanel
100 109
     */

Also available in: Unified diff