Statistics
| Revision:

root / branches / v2_0_0_prep / applications / appgvSIG / src / com / iver / cit / gvsig / gui / preferencespage / DriverCSVPage.java @ 23383

History | View | Annotate | Download (3.77 KB)

1
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib��ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41

    
42
package com.iver.cit.gvsig.gui.preferencespage;
43

    
44
import javax.swing.ImageIcon;
45
import javax.swing.JPanel;
46
import javax.swing.JTextField;
47

    
48
import org.gvsig.fmap.mapcontext.layers.LayerFactory;
49

    
50
//import com.hardcode.driverManager.DriverLoadException;
51
//import com.hardcode.driverManager.DriverManager;
52
//import com.hardcode.gdbms.driver.csvstring.CSVStringDriver;
53
import com.iver.andami.PluginServices;
54
import com.iver.andami.preferences.AbstractPreferencePage;
55
import com.iver.andami.preferences.StoreException;
56
import com.iver.utiles.XMLEntity;
57
/**
58
 * CSV Driver preference page where the user can establish default values for
59
 * <ol>
60
 *  <li><b>separator</b></li>
61
 * </ol>
62
 * @author Vicente Caballero Navarro
63
 *
64
 */
65
//TODO comentado para que compile
66
public class DriverCSVPage extends AbstractPreferencePage{
67
        private static final String DEFAULT_SEPARATOR_CSV_DRIVER = "DefaultSeparatorCSVDriver";
68
        static String id = DriverCSVPage.class.getName();;
69
        private ImageIcon icon;
70
        private JTextField txtSeparator;
71

    
72
        /**
73
         * Builds preference page where the user can establish default values for
74
         * <ol>
75
         *  <li><b>separator</b></li>
76
         * </ol>
77
         */
78
        public DriverCSVPage() {
79
                super();
80
                icon=PluginServices.getIconTheme().get("mapa-icono");
81
                addComponent(PluginServices.getText(this, "separador"), txtSeparator = new JTextField(5));
82
                setParentID(DriversPages.class.getName());
83
        }
84

    
85
        public void storeValues() throws StoreException {
86
                String separator;
87
                separator = txtSeparator.getText();
88
//                DriverManager dm=LayerFactory.getDM();
89
//                CSVStringDriver cvsDriver=null;
90
//                try {
91
//                        cvsDriver = (CSVStringDriver)dm.getDriver("csv string");
92
//                } catch (DriverLoadException e) {
93
//                        throw new StoreException();
94
//                }
95
//                cvsDriver.setSeparator(separator);
96
                PluginServices ps = PluginServices.getPluginServices(this);
97
                XMLEntity xml = ps.getPersistentXML();
98
                xml.putProperty(DEFAULT_SEPARATOR_CSV_DRIVER, separator);
99
        }
100

    
101
        public String getID() {
102
                return id;
103
        }
104

    
105
        public String getTitle() {
106
                return PluginServices.getText(this, "CSVStringDriver");
107
        }
108

    
109
        public JPanel getPanel() {
110
                return this;
111
        }
112

    
113
        public void initializeValues() {
114
                PluginServices ps = PluginServices.getPluginServices(this);
115
                XMLEntity xml = ps.getPersistentXML();
116
                if (xml.contains(DEFAULT_SEPARATOR_CSV_DRIVER)) {
117
                        txtSeparator.setText(xml.getStringProperty(DEFAULT_SEPARATOR_CSV_DRIVER));
118
                }
119

    
120
        }
121

    
122
        public void initializeDefaults() {
123
                txtSeparator.setText(",");
124
        }
125

    
126
        public ImageIcon getIcon() {
127
                return icon;
128
        }
129

    
130
        public boolean isValueChanged() {
131
                return super.hasChanged();
132
        }
133

    
134
        public void setChangesApplied() {
135
                setChanged(false);
136
        }
137
}