Blame view

src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java 21.9 KB
506d0c0b   Nathanael Jourdane   Add licence heade...
1
2
3
4
5
/*
 * This file is a part of EpnTAPClient.
 * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
 * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
 * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
1e543ea0   Nathanael Jourdane   Code clean-up
6
 *
506d0c0b   Nathanael Jourdane   Add licence heade...
7
8
9
10
11
12
13
14
15
16
 * This program is free software: you can
 * redistribute it and/or modify it under the terms of the GNU General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
 * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU General Public License for more details. You should have received a copy of
 * the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */

eb483599   Nathanael Jourdane   Add missing Param...
17
18
19
20
package eu.omp.irap.vespa.epntapclient.view;

import java.awt.Color;
import java.awt.Dimension;
a99d92fa   Nathanael Jourdane   Add JComboBox for...
21
22
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
eb483599   Nathanael Jourdane   Add missing Param...
23
24
25
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
e7647bba   Nathanael Jourdane   change query to g...
26
import java.util.ArrayList;
e7647bba   Nathanael Jourdane   change query to g...
27
import java.util.List;
eb483599   Nathanael Jourdane   Add missing Param...
28
import java.util.Locale;
b6627be6   Nathanael Jourdane   Improve Exceptions
29
import java.util.logging.Level;
5d3c344e   Nathanael Jourdane   Use Java logging ...
30
import java.util.logging.Logger;
eb483599   Nathanael Jourdane   Add missing Param...
31
32

import javax.swing.BoxLayout;
f00cb6bb   Nathanael Jourdane   Add a JComboBox f...
33
import javax.swing.JComboBox;
eb483599   Nathanael Jourdane   Add missing Param...
34
35
36
37
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
eb483599   Nathanael Jourdane   Add missing Param...
38
39
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
eb483599   Nathanael Jourdane   Add missing Param...
40

05b140ed   Nathanael Jourdane   TargetNameField J...
41
42
43
44
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

0f1bce56   Nathanael Jourdane   Use a listerner i...
45
import eu.omp.irap.vespa.epntapclient.controller.ViewListener;
05b140ed   Nathanael Jourdane   TargetNameField J...
46
import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableConnection;
d3a65e87   Nathanael Jourdane   Improve Javadoc.
47
import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.CantSendQueryException;
05b140ed   Nathanael Jourdane   TargetNameField J...
48

a227a22d   Nathanael Jourdane   Add comments.
49
/**
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
50
51
52
53
 * A field used to set a service parameter to build the query (in the parameter panel). ParamField
 * is an abstract method and all type of parameter field should extend it. See
 * https://voparis-confluence.obspm.fr/display/VES/4+-+EPN-TAP+queries to get all parameters
 * details.
1e543ea0   Nathanael Jourdane   Code clean-up
54
 *
a227a22d   Nathanael Jourdane   Add comments.
55
56
 * @author N. Jourdane
 */
