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 @ 37780
History | View | Annotate | Download (3.77 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.exportto.swing.spi.ExporttoSwingProviderLocator; |
36 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderManager; |
37 |
import org.gvsig.gui.beans.wizard.panel.NotContinueWizardException; |
38 |
import org.gvsig.gui.beans.wizard.panel.OptionPanel; |
39 |
import org.gvsig.tools.service.ServiceException; |
40 |
|
41 |
/**
|
42 |
* @author gvSIG Team
|
43 |
* @version $Id$
|
44 |
*
|
45 |
*/
|
46 |
public class ExporterSelectionWizard extends ProviderSelectionPanel implements |
47 |
OptionPanel, ListSelectionListener {
|
48 |
|
49 |
private static final long serialVersionUID = -2818813233378801919L; |
50 |
private static final ExporttoSwingManager EXPORTTO_SWING_MANAGER = |
51 |
ExporttoSwingLocator.getSwingManager(); |
52 |
private static final ExporttoSwingProviderManager EXPORTTO_SWING_PROVIDER_MANAGER = |
53 |
ExporttoSwingProviderLocator.getManager(); |
54 |
private static final Logger LOG = LoggerFactory |
55 |
.getLogger(ExporterSelectionWizard.class); |
56 |
|
57 |
public ExporterSelectionWizard(
|
58 |
DefaultJExporttoServicePanel exporttoServicePanel, int[] providerTypes) { |
59 |
super(exporttoServicePanel, providerTypes);
|
60 |
this.exporttoProviderList.addListSelectionListener(this); |
61 |
} |
62 |
|
63 |
public String getPanelTitle() { |
64 |
return exporttoServicePanel.getExporttoSwingManager().getTranslation(
|
65 |
"select_format_to_export");
|
66 |
} |
67 |
|
68 |
public void nextPanel() throws NotContinueWizardException { |
69 |
String providerName = this.getSelectedProvider(); |
70 |
|
71 |
if (providerName != null) { |
72 |
try {
|
73 |
exporttoServicePanel.selectExporttoSwingProvider(providerName); |
74 |
} catch (ServiceException e) {
|
75 |
LOG.error("Not possible to create a exporto swing provider", e);
|
76 |
throw new NotContinueWizardException( |
77 |
EXPORTTO_SWING_MANAGER |
78 |
.getTranslation("execute_adding_error"),
|
79 |
e, this);
|
80 |
} |
81 |
} |
82 |
} |
83 |
|
84 |
public void lastPanel() { |
85 |
// TODO Auto-generated method stub
|
86 |
|
87 |
} |
88 |
|
89 |
public void updatePanel() { |
90 |
// TODO Auto-generated method stub
|
91 |
|
92 |
} |
93 |
|
94 |
public JPanel getJPanel() { |
95 |
return this; |
96 |
} |
97 |
|
98 |
public void valueChanged(ListSelectionEvent e) { |
99 |
String providerName = this.getSelectedProvider(); |
100 |
|
101 |
if (providerName != null) { |
102 |
descriptionText.setText(EXPORTTO_SWING_PROVIDER_MANAGER |
103 |
.getDescription(providerName)); |
104 |
|
105 |
exporttoServicePanel.setNextButtonEnabled(true);
|
106 |
} |
107 |
} |
108 |
} |