svn-gvsig-desktop / tags / v1_1_Build_1007 / extensions / extCAD / src / com / iver / cit / gvsig / gui / preferences / FlatnessPage.java @ 12478
History | View | Annotate | Download (5.08 KB)
1 | 6713 | caballero | /* 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$
|
||
45 | * $Log$
|
||
46 | 7072 | caballero | * 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 | 6811 | jaume | * improved performances when saving
|
51 | *
|
||
52 | * Revision 1.2 2006/08/22 07:37:32 jaume
|
||
53 | 6805 | jaume | * *** empty log message ***
|
54 | *
|
||
55 | * Revision 1.1 2006/08/10 08:18:35 caballero
|
||
56 | 6713 | caballero | * 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 com.iver.cit.gvsig.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 com.iver.andami.PluginServices; |
||
115 | import com.iver.andami.preferences.AbstractPreferencePage; |
||
116 | import com.iver.andami.preferences.StoreException; |
||
117 | import com.iver.cit.gvsig.fmap.core.v02.FConverter; |
||
118 | |||
119 | public class FlatnessPage extends AbstractPreferencePage { |
||
120 | private static Preferences prefs = Preferences.userRoot().node( "cadtooladapter" ); |
||
121 | private JTextArea jTextArea = null; |
||
122 | private JTextField txtFlatness; |
||
123 | |||
124 | private ImageIcon icon; |
||
125 | |||
126 | public FlatnessPage() {
|
||
127 | super();
|
||
128 | icon = new ImageIcon(this.getClass().getClassLoader().getResource("images/Flatness.png")); |
||
129 | addComponent(getJTextArea()); |
||
130 | |||
131 | addComponent(PluginServices.getText(this, "densityfication") + ":", |
||
132 | txtFlatness = new JTextField("", 15)); |
||
133 | } |
||
134 | |||
135 | public void initializeValues() { |
||
136 | 7072 | caballero | double flatness = FConverter.FLATNESS;
|
137 | 6713 | caballero | |
138 | txtFlatness.setText(String.valueOf(flatness));
|
||
139 | |||
140 | 7072 | caballero | FConverter.FLATNESS=flatness; |
141 | 6713 | caballero | } |
142 | |||
143 | public String getID() { |
||
144 | return this.getClass().getName(); |
||
145 | } |
||
146 | |||
147 | public String getTitle() { |
||
148 | return PluginServices.getText(this, "Flatness"); |
||
149 | } |
||
150 | |||
151 | public JPanel getPanel() { |
||
152 | return this; |
||
153 | } |
||
154 | |||
155 | public void storeValues() throws StoreException { |
||
156 | double flatness;
|
||
157 | try{
|
||
158 | flatness=Double.parseDouble(txtFlatness.getText());
|
||
159 | }catch (Exception e) { |
||
160 | throw new StoreException(PluginServices.getText(this,"minimum_size_of_line_incorrect")); |
||
161 | } |
||
162 | prefs.putDouble("flatness", flatness);
|
||
163 | |||
164 | 7072 | caballero | FConverter.FLATNESS=flatness; |
165 | 6811 | jaume | |
166 | 6713 | caballero | } |
167 | |||
168 | public void initializeDefaults() { |
||
169 | 7072 | caballero | txtFlatness.setText(String.valueOf(FConverter.FLATNESS));
|
170 | 6713 | caballero | } |
171 | |||
172 | public ImageIcon getIcon() { |
||
173 | return icon;
|
||
174 | } |
||
175 | /**
|
||
176 | * This method initializes jTextArea
|
||
177 | *
|
||
178 | * @return javax.swing.JTextArea
|
||
179 | */
|
||
180 | private JTextArea getJTextArea() { |
||
181 | if (jTextArea == null) { |
||
182 | jTextArea = new JTextArea(); |
||
183 | jTextArea.setBounds(new java.awt.Rectangle(13,7,285,57)); |
||
184 | jTextArea.setForeground(java.awt.Color.black); |
||
185 | jTextArea.setBackground(java.awt.SystemColor.control); |
||
186 | jTextArea.setRows(3);
|
||
187 | jTextArea.setWrapStyleWord(true);
|
||
188 | jTextArea.setLineWrap(true);
|
||
189 | jTextArea.setEditable(false);
|
||
190 | jTextArea.setText(PluginServices.getText(this,"specifies_the_minimum_size_of_the_lines_that_will_form_the_curves")); |
||
191 | } |
||
192 | return jTextArea;
|
||
193 | } |
||
194 | 6805 | jaume | |
195 | public boolean isValueChanged() { |
||
196 | return super.hasChanged(); |
||
197 | } |
||
198 | 6811 | jaume | |
199 | public void setChangesApplied() { |
||
200 | setChanged(false);
|
||
201 | } |
||
202 | 6713 | caballero | } |