Revision 39257
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/ExporttoDBFProvider.java | ||
---|---|---|
1 |
package org.gvsig.exportto.swing.prov.dbf; |
|
2 |
|
|
3 |
import org.gvsig.exportto.ExporttoService; |
|
4 |
import org.gvsig.exportto.swing.prov.dbf.panel.ExporttoDBFPanel; |
|
5 |
import org.gvsig.exportto.swing.prov.file.AbstractExporttoFileProvider; |
|
6 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProvider; |
|
7 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
8 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
9 |
|
|
10 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
11 |
* |
|
12 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
13 |
* of the Valencian Government (CIT) |
|
14 |
* |
|
15 |
* This program is free software; you can redistribute it and/or |
|
16 |
* modify it under the terms of the GNU General Public License |
|
17 |
* as published by the Free Software Foundation; either version 2 |
|
18 |
* of the License, or (at your option) any later version. |
|
19 |
* |
|
20 |
* This program is distributed in the hope that it will be useful, |
|
21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23 |
* GNU General Public License for more details. |
|
24 |
* |
|
25 |
* You should have received a copy of the GNU General Public License |
|
26 |
* along with this program; if not, write to the Free Software |
|
27 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
28 |
* MA 02110-1301, USA. |
|
29 |
* |
|
30 |
*/ |
|
31 |
|
|
32 |
/** |
|
33 |
* Exporto provider which gets Exporto from a file. |
|
34 |
* |
|
35 |
* @author gvSIG Team |
|
36 |
* @version $Id$ |
|
37 |
* |
|
38 |
*/ |
|
39 |
public class ExporttoDBFProvider extends AbstractExporttoFileProvider implements |
|
40 |
ExporttoSwingProvider { |
|
41 |
|
|
42 |
private String encoding; |
|
43 |
|
|
44 |
public ExporttoDBFProvider(ProviderServices providerServices, |
|
45 |
FeatureStore featureStore) { |
|
46 |
super(providerServices, featureStore, null, new ExporttoDBFPanel()); |
|
47 |
} |
|
48 |
|
|
49 |
public ExporttoService createExporttoService() { |
|
50 |
return new ExporttoDBFService(selectFileOptionPanel.getSelectedFile(), |
|
51 |
featureStore, |
|
52 |
((ExporttoDBFPanel) selectFileOptionPanel).getEncoding()); |
|
53 |
} |
|
54 |
} |
|
0 | 55 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.exporto package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>Exportto provider that export to dbf.</p> |
|
11 |
|
|
12 |
</body> |
|
13 |
</html> |
|
0 | 14 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/panel/EncodingPanel.java | ||
---|---|---|
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.prov.dbf.panel; |
|
23 |
|
|
24 |
import java.awt.BorderLayout; |
|
25 |
import java.awt.GridBagConstraints; |
|
26 |
import java.awt.GridBagLayout; |
|
27 |
|
|
28 |
import javax.swing.JComboBox; |
|
29 |
import javax.swing.JLabel; |
|
30 |
import javax.swing.JPanel; |
|
31 |
|
|
32 |
import org.gvsig.i18n.Messages; |
|
33 |
import org.gvsig.metadata.MetadataLocator; |
|
34 |
import org.gvsig.metadata.MetadataManager; |
|
35 |
import org.gvsig.tools.dynobject.DynField; |
|
36 |
import org.gvsig.tools.dynobject.DynObjectValueItem; |
|
37 |
import org.gvsig.tools.dynobject.DynStruct; |
|
38 |
|
|
39 |
/** |
|
40 |
* @author gvSIG Team |
|
41 |
* @version $Id$ |
|
42 |
* |
|
43 |
*/ |
|
44 |
public class EncodingPanel extends JPanel { |
|
45 |
|
|
46 |
private JLabel encodingLabel; |
|
47 |
private JComboBox encodingCombo; |
|
48 |
|
|
49 |
public EncodingPanel() { |
|
50 |
super(); |
|
51 |
initComponents(); |
|
52 |
initEncodingCombo(); |
|
53 |
} |
|
54 |
|
|
55 |
private void initComponents() { |
|
56 |
this.setLayout(new BorderLayout()); |
|
57 |
|
|
58 |
java.awt.GridBagConstraints gridBagConstraints; |
|
59 |
|
|
60 |
JPanel northPanel = new JPanel(); |
|
61 |
encodingLabel = new JLabel(); |
|
62 |
encodingCombo = new JComboBox(); |
|
63 |
|
|
64 |
northPanel.setLayout(new GridBagLayout()); |
|
65 |
|
|
66 |
encodingLabel.setText(Messages.getText("encoding ") + ": "); |
|
67 |
gridBagConstraints = new GridBagConstraints(); |
|
68 |
gridBagConstraints.gridx = 0; |
|
69 |
gridBagConstraints.gridy = 0; |
|
70 |
northPanel.add(encodingLabel, gridBagConstraints); |
|
71 |
|
|
72 |
gridBagConstraints = new GridBagConstraints(); |
|
73 |
gridBagConstraints.gridx = 1; |
|
74 |
gridBagConstraints.gridy = 0; |
|
75 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
76 |
gridBagConstraints.weightx = 1.0; |
|
77 |
northPanel.add(encodingCombo, gridBagConstraints); |
|
78 |
|
|
79 |
add(northPanel, BorderLayout.NORTH); |
|
80 |
} |
|
81 |
|
|
82 |
private void initEncodingCombo() { |
|
83 |
MetadataManager metadataManager = MetadataLocator.getMetadataManager(); |
|
84 |
DynStruct dynStruct = metadataManager.getDefinition("DBF"); |
|
85 |
DynField dynField = dynStruct.getDynField("Encoding"); |
|
86 |
DynObjectValueItem[] dynObjectValueItem = dynField.getAvailableValues(); |
|
87 |
for (int i = 0; i < dynObjectValueItem.length; i++) { |
|
88 |
encodingCombo.addItem(dynObjectValueItem[i].getValue()); |
|
89 |
} |
|
90 |
} |
|
91 |
|
|
92 |
/** |
|
93 |
* @return |
|
94 |
*/ |
|
95 |
public String getEncoding() { |
|
96 |
String encoding = (String) encodingCombo.getSelectedItem(); |
|
97 |
if ("".equals(encoding)) { |
|
98 |
return null; |
|
99 |
} |
|
100 |
return encoding; |
|
101 |
} |
|
102 |
} |
|
0 | 103 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/panel/ExporttoDBFPanel.java | ||
---|---|---|
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.prov.dbf.panel; |
|
23 |
|
|
24 |
import javax.swing.JComboBox; |
|
25 |
import javax.swing.JLabel; |
|
26 |
|
|
27 |
import org.slf4j.Logger; |
|
28 |
import org.slf4j.LoggerFactory; |
|
29 |
|
|
30 |
import org.gvsig.exportto.swing.prov.file.panel.SelectFileOptionPanel; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author gvSIG Team |
|
34 |
* @version $Id$ |
|
35 |
* |
|
36 |
*/ |
|
37 |
public class ExporttoDBFPanel extends SelectFileOptionPanel { |
|
38 |
|
|
39 |
private static final long serialVersionUID = -2657306673271108746L; |
|
40 |
|
|
41 |
private static final Logger LOG = LoggerFactory |
|
42 |
.getLogger(ExporttoDBFPanel.class); |
|
43 |
|
|
44 |
private JLabel encodingLabel; |
|
45 |
private JComboBox encodingCombo; |
|
46 |
|
|
47 |
public ExporttoDBFPanel() { |
|
48 |
super(new EncodingPanel()); |
|
49 |
} |
|
50 |
|
|
51 |
/** |
|
52 |
* @return |
|
53 |
*/ |
|
54 |
public String getEncoding() { |
|
55 |
return ((EncodingPanel) this.getOptionsPanel()).getEncoding(); |
|
56 |
} |
|
57 |
} |
|
0 | 58 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/ExporttoDBFProviderLibrary.java | ||
---|---|---|
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.prov.dbf; |
|
23 |
|
|
24 |
import org.gvsig.exportto.swing.ExporttoSwingLibrary; |
|
25 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderLocator; |
|
26 |
import org.gvsig.tools.library.AbstractLibrary; |
|
27 |
import org.gvsig.tools.library.LibraryException; |
|
28 |
import org.gvsig.tools.service.spi.ProviderManager; |
|
29 |
|
|
30 |
/** |
|
31 |
* Library to initialize and register the file Exporto provider |
|
32 |
* implementation. |
|
33 |
* |
|
34 |
* @author gvSIG Team |
|
35 |
* @version $Id$ |
|
36 |
* |
|
37 |
*/ |
|
38 |
public class ExporttoDBFProviderLibrary extends AbstractLibrary { |
|
39 |
|
|
40 |
@Override |
|
41 |
public void doRegistration() { |
|
42 |
registerAsServiceOf(ExporttoSwingLibrary.class); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
protected void doInitialize() throws LibraryException { |
|
47 |
// Nothing to do |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
protected void doPostInitialize() throws LibraryException { |
|
52 |
ProviderManager providerManager = |
|
53 |
ExporttoSwingProviderLocator.getManager(); |
|
54 |
providerManager.addProviderFactory(new ExporttoDBFProviderFactory()); |
|
55 |
} |
|
56 |
} |
|
0 | 57 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/ExporttoDBFService.java | ||
---|---|---|
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.prov.dbf; |
|
23 |
|
|
24 |
import java.io.File; |
|
25 |
|
|
26 |
import org.gvsig.exportto.ExporttoService; |
|
27 |
import org.gvsig.exportto.ExporttoServiceException; |
|
28 |
import org.gvsig.exportto.swing.prov.file.AbstractExporttoFileService; |
|
29 |
import org.gvsig.fmap.dal.exception.DataException; |
|
30 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
31 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
32 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
33 |
|
|
34 |
/** |
|
35 |
* @author gvSIG Team |
|
36 |
* @version $Id$ |
|
37 |
* |
|
38 |
*/ |
|
39 |
public class ExporttoDBFService extends AbstractExporttoFileService implements |
|
40 |
ExporttoService { |
|
41 |
|
|
42 |
private String encoding; |
|
43 |
|
|
44 |
protected ExporttoDBFService(File dbfFile, FeatureStore featureStore, |
|
45 |
String encoding) { |
|
46 |
super(dbfFile, featureStore); |
|
47 |
this.encoding = encoding; |
|
48 |
try { |
|
49 |
this.open(); |
|
50 |
} catch (ExporttoServiceException e) { |
|
51 |
((SimpleTaskStatus) getTaskStatus()).message(e.getMessage()); |
|
52 |
} |
|
53 |
} |
|
54 |
|
|
55 |
public void addParameters( |
|
56 |
NewFeatureStoreParameters newFeatureStoreParameters) |
|
57 |
throws DataException { |
|
58 |
newFeatureStoreParameters.setDynValue("Encoding", encoding); |
|
59 |
newFeatureStoreParameters.setDefaultFeatureType(featureStore |
|
60 |
.getDefaultFeatureType().getEditable()); |
|
61 |
} |
|
62 |
|
|
63 |
public String getFileExtension() { |
|
64 |
return "dbf"; |
|
65 |
} |
|
66 |
} |
|
0 | 67 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/java/org/gvsig/exportto/swing/prov/dbf/ExporttoDBFProviderFactory.java | ||
---|---|---|
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.prov.dbf; |
|
23 |
|
|
24 |
import org.gvsig.exportto.swing.ExporttoSwingManager; |
|
25 |
import org.gvsig.exportto.swing.prov.file.AbstractExporttoFileProviderFactory; |
|
26 |
import org.gvsig.fmap.dal.DataTypes; |
|
27 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
28 |
import org.gvsig.tools.ToolsLocator; |
|
29 |
import org.gvsig.tools.dynobject.DynObject; |
|
30 |
import org.gvsig.tools.service.ServiceException; |
|
31 |
import org.gvsig.tools.service.spi.Provider; |
|
32 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
33 |
|
|
34 |
/** |
|
35 |
* Factory of file {@link ExportoProvider} objects. |
|
36 |
* |
|
37 |
* @author gvSIG Team |
|
38 |
* @version $Id$ |
|
39 |
* |
|
40 |
*/ |
|
41 |
public class ExporttoDBFProviderFactory extends |
|
42 |
AbstractExporttoFileProviderFactory { |
|
43 |
|
|
44 |
private static final String PROVIDER_NAME = "DBF"; |
|
45 |
|
|
46 |
public ExporttoDBFProviderFactory() { |
|
47 |
super( |
|
48 |
new int[] { ExporttoSwingManager.VECTORIAL_TABLE_WITHOUT_GEOMETRY }); |
|
49 |
} |
|
50 |
|
|
51 |
public Provider create(DynObject parameters, ProviderServices services) |
|
52 |
throws ServiceException { |
|
53 |
return new ExporttoDBFProvider(services, |
|
54 |
(FeatureStore) parameters.getDynValue(PARAMETER_FEATURESTORE)); |
|
55 |
} |
|
56 |
|
|
57 |
public String getName() { |
|
58 |
return PROVIDER_NAME; |
|
59 |
} |
|
60 |
|
|
61 |
public void initialize() { |
|
62 |
parametersDefinition = |
|
63 |
ToolsLocator.getDynObjectManager().createDynClass(getName(), |
|
64 |
getDescription()); |
|
65 |
parametersDefinition.addDynField(PARAMETER_FEATURESTORE) |
|
66 |
.setType(DataTypes.OBJECT).setMandatory(true) |
|
67 |
.setClassOfValue(FeatureStore.class); |
|
68 |
} |
|
69 |
} |
|
0 | 70 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.exportto.swing.prov.dbf.ExporttoDBFProviderLibrary |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.dbf/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.exportto.swing.prov.dbf</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>org.gvsig.exportto.swing.prov.dbf</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.exportto.swing.prov</artifactId> |
|
11 |
<version>1.0.0-SNAPSHOT</version> |
|
12 |
</parent> |
|
13 |
<dependencies> |
|
14 |
<dependency> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.exportto.swing.api</artifactId> |
|
17 |
<version>1.0.0-SNAPSHOT</version> |
|
18 |
</dependency> |
|
19 |
<dependency> |
|
20 |
<groupId>org.gvsig</groupId> |
|
21 |
<artifactId>org.gvsig.exportto.swing.spi</artifactId> |
|
22 |
<version>1.0.0-SNAPSHOT</version> |
|
23 |
</dependency> |
|
24 |
<dependency> |
|
25 |
<groupId>org.gvsig</groupId> |
|
26 |
<artifactId>org.gvsig.exportto.swing.prov.file</artifactId> |
|
27 |
<version>1.0.0-SNAPSHOT</version> |
|
28 |
</dependency> |
|
29 |
<dependency> |
|
30 |
<groupId>org.gvsig</groupId> |
|
31 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
32 |
<classifier>spi</classifier> |
|
33 |
<scope>compile</scope> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>org.gvsig</groupId> |
|
37 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
38 |
<scope>compile</scope> |
|
39 |
</dependency> |
|
40 |
<dependency> |
|
41 |
<groupId>org.gvsig</groupId> |
|
42 |
<artifactId>org.gvsig.tools.swing.impl</artifactId> |
|
43 |
<scope>runtime</scope> |
|
44 |
</dependency> |
|
45 |
<dependency> |
|
46 |
<groupId>org.gvsig</groupId> |
|
47 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
48 |
<scope>compile</scope> |
|
49 |
</dependency> |
|
50 |
<dependency> |
|
51 |
<groupId>org.gvsig</groupId> |
|
52 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
53 |
<scope>compile</scope> |
|
54 |
</dependency> |
|
55 |
<dependency> |
|
56 |
<groupId>org.gvsig</groupId> |
|
57 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
58 |
<scope>compile</scope> |
|
59 |
</dependency> |
|
60 |
<dependency> |
|
61 |
<groupId>org.gvsig</groupId> |
|
62 |
<artifactId>org.gvsig.projection</artifactId> |
|
63 |
<scope>compile</scope> |
|
64 |
</dependency> |
|
65 |
<dependency> |
|
66 |
<groupId>org.gvsig</groupId> |
|
67 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
68 |
<scope>compile</scope> |
|
69 |
</dependency> |
|
70 |
<dependency> |
|
71 |
<groupId>org.gvsig</groupId> |
|
72 |
<artifactId>org.gvsig.ui</artifactId> |
|
73 |
<scope>compile</scope> |
|
74 |
</dependency> |
|
75 |
<dependency> |
|
76 |
<groupId>org.gvsig</groupId> |
|
77 |
<artifactId>org.gvsig.fmap.dal.file</artifactId> |
|
78 |
<scope>compile</scope> |
|
79 |
</dependency> |
|
80 |
<dependency> |
|
81 |
<groupId>org.gvsig</groupId> |
|
82 |
<artifactId>org.gvsig.i18n</artifactId> |
|
83 |
<scope>compile</scope> |
|
84 |
</dependency> |
|
85 |
<dependency> |
|
86 |
<groupId>org.gvsig</groupId> |
|
87 |
<artifactId>org.gvsig.timesupport.lib.api</artifactId> |
|
88 |
<scope>compile</scope> |
|
89 |
</dependency> |
|
90 |
</dependencies> |
|
91 |
</project> |
|
0 | 92 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/resources/org/gvsig/exportto/swing/prov/generic/i18n/text.properties | ||
---|---|---|
1 |
select_dataexplorer=Selecciona el explorer |
|
2 |
select_dataexplorer_parameters=Selecciona los par?metros del explorer |
|
3 |
select_datastore=Selecciona el store |
|
4 |
select_datastore_parameters=Selecciona los par?metros del store |
|
5 |
exportto_generic_description=Exporta usando el formulario avanzado a cualquier formato soportado por gvSIG. |
|
6 |
exportto_generic_label=Exportaci?n Avanzada |
|
7 |
_File_cannot_be_empty=Debe elegir un archivo |
|
8 |
_Invalid_values_in_form=Valores no v?lidos |
|
0 | 9 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/resources/org/gvsig/exportto/swing/prov/generic/i18n/text_en.properties | ||
---|---|---|
1 |
select_dataexplorer=Select the explorer |
|
2 |
select_dataexplorer_parameters=Select the explorer parameters |
|
3 |
select_datastore=Select the store |
|
4 |
select_datastore_parameters=Select the store parameters |
|
5 |
exportto_generic_description=Export using the advanced form to any gvSIG supported format |
|
6 |
exportto_generic_label=Advanced export |
|
7 |
_File_cannot_be_empty=A file must be selected |
|
8 |
_Invalid_values_in_form=Invalid values |
|
0 | 9 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.exportto.swing.prov.generic.ExporttoGenericProviderLibrary |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/java/org/gvsig/exportto/swing/prov/generic/ExporttoGenericProviderFactory.java | ||
---|---|---|
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.prov.generic; |
|
23 |
|
|
24 |
import org.cresques.cts.IProjection; |
|
25 |
|
|
26 |
import org.gvsig.exportto.swing.spi.AbstractExporttoProviderFactory; |
|
27 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderFactory; |
|
28 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
29 |
import org.gvsig.i18n.Messages; |
|
30 |
import org.gvsig.tools.dynobject.DynObject; |
|
31 |
import org.gvsig.tools.service.ServiceException; |
|
32 |
import org.gvsig.tools.service.spi.Provider; |
|
33 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
34 |
|
|
35 |
/** |
|
36 |
* Factory of generic {@link ExportoProvider} objects. |
|
37 |
* This factory add support for any DAL provider in a generic way. |
|
38 |
* |
|
39 |
* @author gvSIG Team |
|
40 |
* @version $Id$ |
|
41 |
*/ |
|
42 |
public class ExporttoGenericProviderFactory extends |
|
43 |
AbstractExporttoProviderFactory implements ExporttoSwingProviderFactory { |
|
44 |
|
|
45 |
private static final String PROVIDER_NAME = "Generic"; |
|
46 |
|
|
47 |
/** |
|
48 |
* Constructor. |
|
49 |
*/ |
|
50 |
public ExporttoGenericProviderFactory() { |
|
51 |
super(null); |
|
52 |
} |
|
53 |
|
|
54 |
public Provider create(DynObject parameters, ProviderServices services) |
|
55 |
throws ServiceException { |
|
56 |
return new ExporttoGenericProvider(services, |
|
57 |
(FeatureStore) parameters.getDynValue(PARAMETER_FEATURESTORE), |
|
58 |
(IProjection) parameters.getDynValue(PARAMETER_PROJECTION)); |
|
59 |
} |
|
60 |
|
|
61 |
public String getName() { |
|
62 |
return PROVIDER_NAME; |
|
63 |
} |
|
64 |
|
|
65 |
public boolean support(int providerType) throws ServiceException { |
|
66 |
return true; |
|
67 |
} |
|
68 |
|
|
69 |
public String getDescription() { |
|
70 |
return Messages.getText("exportto_generic_description"); |
|
71 |
} |
|
72 |
|
|
73 |
public String getLabel() { |
|
74 |
return Messages.getText("exportto_generic_label"); |
|
75 |
} |
|
76 |
} |
|
0 | 77 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/java/org/gvsig/exportto/swing/prov/generic/ExporttoGenericProvider.java | ||
---|---|---|
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.prov.generic; |
|
23 |
|
|
24 |
import org.cresques.cts.IProjection; |
|
25 |
import org.slf4j.Logger; |
|
26 |
import org.slf4j.LoggerFactory; |
|
27 |
|
|
28 |
import org.gvsig.exportto.ExporttoLocator; |
|
29 |
import org.gvsig.exportto.ExporttoManager; |
|
30 |
import org.gvsig.exportto.ExporttoService; |
|
31 |
import org.gvsig.exportto.swing.prov.generic.panel.DataServerExplorerPanel; |
|
32 |
import org.gvsig.exportto.swing.prov.generic.panel.DataServerExplorerParamsPanel; |
|
33 |
import org.gvsig.exportto.swing.prov.generic.panel.DataStorePanel; |
|
34 |
import org.gvsig.exportto.swing.prov.generic.panel.DataStoreParamsPanel; |
|
35 |
import org.gvsig.exportto.swing.spi.ExporttoPanelValidationException; |
|
36 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProvider; |
|
37 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderPanel; |
|
38 |
import org.gvsig.fmap.dal.DALLocator; |
|
39 |
import org.gvsig.fmap.dal.DataManager; |
|
40 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
41 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
42 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
|
43 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
44 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
45 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
46 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
47 |
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
|
48 |
import org.gvsig.tools.service.ServiceException; |
|
49 |
import org.gvsig.tools.service.spi.AbstractProvider; |
|
50 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
51 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
52 |
import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager; |
|
53 |
import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent; |
|
54 |
|
|
55 |
/** |
|
56 |
* Exporto provider which gets Exporto from a file. |
|
57 |
* |
|
58 |
* @author gvSIG Team |
|
59 |
* @version $Id$ |
|
60 |
*/ |
|
61 |
public class ExporttoGenericProvider extends AbstractProvider implements |
|
62 |
ExporttoSwingProvider { |
|
63 |
|
|
64 |
private static final Logger LOG = LoggerFactory |
|
65 |
.getLogger(ExporttoGenericProvider.class); |
|
66 |
|
|
67 |
private static final DataManager DATA_MANAGER = DALLocator.getDataManager(); |
|
68 |
private static final DynObjectSwingManager DYN_OBJECT_SWING_MANAGER = |
|
69 |
ToolsSwingLocator.getDynObjectSwingManager(); |
|
70 |
private static final ExporttoManager EXPORTTO_MANAGER = ExporttoLocator |
|
71 |
.getManager(); |
|
72 |
|
|
73 |
private DataServerExplorerPanel dataServerExplorerPanel = null; |
|
74 |
private DataServerExplorerParamsPanel dataServerExplorerParamsPanel = null; |
|
75 |
private DataStorePanel dataStorePanel = null; |
|
76 |
private DataStoreParamsPanel dataStoreParamsPanel = null; |
|
77 |
|
|
78 |
private FeatureStore featureStore; |
|
79 |
private IProjection projection; |
|
80 |
private DataServerExplorer dataServerExplorer = null; |
|
81 |
|
|
82 |
/** |
|
83 |
* Constructor. |
|
84 |
* |
|
85 |
* @param providerServices |
|
86 |
* the services for the provider |
|
87 |
* @param file |
|
88 |
* to get the Exporto from |
|
89 |
*/ |
|
90 |
public ExporttoGenericProvider(ProviderServices providerServices, |
|
91 |
FeatureStore featureStore, IProjection projection) { |
|
92 |
super(providerServices); |
|
93 |
this.featureStore = featureStore; |
|
94 |
this.projection = projection; |
|
95 |
|
|
96 |
dataServerExplorerPanel = new DataServerExplorerPanel(this); |
|
97 |
dataServerExplorerParamsPanel = new DataServerExplorerParamsPanel(this); |
|
98 |
dataStorePanel = new DataStorePanel(this); |
|
99 |
dataStoreParamsPanel = new DataStoreParamsPanel(this); |
|
100 |
} |
|
101 |
|
|
102 |
public int getPanelCount() { |
|
103 |
return 4; |
|
104 |
} |
|
105 |
|
|
106 |
public ExporttoSwingProviderPanel getPanelAt(int index) { |
|
107 |
switch (index) { |
|
108 |
case 0: |
|
109 |
return dataServerExplorerPanel; |
|
110 |
case 1: |
|
111 |
return dataServerExplorerParamsPanel; |
|
112 |
case 2: |
|
113 |
return dataStorePanel; |
|
114 |
case 3: |
|
115 |
return dataStoreParamsPanel; |
|
116 |
} |
|
117 |
return null; |
|
118 |
} |
|
119 |
|
|
120 |
public void setDataServerExplorerSelected(String explorerName) |
|
121 |
throws ExporttoPanelValidationException { |
|
122 |
DataServerExplorerParameters dataServerExplorerParameters; |
|
123 |
try { |
|
124 |
dataServerExplorerParameters = |
|
125 |
DATA_MANAGER.createServerExplorerParameters(explorerName); |
|
126 |
JDynObjectComponent dynObjectComponent = |
|
127 |
DYN_OBJECT_SWING_MANAGER.createJDynObjectComponent( |
|
128 |
dataServerExplorerParameters, true); |
|
129 |
this.dataServerExplorerParamsPanel |
|
130 |
.setDynObjectComponent(dynObjectComponent); |
|
131 |
} catch (InitializeException e1) { |
|
132 |
throw new ExporttoPanelValidationException( |
|
133 |
"Error creating the explorer params panel", e1); |
|
134 |
} catch (ProviderNotRegisteredException e1) { |
|
135 |
throw new ExporttoPanelValidationException( |
|
136 |
"Error creating the explorer params panel", e1); |
|
137 |
} catch (ServiceException e1) { |
|
138 |
throw new ExporttoPanelValidationException( |
|
139 |
"Error creating the explorer params panel", e1); |
|
140 |
} |
|
141 |
} |
|
142 |
|
|
143 |
public void setDataServerExplorerParameters( |
|
144 |
DataServerExplorerParameters dataServerExplorerParameters) |
|
145 |
throws ExporttoPanelValidationException { |
|
146 |
String explorerName = |
|
147 |
this.dataServerExplorerPanel.getSelectedProvider(); |
|
148 |
if (explorerName != null) { |
|
149 |
if (dataServerExplorerParameters != null) { |
|
150 |
try { |
|
151 |
dataServerExplorer = |
|
152 |
DATA_MANAGER.openServerExplorer(explorerName, |
|
153 |
dataServerExplorerParameters); |
|
154 |
this.dataStorePanel |
|
155 |
.setDataServerExplorer(dataServerExplorer); |
|
156 |
} catch (ValidateDataParametersException e) { |
|
157 |
throw new ExporttoPanelValidationException( |
|
158 |
"error creating the explorer", e); |
|
159 |
} catch (InitializeException e) { |
|
160 |
throw new ExporttoPanelValidationException( |
|
161 |
"error creating the explorer", e); |
|
162 |
} catch (ProviderNotRegisteredException e) { |
|
163 |
throw new ExporttoPanelValidationException( |
|
164 |
"error creating the explorer", e); |
|
165 |
} |
|
166 |
} |
|
167 |
} |
|
168 |
} |
|
169 |
|
|
170 |
public DataServerExplorer getDataServerExplorer() { |
|
171 |
return dataServerExplorer; |
|
172 |
} |
|
173 |
|
|
174 |
public void setDataStoreSelected(String storeName) |
|
175 |
throws ExporttoPanelValidationException { |
|
176 |
try { |
|
177 |
NewDataStoreParameters newDataStoreParameters = |
|
178 |
dataServerExplorer.getAddParameters(storeName); |
|
179 |
|
|
180 |
try { |
|
181 |
newDataStoreParameters.setDynValue("CRS", projection); |
|
182 |
} catch (DynFieldNotFoundException e) { |
|
183 |
LOG.info("The provider {} doesn't support the CRS parameter", |
|
184 |
storeName); |
|
185 |
} |
|
186 |
try { |
|
187 |
newDataStoreParameters.setDynValue("featureType", featureStore |
|
188 |
.getDefaultFeatureType().getEditable()); |
|
189 |
} catch (DynFieldNotFoundException e) { |
|
190 |
LOG.info( |
|
191 |
"The provider {} doesn't support the featureType parameter", |
|
192 |
storeName); |
|
193 |
} |
|
194 |
|
|
195 |
JDynObjectComponent dynObjectComponent = |
|
196 |
DYN_OBJECT_SWING_MANAGER.createJDynObjectComponent( |
|
197 |
newDataStoreParameters, true); |
|
198 |
this.dataStoreParamsPanel.setDynObjectComponent(dynObjectComponent); |
|
199 |
} catch (Exception e1) { |
|
200 |
throw new ExporttoPanelValidationException( |
|
201 |
"Error creating the store params panel", e1); |
|
202 |
} |
|
203 |
} |
|
204 |
|
|
205 |
private NewDataStoreParameters getNewDataStoreParameters() { |
|
206 |
return dataStoreParamsPanel.getNewDataStoreParameters(); |
|
207 |
} |
|
208 |
|
|
209 |
public ExporttoService createExporttoService() { |
|
210 |
return EXPORTTO_MANAGER.getExporttoService(dataServerExplorer, |
|
211 |
getNewDataStoreParameters()); |
|
212 |
|
|
213 |
} |
|
214 |
} |
|
0 | 215 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/java/org/gvsig/exportto/swing/prov/generic/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.exporto package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>Exporto provider which gets Exporto from a file.</p> |
|
11 |
|
|
12 |
</body> |
|
13 |
</html> |
|
0 | 14 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/java/org/gvsig/exportto/swing/prov/generic/panel/DataStoreParamsPanel.java | ||
---|---|---|
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.prov.generic.panel; |
|
23 |
|
|
24 |
import org.gvsig.exportto.swing.prov.generic.ExporttoGenericProvider; |
|
25 |
import org.gvsig.exportto.swing.spi.ExporttoPanelValidationException; |
|
26 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
|
27 |
|
|
28 |
/** |
|
29 |
* @author gvSIG Team |
|
30 |
* @version $Id$ |
|
31 |
* |
|
32 |
*/ |
|
33 |
public class DataStoreParamsPanel extends AbstractDynObjectParamsPanel { |
|
34 |
|
|
35 |
private static final long serialVersionUID = 181015750609899330L; |
|
36 |
|
|
37 |
/** |
|
38 |
* @param exporttoGenericProvider |
|
39 |
*/ |
|
40 |
public DataStoreParamsPanel(ExporttoGenericProvider exporttoGenericProvider) { |
|
41 |
super(exporttoGenericProvider); |
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
public String getPanelTitle() { |
|
46 |
return EXPORTTO_SWING_MANAGER |
|
47 |
.getTranslation("select_datastore_parameters"); |
|
48 |
} |
|
49 |
|
|
50 |
public boolean isValidPanel() throws ExporttoPanelValidationException { |
|
51 |
dynObjectComponent.saveStatus(); |
|
52 |
super.isValidPanel(); |
|
53 |
return true; |
|
54 |
} |
|
55 |
|
|
56 |
public NewDataStoreParameters getNewDataStoreParameters() { |
|
57 |
dynObjectComponent.saveStatus(); |
|
58 |
return (NewDataStoreParameters) dynObjectComponent.getDynObject(); |
|
59 |
} |
|
60 |
} |
|
0 | 61 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/java/org/gvsig/exportto/swing/prov/generic/panel/AbstractProviderPanel.java | ||
---|---|---|
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.prov.generic.panel; |
|
23 |
|
|
24 |
import java.awt.BorderLayout; |
|
25 |
|
|
26 |
import javax.swing.JList; |
|
27 |
import javax.swing.JScrollPane; |
|
28 |
import javax.swing.ListModel; |
|
29 |
import javax.swing.event.ListSelectionListener; |
|
30 |
|
|
31 |
import org.gvsig.exportto.swing.prov.generic.ExporttoGenericProvider; |
|
32 |
import org.gvsig.exportto.swing.spi.ExporttoPanelValidationException; |
|
33 |
|
|
34 |
/** |
|
35 |
* @author gvSIG Team |
|
36 |
* @version $Id$ |
|
37 |
* |
|
38 |
*/ |
|
39 |
public abstract class AbstractProviderPanel extends |
|
40 |
AbstractExporttoGenericPanel { |
|
41 |
|
|
42 |
private static final long serialVersionUID = -3344421488964340688L; |
|
43 |
private JList dalProviderList = null; |
|
44 |
private JScrollPane scrollPane = null; |
|
45 |
|
|
46 |
public AbstractProviderPanel( |
|
47 |
ExporttoGenericProvider exporttoGenericProvider, ListModel listModel) { |
|
48 |
super(exporttoGenericProvider); |
|
49 |
initializeComponents(listModel); |
|
50 |
} |
|
51 |
|
|
52 |
private void initializeComponents(ListModel listModel) { |
|
53 |
this.setLayout(new BorderLayout()); |
|
54 |
|
|
55 |
// Create the list |
|
56 |
dalProviderList = new JList(); |
|
57 |
dalProviderList.setModel(listModel); |
|
58 |
|
|
59 |
scrollPane = new JScrollPane(); |
|
60 |
scrollPane.setViewportView(dalProviderList); |
|
61 |
|
|
62 |
this.add(scrollPane, BorderLayout.CENTER); |
|
63 |
} |
|
64 |
|
|
65 |
protected void setModel(ListModel listModel) { |
|
66 |
dalProviderList.setModel(listModel); |
|
67 |
} |
|
68 |
|
|
69 |
public String getSelectedProvider() { |
|
70 |
Object obj = dalProviderList.getSelectedValue(); |
|
71 |
if (obj != null) { |
|
72 |
return (String) obj; |
|
73 |
} |
|
74 |
return null; |
|
75 |
} |
|
76 |
|
|
77 |
public void AddListSelectionListener( |
|
78 |
ListSelectionListener listSelectionListener) { |
|
79 |
this.dalProviderList.addListSelectionListener(listSelectionListener); |
|
80 |
} |
|
81 |
|
|
82 |
@Override |
|
83 |
public boolean isValidPanel() throws ExporttoPanelValidationException { |
|
84 |
if (getSelectedProvider() == null) { |
|
85 |
throw new ExporttoPanelValidationException( |
|
86 |
"A provider has to be selected"); |
|
87 |
} |
|
88 |
return true; |
|
89 |
} |
|
90 |
} |
|
0 | 91 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/java/org/gvsig/exportto/swing/prov/generic/panel/DataServerExplorerListModel.java | ||
---|---|---|
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.prov.generic.panel; |
|
23 |
|
|
24 |
import java.util.List; |
|
25 |
|
|
26 |
import javax.swing.ListModel; |
|
27 |
import javax.swing.event.ListDataListener; |
|
28 |
|
|
29 |
import org.gvsig.fmap.dal.DALLocator; |
|
30 |
import org.gvsig.fmap.dal.DataManager; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author gvSIG Team |
|
34 |
* @version $Id$ |
|
35 |
* |
|
36 |
*/ |
|
37 |
public class DataServerExplorerListModel implements ListModel { |
|
38 |
|
|
39 |
@SuppressWarnings("rawtypes") |
|
40 |
private List providers = null; |
|
41 |
|
|
42 |
public DataServerExplorerListModel() { |
|
43 |
super(); |
|
44 |
DataManager dataManager = DALLocator.getDataManager(); |
|
45 |
providers = dataManager.getExplorerProviders(); |
|
46 |
} |
|
47 |
|
|
48 |
public int getSize() { |
|
49 |
return providers.size(); |
|
50 |
} |
|
51 |
|
|
52 |
public Object getElementAt(int index) { |
|
53 |
return providers.get(index); |
|
54 |
} |
|
55 |
|
|
56 |
public void addListDataListener(ListDataListener l) { |
|
57 |
// TODO Auto-generated method stub |
|
58 |
|
|
59 |
} |
|
60 |
|
|
61 |
public void removeListDataListener(ListDataListener l) { |
|
62 |
// TODO Auto-generated method stub |
|
63 |
|
|
64 |
} |
|
65 |
} |
|
0 | 66 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/java/org/gvsig/exportto/swing/prov/generic/panel/DataServerExplorerPanel.java | ||
---|---|---|
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.prov.generic.panel; |
|
23 |
|
|
24 |
import org.gvsig.exportto.swing.prov.generic.ExporttoGenericProvider; |
|
25 |
import org.gvsig.exportto.swing.spi.ExporttoPanelValidationException; |
|
26 |
|
|
27 |
/** |
|
28 |
* @author gvSIG Team |
|
29 |
* @version $Id$ |
|
30 |
* |
|
31 |
*/ |
|
32 |
public class DataServerExplorerPanel extends AbstractProviderPanel { |
|
33 |
|
|
34 |
private static final long serialVersionUID = -5600080647075615795L; |
|
35 |
|
|
36 |
/** |
|
37 |
* @param exporttoGenericProvider |
|
38 |
*/ |
|
39 |
public DataServerExplorerPanel( |
|
40 |
ExporttoGenericProvider exporttoGenericProvider) { |
|
41 |
super(exporttoGenericProvider, new DataServerExplorerListModel()); |
|
42 |
} |
|
43 |
|
|
44 |
public String getPanelTitle() { |
|
45 |
return EXPORTTO_SWING_MANAGER.getTranslation("select_dataexplorer"); |
|
46 |
} |
|
47 |
|
|
48 |
public boolean isValidPanel() throws ExporttoPanelValidationException { |
|
49 |
super.isValidPanel(); |
|
50 |
this.exporttoGenericProvider |
|
51 |
.setDataServerExplorerSelected(getSelectedProvider()); |
|
52 |
return true; |
|
53 |
} |
|
54 |
} |
|
0 | 55 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/java/org/gvsig/exportto/swing/prov/generic/panel/DataStoreListModel.java | ||
---|---|---|
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.prov.generic.panel; |
|
23 |
|
|
24 |
import java.util.List; |
|
25 |
|
|
26 |
import javax.swing.ListModel; |
|
27 |
import javax.swing.event.ListDataListener; |
|
28 |
|
|
29 |
import org.gvsig.fmap.dal.DALLocator; |
|
30 |
import org.gvsig.fmap.dal.DataManager; |
|
31 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
32 |
|
|
33 |
/** |
|
34 |
* @author gvSIG Team |
|
35 |
* @version $Id$ |
|
36 |
* |
|
37 |
*/ |
|
38 |
public class DataStoreListModel implements ListModel { |
|
39 |
|
|
40 |
@SuppressWarnings("rawtypes") |
|
41 |
private List providers = null; |
|
42 |
|
|
43 |
public DataStoreListModel() { |
|
44 |
super(); |
|
45 |
DataManager dataManager = DALLocator.getDataManager(); |
|
46 |
providers = dataManager.getStoreProviders(); |
|
47 |
} |
|
48 |
|
|
49 |
public DataStoreListModel(DataServerExplorer dataServerExplorer) { |
|
50 |
super(); |
|
51 |
providers = dataServerExplorer.getDataStoreProviderNames(); |
|
52 |
} |
|
53 |
|
|
54 |
public int getSize() { |
|
55 |
return providers.size(); |
|
56 |
} |
|
57 |
|
|
58 |
public Object getElementAt(int index) { |
|
59 |
return providers.get(index); |
|
60 |
} |
|
61 |
|
|
62 |
public void addListDataListener(ListDataListener l) { |
|
63 |
// TODO Auto-generated method stub |
|
64 |
|
|
65 |
} |
|
66 |
|
|
67 |
public void removeListDataListener(ListDataListener l) { |
|
68 |
// TODO Auto-generated method stub |
|
69 |
|
|
70 |
} |
|
71 |
} |
|
0 | 72 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/java/org/gvsig/exportto/swing/prov/generic/panel/AbstractExporttoGenericPanel.java | ||
---|---|---|
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.prov.generic.panel; |
|
23 |
|
|
24 |
import org.gvsig.exportto.swing.ExporttoSwingLocator; |
|
25 |
import org.gvsig.exportto.swing.ExporttoSwingManager; |
|
26 |
import org.gvsig.exportto.swing.prov.generic.ExporttoGenericProvider; |
|
27 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderPanel; |
|
28 |
|
|
29 |
/** |
|
30 |
* @author gvSIG Team |
|
31 |
* @version $Id$ |
|
32 |
* |
|
33 |
*/ |
|
34 |
public abstract class AbstractExporttoGenericPanel extends |
|
35 |
ExporttoSwingProviderPanel { |
|
36 |
|
|
37 |
private static final long serialVersionUID = -7994157431819798158L; |
|
38 |
|
|
39 |
protected ExporttoGenericProvider exporttoGenericProvider; |
|
40 |
protected static final ExporttoSwingManager EXPORTTO_SWING_MANAGER = |
|
41 |
ExporttoSwingLocator.getSwingManager(); |
|
42 |
|
|
43 |
public AbstractExporttoGenericPanel( |
|
44 |
ExporttoGenericProvider exporttoGenericProvider) { |
|
45 |
super(); |
|
46 |
this.exporttoGenericProvider = exporttoGenericProvider; |
|
47 |
} |
|
48 |
} |
|
0 | 49 |
tags/v2_0_0_Build_2058/libraries/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.generic/src/main/java/org/gvsig/exportto/swing/prov/generic/panel/DataServerExplorerParamsPanel.java | ||
---|---|---|
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.prov.generic.panel; |
|
23 |
|
|
24 |
import org.gvsig.exportto.swing.prov.generic.ExporttoGenericProvider; |
|
25 |
import org.gvsig.exportto.swing.spi.ExporttoPanelValidationException; |
|
26 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
27 |
|
|
28 |
/** |
|
29 |
* @author gvSIG Team |
|
30 |
* @version $Id$ |
|
31 |
* |
|
32 |
*/ |
|
33 |
public class DataServerExplorerParamsPanel extends AbstractDynObjectParamsPanel { |
|
34 |
|
|
35 |
private static final long serialVersionUID = 667990960406810267L; |
|
36 |
|
|
37 |
/** |
|
38 |
* @param exporttoGenericProvider |
|
39 |
*/ |
|
40 |
public DataServerExplorerParamsPanel( |
|
41 |
ExporttoGenericProvider exporttoGenericProvider) { |
|
42 |
super(exporttoGenericProvider); |
|
43 |
} |
Also available in: Unified diff