eb483599   Nathanael Jourdane   Add missing Param...
57
public abstract class ParamField extends JPanel {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
58

1e543ea0   Nathanael Jourdane   Code clean-up
59
60
	/** The serial version UID. */
	private static final long serialVersionUID = 1L;
53d49e83   Nathanael Jourdane   Fix all Eclipse w...
61

5d3c344e   Nathanael Jourdane   Use Java logging ...
62
	/** The logger for the class ParamField. */
869d1749   Nathanael Jourdane   remove unused log...
63
	protected static final Logger logger = Logger.getLogger(ParamField.class.getName());
eb483599   Nathanael Jourdane   Add missing Param...
64

a227a22d   Nathanael Jourdane   Add comments.
65
	/** The minimum width of the field. */
68ae1315   Nathanael Jourdane   Improve GUI appar...
66
	private static final int MIN_FIELD_WIDTH = 30;
1e543ea0   Nathanael Jourdane   Code clean-up
67

a227a22d   Nathanael Jourdane   Add comments.
68
	/** The preferred field height. */
68ae1315   Nathanael Jourdane   Improve GUI appar...
69
	private static final int FIELD_HEIGHT = 20;
1e543ea0   Nathanael Jourdane   Code clean-up
70

a227a22d   Nathanael Jourdane   Add comments.
71
	/** The maximum width of the field. */
68ae1315   Nathanael Jourdane   Improve GUI appar...
72
	private static final int MAX_FIELD_WIDTH = 400;
1e543ea0   Nathanael Jourdane   Code clean-up
73

a227a22d   Nathanael Jourdane   Add comments.
74
	/** The preferred label width. */
68ae1315   Nathanael Jourdane   Improve GUI appar...
75
76
	private static final int LABEL_WIDTH = 140;

a227a22d   Nathanael Jourdane   Add comments.
77
	/** The URL of the resolver used for the `target name` field. */
05b140ed   Nathanael Jourdane   TargetNameField J...
78
	private static final String RESOLVER_URL = "http://voparis-registry.obspm.fr/ssodnet/1/autocomplete";
1e543ea0   Nathanael Jourdane   Code clean-up
79

a227a22d   Nathanael Jourdane   Add comments.
80
	/** The date format used in the DateRange field */
eb483599   Nathanael Jourdane   Add missing Param...
81
	private static final String DATE_FORMAT = "dd/MM/yyyy";
1e543ea0   Nathanael Jourdane   Code clean-up
82

a227a22d   Nathanael Jourdane   Add comments.
83
	/** The regex used to validate the Date fields */
eb483599   Nathanael Jourdane   Add missing Param...
84
	private static final String DATE_REGEX = "(^(((0[1-9]|1[0-9]|2[0-8])[\\/](0[1-9]|1[012]))|((29|30|31)[\\/](0[13578]|1[02]))|((29|30)[\\/](0[4,6,9]|11)))[\\/](19|[2-9][0-9])\\d\\d$)|(^29[\\/]02[\\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)";
1e543ea0   Nathanael Jourdane   Code clean-up
85

a227a22d   Nathanael Jourdane   Add comments.
86
	/** The suffix used in REG-TAP parameters names, indicating that it's a beginning of a range. */
eb483599   Nathanael Jourdane   Add missing Param...
87
	private static final String MIN_SUFFIX = "min";
1e543ea0   Nathanael Jourdane   Code clean-up
88

a227a22d   Nathanael Jourdane   Add comments.
89
	/** The suffix used in REG-TAP parameters names, indicating that it is a end of a range. */
eb483599   Nathanael Jourdane   Add missing Param...
90
91
	private static final String MAX_SUFFIX = "max";

a227a22d   Nathanael Jourdane   Add comments.
92
	/** The main view of the application. */
0f1bce56   Nathanael Jourdane   Use a listerner i...
93
	protected ViewListener viewListener;
1e543ea0   Nathanael Jourdane   Code clean-up
94

a227a22d   Nathanael Jourdane   Add comments.
95
	/** The parameter name of the field */
eb483599   Nathanael Jourdane   Add missing Param...
96
97
	protected String paramName;

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
98

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
99
100
101
	/**
	 * Method constructor for the parameter field abstract class, which do all common action for all
	 * type of field, such as displaying the name of the parameter.
1e543ea0   Nathanael Jourdane   Code clean-up
102
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
103
104
105
	 * @param mainView The main view of the application.
	 * @param paramName The name of the parameter.
	 */
0f1bce56   Nathanael Jourdane   Use a listerner i...
106
	public ParamField(ViewListener viewListener, String paramName) {
eb483599   Nathanael Jourdane   Add missing Param...
107
		super();
5af53be7   Nathanael Jourdane   Make the applicat...
108

0f1bce56   Nathanael Jourdane   Use a listerner i...
109
		this.viewListener = viewListener;
5af53be7   Nathanael Jourdane   Make the applicat...
110
111
		this.paramName = paramName;

1e543ea0   Nathanael Jourdane   Code clean-up
112
113
		setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
		setMaximumSize(new Dimension(ParamField.MAX_FIELD_WIDTH, ParamField.FIELD_HEIGHT));
eb483599   Nathanael Jourdane   Add missing Param...
114
115
		String strLabel = paramName.replaceAll("_", " ").trim();
		JLabel label = new JLabel(strLabel.substring(0, 1).toUpperCase() + strLabel.substring(1));
1e543ea0   Nathanael Jourdane   Code clean-up
116
		label.setPreferredSize(new Dimension(ParamField.LABEL_WIDTH, ParamField.FIELD_HEIGHT));
eb483599   Nathanael Jourdane   Add missing Param...
117
		this.add(label);
41133475   Nathanael Jourdane   build floatRangeF...
118
		// TODO: Add tooltip text based on rr.table_column.column_description
eb483599   Nathanael Jourdane   Add missing Param...
119
120
	}

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
121

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
122
123
124
	/**
	 * The string field is used for parameter with a `String` class. It is a simple JTextField with
	 * no verification. The parameter is sent to the controller each time it is modified.
1e543ea0   Nathanael Jourdane   Code clean-up
125
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
126
127
	 * @author N. Jourdane
	 */
e97b40e8   Nathanael Jourdane   Make ParamField c...
128
	public static class StringField extends ParamField implements TextFieldListener {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
129

1e543ea0   Nathanael Jourdane   Code clean-up
130
131
132
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
133
		/** The JTextField used to put the parameter value. */
667dd80c   Nathanael Jourdane   JTextField as Par...
134
135
		JTextField field;

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
136

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
137
138
		/**
		 * Method constructor for the string field.
1e543ea0   Nathanael Jourdane   Code clean-up
139
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
140
141
142
		 * @param mainView The main view of the application.
		 * @param paramName The name of the parameter.
		 */
0f1bce56   Nathanael Jourdane   Use a listerner i...
143
144
		public StringField(ViewListener viewListener, String paramName) {
			super(viewListener, paramName);
667dd80c   Nathanael Jourdane   JTextField as Par...
145
			field = new JTextField();
1e543ea0   Nathanael Jourdane   Code clean-up
146
			ParamField.addChangeListener(this, field);
eb483599   Nathanael Jourdane   Add missing Param...
147
148
149
			this.add(field);
		}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
150
151
152
		/**
		 * This method is called each time the field is modified.
		 */
53d49e83   Nathanael Jourdane   Fix all Eclipse w...
153
154
		@Override
		public void update(JTextField textField) {
fe1e4470   Nathanael Jourdane   Minor code improv...
155
			if (textField.getText().isEmpty()) {
0f1bce56   Nathanael Jourdane   Use a listerner i...
156
				viewListener.onParameterChanged(paramName, null);
eb483599   Nathanael Jourdane   Add missing Param...
157
			} else {
0f1bce56   Nathanael Jourdane   Use a listerner i...
158
				viewListener.onParameterChanged(paramName, textField.getText());
eb483599   Nathanael Jourdane   Add missing Param...
159
160
161
162
			}
		}
	}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
163
164
165
166
	/**
	 * The float field is used for parameter with a `Float` class. It is a JTextField which checks
	 * if the content is a valid float. If the parameter is valid or if it is empty, then the float
	 * value is sent to the controller.
1e543ea0   Nathanael Jourdane   Code clean-up
167
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
168
169
	 * @author N. Jourdane
	 */
e97b40e8   Nathanael Jourdane   Make ParamField c...
170
	public static class FloatField extends ParamField implements TextFieldListener {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
171

1e543ea0   Nathanael Jourdane   Code clean-up
172
173
174
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
175
		/** The JTextField used to put the parameter value. */
667dd80c   Nathanael Jourdane   JTextField as Par...
176
177
		JTextField field;

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
178

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
179
180
		/**
		 * Method constructor
1e543ea0   Nathanael Jourdane   Code clean-up
181
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
182
183
184
		 * @param mainView The main view of the application.
		 * @param paramName The name of the parameter.
		 */
0f1bce56   Nathanael Jourdane   Use a listerner i...
185
186
		public FloatField(ViewListener viewListener, String paramName) {
			super(viewListener, paramName);
667dd80c   Nathanael Jourdane   JTextField as Par...
187
			field = new JTextField();
1e543ea0   Nathanael Jourdane   Code clean-up
188
			ParamField.addChangeListener(this, field);
eb483599   Nathanael Jourdane   Add missing Param...
189
190
191
			this.add(field);
		}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
192
193
194
		/**
		 * This method is called each time the field is modified.
		 */
53d49e83   Nathanael Jourdane   Fix all Eclipse w...
195
196
		@Override
		public void update(JTextField textField) {
fe1e4470   Nathanael Jourdane   Minor code improv...
197
			if (textField.getText().isEmpty()) {
53d49e83   Nathanael Jourdane   Fix all Eclipse w...
198
				textField.setBackground(Color.WHITE);
0f1bce56   Nathanael Jourdane   Use a listerner i...
199
				viewListener.onParameterRemoved(paramName);
eb483599   Nathanael Jourdane   Add missing Param...
200
201
			} else {
				try {
53d49e83   Nathanael Jourdane   Fix all Eclipse w...
202
					float value = Float.parseFloat(textField.getText());
0f1bce56   Nathanael Jourdane   Use a listerner i...
203
					viewListener.onParameterChanged(paramName, value);
53d49e83   Nathanael Jourdane   Fix all Eclipse w...
204
205
206
					textField.setBackground(Color.WHITE);
				} catch (@SuppressWarnings("unused") NumberFormatException e) {
					textField.setBackground(Color.PINK);
eb483599   Nathanael Jourdane   Add missing Param...
207
208
209
210
211
				}
			}
		}
	}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
212
213
214
215
216
	/**
	 * The date range field is used for couples of parameter with both a `Date` type (actually only
	 * `time_min` and `time_max` parameters is concerned for now). These are JTextFields which check
	 * if the content is a valid date, according to DATE_FORMAT. If the parameter is valid or if it
	 * is empty, then the dates value are sent to the controller, in Julian Day format.
1e543ea0   Nathanael Jourdane   Code clean-up
217
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
218
219
	 * @author N. Jourdane
	 */
e97b40e8   Nathanael Jourdane   Make ParamField c...
220
	public static class DateRangeField extends ParamField implements TextFieldListener {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
221

1e543ea0   Nathanael Jourdane   Code clean-up
222
223
224
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
225
		/** The JTextField used to put the parameter minimum value of the range. */
667dd80c   Nathanael Jourdane   JTextField as Par...
226
		JTextField fieldMin;
1e543ea0   Nathanael Jourdane   Code clean-up
227

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
228
		/** The JTextField used to put the parameter maximum value of the range. */
667dd80c   Nathanael Jourdane   JTextField as Par...
229
230
		JTextField fieldMax;

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
231

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
232
233
		/**
		 * Method constructor
1e543ea0   Nathanael Jourdane   Code clean-up
234
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
235
236
237
		 * @param mainView The main view of the application.
		 * @param paramName The name of the parameter.
		 */
0f1bce56   Nathanael Jourdane   Use a listerner i...
238
239
		public DateRangeField(ViewListener viewListener, String paramName) {
			super(viewListener, paramName);
68ae1315   Nathanael Jourdane   Improve GUI appar...
240
			this.add(new JLabel("min "));
667dd80c   Nathanael Jourdane   JTextField as Par...
241
			fieldMin = new JTextField();
1e543ea0   Nathanael Jourdane   Code clean-up
242
243
244
245
			fieldMin.setName(ParamField.MIN_SUFFIX);
			fieldMin.setPreferredSize(
					new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT));
			ParamField.addChangeListener(this, fieldMin);
eb483599   Nathanael Jourdane   Add missing Param...
246
247
			this.add(fieldMin);

68ae1315   Nathanael Jourdane   Improve GUI appar...
248
			this.add(new JLabel("max "));
667dd80c   Nathanael Jourdane   JTextField as Par...
249
			fieldMax = new JTextField();
1e543ea0   Nathanael Jourdane   Code clean-up
250
251
252
253
			fieldMax.setName(ParamField.MAX_SUFFIX);
			fieldMax.setPreferredSize(
					new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT));
			ParamField.addChangeListener(this, fieldMin);
eb483599   Nathanael Jourdane   Add missing Param...
254
255
256
			this.add(fieldMax);
		}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
