Blame view

src/main/java/eu/omp/irap/vespa/epntapclient/gui/ParamField.java 21.7 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/>.
 */

6dd0d332   Nathanael Jourdane   The controller do...
17
package eu.omp.irap.vespa.epntapclient.gui;
eb483599   Nathanael Jourdane   Add missing Param...
18
19
20

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;
468b7523   Nathanael Jourdane   Improve Network c...
27
import java.util.HashMap;
e7647bba   Nathanael Jourdane   change query to g...
28
import java.util.List;
eb483599   Nathanael Jourdane   Add missing Param...
29
import java.util.Locale;
468b7523   Nathanael Jourdane   Improve Network c...
30
import java.util.Map;
b6627be6   Nathanael Jourdane   Improve Exceptions
31
import java.util.logging.Level;
5d3c344e   Nathanael Jourdane   Use Java logging ...
32
import java.util.logging.Logger;
eb483599   Nathanael Jourdane   Add missing Param...
33
34

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

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

cfbb6d07   Nathanael Jourdane   Implement most of...
46
import eu.omp.irap.vespa.votable.utils.CantSendQueryException;
e2264856   Nathanael Jourdane   Delete votable pa...
47
import eu.omp.irap.vespa.votable.utils.Network;
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;

4ce406a8   Nathanael Jourdane   Add build() class...
112
		buildParamField();
4ce406a8   Nathanael Jourdane   Add build() class...
113
114
115
	}

	private void buildParamField() {
1e543ea0   Nathanael Jourdane   Code clean-up
116
		setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
4ce406a8   Nathanael Jourdane   Add build() class...
117

1e543ea0   Nathanael Jourdane   Code clean-up
118
		setMaximumSize(new Dimension(ParamField.MAX_FIELD_WIDTH, ParamField.FIELD_HEIGHT));
4ce406a8   Nathanael Jourdane   Add build() class...
119

eb483599   Nathanael Jourdane   Add missing Param...
120
121
		String strLabel = paramName.replaceAll("_", " ").trim();
		JLabel label = new JLabel(strLabel.substring(0, 1).toUpperCase() + strLabel.substring(1));
1e543ea0   Nathanael Jourdane   Code clean-up
122
		label.setPreferredSize(new Dimension(ParamField.LABEL_WIDTH, ParamField.FIELD_HEIGHT));
4ce406a8   Nathanael Jourdane   Add build() class...
123

eb483599   Nathanael Jourdane   Add missing Param...
124
		this.add(label);
eb483599   Nathanael Jourdane   Add missing Param...
125
126
	}

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

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
128
129
130
	/**
	 * 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
131
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
132
133
	 * @author N. Jourdane
	 */
