root / trunk / extensions / extExpressionField / src / com / iver / cit / gvsig / gui / FieldExpressionPage.java @ 13444
History | View | Annotate | Download (6.42 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: FieldExpressionPage.java 13444 2007-09-03 10:31:51Z caballero $
|
45 |
* $Log$
|
46 |
* Revision 1.1 2007-09-03 10:28:47 caballero
|
47 |
* prepare head
|
48 |
*
|
49 |
* Revision 1.1 2007/02/09 10:49:36 caballero
|
50 |
* expression field
|
51 |
*
|
52 |
* Revision 1.4 2006/09/06 15:29:59 caballero
|
53 |
* initialize flatness
|
54 |
*
|
55 |
* Revision 1.3 2006/08/22 12:27:53 jaume
|
56 |
* improved performances when saving
|
57 |
*
|
58 |
* Revision 1.2 2006/08/22 07:37:32 jaume
|
59 |
* *** empty log message ***
|
60 |
*
|
61 |
* Revision 1.1 2006/08/10 08:18:35 caballero
|
62 |
* configurar grid
|
63 |
*
|
64 |
* Revision 1.1 2006/08/04 11:41:05 caballero
|
65 |
* poder especificar el zoom a aplicar en las vistas
|
66 |
*
|
67 |
* Revision 1.3 2006/07/31 10:02:31 jaume
|
68 |
* *** empty log message ***
|
69 |
*
|
70 |
* Revision 1.2 2006/06/13 07:43:08 fjp
|
71 |
* Ajustes sobre los cuadros de dialogos de preferencias
|
72 |
*
|
73 |
* Revision 1.1 2006/06/12 16:04:28 caballero
|
74 |
* Preferencias
|
75 |
*
|
76 |
* Revision 1.11 2006/06/06 10:26:31 jaume
|
77 |
* *** empty log message ***
|
78 |
*
|
79 |
* Revision 1.10 2006/06/05 17:07:17 jaume
|
80 |
* *** empty log message ***
|
81 |
*
|
82 |
* Revision 1.9 2006/06/05 17:00:44 jaume
|
83 |
* *** empty log message ***
|
84 |
*
|
85 |
* Revision 1.8 2006/06/05 16:57:59 jaume
|
86 |
* *** empty log message ***
|
87 |
*
|
88 |
* Revision 1.7 2006/06/05 14:45:06 jaume
|
89 |
* *** empty log message ***
|
90 |
*
|
91 |
* Revision 1.6 2006/06/05 11:00:09 jaume
|
92 |
* *** empty log message ***
|
93 |
*
|
94 |
* Revision 1.5 2006/06/05 10:39:02 jaume
|
95 |
* *** empty log message ***
|
96 |
*
|
97 |
* Revision 1.4 2006/06/05 10:13:40 jaume
|
98 |
* *** empty log message ***
|
99 |
*
|
100 |
* Revision 1.3 2006/06/05 10:06:08 jaume
|
101 |
* *** empty log message ***
|
102 |
*
|
103 |
* Revision 1.2 2006/06/05 09:51:56 jaume
|
104 |
* *** empty log message ***
|
105 |
*
|
106 |
* Revision 1.1 2006/06/02 10:50:18 jaume
|
107 |
* *** empty log message ***
|
108 |
*
|
109 |
*
|
110 |
*/
|
111 |
package com.iver.cit.gvsig.gui; |
112 |
|
113 |
import java.awt.event.MouseEvent; |
114 |
import java.awt.event.MouseListener; |
115 |
import java.util.prefs.Preferences; |
116 |
|
117 |
import javax.swing.ImageIcon; |
118 |
import javax.swing.JCheckBox; |
119 |
import javax.swing.JPanel; |
120 |
import javax.swing.JTextArea; |
121 |
import javax.swing.JTextField; |
122 |
|
123 |
import com.iver.andami.PluginServices; |
124 |
import com.iver.andami.preferences.AbstractPreferencePage; |
125 |
import com.iver.andami.preferences.StoreException; |
126 |
|
127 |
public class FieldExpressionPage extends AbstractPreferencePage { |
128 |
private static Preferences prefs = Preferences.userRoot().node( "fieldExpressionOptions" ); |
129 |
private JTextArea jTextArea = null; |
130 |
private JTextField txtLimit; |
131 |
private JCheckBox ckLimit=null; |
132 |
private ImageIcon icon; |
133 |
|
134 |
public FieldExpressionPage() {
|
135 |
super();
|
136 |
icon = new ImageIcon(this.getClass().getClassLoader().getResource("images/FieldExpression.png")); |
137 |
addComponent(getJTextArea()); |
138 |
|
139 |
addComponent(PluginServices.getText(this, "limit_rows_in_memory") + ":", |
140 |
txtLimit = new JTextField("", 15)); |
141 |
addComponent(ckLimit = new JCheckBox(PluginServices.getText(this, "without_limit"))); |
142 |
ckLimit.addMouseListener(new MouseListener() { |
143 |
public void mouseClicked(MouseEvent e) { |
144 |
if (ckLimit.isSelected()) {
|
145 |
txtLimit.setText(PluginServices.getText(this, "without_limit")); |
146 |
}else {
|
147 |
if (txtLimit.getText().equals(PluginServices.getText(this, "without_limit"))) |
148 |
txtLimit.setText("500000");
|
149 |
} |
150 |
|
151 |
} |
152 |
public void mouseEntered(MouseEvent e) { |
153 |
} |
154 |
public void mouseExited(MouseEvent e) { |
155 |
} |
156 |
public void mousePressed(MouseEvent e) { |
157 |
} |
158 |
public void mouseReleased(MouseEvent e) { |
159 |
} |
160 |
|
161 |
}); |
162 |
} |
163 |
|
164 |
public void initializeValues() { |
165 |
int limit = prefs.getInt("limit_rows_in_memory",-1); |
166 |
if (limit==-1) { |
167 |
ckLimit.setSelected(true);
|
168 |
txtLimit.setText(PluginServices.getText(this,"without_limit")); |
169 |
}else {
|
170 |
ckLimit.setSelected(false);
|
171 |
txtLimit.setText(String.valueOf(limit));
|
172 |
} |
173 |
} |
174 |
|
175 |
public String getID() { |
176 |
return this.getClass().getName(); |
177 |
} |
178 |
|
179 |
public String getTitle() { |
180 |
return PluginServices.getText(this, "limit_rows_in_memory"); |
181 |
} |
182 |
|
183 |
public JPanel getPanel() { |
184 |
return this; |
185 |
} |
186 |
|
187 |
public void storeValues() throws StoreException { |
188 |
int limit;
|
189 |
try{
|
190 |
if (ckLimit.isSelected()) {
|
191 |
limit=-1;
|
192 |
}else {
|
193 |
// if (txtLimit.getText().equals(PluginServices.getText(this,"without_limit"))) {
|
194 |
// limit=-1;
|
195 |
// }else {
|
196 |
limit=Integer.parseInt(txtLimit.getText());
|
197 |
} |
198 |
}catch (Exception e) { |
199 |
throw new StoreException(PluginServices.getText(this,"limit_rows_in_memory")+PluginServices.getText(this,"error")); |
200 |
} |
201 |
prefs.putInt("limit_rows_in_memory", limit);
|
202 |
} |
203 |
|
204 |
public void initializeDefaults() { |
205 |
int limit=prefs.getInt("limit_rows_in_memory",-1); |
206 |
if (limit==-1) { |
207 |
ckLimit.setSelected(true);
|
208 |
txtLimit.setText(PluginServices.getText(this,"without_limit")); |
209 |
}else {
|
210 |
ckLimit.setSelected(false);
|
211 |
txtLimit.setText(String.valueOf(limit));
|
212 |
} |
213 |
} |
214 |
|
215 |
public ImageIcon getIcon() { |
216 |
return icon;
|
217 |
} |
218 |
/**
|
219 |
* This method initializes jTextArea
|
220 |
*
|
221 |
* @return javax.swing.JTextArea
|
222 |
*/
|
223 |
private JTextArea getJTextArea() { |
224 |
if (jTextArea == null) { |
225 |
jTextArea = new JTextArea(); |
226 |
jTextArea.setBounds(new java.awt.Rectangle(13,7,285,57)); |
227 |
jTextArea.setForeground(java.awt.Color.black); |
228 |
jTextArea.setBackground(java.awt.SystemColor.control); |
229 |
jTextArea.setRows(3);
|
230 |
jTextArea.setWrapStyleWord(true);
|
231 |
jTextArea.setLineWrap(true);
|
232 |
jTextArea.setEditable(false);
|
233 |
jTextArea.setText(PluginServices.getText(this,"specifies_the_limit_rows_in_memory_when_the_program_eval_the_expression")); |
234 |
} |
235 |
return jTextArea;
|
236 |
} |
237 |
|
238 |
public boolean isValueChanged() { |
239 |
return super.hasChanged(); |
240 |
} |
241 |
|
242 |
public void setChangesApplied() { |
243 |
setChanged(false);
|
244 |
} |
245 |
} |