257
258
259
		/**
		 * This method is called each time the field is modified.
		 */
53d49e83   Nathanael Jourdane   Fix all Eclipse w...
260
		@Override
e97b40e8   Nathanael Jourdane   Make ParamField c...
261
		public void update(JTextField field) {
1e543ea0   Nathanael Jourdane   Code clean-up
262
			DateFormat df = new SimpleDateFormat(ParamField.DATE_FORMAT, Locale.ENGLISH);
fe1e4470   Nathanael Jourdane   Minor code improv...
263
			if (field.getText().isEmpty()) {
eb483599   Nathanael Jourdane   Add missing Param...
264
				field.setBackground(Color.WHITE);
0f1bce56   Nathanael Jourdane   Use a listerner i...
265
				viewListener.onParameterRemoved(paramName + field.getName());
1e543ea0   Nathanael Jourdane   Code clean-up
266
			} else if (field.getText().matches(ParamField.DATE_REGEX)) {
eb483599   Nathanael Jourdane   Add missing Param...
267
268
				try {
					long date = df.parse(field.getText()).getTime();
1e543ea0   Nathanael Jourdane   Code clean-up
269
					date = Math.round(date / 86400000.0 + 2440587.5); // to JD
0f1bce56   Nathanael Jourdane   Use a listerner i...
270
271
					viewListener.onParameterChanged(paramName + field.getName(),
							date);
eb483599   Nathanael Jourdane   Add missing Param...
272
					field.setBackground(Color.WHITE);
53d49e83   Nathanael Jourdane   Fix all Eclipse w...
273
				} catch (@SuppressWarnings("unused") ParseException e) {
eb483599   Nathanael Jourdane   Add missing Param...
274
275
276
277
278
279
280
281
282
					field.setBackground(Color.PINK);
				}
				// TODO: check if date min < date max
			} else {
				field.setBackground(Color.PINK);
			}
		}
	}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
