Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / extEditing / src / org / gvsig / editing / gui / preferences / FlatnessPage.java @ 29685

History | View | Annotate | Download (5.04 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
/* CVS MESSAGES:
43
*
44
* $Id: FlatnessPage.java 29685 2009-06-29 20:54:24Z jpiera $
45
* $Log$
46
* Revision 1.4  2006-09-06 15:29:59  caballero
47
* initialize flatness
48
*
49
* Revision 1.3  2006/08/22 12:27:53  jaume
50
* improved performances when saving
51
*
52
* Revision 1.2  2006/08/22 07:37:32  jaume
53
* *** empty log message ***
54
*
55
* Revision 1.1  2006/08/10 08:18:35  caballero
56
* configurar grid
57
*
58
* Revision 1.1  2006/08/04 11:41:05  caballero
59
* poder especificar el zoom a aplicar en las vistas
60
*
61
* Revision 1.3  2006/07/31 10:02:31  jaume
62
* *** empty log message ***
63
*
64
* Revision 1.2  2006/06/13 07:43:08  fjp
65
* Ajustes sobre los cuadros de dialogos de preferencias
66
*
67
* Revision 1.1  2006/06/12 16:04:28  caballero
68
* Preferencias
69
*
70
* Revision 1.11  2006/06/06 10:26:31  jaume
71
* *** empty log message ***
72
*
73
* Revision 1.10  2006/06/05 17:07:17  jaume
74
* *** empty log message ***
75
*
76
* Revision 1.9  2006/06/05 17:00:44  jaume
77
* *** empty log message ***
78
*
79
* Revision 1.8  2006/06/05 16:57:59  jaume
80
* *** empty log message ***
81
*
82
* Revision 1.7  2006/06/05 14:45:06  jaume
83
* *** empty log message ***
84
*
85
* Revision 1.6  2006/06/05 11:00:09  jaume
86
* *** empty log message ***
87
*
88
* Revision 1.5  2006/06/05 10:39:02  jaume
89
* *** empty log message ***
90
*
91
* Revision 1.4  2006/06/05 10:13:40  jaume
92
* *** empty log message ***
93
*
94
* Revision 1.3  2006/06/05 10:06:08  jaume
95
* *** empty log message ***
96
*
97
* Revision 1.2  2006/06/05 09:51:56  jaume
98
* *** empty log message ***
99
*
100
* Revision 1.1  2006/06/02 10:50:18  jaume
101
* *** empty log message ***
102
*
103
*
104
*/
105
package org.gvsig.editing.gui.preferences;
106

    
107
import java.util.prefs.Preferences;
108

    
109
import javax.swing.ImageIcon;
110
import javax.swing.JPanel;
111
import javax.swing.JTextArea;
112
import javax.swing.JTextField;
113

    
114
import org.gvsig.andami.PluginServices;
115
import org.gvsig.andami.preferences.AbstractPreferencePage;
116
import org.gvsig.andami.preferences.StoreException;
117
import org.gvsig.fmap.geom.util.Converter;
118

    
119

    
120

    
121
public class FlatnessPage extends AbstractPreferencePage {
122
        private static Preferences prefs = Preferences.userRoot().node( "cadtooladapter" );
123
        private JTextArea jTextArea = null;
124
        private JTextField txtFlatness;
125

    
126
        private ImageIcon icon;
127

    
128
        public FlatnessPage() {
129
                super();
130
                icon = PluginServices.getIconTheme().get("flatness-icon");
131
                addComponent(getJTextArea());
132

    
133
                addComponent(PluginServices.getText(this, "densityfication") + ":",
134
                        txtFlatness = new JTextField("", 15));
135
        }
136

    
137
        public void initializeValues() {
138
                double flatness = Converter.FLATNESS;
139

    
140
                txtFlatness.setText(String.valueOf(flatness));
141

    
142
                Converter.FLATNESS=flatness;
143
        }
144

    
145
        public String getID() {
146
                return this.getClass().getName();
147
        }
148

    
149
        public String getTitle() {
150
                return PluginServices.getText(this, "Flatness");
151
        }
152

    
153
        public JPanel getPanel() {
154
                return this;
155
        }
156

    
157
        public void storeValues() throws StoreException {
158
                double flatness;
159
                try{
160
                        flatness=Double.parseDouble(txtFlatness.getText());
161
                }catch (Exception e) {
162
                        throw new StoreException(PluginServices.getText(this,"minimum_size_of_line_incorrect"));
163
                }
164
                prefs.putDouble("flatness", flatness);
165

    
166
                Converter.FLATNESS=flatness;
167

    
168
        }
169

    
170
        public void initializeDefaults() {
171
                txtFlatness.setText(String.valueOf(Converter.FLATNESS));
172
        }
173

    
174
        public ImageIcon getIcon() {
175
                return icon;
176
        }
177
        /**
178
         * This method initializes jTextArea
179
         *
180
         * @return javax.swing.JTextArea
181
         */
182
        private JTextArea getJTextArea() {
183
                if (jTextArea == null) {
184
                        jTextArea = new JTextArea();
185
                        jTextArea.setBounds(new java.awt.Rectangle(13,7,285,57));
186
                        jTextArea.setForeground(java.awt.Color.black);
187
                        jTextArea.setBackground(java.awt.SystemColor.control);
188
                        jTextArea.setRows(3);
189
                        jTextArea.setWrapStyleWord(true);
190
                        jTextArea.setLineWrap(true);
191
                        jTextArea.setEditable(false);
192
                        jTextArea.setText(PluginServices.getText(this,"specifies_the_minimum_size_of_the_lines_that_will_form_the_curves"));
193
                }
194
                return jTextArea;
195
        }
196

    
197
        public boolean isValueChanged() {
198
                return super.hasChanged();
199
        }
200

    
201
        public void setChangesApplied() {
202
                setChanged(false);
203
        }
204
}