root / branches / v2_0_0_prep / extensions / extExpressionField / src / org / gvsig / expressionfield / gui / FieldExpressionPage.java @ 38564
History | View | Annotate | Download (6.76 KB)
1 | 27752 | vcaballero | /* 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 14822 2007-10-22 12:15:32Z jmvivo $
|
||
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 | 29628 | jpiera | package org.gvsig.expressionfield.gui; |
112 | 27752 | vcaballero | |
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 | 29628 | jpiera | import org.gvsig.andami.PluginServices; |
124 | import org.gvsig.andami.preferences.AbstractPreferencePage; |
||
125 | import org.gvsig.andami.preferences.StoreException; |
||
126 | 27752 | vcaballero | |
127 | 29628 | jpiera | |
128 | 27876 | vcaballero | /**
|
129 | * @author Vicente Caballero Navarro
|
||
130 | */
|
||
131 | 27752 | vcaballero | public class FieldExpressionPage extends AbstractPreferencePage { |
132 | private static Preferences prefs = Preferences.userRoot().node( "fieldExpressionOptions" ); |
||
133 | private JTextArea jTextArea = null; |
||
134 | private JTextField txtLimit; |
||
135 | private JCheckBox ckLimit=null; |
||
136 | private ImageIcon icon; |
||
137 | |||
138 | public FieldExpressionPage() {
|
||
139 | super();
|
||
140 | 38564 | jjdelcerro | icon=PluginServices.getIconTheme().get("expression-field-preferences");
|
141 | 27752 | vcaballero | addComponent(getJTextArea()); |
142 | |||
143 | addComponent(PluginServices.getText(this, "limit_rows_in_memory") + ":", |
||
144 | txtLimit = new JTextField("", 15)); |
||
145 | addComponent(ckLimit = new JCheckBox(PluginServices.getText(this, "without_limit"))); |
||
146 | ckLimit.addMouseListener(new MouseListener() { |
||
147 | public void mouseClicked(MouseEvent e) { |
||
148 | if (ckLimit.isSelected()) {
|
||
149 | txtLimit.setText(PluginServices.getText(this, "without_limit")); |
||
150 | }else {
|
||
151 | if (txtLimit.getText().equals(PluginServices.getText(this, "without_limit"))) |
||
152 | txtLimit.setText("500000");
|
||
153 | } |
||
154 | |||
155 | } |
||
156 | public void mouseEntered(MouseEvent e) { |
||
157 | } |
||
158 | public void mouseExited(MouseEvent e) { |
||
159 | } |
||
160 | public void mousePressed(MouseEvent e) { |
||
161 | } |
||
162 | public void mouseReleased(MouseEvent e) { |
||
163 | } |
||
164 | |||
165 | }); |
||
166 | } |
||
167 | |||
168 | public void initializeValues() { |
||
169 | int limit = prefs.getInt("limit_rows_in_memory",-1); |
||
170 | if (limit==-1) { |
||
171 | ckLimit.setSelected(true);
|
||
172 | txtLimit.setText(PluginServices.getText(this,"without_limit")); |
||
173 | }else {
|
||
174 | ckLimit.setSelected(false);
|
||
175 | txtLimit.setText(String.valueOf(limit));
|
||
176 | } |
||
177 | } |
||
178 | |||
179 | public String getID() { |
||
180 | return this.getClass().getName(); |
||
181 | } |
||
182 | |||
183 | public String getTitle() { |
||
184 | return PluginServices.getText(this, "limit_rows_in_memory"); |
||
185 | } |
||
186 | |||
187 | public JPanel getPanel() { |
||
188 | return this; |
||
189 | } |
||
190 | |||
191 | public void storeValues() throws StoreException { |
||
192 | int limit;
|
||
193 | try{
|
||
194 | if (ckLimit.isSelected()) {
|
||
195 | limit=-1;
|
||
196 | }else {
|
||
197 | // if (txtLimit.getText().equals(PluginServices.getText(this,"without_limit"))) {
|
||
198 | // limit=-1;
|
||
199 | // }else {
|
||
200 | limit=Integer.parseInt(txtLimit.getText());
|
||
201 | } |
||
202 | }catch (Exception e) { |
||
203 | throw new StoreException(PluginServices.getText(this,"limit_rows_in_memory")+PluginServices.getText(this,"error")); |
||
204 | } |
||
205 | prefs.putInt("limit_rows_in_memory", limit);
|
||
206 | } |
||
207 | |||
208 | public void initializeDefaults() { |
||
209 | int limit=prefs.getInt("limit_rows_in_memory",-1); |
||
210 | if (limit==-1) { |
||
211 | ckLimit.setSelected(true);
|
||
212 | txtLimit.setText(PluginServices.getText(this,"without_limit")); |
||
213 | }else {
|
||
214 | ckLimit.setSelected(false);
|
||
215 | txtLimit.setText(String.valueOf(limit));
|
||
216 | } |
||
217 | } |
||
218 | |||
219 | public ImageIcon getIcon() { |
||
220 | return icon;
|
||
221 | } |
||
222 | /**
|
||
223 | * This method initializes jTextArea
|
||
224 | *
|
||
225 | * @return javax.swing.JTextArea
|
||
226 | */
|
||
227 | private JTextArea getJTextArea() { |
||
228 | if (jTextArea == null) { |
||
229 | jTextArea = new JTextArea(); |
||
230 | jTextArea.setBounds(new java.awt.Rectangle(13,7,285,57)); |
||
231 | jTextArea.setForeground(java.awt.Color.black); |
||
232 | jTextArea.setBackground(java.awt.SystemColor.control); |
||
233 | jTextArea.setRows(3);
|
||
234 | jTextArea.setWrapStyleWord(true);
|
||
235 | jTextArea.setLineWrap(true);
|
||
236 | jTextArea.setEditable(false);
|
||
237 | jTextArea.setText(PluginServices.getText(this,"specifies_the_limit_rows_in_memory_when_the_program_eval_the_expression")); |
||
238 | } |
||
239 | return jTextArea;
|
||
240 | } |
||
241 | |||
242 | public boolean isValueChanged() { |
||
243 | return super.hasChanged(); |
||
244 | } |
||
245 | |||
246 | public void setChangesApplied() { |
||
247 | setChanged(false);
|
||
248 | } |
||
249 | } |