283
284
285
286
	/**
	 * The float range field is used for couples of parameter with both a `Float` class. These are
	 * JTextFields which check if the content is a valid float. If the parameter is valid or if it
	 * is empty, then the float value are sent to the controller.
1e543ea0   Nathanael Jourdane   Code clean-up
287
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
288
289
	 * @author N. Jourdane
	 */
e97b40e8   Nathanael Jourdane   Make ParamField c...
290
	public static class FloatRangeField extends ParamField implements TextFieldListener {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
291

1e543ea0   Nathanael Jourdane   Code clean-up
292
293
294
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
295
		/** The JTextField used to put the parameter minimum value of the range. */
41133475   Nathanael Jourdane   build floatRangeF...
296
		JTextField fieldMin;
1e543ea0   Nathanael Jourdane   Code clean-up
297

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
298
		/** The JTextField used to put the parameter maximum value of the range. */
41133475   Nathanael Jourdane   build floatRangeF...
299
		JTextField fieldMax;
eb483599   Nathanael Jourdane   Add missing Param...
300

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
301

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
302
303
		/**
		 * Method constructor
1e543ea0   Nathanael Jourdane   Code clean-up
304
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
305
306
307
		 * @param mainView The main view of the application.
		 * @param paramName The name of the parameter.
		 */
0f1bce56   Nathanael Jourdane   Use a listerner i...
308
309
		public FloatRangeField(ViewListener viewListener, String paramName) {
			super(viewListener, paramName);
41133475   Nathanael Jourdane   build floatRangeF...
310
			fieldMin = new JTextField();
1e543ea0   Nathanael Jourdane   Code clean-up
311
312
			fieldMin.setName(ParamField.MIN_SUFFIX);
			ParamField.addChangeListener(this, fieldMin);
eb483599   Nathanael Jourdane   Add missing Param...
313
314
			this.add(fieldMin);

41133475   Nathanael Jourdane   build floatRangeF...
315
			fieldMax = new JTextField();
1e543ea0   Nathanael Jourdane   Code clean-up
316
317
			fieldMax.setName(ParamField.MAX_SUFFIX);
			ParamField.addChangeListener(this, fieldMax);
eb483599   Nathanael Jourdane   Add missing Param...
318
319
			this.add(fieldMax);
		}
41133475   Nathanael Jourdane   build floatRangeF...
320

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
321
322
323
		/**
		 * This method is called each time the field is modified.
		 */
53d49e83   Nathanael Jourdane   Fix all Eclipse w...
324
		@Override
e97b40e8   Nathanael Jourdane   Make ParamField c...
325
		public void update(JTextField field) {
fe1e4470   Nathanael Jourdane   Minor code improv...
326
			if (field.getText().isEmpty()) {
41133475   Nathanael Jourdane   build floatRangeF...
327
				field.setBackground(Color.WHITE);
0f1bce56   Nathanael Jourdane   Use a listerner i...
328
				viewListener.onParameterRemoved(paramName + field.getName());
41133475   Nathanael Jourdane   build floatRangeF...
329
330
			} else {
				try {
0f1bce56   Nathanael Jourdane   Use a listerner i...
331
					viewListener.onParameterChanged(paramName + field.getName(),
e97b40e8   Nathanael Jourdane   Make ParamField c...
332
							Float.parseFloat(field.getText()));
41133475   Nathanael Jourdane   build floatRangeF...
333
					field.setBackground(Color.WHITE);
53d49e83   Nathanael Jourdane   Fix all Eclipse w...
334
				} catch (@SuppressWarnings("unused") NumberFormatException e) {
41133475   Nathanael Jourdane   build floatRangeF...
335
336
337
338
					field.setBackground(Color.PINK);
				}
			}
		}
eb483599   Nathanael Jourdane   Add missing Param...
339
340
	}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