e97b40e8   Nathanael Jourdane   Make ParamField c...
134
	public static class StringField extends ParamField implements TextFieldListener {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
135

1e543ea0   Nathanael Jourdane   Code clean-up
136
137
138
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;

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

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

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

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

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
169
170
171
172
	/**
	 * 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
173
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
174
175
	 * @author N. Jourdane
	 */
e97b40e8   Nathanael Jourdane   Make ParamField c...
176
	public static class FloatField extends ParamField implements TextFieldListener {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
177

1e543ea0   Nathanael Jourdane   Code clean-up
178
179
180
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;

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

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

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

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

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
218
219
220
221
222
	/**
	 * 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
223
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
224
225
	 * @author N. Jourdane
	 */
e97b40e8   Nathanael Jourdane   Make ParamField c...
226
	public static class DateRangeField extends ParamField implements TextFieldListener {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
227

1e543ea0   Nathanael Jourdane   Code clean-up
228
229
230
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;

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

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

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

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
238
239
		/**
		 * Method constructor
1e543ea0   Nathanael Jourdane   Code clean-up
240
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
241
242
243
		 * @param mainView The main view of the application.
		 * @param paramName The name of the parameter.
		 */
0f1bce56   Nathanael Jourdane   Use a listerner i...
244
245
		public DateRangeField(ViewListener viewListener, String paramName) {
			super(viewListener, paramName);
68ae1315   Nathanael Jourdane   Improve GUI appar...
246
			this.add(new JLabel("min "));
667dd80c   Nathanael Jourdane   JTextField as Par...
247
			fieldMin = new JTextField();
1e543ea0   Nathanael Jourdane   Code clean-up
248
249
250
251
			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...
252
253
			this.add(fieldMin);

68ae1315   Nathanael Jourdane   Improve GUI appar...
254
			this.add(new JLabel("max "));
667dd80c   Nathanael Jourdane   JTextField as Par...
255
			fieldMax = new JTextField();
1e543ea0   Nathanael Jourdane   Code clean-up
256
257
258
259
			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...
260
261
262
			this.add(fieldMax);
		}

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

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
289
290
291
292
	/**
	 * 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
293
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
294
295
	 * @author N. Jourdane
	 */
e97b40e8   Nathanael Jourdane   Make ParamField c...
296
	public static class FloatRangeField extends ParamField implements TextFieldListener {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
297

1e543ea0   Nathanael Jourdane   Code clean-up
298
299
300
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;

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

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

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

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

41133475   Nathanael Jourdane   build floatRangeF...
321
			fieldMax = new JTextField();
1e543ea0   Nathanael Jourdane   Code clean-up
322
323
			fieldMax.setName(ParamField.MAX_SUFFIX);
			ParamField.addChangeListener(this, fieldMax);
eb483599   Nathanael Jourdane   Add missing Param...
324
325
			this.add(fieldMax);
		}
41133475   Nathanael Jourdane   build floatRangeF...
326

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

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
347
348
349
350
351
	/**
	 * 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
352
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
353
354
	 * @author N. Jourdane
	 */
e97b40e8   Nathanael Jourdane   Make ParamField c...
355
	public static class TargetNameField extends ParamField implements TextFieldListener {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
356

1e543ea0   Nathanael Jourdane   Code clean-up
357
358
359
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;

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

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

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
366
367
368
369
370
		/**
		 * 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...
371
		String lastContent;
667dd80c   Nathanael Jourdane   JTextField as Par...
372

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
373
		/**
4268557f   Nathanael Jourdane   Fix some Sonar is...
374
375
376
377
		 * 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 ...
378

4268557f   Nathanael Jourdane   Fix some Sonar is...
379
380
381
382
383
384
385
386
			@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
387
							for (String s : TargetNameField.getItems(content)) {
4268557f   Nathanael Jourdane   Fix some Sonar is...
388
389
390
								comboBox.addItem(s);
							}
						} catch (CantSendQueryException e) {
1e543ea0   Nathanael Jourdane   Code clean-up
391
392
							ParamField.logger.log(Level.WARNING,
									"Can't get table names for the resolver", e);
4268557f   Nathanael Jourdane   Fix some Sonar is...
393
394
						}
						comboBox.getEditor().setItem(content);
5e6b2228   Nathanael Jourdane   Fix #11
395
						comboBox.showPopup();
4268557f   Nathanael Jourdane   Fix some Sonar is...
396
					}
fe1e4470   Nathanael Jourdane   Minor code improv...
397
					if (content.isEmpty()) {
0f1bce56   Nathanael Jourdane   Use a listerner i...
398
						viewListener.onParameterRemoved(paramName);
4268557f   Nathanael Jourdane   Fix some Sonar is...
399
					} else {
0f1bce56   Nathanael Jourdane   Use a listerner i...
400
						viewListener.onParameterChanged(paramName, content);
4268557f   Nathanael Jourdane   Fix some Sonar is...
401
402
403
404
405
					}
				}
			}
		};

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

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

f00cb6bb   Nathanael Jourdane   Add a JComboBox f...
419
420
			comboBox.setEditable(true);
			field = (JTextField) comboBox.getEditor().getEditorComponent();
1e543ea0   Nathanael Jourdane   Code clean-up
421
			ParamField.addChangeListener(this, field);
f00cb6bb   Nathanael Jourdane   Add a JComboBox f...
422
423
424
			this.add(comboBox);
		}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
425
426
		/**
		 * The method used to get target names propositions by asking to the resolver.
1e543ea0   Nathanael Jourdane   Code clean-up
427
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
428
429
		 * @param begining The beginning of the target_name.
		 * @return An array of Strings corresponding to the target names got.
cfbb6d07   Nathanael Jourdane   Implement most of...
430
431
		 * @throws CantSendQueryException
		 * @throws CantGetXMLException If the resolver do not work.
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
432
		 */
d3a65e87   Nathanael Jourdane   Improve Javadoc.
433
		static String[] getItems(String begining) throws CantSendQueryException {
468b7523   Nathanael Jourdane   Improve Network c...
434
435
436
			Map<String, String> params = new HashMap<>();
			params.put("q", "\"" + begining + "\"");

cfbb6d07   Nathanael Jourdane   Implement most of...
437
438
			String query = Network.buildQuery(ParamField.RESOLVER_URL, params);
			JsonObject root = Network.readJson(query);
05b140ed   Nathanael Jourdane   TargetNameField J...
439
440
441
442
443
444
			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("\"", "");
05b140ed   Nathanael Jourdane   TargetNameField J...
445
			}
f00cb6bb   Nathanael Jourdane   Add a JComboBox f...
446
			return targetNames;
eb483599   Nathanael Jourdane   Add missing Param...
447
448
		}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
449
		/**
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
450
451
		 * This method is called each time the field is modified.
		 */
53d49e83   Nathanael Jourdane   Fix all Eclipse w...
452
453
		@Override
		public void update(JTextField textField) {
3d80f3c3   Nathanael Jourdane   bugFix: targetNam...
454
			SwingUtilities.invokeLater(updateComboBox);
eb483599   Nathanael Jourdane   Add missing Param...
455
456
457
		}
	}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
458
459
460
461
462
463
	/**
	 * 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
464
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
465
466
	 * @author N. Jourdane
	 */
eb483599   Nathanael Jourdane   Add missing Param...
467
	public static class DataProductTypeField extends ParamField {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
468

1e543ea0   Nathanael Jourdane   Code clean-up
469
470
471
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;

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

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

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
476
477
478
479
		/**
		 * 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
480
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
481
482
483
		 * @author N. Jourdane
		 */
		@SuppressWarnings("javadoc")
77184f22   Nathanael Jourdane   Use enums for Dat...
484
485
		enum DataProductType {
			// @noformat
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
486
487
488
489
			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...
490
491
			// @format

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

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

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

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
499
500
			/**
			 * Method constructor for the enumeration.
1e543ea0   Nathanael Jourdane   Code clean-up
501
			 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
502
503
504
505
			 * @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...
506
				this.name = name;
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
507
				this.id = id;
77184f22   Nathanael Jourdane   Use enums for Dat...
508
509
			}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
510
511
512
513
514
			/**
			 * @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...
515
516
517
518
519
520
521
522
523
524
525
526
			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...
527

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

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

a99d92fa   Nathanael Jourdane   Add JComboBox for...
543
544
				@Override
				public void actionPerformed(ActionEvent e) {
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
545
					update();
a99d92fa   Nathanael Jourdane   Add JComboBox for...
546
547
548
549
550
				}
			});
			this.add(comboBox);
		}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
551
552
553
554
		/**
		 * This method is called each time the field is modified.
		 */
		void update() {
77184f22   Nathanael Jourdane   Use enums for Dat...
555
556
			DataProductType item = (DataProductType) comboBox.getSelectedItem();
			if (DataProductType.ALL.equals(item)) {
0f1bce56   Nathanael Jourdane   Use a listerner i...
557
				viewListener.onParameterRemoved(paramName);
5af53be7   Nathanael Jourdane   Make the applicat...
558
			} else {
0f1bce56   Nathanael Jourdane   Use a listerner i...
559
				viewListener.onParameterChanged(paramName, item.query());
5af53be7   Nathanael Jourdane   Make the applicat...
560
			}
eb483599   Nathanael Jourdane   Add missing Param...
561
562
563
		}
	}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
564
565
566
567
568
569
	/**
	 * 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
570
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
571
572
	 * @author N. Jourdane
	 */
eb483599   Nathanael Jourdane   Add missing Param...
573
	public static class TargetClassField extends ParamField {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
574

1e543ea0   Nathanael Jourdane   Code clean-up
575
576
		/** The serial version UID. */
		private static final long serialVersionUID = 1L;
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
577
578

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

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

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
582
583
		/**
		 * An enumeration of all available target classes.
1e543ea0   Nathanael Jourdane   Code clean-up
584
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
585
586
587
		 * @author N. Jourdane
		 */
		@SuppressWarnings("javadoc")
77184f22   Nathanael Jourdane   Use enums for Dat...
588
589
		enum TargetClass {
			// @noformat
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
590
591
592
			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...
593
594
			// @format

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
595
			/** The name of the target class. */
77184f22   Nathanael Jourdane   Use enums for Dat...
596
597
			String name;

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

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
599
600
			/**
			 * Method constructor for the enumeration.
1e543ea0   Nathanael Jourdane   Code clean-up
601
			 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
602
603
			 * @param name The name of the target class.
			 */
77184f22   Nathanael Jourdane   Use enums for Dat...
604
605
606
607
			TargetClass(String name) {
				this.name = name;
			}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
608
609
610
			/**
			 * @return The name formated for the query.
			 */
77184f22   Nathanael Jourdane   Use enums for Dat...
611
612
613
614
			String query() {
				return name.replace(" ", "_").toLowerCase();
			}
		}
667dd80c   Nathanael Jourdane   JTextField as Par...
615

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

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

a99d92fa   Nathanael Jourdane   Add JComboBox for...
630
631
				@Override
				public void actionPerformed(ActionEvent e) {
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
632
					update();
a99d92fa   Nathanael Jourdane   Add JComboBox for...
633
634
635
636
637
				}
			});
			this.add(comboBox);
		}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
638
639
640
641
		/**
		 * This method is called each time the field is modified.
		 */
		void update() {
77184f22   Nathanael Jourdane   Use enums for Dat...
642
643
			TargetClass value = (TargetClass) comboBox.getSelectedItem();
			if (TargetClass.ALL.equals(value)) {
0f1bce56   Nathanael Jourdane   Use a listerner i...
644
				viewListener.onParameterRemoved(paramName);
5af53be7   Nathanael Jourdane   Make the applicat...
645
			} else {
0f1bce56   Nathanael Jourdane   Use a listerner i...
646
				viewListener.onParameterChanged(paramName, value.query());
5af53be7   Nathanael Jourdane   Make the applicat...
647
			}
eb483599   Nathanael Jourdane   Add missing Param...
648
649
650
		}
	}

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
651
652
653
654
	/**
	 * 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
655
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
656
657
	 * @author N. Jourdane
	 */
