Commit 53d49e834976c6dafdfa916a5c3cc501ec7a67da
1 parent
d0823848
Exists in
master
Fix all Eclipse warnings.
Showing
11 changed files
with
105 additions
and
51 deletions
Show diff stats
src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java
@@ -30,7 +30,7 @@ import eu.omp.irap.vespa.epntapclient.controller.EpnTapController; | @@ -30,7 +30,7 @@ import eu.omp.irap.vespa.epntapclient.controller.EpnTapController; | ||
30 | */ | 30 | */ |
31 | public class EpnTapMainApp { | 31 | public class EpnTapMainApp { |
32 | /** The logger for the class EpnTapMainApp. */ | 32 | /** The logger for the class EpnTapMainApp. */ |
33 | - private static final Logger logger = Logger.getLogger(EpnTapMainApp.class.getName()); | 33 | + static final Logger logger = Logger.getLogger(EpnTapMainApp.class.getName()); |
34 | 34 | ||
35 | /** Constructor to hide the implicit public one. */ | 35 | /** Constructor to hide the implicit public one. */ |
36 | private EpnTapMainApp() { | 36 | private EpnTapMainApp() { |
src/main/java/eu/omp/irap/vespa/epntapclient/controller/EpnTapController.java
@@ -34,22 +34,22 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException; | @@ -34,22 +34,22 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException; | ||
34 | */ | 34 | */ |
35 | public class EpnTapController implements MainViewListener { | 35 | public class EpnTapController implements MainViewListener { |
36 | /** The logger for the class EpnTapController. */ | 36 | /** The logger for the class EpnTapController. */ |
37 | - Logger logger = Logger.getLogger(EpnTapController.class.getName()); | 37 | + private Logger logger = Logger.getLogger(EpnTapController.class.getName()); |
38 | 38 | ||
39 | /** The view of EPN-TAP application. */ | 39 | /** The view of EPN-TAP application. */ |
40 | - EpnTapMainView mainView; | 40 | + private EpnTapMainView mainView; |
41 | 41 | ||
42 | /** The controller of the VOTable displaying the list of services. */ | 42 | /** The controller of the VOTable displaying the list of services. */ |
43 | - VOTableController servicesController; | 43 | + private VOTableController servicesController; |
44 | 44 | ||
45 | /** The controller of the VOTable displaying the query results. */ | 45 | /** The controller of the VOTable displaying the query results. */ |
46 | - VOTableController resultsController; | 46 | + private VOTableController resultsController; |
47 | 47 | ||
48 | /** The name of the table selected by the user on the table list panel. */ | 48 | /** The name of the table selected by the user on the table list panel. */ |
49 | - String selectedTableName; | 49 | + private String selectedTableName; |
50 | 50 | ||
51 | /** The URL of the service corresponding to the selected table. */ | 51 | /** The URL of the service corresponding to the selected table. */ |
52 | - String selectedTableServiceURL; | 52 | + private String selectedTableServiceURL; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * The parameters fields for the request. | 55 | * The parameters fields for the request. |
@@ -135,22 +135,24 @@ public class EpnTapController implements MainViewListener { | @@ -135,22 +135,24 @@ public class EpnTapController implements MainViewListener { | ||
135 | * @param event | 135 | * @param event |
136 | * @param args | 136 | * @param args |
137 | */ | 137 | */ |
138 | - public void event(Event event, Object[] args) { | 138 | + @Override |
139 | + public void event(Event event, Object... args) { | ||
139 | logger.info("new event: " + event.toString()); | 140 | logger.info("new event: " + event.toString()); |
140 | 141 | ||
141 | try { | 142 | try { |
143 | + Object object = args[0]; | ||
142 | switch (event) { | 144 | switch (event) { |
143 | case serviceSelected: | 145 | case serviceSelected: |
144 | - updateSelected((int) args[0]); | 146 | + updateSelected(((Integer) args[0]).intValue()); |
145 | break; | 147 | break; |
146 | case btnSearchClicked: | 148 | case btnSearchClicked: |
147 | - sendQuery((String) args[0]); | 149 | + sendQuery((String) object); |
148 | break; | 150 | break; |
149 | case paramChanged: | 151 | case paramChanged: |
150 | - updateParameter((String) args[0], args[1]); | 152 | + updateParameter((String) object, args[1]); |
151 | break; | 153 | break; |
152 | case paramRemoved: | 154 | case paramRemoved: |
153 | - removeParameter((String) args[0]); | 155 | + removeParameter((String) object); |
154 | break; | 156 | break; |
155 | default: | 157 | default: |
156 | logger.warning("Event " + event.toString() + " detected but is not implemented."); | 158 | logger.warning("Event " + event.toString() + " detected but is not implemented."); |
src/main/java/eu/omp/irap/vespa/epntapclient/utils/Queries.java
@@ -28,7 +28,8 @@ import eu.omp.irap.vespa.epntapclient.votable.Utils.StringJoiner; | @@ -28,7 +28,8 @@ import eu.omp.irap.vespa.epntapclient.votable.Utils.StringJoiner; | ||
28 | */ | 28 | */ |
29 | public final class Queries { | 29 | public final class Queries { |
30 | /** The logger for the class Queries. */ | 30 | /** The logger for the class Queries. */ |
31 | - Logger logger = Logger.getLogger(Queries.class.getName()); | 31 | + @SuppressWarnings("unused") |
32 | + private Logger logger = Logger.getLogger(Queries.class.getName()); | ||
32 | 33 | ||
33 | // AMDA access_url: http://cdpp-epntap.cesr.fr/__system__/tap/run/tap | 34 | // AMDA access_url: http://cdpp-epntap.cesr.fr/__system__/tap/run/tap |
34 | // AMDA table name: amdadb.epn_core | 35 | // AMDA table name: amdadb.epn_core |
@@ -56,14 +57,14 @@ public final class Queries { | @@ -56,14 +57,14 @@ public final class Queries { | ||
56 | public static String getQuery(String tableName, Map<String, Object> params, int nbRow) { | 57 | public static String getQuery(String tableName, Map<String, Object> params, int nbRow) { |
57 | StringJoiner addJoin = new StringJoiner(" AND "); | 58 | StringJoiner addJoin = new StringJoiner(" AND "); |
58 | for (Map.Entry<String, Object> param : params.entrySet()) { | 59 | for (Map.Entry<String, Object> param : params.entrySet()) { |
59 | - Class paramClass = param.getValue().getClass(); | ||
60 | - if (paramClass == ArrayList.class) { | 60 | + if (param.getValue() instanceof ArrayList) { |
61 | StringJoiner orJoin = new StringJoiner(" OR "); | 61 | StringJoiner orJoin = new StringJoiner(" OR "); |
62 | - List<String> possibleValues = ((List<String>) param.getValue()); | 62 | + @SuppressWarnings("unchecked") |
63 | + List<String> possibleValues = (List<String>) param.getValue(); | ||
63 | for (String possibleValue : possibleValues) | 64 | for (String possibleValue : possibleValues) |
64 | orJoin.add(param.getKey() + " LIKE '" + possibleValue + "'"); | 65 | orJoin.add(param.getKey() + " LIKE '" + possibleValue + "'"); |
65 | addJoin.add("(" + orJoin + ")"); | 66 | addJoin.add("(" + orJoin + ")"); |
66 | - } else if (paramClass == String.class) { | 67 | + } else if (param.getValue() instanceof String) { |
67 | addJoin.add(param.getKey() + " LIKE '" + param.getValue() + "'"); | 68 | addJoin.add(param.getKey() + " LIKE '" + param.getValue() + "'"); |
68 | } else { | 69 | } else { |
69 | addJoin.add(param.getKey() + " = " + param.getValue().toString()); | 70 | addJoin.add(param.getKey() + " = " + param.getValue().toString()); |
src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java
@@ -34,6 +34,7 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; | @@ -34,6 +34,7 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; | ||
34 | */ | 34 | */ |
35 | public class EpnTapMainView extends JPanel { | 35 | public class EpnTapMainView extends JPanel { |
36 | /** The logger for the class EpnTapMainView. */ | 36 | /** The logger for the class EpnTapMainView. */ |
37 | + @SuppressWarnings("unused") | ||
37 | private static final Logger logger = Logger.getLogger(EpnTapMainView.class.getName()); | 38 | private static final Logger logger = Logger.getLogger(EpnTapMainView.class.getName()); |
38 | 39 | ||
39 | /** The serial version UID (affected with a random number). */ | 40 | /** The serial version UID (affected with a random number). */ |
src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java
@@ -47,8 +47,11 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableConnection; | @@ -47,8 +47,11 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableConnection; | ||
47 | import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.SendQueryException; | 47 | import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.SendQueryException; |
48 | 48 | ||
49 | public abstract class ParamField extends JPanel { | 49 | public abstract class ParamField extends JPanel { |
50 | + /** */ | ||
51 | + private static final long serialVersionUID = 6025994164004985362L; | ||
52 | + | ||
50 | /** The logger for the class ParamField. */ | 53 | /** The logger for the class ParamField. */ |
51 | - private static final Logger logger = Logger.getLogger(ParamField.class.getName()); | 54 | + static final Logger logger = Logger.getLogger(ParamField.class.getName()); |
52 | 55 | ||
53 | private static final int MIN_FIELD_WIDTH = 30; | 56 | private static final int MIN_FIELD_WIDTH = 30; |
54 | private static final int FIELD_HEIGHT = 20; | 57 | private static final int FIELD_HEIGHT = 20; |
@@ -61,7 +64,7 @@ public abstract class ParamField extends JPanel { | @@ -61,7 +64,7 @@ public abstract class ParamField extends JPanel { | ||
61 | private static final String MIN_SUFFIX = "min"; | 64 | private static final String MIN_SUFFIX = "min"; |
62 | private static final String MAX_SUFFIX = "max"; | 65 | private static final String MAX_SUFFIX = "max"; |
63 | 66 | ||
64 | - protected static EpnTapMainView mainView; | 67 | + protected EpnTapMainView mainView; |
65 | protected String paramName; | 68 | protected String paramName; |
66 | 69 | ||
67 | public ParamField(EpnTapMainView mainView, String paramName) { | 70 | public ParamField(EpnTapMainView mainView, String paramName) { |
@@ -80,6 +83,8 @@ public abstract class ParamField extends JPanel { | @@ -80,6 +83,8 @@ public abstract class ParamField extends JPanel { | ||
80 | } | 83 | } |
81 | 84 | ||
82 | public static class StringField extends ParamField implements TextFieldListener { | 85 | public static class StringField extends ParamField implements TextFieldListener { |
86 | + /** */ | ||
87 | + private static final long serialVersionUID = 24219488975302068L; | ||
83 | JTextField field; | 88 | JTextField field; |
84 | 89 | ||
85 | public StringField(EpnTapMainView mainView, String paramName) { | 90 | public StringField(EpnTapMainView mainView, String paramName) { |
@@ -89,16 +94,19 @@ public abstract class ParamField extends JPanel { | @@ -89,16 +94,19 @@ public abstract class ParamField extends JPanel { | ||
89 | this.add(field); | 94 | this.add(field); |
90 | } | 95 | } |
91 | 96 | ||
92 | - public void update(JTextField field) { | ||
93 | - if ("".equals(field.getText())) { | 97 | + @Override |
98 | + public void update(JTextField textField) { | ||
99 | + if ("".equals(textField.getText())) { | ||
94 | mainView.event(Event.paramChanged, paramName, null); | 100 | mainView.event(Event.paramChanged, paramName, null); |
95 | } else { | 101 | } else { |
96 | - mainView.event(Event.paramChanged, paramName, field.getText()); | 102 | + mainView.event(Event.paramChanged, paramName, textField.getText()); |
97 | } | 103 | } |
98 | } | 104 | } |
99 | } | 105 | } |
100 | 106 | ||
101 | public static class FloatField extends ParamField implements TextFieldListener { | 107 | public static class FloatField extends ParamField implements TextFieldListener { |
108 | + /** */ | ||
109 | + private static final long serialVersionUID = -1880193152285564590L; | ||
102 | JTextField field; | 110 | JTextField field; |
103 | 111 | ||
104 | public FloatField(EpnTapMainView mainView, String paramName) { | 112 | public FloatField(EpnTapMainView mainView, String paramName) { |
@@ -108,23 +116,26 @@ public abstract class ParamField extends JPanel { | @@ -108,23 +116,26 @@ public abstract class ParamField extends JPanel { | ||
108 | this.add(field); | 116 | this.add(field); |
109 | } | 117 | } |
110 | 118 | ||
111 | - public void update(JTextField field) { | ||
112 | - if ("".equals(field.getText())) { | ||
113 | - field.setBackground(Color.WHITE); | 119 | + @Override |
120 | + public void update(JTextField textField) { | ||
121 | + if ("".equals(textField.getText())) { | ||
122 | + textField.setBackground(Color.WHITE); | ||
114 | mainView.event(Event.paramRemoved, paramName); | 123 | mainView.event(Event.paramRemoved, paramName); |
115 | } else { | 124 | } else { |
116 | try { | 125 | try { |
117 | - mainView.event(Event.paramChanged, paramName, | ||
118 | - Float.parseFloat(field.getText())); | ||
119 | - field.setBackground(Color.WHITE); | ||
120 | - } catch (NumberFormatException e) { | ||
121 | - field.setBackground(Color.PINK); | 126 | + float value = Float.parseFloat(textField.getText()); |
127 | + mainView.event(Event.paramChanged, paramName, value); | ||
128 | + textField.setBackground(Color.WHITE); | ||
129 | + } catch (@SuppressWarnings("unused") NumberFormatException e) { | ||
130 | + textField.setBackground(Color.PINK); | ||
122 | } | 131 | } |
123 | } | 132 | } |
124 | } | 133 | } |
125 | } | 134 | } |
126 | 135 | ||
127 | public static class DateRangeField extends ParamField implements TextFieldListener { | 136 | public static class DateRangeField extends ParamField implements TextFieldListener { |
137 | + /** */ | ||
138 | + private static final long serialVersionUID = -7781309003911514777L; | ||
128 | JTextField fieldMin; | 139 | JTextField fieldMin; |
129 | JTextField fieldMax; | 140 | JTextField fieldMax; |
130 | 141 | ||
@@ -145,6 +156,7 @@ public abstract class ParamField extends JPanel { | @@ -145,6 +156,7 @@ public abstract class ParamField extends JPanel { | ||
145 | this.add(fieldMax); | 156 | this.add(fieldMax); |
146 | } | 157 | } |
147 | 158 | ||
159 | + @Override | ||
148 | public void update(JTextField field) { | 160 | public void update(JTextField field) { |
149 | DateFormat df = new SimpleDateFormat(DATE_FORMAT, Locale.ENGLISH); | 161 | DateFormat df = new SimpleDateFormat(DATE_FORMAT, Locale.ENGLISH); |
150 | if ("".equals(field.getText())) { | 162 | if ("".equals(field.getText())) { |
@@ -156,7 +168,7 @@ public abstract class ParamField extends JPanel { | @@ -156,7 +168,7 @@ public abstract class ParamField extends JPanel { | ||
156 | date = Math.round((date / 86400000.0) + 2440587.5); // to JD | 168 | date = Math.round((date / 86400000.0) + 2440587.5); // to JD |
157 | mainView.event(Event.paramChanged, paramName + field.getName(), date); | 169 | mainView.event(Event.paramChanged, paramName + field.getName(), date); |
158 | field.setBackground(Color.WHITE); | 170 | field.setBackground(Color.WHITE); |
159 | - } catch (ParseException e) { | 171 | + } catch (@SuppressWarnings("unused") ParseException e) { |
160 | field.setBackground(Color.PINK); | 172 | field.setBackground(Color.PINK); |
161 | } | 173 | } |
162 | // TODO: check if date min < date max | 174 | // TODO: check if date min < date max |
@@ -167,6 +179,8 @@ public abstract class ParamField extends JPanel { | @@ -167,6 +179,8 @@ public abstract class ParamField extends JPanel { | ||
167 | } | 179 | } |
168 | 180 | ||
169 | public static class FloatRangeField extends ParamField implements TextFieldListener { | 181 | public static class FloatRangeField extends ParamField implements TextFieldListener { |
182 | + /** */ | ||
183 | + private static final long serialVersionUID = 7923358142882329015L; | ||
170 | JTextField fieldMin; | 184 | JTextField fieldMin; |
171 | JTextField fieldMax; | 185 | JTextField fieldMax; |
172 | 186 | ||
@@ -183,6 +197,7 @@ public abstract class ParamField extends JPanel { | @@ -183,6 +197,7 @@ public abstract class ParamField extends JPanel { | ||
183 | this.add(fieldMax); | 197 | this.add(fieldMax); |
184 | } | 198 | } |
185 | 199 | ||
200 | + @Override | ||
186 | public void update(JTextField field) { | 201 | public void update(JTextField field) { |
187 | if ("".equals(field.getText())) { | 202 | if ("".equals(field.getText())) { |
188 | field.setBackground(Color.WHITE); | 203 | field.setBackground(Color.WHITE); |
@@ -192,7 +207,7 @@ public abstract class ParamField extends JPanel { | @@ -192,7 +207,7 @@ public abstract class ParamField extends JPanel { | ||
192 | mainView.event(Event.paramChanged, paramName + field.getName(), | 207 | mainView.event(Event.paramChanged, paramName + field.getName(), |
193 | Float.parseFloat(field.getText())); | 208 | Float.parseFloat(field.getText())); |
194 | field.setBackground(Color.WHITE); | 209 | field.setBackground(Color.WHITE); |
195 | - } catch (NumberFormatException e) { | 210 | + } catch (@SuppressWarnings("unused") NumberFormatException e) { |
196 | field.setBackground(Color.PINK); | 211 | field.setBackground(Color.PINK); |
197 | } | 212 | } |
198 | } | 213 | } |
@@ -200,13 +215,15 @@ public abstract class ParamField extends JPanel { | @@ -200,13 +215,15 @@ public abstract class ParamField extends JPanel { | ||
200 | } | 215 | } |
201 | 216 | ||
202 | public static class TargetNameField extends ParamField implements TextFieldListener { | 217 | public static class TargetNameField extends ParamField implements TextFieldListener { |
218 | + /** */ | ||
219 | + private static final long serialVersionUID = 5136431108894677113L; | ||
203 | JComboBox<String> comboBox; | 220 | JComboBox<String> comboBox; |
204 | JTextField field; | 221 | JTextField field; |
205 | String lastContent; | 222 | String lastContent; |
206 | 223 | ||
207 | public TargetNameField(EpnTapMainView mainView, String paramName) { | 224 | public TargetNameField(EpnTapMainView mainView, String paramName) { |
208 | super(mainView, paramName); | 225 | super(mainView, paramName); |
209 | - comboBox = new JComboBox(); | 226 | + comboBox = new JComboBox<>(); |
210 | comboBox.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); | 227 | comboBox.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); |
211 | 228 | ||
212 | comboBox.setEditable(true); | 229 | comboBox.setEditable(true); |
@@ -215,7 +232,7 @@ public abstract class ParamField extends JPanel { | @@ -215,7 +232,7 @@ public abstract class ParamField extends JPanel { | ||
215 | this.add(comboBox); | 232 | this.add(comboBox); |
216 | } | 233 | } |
217 | 234 | ||
218 | - private String[] getItems(String begining) throws SendQueryException { | 235 | + static String[] getItems(String begining) throws SendQueryException { |
219 | StringBuilder resolverResult = null; | 236 | StringBuilder resolverResult = null; |
220 | resolverResult = VOTableConnection.sendGet(RESOLVER_URL, "q=\"" + begining + "\""); | 237 | resolverResult = VOTableConnection.sendGet(RESOLVER_URL, "q=\"" + begining + "\""); |
221 | JsonObject root = new JsonParser().parse(resolverResult.toString()).getAsJsonObject(); | 238 | JsonObject root = new JsonParser().parse(resolverResult.toString()).getAsJsonObject(); |
@@ -256,17 +273,20 @@ public abstract class ParamField extends JPanel { | @@ -256,17 +273,20 @@ public abstract class ParamField extends JPanel { | ||
256 | } | 273 | } |
257 | }; | 274 | }; |
258 | 275 | ||
259 | - public void update(JTextField field) { | 276 | + @Override |
277 | + public void update(JTextField textField) { | ||
260 | SwingUtilities.invokeLater(updateComboBox); | 278 | SwingUtilities.invokeLater(updateComboBox); |
261 | } | 279 | } |
262 | } | 280 | } |
263 | 281 | ||
264 | public static class DataProductTypeField extends ParamField { | 282 | public static class DataProductTypeField extends ParamField { |
283 | + /** */ | ||
284 | + private static final long serialVersionUID = -6362359909898369750L; | ||
265 | JComboBox<String> comboBox; | 285 | JComboBox<String> comboBox; |
266 | 286 | ||
267 | public DataProductTypeField(EpnTapMainView mainView, String paramName) { | 287 | public DataProductTypeField(EpnTapMainView mainView, String paramName) { |
268 | super(mainView, paramName); | 288 | super(mainView, paramName); |
269 | - comboBox = new JComboBox(getItems().keySet().toArray()); | 289 | + comboBox = new JComboBox<>((String[]) getItems().keySet().toArray()); |
270 | comboBox.setSelectedItem("All"); | 290 | comboBox.setSelectedItem("All"); |
271 | comboBox.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); | 291 | comboBox.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); |
272 | comboBox.addActionListener(new ActionListener() { | 292 | comboBox.addActionListener(new ActionListener() { |
@@ -278,8 +298,8 @@ public abstract class ParamField extends JPanel { | @@ -278,8 +298,8 @@ public abstract class ParamField extends JPanel { | ||
278 | this.add(comboBox); | 298 | this.add(comboBox); |
279 | } | 299 | } |
280 | 300 | ||
281 | - private HashMap<String, String> getItems() { | ||
282 | - HashMap items = new HashMap<String, String>(); | 301 | + private static HashMap<String, String> getItems() { |
302 | + HashMap<String, String> items = new HashMap<>(); | ||
283 | items.put("All", "all"); | 303 | items.put("All", "all"); |
284 | items.put("Image", "im"); | 304 | items.put("Image", "im"); |
285 | items.put("Spectrum", "sp"); | 305 | items.put("Spectrum", "sp"); |
@@ -295,9 +315,9 @@ public abstract class ParamField extends JPanel { | @@ -295,9 +315,9 @@ public abstract class ParamField extends JPanel { | ||
295 | return items; | 315 | return items; |
296 | } | 316 | } |
297 | 317 | ||
298 | - private void onUpdate() { | 318 | + void onUpdate() { |
299 | String key = comboBox.getSelectedItem().toString(); | 319 | String key = comboBox.getSelectedItem().toString(); |
300 | - List<String> item = new ArrayList(); | 320 | + List<String> item = new ArrayList<>(); |
301 | item.add(key.replace(" ", "-").toLowerCase()); | 321 | item.add(key.replace(" ", "-").toLowerCase()); |
302 | item.add(getItems().get(key)); | 322 | item.add(getItems().get(key)); |
303 | if ("All".equals(key)) { | 323 | if ("All".equals(key)) { |
@@ -309,11 +329,13 @@ public abstract class ParamField extends JPanel { | @@ -309,11 +329,13 @@ public abstract class ParamField extends JPanel { | ||
309 | } | 329 | } |
310 | 330 | ||
311 | public static class TargetClassField extends ParamField { | 331 | public static class TargetClassField extends ParamField { |
332 | + /** */ | ||
333 | + private static final long serialVersionUID = 6439475087727685080L; | ||
312 | JComboBox<String> comboBox; | 334 | JComboBox<String> comboBox; |
313 | 335 | ||
314 | public TargetClassField(EpnTapMainView mainView, String paramName) { | 336 | public TargetClassField(EpnTapMainView mainView, String paramName) { |
315 | super(mainView, paramName); | 337 | super(mainView, paramName); |
316 | - comboBox = new JComboBox(getItems()); | 338 | + comboBox = new JComboBox<>(getItems()); |
317 | comboBox.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); | 339 | comboBox.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); |
318 | comboBox.addActionListener(new ActionListener() { | 340 | comboBox.addActionListener(new ActionListener() { |
319 | @Override | 341 | @Override |
@@ -324,12 +346,12 @@ public abstract class ParamField extends JPanel { | @@ -324,12 +346,12 @@ public abstract class ParamField extends JPanel { | ||
324 | this.add(comboBox); | 346 | this.add(comboBox); |
325 | } | 347 | } |
326 | 348 | ||
327 | - private String[] getItems() { | 349 | + private static String[] getItems() { |
328 | return new String[] { "All", "Comet", "Exoplanet", "Interplanetary medium", "Ring", | 350 | return new String[] { "All", "Comet", "Exoplanet", "Interplanetary medium", "Ring", |
329 | "Sample", "Sky", "Spacecraft", "Spacejunk", "Star" }; | 351 | "Sample", "Sky", "Spacecraft", "Spacejunk", "Star" }; |
330 | } | 352 | } |
331 | 353 | ||
332 | - private void onUpdate() { | 354 | + void onUpdate() { |
333 | String value = comboBox.getSelectedItem().toString().replace(" ", "_").toLowerCase(); | 355 | String value = comboBox.getSelectedItem().toString().replace(" ", "_").toLowerCase(); |
334 | if ("All".equals(value)) { | 356 | if ("All".equals(value)) { |
335 | mainView.event(Event.paramRemoved, paramName); | 357 | mainView.event(Event.paramRemoved, paramName); |
@@ -345,14 +367,17 @@ public abstract class ParamField extends JPanel { | @@ -345,14 +367,17 @@ public abstract class ParamField extends JPanel { | ||
345 | 367 | ||
346 | static void addChangeListener(final TextFieldListener changeListener, final JTextField field) { | 368 | static void addChangeListener(final TextFieldListener changeListener, final JTextField field) { |
347 | field.getDocument().addDocumentListener(new DocumentListener() { | 369 | field.getDocument().addDocumentListener(new DocumentListener() { |
370 | + @Override | ||
348 | public void removeUpdate(DocumentEvent de) { | 371 | public void removeUpdate(DocumentEvent de) { |
349 | changeListener.update(field); | 372 | changeListener.update(field); |
350 | } | 373 | } |
351 | 374 | ||
375 | + @Override | ||
352 | public void insertUpdate(DocumentEvent de) { | 376 | public void insertUpdate(DocumentEvent de) { |
353 | changeListener.update(field); | 377 | changeListener.update(field); |
354 | } | 378 | } |
355 | 379 | ||
380 | + @Override | ||
356 | public void changedUpdate(DocumentEvent de) { | 381 | public void changedUpdate(DocumentEvent de) { |
357 | changeListener.update(field); | 382 | changeListener.update(field); |
358 | } | 383 | } |
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/BottomBarPanel.java
@@ -29,11 +29,20 @@ import eu.omp.irap.vespa.epntapclient.view.EpnTapMainView; | @@ -29,11 +29,20 @@ import eu.omp.irap.vespa.epntapclient.view.EpnTapMainView; | ||
29 | * @author N. Jourdane | 29 | * @author N. Jourdane |
30 | */ | 30 | */ |
31 | public class BottomBarPanel extends JPanel { | 31 | public class BottomBarPanel extends JPanel { |
32 | + /** */ | ||
33 | + private static final long serialVersionUID = 8083897308526492902L; | ||
34 | + | ||
32 | /** The logger for the class BottomBar. */ | 35 | /** The logger for the class BottomBar. */ |
36 | + @SuppressWarnings("unused") | ||
33 | private static final Logger logger = Logger.getLogger(BottomBarPanel.class.getName()); | 37 | private static final Logger logger = Logger.getLogger(BottomBarPanel.class.getName()); |
34 | - JLabel infoLabel; | 38 | + |
39 | + @SuppressWarnings("unused") | ||
40 | + private EpnTapMainView mainView; | ||
41 | + | ||
42 | + private JLabel infoLabel; | ||
35 | 43 | ||
36 | public BottomBarPanel(EpnTapMainView mainView) { | 44 | public BottomBarPanel(EpnTapMainView mainView) { |
45 | + this.mainView = mainView; | ||
37 | setLayout(new BorderLayout()); | 46 | setLayout(new BorderLayout()); |
38 | infoLabel = new JLabel(); | 47 | infoLabel = new JLabel(); |
39 | this.add(infoLabel); | 48 | this.add(infoLabel); |
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/RequestPanel.java
@@ -44,6 +44,7 @@ import eu.omp.irap.vespa.epntapclient.view.ParamField.TargetNameField; | @@ -44,6 +44,7 @@ import eu.omp.irap.vespa.epntapclient.view.ParamField.TargetNameField; | ||
44 | */ | 44 | */ |
45 | public class RequestPanel extends JPanel implements ActionListener { | 45 | public class RequestPanel extends JPanel implements ActionListener { |
46 | /** The logger for the class RequestView. */ | 46 | /** The logger for the class RequestView. */ |
47 | + @SuppressWarnings("unused") | ||
47 | private static final Logger logger = Logger.getLogger(RequestPanel.class.getName()); | 48 | private static final Logger logger = Logger.getLogger(RequestPanel.class.getName()); |
48 | 49 | ||
49 | /** The serial version UID (affected with a random number). */ | 50 | /** The serial version UID (affected with a random number). */ |
@@ -96,7 +97,7 @@ public class RequestPanel extends JPanel implements ActionListener { | @@ -96,7 +97,7 @@ public class RequestPanel extends JPanel implements ActionListener { | ||
96 | // TODO: new GUI field column to allow the user to select the comparison operator: | 97 | // TODO: new GUI field column to allow the user to select the comparison operator: |
97 | // - if the field is a String: listbox with 'xx', '%xx', 'xx%', and '%xx%'. | 98 | // - if the field is a String: listbox with 'xx', '%xx', 'xx%', and '%xx%'. |
98 | // - if the field is a numeric value: listbox with <, <=, =, =>, >. | 99 | // - if the field is a numeric value: listbox with <, <=, =, =>, >. |
99 | - paramFields = new ArrayList(); | 100 | + paramFields = new ArrayList<>(); |
100 | paramFields.add(new TargetNameField(mainView, "target_name")); | 101 | paramFields.add(new TargetNameField(mainView, "target_name")); |
101 | paramFields.add(new DateRangeField(mainView, "time_")); | 102 | paramFields.add(new DateRangeField(mainView, "time_")); |
102 | paramFields.add(new FloatRangeField(mainView, "spectral_range_")); | 103 | paramFields.add(new FloatRangeField(mainView, "spectral_range_")); |
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java
@@ -30,11 +30,18 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; | @@ -30,11 +30,18 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; | ||
30 | * @author N. Jourdane | 30 | * @author N. Jourdane |
31 | */ | 31 | */ |
32 | public class ResultsPanel extends JPanel { | 32 | public class ResultsPanel extends JPanel { |
33 | + /** */ | ||
34 | + private static final long serialVersionUID = -3387526562625069156L; | ||
35 | + | ||
33 | /** The logger for the class ResultPanel. */ | 36 | /** The logger for the class ResultPanel. */ |
37 | + @SuppressWarnings("unused") | ||
34 | private static final Logger logger = Logger.getLogger(ResultsPanel.class.getName()); | 38 | private static final Logger logger = Logger.getLogger(ResultsPanel.class.getName()); |
35 | 39 | ||
36 | - EpnTapMainView mainView; | ||
37 | - VOTableView voTableView; | 40 | + @SuppressWarnings("unused") |
41 | + private EpnTapMainView mainView; | ||
42 | + | ||
43 | + @SuppressWarnings("unused") | ||
44 | + private VOTableView voTableView; | ||
38 | 45 | ||
39 | public ResultsPanel(EpnTapMainView mainView, VOTableView voTableView) { | 46 | public ResultsPanel(EpnTapMainView mainView, VOTableView voTableView) { |
40 | super(); | 47 | super(); |
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java
@@ -33,11 +33,17 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; | @@ -33,11 +33,17 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; | ||
33 | * @author N. Jourdane | 33 | * @author N. Jourdane |
34 | */ | 34 | */ |
35 | public class ServicesPanel extends JPanel { | 35 | public class ServicesPanel extends JPanel { |
36 | + /** */ | ||
37 | + private static final long serialVersionUID = 7850369546415832758L; | ||
38 | + | ||
36 | /** The logger for the class ServicesView. */ | 39 | /** The logger for the class ServicesView. */ |
40 | + @SuppressWarnings("unused") | ||
37 | private static final Logger logger = Logger.getLogger(ServicesPanel.class.getName()); | 41 | private static final Logger logger = Logger.getLogger(ServicesPanel.class.getName()); |
38 | 42 | ||
39 | - EpnTapMainView mainView; | ||
40 | - VOTableView voTableView; | 43 | + @SuppressWarnings("unused") |
44 | + private EpnTapMainView mainView; | ||
45 | + | ||
46 | + private VOTableView voTableView; | ||
41 | 47 | ||
42 | public ServicesPanel(final EpnTapMainView mainView, final VOTableView voTableView) { | 48 | public ServicesPanel(final EpnTapMainView mainView, final VOTableView voTableView) { |
43 | super(); | 49 | super(); |
@@ -53,6 +59,7 @@ public class ServicesPanel extends JPanel { | @@ -53,6 +59,7 @@ public class ServicesPanel extends JPanel { | ||
53 | // TODO: Support multi-selection | 59 | // TODO: Support multi-selection |
54 | voTableView.getTable().getSelectionModel() | 60 | voTableView.getTable().getSelectionModel() |
55 | .addListSelectionListener(new ListSelectionListener() { | 61 | .addListSelectionListener(new ListSelectionListener() { |
62 | + @Override | ||
56 | public void valueChanged(ListSelectionEvent evt) { | 63 | public void valueChanged(ListSelectionEvent evt) { |
57 | mainView.event(Event.serviceSelected, | 64 | mainView.event(Event.serviceSelected, |
58 | voTableView.getTable().getSelectedRow()); | 65 | voTableView.getTable().getSelectedRow()); |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/Utils.java
@@ -41,7 +41,7 @@ public class Utils { | @@ -41,7 +41,7 @@ public class Utils { | ||
41 | 41 | ||
42 | public StringJoiner(String separator) { | 42 | public StringJoiner(String separator) { |
43 | this.separator = separator; | 43 | this.separator = separator; |
44 | - this.list = new ArrayList(); | 44 | + this.list = new ArrayList<>(); |
45 | string = ""; | 45 | string = ""; |
46 | } | 46 | } |
47 | 47 |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/VOTableApp.java
@@ -33,7 +33,7 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException; | @@ -33,7 +33,7 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException; | ||
33 | */ | 33 | */ |
34 | public class VOTableApp { | 34 | public class VOTableApp { |
35 | /** The logger for the class VOTableApp. */ | 35 | /** The logger for the class VOTableApp. */ |
36 | - private static final Logger logger = Logger.getLogger(VOTableApp.class.getName()); | 36 | + static final Logger logger = Logger.getLogger(VOTableApp.class.getName()); |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * Main function to start the application as standalone. | 39 | * Main function to start the application as standalone. |
@@ -64,6 +64,7 @@ public class VOTableApp { | @@ -64,6 +64,7 @@ public class VOTableApp { | ||
64 | voTableControl = new VOTableController(args[0]); | 64 | voTableControl = new VOTableController(args[0]); |
65 | } catch (VOTableException e) { | 65 | } catch (VOTableException e) { |
66 | System.console().writer().println("Error: " + e.getMessage()); | 66 | System.console().writer().println("Error: " + e.getMessage()); |
67 | + return; | ||
67 | } | 68 | } |
68 | } else if (args.length == 3) { | 69 | } else if (args.length == 3) { |
69 | voTableControl = new VOTableController(args[0], args[1], args[2]); | 70 | voTableControl = new VOTableController(args[0], args[1], args[2]); |