341
342
343
344
345
	/**
	 * The target name field is used only for the `target_name` parameter. It is a ComboBox which is
	 * automatically filled with actual target names which begins by the entered characters, by
	 * asking to an online resolver (RESOLVER_URL). The parameter is sent to the controller each
	 * time it is updated, so it is possible to enter a parameter that the resolver do not know.
1e543ea0   Nathanael Jourdane   Code clean-up
346
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
347
348
	 * @author N. Jourdane
	 */
e97b40e8   Nathanael Jourdane   Make ParamField c...
349
	public static class TargetNameField extends ParamField implements TextFieldListener {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
350

1e543ea0   Nathanael Jourdane   Code clean-up
351
352
353
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
354
		/** The comboBox to enter the target_name and display target name propositions. */
f00cb6bb   Nathanael Jourdane   Add a JComboBox f...
355
		JComboBox<String> comboBox;
1e543ea0   Nathanael Jourdane   Code clean-up
356

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
357
		/** The JTextField related to the ComboBox, allowing to listen for text content update. */
667dd80c   Nathanael Jourdane   JTextField as Par...
358
		JTextField field;
1e543ea0   Nathanael Jourdane   Code clean-up
359

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
360
361
362
363
364
		/**
		 * The content of the last entered value. It is used to avoid recursions, because each time
		 * an update event is detected, the resolver is called and the ComboBox is filled with new
		 * values, which trigger a new event.
		 */
f00cb6bb   Nathanael Jourdane   Add a JComboBox f...
365
		String lastContent;
667dd80c   Nathanael Jourdane   JTextField as Par...
366

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
367
		/**
4268557f   Nathanael Jourdane   Fix some Sonar is...
368
369
370
371
		 * This method is called each time the field is modified. A Runnable is used it is
		 * impossible to modify the comboBox from a DocumentEvent.
		 */
		Runnable updateComboBox = new Runnable() {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
372

4268557f   Nathanael Jourdane   Fix some Sonar is...
373
374
375
376
377
378
379
380
			@Override
			public void run() {
				String content = field.getText();
				if (!content.equals(lastContent)) {
					if (content.length() >= 2) {
						lastContent = content;
						comboBox.removeAllItems();
						try {
1e543ea0   Nathanael Jourdane   Code clean-up
381
							for (String s : TargetNameField.getItems(content)) {
4268557f   Nathanael Jourdane   Fix some Sonar is...
382
383
384
								comboBox.addItem(s);
							}
						} catch (CantSendQueryException e) {
1e543ea0   Nathanael Jourdane   Code clean-up
385
386
							ParamField.logger.log(Level.WARNING,
									"Can't get table names for the resolver", e);
4268557f   Nathanael Jourdane   Fix some Sonar is...
387
388
389
						}
						comboBox.getEditor().setItem(content);
					}
fe1e4470   Nathanael Jourdane   Minor code improv...
390
					if (content.isEmpty()) {
0f1bce56   Nathanael Jourdane   Use a listerner i...
391
						viewListener.onParameterRemoved(paramName);
4268557f   Nathanael Jourdane   Fix some Sonar is...
392
					} else {
0f1bce56   Nathanael Jourdane   Use a listerner i...
393
						viewListener.onParameterChanged(paramName, content);
4268557f   Nathanael Jourdane   Fix some Sonar is...
394
395
396
397
398
					}
				}
			}
		};

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
399

4268557f   Nathanael Jourdane   Fix some Sonar is...
400
		/**
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
401
		 * Method constructor
1e543ea0   Nathanael Jourdane   Code clean-up
402
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
403
404
405
		 * @param mainView The main view of the application.
		 * @param paramName The name of the parameter.
		 */
0f1bce56   Nathanael Jourdane   Use a listerner i...
406
407
		public TargetNameField(ViewListener viewListener, String paramName) {
			super(viewListener, paramName);
53d49e83   Nathanael Jourdane   Fix all Eclipse w...
408
			comboBox = new JComboBox<>();
1e543ea0   Nathanael Jourdane   Code clean-up
409
410
			comboBox.setPreferredSize(
					new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT));
68ae1315   Nathanael Jourdane   Improve GUI appar...
411

f00cb6bb   Nathanael Jourdane   Add a JComboBox f...
412
413
			comboBox.setEditable(true);
			field = (JTextField) comboBox.getEditor().getEditorComponent();
1e543ea0   Nathanael Jourdane   Code clean-up
414
			ParamField.addChangeListener(this, field);
f00cb6bb   Nathanael Jourdane   Add a JComboBox f...
415
416
417
			this.add(comboBox);
		}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