e97b40e8   Nathanael Jourdane   Make ParamField c...
658
	interface TextFieldListener {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
659

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
660
661
		/**
		 * When the content of the JTextField is updated.
1e543ea0   Nathanael Jourdane   Code clean-up
662
		 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
663
664
665
		 * @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...
666
667
		void update(JTextField field);
	}
eb483599   Nathanael Jourdane   Add missing Param...
668

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

b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
670
671
	/**
	 * To add the listener. @see TextFieldListener
1e543ea0   Nathanael Jourdane   Code clean-up
672
	 *
b6b4fb3e   Nathanael Jourdane   Add Javadoc for P...
673
674
675
	 * @param changeListener The listener of text fields.
	 * @param field The field to listen.
	 */
42819b99   Nathanael Jourdane   Make EpnTAPClient...
676
	static void addChangeListener(final TextFieldListener changeListener, final JTextField field) {
e97b40e8   Nathanael Jourdane   Make ParamField c...
677
		field.getDocument().addDocumentListener(new DocumentListener() {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
678

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

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

53d49e83   Nathanael Jourdane   Fix all Eclipse w...
689
			@Override
e97b40e8   Nathanael Jourdane   Make ParamField c...
690
691
			public void changedUpdate(DocumentEvent de) {
				changeListener.update(field);
eb483599   Nathanael Jourdane   Add missing Param...
692
			}
eb483599   Nathanael Jourdane   Add missing Param...
693
		});
eb483599   Nathanael Jourdane   Add missing Param...
694
695
	}
}