Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / org.gvsig.exportto / org.gvsig.exportto.swing / org.gvsig.exportto.swing.impl / src / main / java / org / gvsig / exportto / swing / impl / wizard / ExporterSelectionWizard.java @ 35745

History | View | Annotate | Download (3.36 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.exportto.swing.impl.wizard;
23

    
24
import javax.swing.JPanel;
25
import javax.swing.event.ListSelectionEvent;
26
import javax.swing.event.ListSelectionListener;
27

    
28
import org.slf4j.Logger;
29
import org.slf4j.LoggerFactory;
30

    
31
import org.gvsig.exportto.swing.ExporttoSwingLocator;
32
import org.gvsig.exportto.swing.ExporttoSwingManager;
33
import org.gvsig.exportto.swing.impl.DefaultJExporttoServicePanel;
34
import org.gvsig.exportto.swing.impl.panel.ProviderSelectionPanel;
35
import org.gvsig.gui.beans.wizard.panel.NotContinueWizardException;
36
import org.gvsig.gui.beans.wizard.panel.OptionPanel;
37
import org.gvsig.tools.service.ServiceException;
38

    
39

    
40
/**
41
 * @author gvSIG Team
42
 * @version $Id$
43
 *
44
 */
45
public class ExporterSelectionWizard extends ProviderSelectionPanel implements OptionPanel, ListSelectionListener{
46
    private static final long serialVersionUID = -2818813233378801919L;
47
    private static final ExporttoSwingManager EXPORTTO_SWING_MANAGER =
48
        ExporttoSwingLocator.getSwingManager();
49
    private static final Logger LOG =
50
        LoggerFactory.getLogger(ExporterSelectionWizard.class);
51

    
52
    public ExporterSelectionWizard(DefaultJExporttoServicePanel exporttoServicePanel, int[] providerTypes) {
53
        super(exporttoServicePanel, providerTypes);     
54
        this.exporttoProviderList.addListSelectionListener(this);        
55
    }
56

    
57
    public String getPanelTitle() {
58
        return exporttoServicePanel.getExporttoSwingManager().getTranslation("select_format_to_export");
59
    }
60

    
61
    public void nextPanel() throws NotContinueWizardException {
62
        String providerName = this.getSelectedProvider();
63

    
64
        if (providerName != null){
65
            try {            
66
                exporttoServicePanel.selectExporttoSwingProvider(providerName);
67
            } catch (ServiceException e) {
68
                LOG.error("Not possible to create a exporto swing provider", e);
69
                throw new NotContinueWizardException(
70
                    EXPORTTO_SWING_MANAGER.getTranslation("execute_adding_error"), e, this);
71
            }
72
        }          
73
    }    
74

    
75
    public void lastPanel() {
76
        // TODO Auto-generated method stub
77

    
78
    }
79

    
80
    public void updatePanel() {
81
        // TODO Auto-generated method stub
82

    
83
    }
84

    
85
    public JPanel getJPanel() {     
86
        return this;
87
    }
88

    
89
    public void valueChanged(ListSelectionEvent e) {
90
        String providerName = this.getSelectedProvider();
91

    
92
        if (providerName != null){
93
            exporttoServicePanel.setNextButtonEnabled(true);
94
        }
95
    }
96
}