418
419
		/**
		 * The method used to get target names propositions by asking to the resolver.
1e543ea0   Nathanael Jourdane   Code clean-up
420
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
421
422
		 * @param begining The beginning of the target_name.
		 * @return An array of Strings corresponding to the target names got.
d3a65e87   Nathanael Jourdane   Improve Javadoc.
423
		 * @throws CantSendQueryException If the resolver do not work.
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
424
		 */
d3a65e87   Nathanael Jourdane   Improve Javadoc.
425
		static String[] getItems(String begining) throws CantSendQueryException {
4268557f   Nathanael Jourdane   Fix some Sonar is...
426
			StringBuilder resolverResult;
1e543ea0   Nathanael Jourdane   Code clean-up
427
428
			resolverResult = VOTableConnection.sendGet(ParamField.RESOLVER_URL,
					"q=\"" + begining + "\"");
05b140ed   Nathanael Jourdane   TargetNameField J...
429
430
431
432
433
434
435
436
437
			JsonObject root = new JsonParser().parse(resolverResult.toString()).getAsJsonObject();
			int count = Integer.parseInt(root.get("count").toString());
			String[] targetNames = new String[count];
			JsonArray hits = root.getAsJsonArray("hits");
			for (int i = 0; i < count; i++) {
				JsonObject elmt = hits.get(i).getAsJsonObject();
				targetNames[i] = elmt.get("name").toString().replace("\"", "");
				// TODO: Display "[name] ([type])" on the JComboBox, but only "[name]" on the query.
			}
f00cb6bb   Nathanael Jourdane   Add a JComboBox f...
438
			return targetNames;
eb483599   Nathanael Jourdane   Add missing Param...
439
440
		}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
441
		/**
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
442
443
		 * This method is called each time the field is modified.
		 */
53d49e83   Nathanael Jourdane   Fix all Eclipse w...
444
445
		@Override
		public void update(JTextField textField) {
3d80f3c3   Nathanael Jourdane   bugFix: targetNam...
446
			SwingUtilities.invokeLater(updateComboBox);
eb483599   Nathanael Jourdane   Add missing Param...
447
448
449
		}
	}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
450
451
452
453
454
455
	/**
	 * The data product type field is used only for the `dataproduct_type` parameter. It is a
	 * ComboBox filled with a list of static data product types (see
	 * https://voparis-confluence.obspm.fr/display/VES/4+-+EPN-TAP+queries#id-4-EPN-TAPqueries-
	 * __RefHeading__35_312326667_Toc3037660444.2.4DataProductType). The parameter is sent to the
	 * controller each time it is updated.
1e543ea0   Nathanael Jourdane   Code clean-up
456
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
457
458
	 * @author N. Jourdane
	 */
eb483599   Nathanael Jourdane   Add missing Param...
459
	public static class DataProductTypeField extends ParamField {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
460

1e543ea0   Nathanael Jourdane   Code clean-up
461
462
463
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
464
		/** The comboBox used to select the data product type. */
77184f22   Nathanael Jourdane   Use enums for Dat...
465
466
		JComboBox<DataProductType> comboBox;

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
467

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
468
469
470
471
		/**
		 * An enumeration of all available data product types. Each values comes with an id because
		 * EPN-TAP table can possibly be filled with the id instead of the name, so the query have
		 * to ask for both of them.
1e543ea0   Nathanael Jourdane   Code clean-up
472
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
473
474
475
		 * @author N. Jourdane
		 */
		@SuppressWarnings("javadoc")
77184f22   Nathanael Jourdane   Use enums for Dat...
476
477
		enum DataProductType {
			// @noformat
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
478
479
480
481
			ALL("All", "all"),            IM("Image", "im"),         SP("Spectrum", "sp"),
			DS("Dynamic spectrum", "ds"), SC("Spectral cube", "sc"), PR("Profile", "pr"),
			VO("Volume", "vo"),           MO("Movie", "mo"),         CU("Cube", "cu"),
			TS("Time series", "ts"),      CA("Catalog", "ca"),       SV("Spatial vector", "sv");
77184f22   Nathanael Jourdane   Use enums for Dat...
482
483
			// @format

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
484
			/** The full name of the data product type, such as `Dynamic spectrum`. */
77184f22   Nathanael Jourdane   Use enums for Dat...
485
			private String name = "";
1e543ea0   Nathanael Jourdane   Code clean-up
486

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
487
			/** The id of the data product type, such as `ds`. */
77184f22   Nathanael Jourdane   Use enums for Dat...
488
489
			private String id = "";

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
490

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
491
492
			/**
			 * Method constructor for the enumeration.
1e543ea0   Nathanael Jourdane   Code clean-up
493
			 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
494
495
496
497
			 * @param name The full name of the data product type, such as `Dynamic spectrum`.
			 * @param id The id of the data product type, such as `ds`.
			 */
			DataProductType(String name, String id) {
77184f22   Nathanael Jourdane   Use enums for Dat...
498
				this.name = name;
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
499
				this.id = id;
77184f22   Nathanael Jourdane   Use enums for Dat...
500
501
			}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
502
503
504
505
506
			/**
			 * @return A list of two strings, containing the name (formated for the query) and the
			 *         id, used in the query. A list is used instead of a array because the getQuery
			 *         function ( @see Queries) needs to know the parameter type.
			 */
77184f22   Nathanael Jourdane   Use enums for Dat...
507
508
509
510
511
512
513
514
515
516
517
518
			public List<String> query() {
				List<String> item = new ArrayList<>();
				item.add(name.replace(" ", "-").toLowerCase());
				item.add(id);
				return item;
			}

			@Override
			public String toString() {
				return name;
			}
		}
667dd80c   Nathanael Jourdane   JTextField as Par...
519

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
520

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
521
522
		/**
		 * Method constructor
1e543ea0   Nathanael Jourdane   Code clean-up
523
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
524
525
526
		 * @param mainView The main view of the application.
		 * @param paramName The name of the parameter.
		 */
0f1bce56   Nathanael Jourdane   Use a listerner i...
527
528
		public DataProductTypeField(ViewListener viewListener, String paramName) {
			super(viewListener, paramName);
77184f22   Nathanael Jourdane   Use enums for Dat...
529
530
			comboBox = new JComboBox<>(DataProductType.values());
			comboBox.setSelectedItem(DataProductType.ALL);
1e543ea0   Nathanael Jourdane   Code clean-up
531
532
			comboBox.setPreferredSize(
					new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT));
a99d92fa   Nathanael Jourdane   Add JComboBox for...
533
			comboBox.addActionListener(new ActionListener() {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
534

a99d92fa   Nathanael Jourdane   Add JComboBox for...
535
536
				@Override
				public void actionPerformed(ActionEvent e) {
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
537
					update();
a99d92fa   Nathanael Jourdane   Add JComboBox for...
538
539
540
541
542
				}
			});
			this.add(comboBox);
		}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
543
544
545
546
		/**
		 * This method is called each time the field is modified.
		 */
		void update() {
77184f22   Nathanael Jourdane   Use enums for Dat...
547
548
			DataProductType item = (DataProductType) comboBox.getSelectedItem();
			if (DataProductType.ALL.equals(item)) {
0f1bce56   Nathanael Jourdane   Use a listerner i...
549
				viewListener.onParameterRemoved(paramName);
5af53be7   Nathanael Jourdane   Make the applicat...
550
			} else {
0f1bce56   Nathanael Jourdane   Use a listerner i...
551
				viewListener.onParameterChanged(paramName, item.query());
5af53be7   Nathanael Jourdane   Make the applicat...
552
			}
eb483599   Nathanael Jourdane   Add missing Param...
553
554
555
		}
	}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
556
557
558
559
560
561
	/**
	 * The target class field is used only for the `target_class` parameter. It is a ComboBox filled
	 * with a list of static target classes (see
	 * https://voparis-confluence.obspm.fr/display/VES/4+-+EPN-TAP+queries#id-4-EPN-TAPqueries-
	 * __RefHeading__39_312326667_Toc3037660464.2.6TargetClass). The parameter is sent to the
	 * controller each time it is updated.
1e543ea0   Nathanael Jourdane   Code clean-up
562
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
563
564
	 * @author N. Jourdane
	 */
eb483599   Nathanael Jourdane   Add missing Param...
565
	public static class TargetClassField extends ParamField {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
566

1e543ea0   Nathanael Jourdane   Code clean-up
567
568
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
569
570

		/** The comboBox used to select the target class. */
77184f22   Nathanael Jourdane   Use enums for Dat...
571
572
		JComboBox<TargetClass> comboBox;

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
573

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
574
575
		/**
		 * An enumeration of all available target classes.
1e543ea0   Nathanael Jourdane   Code clean-up
576
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
577
578
579
		 * @author N. Jourdane
		 */
		@SuppressWarnings("javadoc")
77184f22   Nathanael Jourdane   Use enums for Dat...
580
581
		enum TargetClass {
			// @noformat
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
582
583
584
			ALL("All"),        COMET("Comet"),   EXOPLANET("Exoplanet"),    RING("Ring"),
			SAMPLE("Sample"),  SKY("Sky"),       SPACECRAFT("Spacecraft"),  SPACEJUNK("Spacejunk"),
			STAR("Star"),      INTERPLANETARY_MEDIUM("Interplanetary medium");
77184f22   Nathanael Jourdane   Use enums for Dat...
585
586
			// @format

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
587
			/** The name of the target class. */
77184f22   Nathanael Jourdane   Use enums for Dat...
588
589
			String name;

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
590

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
591
592
			/**
			 * Method constructor for the enumeration.
1e543ea0   Nathanael Jourdane   Code clean-up
593
			 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
594
595
			 * @param name The name of the target class.
			 */
77184f22   Nathanael Jourdane   Use enums for Dat...
596
597
598
599
			TargetClass(String name) {
				this.name = name;
			}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
600
601
602
			/**
			 * @return The name formated for the query.
			 */
77184f22   Nathanael Jourdane   Use enums for Dat...
603
604
605
606
			String query() {
				return name.replace(" ", "_").toLowerCase();
			}
		}
667dd80c   Nathanael Jourdane   JTextField as Par...
607

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
608

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
609
610
		/**
		 * Method constructor
1e543ea0   Nathanael Jourdane   Code clean-up
611
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
612
613
614
		 * @param mainView The main view of the application.
		 * @param paramName The name of the parameter.
		 */
0f1bce56   Nathanael Jourdane   Use a listerner i...
615
616
		public TargetClassField(ViewListener viewListener, String paramName) {
			super(viewListener, paramName);
77184f22   Nathanael Jourdane   Use enums for Dat...
617
			comboBox = new JComboBox<>(TargetClass.values());
1e543ea0   Nathanael Jourdane   Code clean-up
618
619
			comboBox.setPreferredSize(
					new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT));
a99d92fa   Nathanael Jourdane   Add JComboBox for...
620
			comboBox.addActionListener(new ActionListener() {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
621

a99d92fa   Nathanael Jourdane   Add JComboBox for...
622
623
				@Override
				public void actionPerformed(ActionEvent e) {
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
624
					update();
a99d92fa   Nathanael Jourdane   Add JComboBox for...
625
626
627
628
629
				}
			});
			this.add(comboBox);
		}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
630
631
632
633
		/**
		 * This method is called each time the field is modified.
		 */
		void update() {
77184f22   Nathanael Jourdane   Use enums for Dat...
634
635
			TargetClass value = (TargetClass) comboBox.getSelectedItem();
			if (TargetClass.ALL.equals(value)) {
0f1bce56   Nathanael Jourdane   Use a listerner i...
636
				viewListener.onParameterRemoved(paramName);
5af53be7   Nathanael Jourdane   Make the applicat...
637
			} else {
0f1bce56   Nathanael Jourdane   Use a listerner i...
638
				viewListener.onParameterChanged(paramName, value.query());
5af53be7   Nathanael Jourdane   Make the applicat...
639
			}
eb483599   Nathanael Jourdane   Add missing Param...
640
641
642
		}
	}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
643
644
645
646
	/**
	 * The listener of text field, it aims to provide a simple way to listen a text field without to
	 * override removeUpdate(DocumentEvent de), insertUpdate(DocumentEvent de) and
	 * changedUpdate(DocumentEvent de) on each field to listen.
1e543ea0   Nathanael Jourdane   Code clean-up
647
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
648
649
	 * @author N. Jourdane
	 */
e97b40e8   Nathanael Jourdane   Make ParamField c...
650
	interface TextFieldListener {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
651

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
652
653
		/**
		 * When the content of the JTextField is updated.
1e543ea0   Nathanael Jourdane   Code clean-up
654
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
655
656
657
		 * @param field The JTextField. Is useful for classes containing several text fields, such
		 *            as DateRangeField, to know which one triggered the event.
		 */
e97b40e8   Nathanael Jourdane   Make ParamField c...
658
659
		void update(JTextField field);
	}
eb483599   Nathanael Jourdane   Add missing Param...
660

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
661

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
662
663
	/**
	 * To add the listener. @see TextFieldListener
1e543ea0   Nathanael Jourdane   Code clean-up
664
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
665
666
667
	 * @param changeListener The listener of text fields.
	 * @param field The field to listen.
	 */
42819b99   Nathanael Jourdane   Make EpnTAPClient...
668
	static void addChangeListener(final TextFieldListener changeListener, final JTextField field) {
e97b40e8   Nathanael Jourdane   Make ParamField c...
669
		field.getDocument().addDocumentListener(new DocumentListener() {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
670

53d49e83   Nathanael Jourdane   Fix all Eclipse w...
671
			@Override
e97b40e8   Nathanael Jourdane   Make ParamField c...
672
673
			public void removeUpdate(DocumentEvent de) {
				changeListener.update(field);
eb483599   Nathanael Jourdane   Add missing Param...
674
675
			}

53d49e83   Nathanael Jourdane   Fix all Eclipse w...
676
			@Override
e97b40e8   Nathanael Jourdane   Make ParamField c...
677
678
			public void insertUpdate(DocumentEvent de) {
				changeListener.update(field);
eb483599   Nathanael Jourdane   Add missing Param...
679
680
			}

53d49e83   Nathanael Jourdane   Fix all Eclipse w...
681
			@Override
e97b40e8   Nathanael Jourdane   Make ParamField c...
682
683
			public void changedUpdate(DocumentEvent de) {
				changeListener.update(field);
eb483599   Nathanael Jourdane   Add missing Param...
684
			}
eb483599   Nathanael Jourdane   Add missing Param...
685
		});
eb483599   Nathanael Jourdane   Add missing Param...
686
687
	}
}