Commit 1e543ea07b22339f695ec0840d9527e62054a3db
1 parent
a8113866
Exists in
master
Code clean-up
Showing
21 changed files
with
263 additions
and
219 deletions
Show diff stats
.settings/org.eclipse.jdt.core.prefs deleted
@@ -1,8 +0,0 @@ | @@ -1,8 +0,0 @@ | ||
1 | -eclipse.preferences.version=1 | ||
2 | -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
3 | -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 | ||
4 | -org.eclipse.jdt.core.compiler.compliance=1.7 | ||
5 | -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
6 | -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
7 | -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
8 | -org.eclipse.jdt.core.compiler.source=1.7 |
src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -25,7 +25,7 @@ import eu.omp.irap.vespa.epntapclient.controller.EpnTapController; | @@ -25,7 +25,7 @@ import eu.omp.irap.vespa.epntapclient.controller.EpnTapController; | ||
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Simple class to have a main function to launch the EPNTap client. | 27 | * Simple class to have a main function to launch the EPNTap client. |
28 | - * | 28 | + * |
29 | * @author N. Jourdane | 29 | * @author N. Jourdane |
30 | */ | 30 | */ |
31 | public class EpnTapMainApp { | 31 | public class EpnTapMainApp { |
@@ -38,14 +38,14 @@ public class EpnTapMainApp { | @@ -38,14 +38,14 @@ public class EpnTapMainApp { | ||
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Main function to start the application as standalone. | 40 | * Main function to start the application as standalone. |
41 | - * | 41 | + * |
42 | * @param args The program arguments (not used). | 42 | * @param args The program arguments (not used). |
43 | */ | 43 | */ |
44 | public static void main(final String[] args) { | 44 | public static void main(final String[] args) { |
45 | SwingUtilities.invokeLater(new Runnable() { | 45 | SwingUtilities.invokeLater(new Runnable() { |
46 | @Override | 46 | @Override |
47 | public void run() { | 47 | public void run() { |
48 | - logger.info("Lauching EPN-TAP application..."); | 48 | + EpnTapMainApp.logger.info("Lauching EPN-TAP application..."); |
49 | EpnTapController epnTapControl = new EpnTapController(); | 49 | EpnTapController epnTapControl = new EpnTapController(); |
50 | if (args.length != 0) { | 50 | if (args.length != 0) { |
51 | System.console().writer().println("Usage: EpnTapMainApp"); | 51 | System.console().writer().println("Usage: EpnTapMainApp"); |
src/main/java/eu/omp/irap/vespa/epntapclient/controller/EpnTapController.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -31,7 +31,7 @@ import eu.omp.irap.vespa.epntapclient.votable.utils.Const; | @@ -31,7 +31,7 @@ import eu.omp.irap.vespa.epntapclient.votable.utils.Const; | ||
31 | 31 | ||
32 | /** | 32 | /** |
33 | * The main controller which manage views and controllers. | 33 | * The main controller which manage views and controllers. |
34 | - * | 34 | + * |
35 | * @author N. Jourdane | 35 | * @author N. Jourdane |
36 | */ | 36 | */ |
37 | public class EpnTapController implements MainViewListener { | 37 | public class EpnTapController implements MainViewListener { |
@@ -94,7 +94,7 @@ public class EpnTapController implements MainViewListener { | @@ -94,7 +94,7 @@ public class EpnTapController implements MainViewListener { | ||
94 | 94 | ||
95 | /** | 95 | /** |
96 | * Update the row selected by the user on the Services Panel. | 96 | * Update the row selected by the user on the Services Panel. |
97 | - * | 97 | + * |
98 | * @param row The row selected by the user on the Jtable. | 98 | * @param row The row selected by the user on the Jtable. |
99 | */ | 99 | */ |
100 | public void updateSelected(int row) { | 100 | public void updateSelected(int row) { |
@@ -111,7 +111,7 @@ public class EpnTapController implements MainViewListener { | @@ -111,7 +111,7 @@ public class EpnTapController implements MainViewListener { | ||
111 | 111 | ||
112 | /** | 112 | /** |
113 | * Remove a query parameter from the parameters list. | 113 | * Remove a query parameter from the parameters list. |
114 | - * | 114 | + * |
115 | * @param paramName The name of the parameter as described in REG-TAP specifications. | 115 | * @param paramName The name of the parameter as described in REG-TAP specifications. |
116 | */ | 116 | */ |
117 | public void removeParameter(String paramName) { | 117 | public void removeParameter(String paramName) { |
@@ -122,7 +122,7 @@ public class EpnTapController implements MainViewListener { | @@ -122,7 +122,7 @@ public class EpnTapController implements MainViewListener { | ||
122 | 122 | ||
123 | /** | 123 | /** |
124 | * Update a query parameter in the parameter list. | 124 | * Update a query parameter in the parameter list. |
125 | - * | 125 | + * |
126 | * @param paramName The name of the parameter as described in REG-TAP specifications. | 126 | * @param paramName The name of the parameter as described in REG-TAP specifications. |
127 | * @param value The value of the parameter to update. | 127 | * @param value The value of the parameter to update. |
128 | */ | 128 | */ |
@@ -142,7 +142,7 @@ public class EpnTapController implements MainViewListener { | @@ -142,7 +142,7 @@ public class EpnTapController implements MainViewListener { | ||
142 | 142 | ||
143 | /** | 143 | /** |
144 | * Send a query to the selected service on the services panel. | 144 | * Send a query to the selected service on the services panel. |
145 | - * | 145 | + * |
146 | * @param query The query to send to the selected service. | 146 | * @param query The query to send to the selected service. |
147 | * @throws VOTableException Can not fill the Table | 147 | * @throws VOTableException Can not fill the Table |
148 | */ | 148 | */ |
@@ -153,7 +153,7 @@ public class EpnTapController implements MainViewListener { | @@ -153,7 +153,7 @@ public class EpnTapController implements MainViewListener { | ||
153 | 153 | ||
154 | /** | 154 | /** |
155 | * This methods is called each time a graphical event is detected from a view. | 155 | * This methods is called each time a graphical event is detected from a view. |
156 | - * | 156 | + * |
157 | * @param event The type of the detected event. @see Event | 157 | * @param event The type of the detected event. @see Event |
158 | * @param args The possible arguments which comes with the event (ie. a row column). | 158 | * @param args The possible arguments which comes with the event (ie. a row column). |
159 | */ | 159 | */ |
src/main/java/eu/omp/irap/vespa/epntapclient/utils/Queries.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -25,7 +25,7 @@ import eu.omp.irap.vespa.epntapclient.votable.utils.Utils.StringJoiner; | @@ -25,7 +25,7 @@ import eu.omp.irap.vespa.epntapclient.votable.utils.Utils.StringJoiner; | ||
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Defines the queries and the query patterns usually used in the application. | 27 | * Defines the queries and the query patterns usually used in the application. |
28 | - * | 28 | + * |
29 | * @author N. Jourdane | 29 | * @author N. Jourdane |
30 | */ | 30 | */ |
31 | public final class Queries { | 31 | public final class Queries { |
@@ -54,7 +54,7 @@ public final class Queries { | @@ -54,7 +54,7 @@ public final class Queries { | ||
54 | /** | 54 | /** |
55 | * The default query, with these parameters, respectively: max_rows, target_name, time_min, | 55 | * The default query, with these parameters, respectively: max_rows, target_name, time_min, |
56 | * time_max, dataproduct_type, spectral_range_min, spectral_range_max. | 56 | * time_max, dataproduct_type, spectral_range_min, spectral_range_max. |
57 | - * | 57 | + * |
58 | * @param nbRow The maximum number of rows returned. | 58 | * @param nbRow The maximum number of rows returned. |
59 | * @param tableName The name of the target table for the query. | 59 | * @param tableName The name of the target table for the query. |
60 | * @param params A map of parameters, for the `WHERE` keywords. | 60 | * @param params A map of parameters, for the `WHERE` keywords. |
@@ -67,8 +67,9 @@ public final class Queries { | @@ -67,8 +67,9 @@ public final class Queries { | ||
67 | StringJoiner orJoin = new StringJoiner(" OR "); | 67 | StringJoiner orJoin = new StringJoiner(" OR "); |
68 | @SuppressWarnings("unchecked") | 68 | @SuppressWarnings("unchecked") |
69 | List<String> possibleValues = (List<String>) param.getValue(); | 69 | List<String> possibleValues = (List<String>) param.getValue(); |
70 | - for (String possibleValue : possibleValues) | 70 | + for (String possibleValue : possibleValues) { |
71 | orJoin.add(param.getKey() + " LIKE '" + possibleValue + "'"); | 71 | orJoin.add(param.getKey() + " LIKE '" + possibleValue + "'"); |
72 | + } | ||
72 | addJoin.add("(" + orJoin + ")"); | 73 | addJoin.add("(" + orJoin + ")"); |
73 | } else if (param.getValue() instanceof String) { | 74 | } else if (param.getValue() instanceof String) { |
74 | addJoin.add(param.getKey() + " LIKE '" + param.getValue() + "'"); | 75 | addJoin.add(param.getKey() + " LIKE '" + param.getValue() + "'"); |
src/main/java/eu/omp/irap/vespa/epntapclient/view/Dim.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -18,7 +18,7 @@ package eu.omp.irap.vespa.epntapclient.view; | @@ -18,7 +18,7 @@ package eu.omp.irap.vespa.epntapclient.view; | ||
18 | 18 | ||
19 | /** | 19 | /** |
20 | * A simple class containing GUI panel and elements dimensions. | 20 | * A simple class containing GUI panel and elements dimensions. |
21 | - * | 21 | + * |
22 | * @author N. Jourdane | 22 | * @author N. Jourdane |
23 | */ | 23 | */ |
24 | public class Dim { | 24 | public class Dim { |
src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -31,7 +31,7 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; | @@ -31,7 +31,7 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; | ||
31 | 31 | ||
32 | /** | 32 | /** |
33 | * The main view of the application, which manage all the other views. | 33 | * The main view of the application, which manage all the other views. |
34 | - * | 34 | + * |
35 | * @author N. Jourdane | 35 | * @author N. Jourdane |
36 | */ | 36 | */ |
37 | public class EpnTapMainView extends JPanel { | 37 | public class EpnTapMainView extends JPanel { |
@@ -39,8 +39,8 @@ public class EpnTapMainView extends JPanel { | @@ -39,8 +39,8 @@ public class EpnTapMainView extends JPanel { | ||
39 | @SuppressWarnings("unused") | 39 | @SuppressWarnings("unused") |
40 | private static final Logger logger = Logger.getLogger(EpnTapMainView.class.getName()); | 40 | private static final Logger logger = Logger.getLogger(EpnTapMainView.class.getName()); |
41 | 41 | ||
42 | - /** The serial version UID (affected with a random number). */ | ||
43 | - private static final long serialVersionUID = -1233290271099283814L; | 42 | + /** The serial version UID. */ |
43 | + private static final long serialVersionUID = 1L; | ||
44 | 44 | ||
45 | /** The JPanel where the VOTable results is displayed. */ | 45 | /** The JPanel where the VOTable results is displayed. */ |
46 | private ResultsPanel resultsPanel; | 46 | private ResultsPanel resultsPanel; |
@@ -59,14 +59,14 @@ public class EpnTapMainView extends JPanel { | @@ -59,14 +59,14 @@ public class EpnTapMainView extends JPanel { | ||
59 | 59 | ||
60 | /** | 60 | /** |
61 | * The interface for the main view listener, which listen for events. | 61 | * The interface for the main view listener, which listen for events. |
62 | - * | 62 | + * |
63 | * @author N. Jourdane | 63 | * @author N. Jourdane |
64 | */ | 64 | */ |
65 | public interface MainViewListener { | 65 | public interface MainViewListener { |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * When an event is detected on the main view. | 68 | * When an event is detected on the main view. |
69 | - * | 69 | + * |
70 | * @param event The event type. @see Event | 70 | * @param event The event type. @see Event |
71 | * @param args The possible arguments which comes with the event (ie. a row number). | 71 | * @param args The possible arguments which comes with the event (ie. a row number). |
72 | */ | 72 | */ |
@@ -75,22 +75,22 @@ public class EpnTapMainView extends JPanel { | @@ -75,22 +75,22 @@ public class EpnTapMainView extends JPanel { | ||
75 | 75 | ||
76 | /** | 76 | /** |
77 | * The main view constructor, which create all the panels. | 77 | * The main view constructor, which create all the panels. |
78 | - * | 78 | + * |
79 | * @param voTableServicesView The view to put in the services panel, built by ServicesController | 79 | * @param voTableServicesView The view to put in the services panel, built by ServicesController |
80 | * @param voTableResultsView The view to put in the results panel, built by ResultsController. | 80 | * @param voTableResultsView The view to put in the results panel, built by ResultsController. |
81 | */ | 81 | */ |
82 | 82 | ||
83 | public EpnTapMainView(VOTableView voTableServicesView, VOTableView voTableResultsView) { | 83 | public EpnTapMainView(VOTableView voTableServicesView, VOTableView voTableResultsView) { |
84 | - this.servicesPanel = new ServicesPanel(this, voTableServicesView); | ||
85 | - this.resultsPanel = new ResultsPanel(this, voTableResultsView); | ||
86 | - this.requestPanel = new RequestPanel(this); | ||
87 | - this.bottomBarPanel = new BottomBarPanel(this); | 84 | + servicesPanel = new ServicesPanel(this, voTableServicesView); |
85 | + resultsPanel = new ResultsPanel(this, voTableResultsView); | ||
86 | + requestPanel = new RequestPanel(this); | ||
87 | + bottomBarPanel = new BottomBarPanel(this); | ||
88 | buildWindow(); | 88 | buildWindow(); |
89 | } | 89 | } |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * Add a listener for the main view. | 92 | * Add a listener for the main view. |
93 | - * | 93 | + * |
94 | * @param listener A MainViewListener. | 94 | * @param listener A MainViewListener. |
95 | */ | 95 | */ |
96 | public void addMainViewListener(MainViewListener listener) { | 96 | public void addMainViewListener(MainViewListener listener) { |
@@ -152,7 +152,7 @@ public class EpnTapMainView extends JPanel { | @@ -152,7 +152,7 @@ public class EpnTapMainView extends JPanel { | ||
152 | 152 | ||
153 | /** | 153 | /** |
154 | * Get an event and send it to the listener of the main view. | 154 | * Get an event and send it to the listener of the main view. |
155 | - * | 155 | + * |
156 | * @param event The event type. @see Event | 156 | * @param event The event type. @see Event |
157 | * @param args The possible arguments which comes with the event (ie. a row number). | 157 | * @param args The possible arguments which comes with the event (ie. a row number). |
158 | */ | 158 | */ |
src/main/java/eu/omp/irap/vespa/epntapclient/view/Event.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -50,45 +50,53 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.CantSe | @@ -50,45 +50,53 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.CantSe | ||
50 | * is an abstract method and all type of parameter field should extend it. See | 50 | * is an abstract method and all type of parameter field should extend it. See |
51 | * https://voparis-confluence.obspm.fr/display/VES/4+-+EPN-TAP+queries to get all parameters | 51 | * https://voparis-confluence.obspm.fr/display/VES/4+-+EPN-TAP+queries to get all parameters |
52 | * details. | 52 | * details. |
53 | - * | 53 | + * |
54 | * @author N. Jourdane | 54 | * @author N. Jourdane |
55 | */ | 55 | */ |
56 | public abstract class ParamField extends JPanel { | 56 | public abstract class ParamField extends JPanel { |
57 | - /** The serial version UID (affected with a random number). */ | ||
58 | - private static final long serialVersionUID = 6025994164004985362L; | 57 | + /** The serial version UID. */ |
58 | + private static final long serialVersionUID = 1L; | ||
59 | 59 | ||
60 | /** The logger for the class ParamField. */ | 60 | /** The logger for the class ParamField. */ |
61 | static final Logger logger = Logger.getLogger(ParamField.class.getName()); | 61 | static final Logger logger = Logger.getLogger(ParamField.class.getName()); |
62 | 62 | ||
63 | /** The minimum width of the field. */ | 63 | /** The minimum width of the field. */ |
64 | private static final int MIN_FIELD_WIDTH = 30; | 64 | private static final int MIN_FIELD_WIDTH = 30; |
65 | + | ||
65 | /** The preferred field height. */ | 66 | /** The preferred field height. */ |
66 | private static final int FIELD_HEIGHT = 20; | 67 | private static final int FIELD_HEIGHT = 20; |
68 | + | ||
67 | /** The maximum width of the field. */ | 69 | /** The maximum width of the field. */ |
68 | private static final int MAX_FIELD_WIDTH = 400; | 70 | private static final int MAX_FIELD_WIDTH = 400; |
71 | + | ||
69 | /** The preferred label width. */ | 72 | /** The preferred label width. */ |
70 | private static final int LABEL_WIDTH = 140; | 73 | private static final int LABEL_WIDTH = 140; |
71 | 74 | ||
72 | /** The URL of the resolver used for the `target name` field. */ | 75 | /** The URL of the resolver used for the `target name` field. */ |
73 | private static final String RESOLVER_URL = "http://voparis-registry.obspm.fr/ssodnet/1/autocomplete"; | 76 | private static final String RESOLVER_URL = "http://voparis-registry.obspm.fr/ssodnet/1/autocomplete"; |
77 | + | ||
74 | /** The date format used in the DateRange field */ | 78 | /** The date format used in the DateRange field */ |
75 | private static final String DATE_FORMAT = "dd/MM/yyyy"; | 79 | private static final String DATE_FORMAT = "dd/MM/yyyy"; |
80 | + | ||
76 | /** The regex used to validate the Date fields */ | 81 | /** The regex used to validate the Date fields */ |
77 | 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)$)"; | 82 | 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)$)"; |
83 | + | ||
78 | /** The suffix used in REG-TAP parameters names, indicating that it's a beginning of a range. */ | 84 | /** The suffix used in REG-TAP parameters names, indicating that it's a beginning of a range. */ |
79 | private static final String MIN_SUFFIX = "min"; | 85 | private static final String MIN_SUFFIX = "min"; |
86 | + | ||
80 | /** The suffix used in REG-TAP parameters names, indicating that it is a end of a range. */ | 87 | /** The suffix used in REG-TAP parameters names, indicating that it is a end of a range. */ |
81 | private static final String MAX_SUFFIX = "max"; | 88 | private static final String MAX_SUFFIX = "max"; |
82 | 89 | ||
83 | /** The main view of the application. */ | 90 | /** The main view of the application. */ |
84 | protected EpnTapMainView mainView; | 91 | protected EpnTapMainView mainView; |
92 | + | ||
85 | /** The parameter name of the field */ | 93 | /** The parameter name of the field */ |
86 | protected String paramName; | 94 | protected String paramName; |
87 | 95 | ||
88 | /** | 96 | /** |
89 | * Method constructor for the parameter field abstract class, which do all common action for all | 97 | * Method constructor for the parameter field abstract class, which do all common action for all |
90 | * type of field, such as displaying the name of the parameter. | 98 | * type of field, such as displaying the name of the parameter. |
91 | - * | 99 | + * |
92 | * @param mainView The main view of the application. | 100 | * @param mainView The main view of the application. |
93 | * @param paramName The name of the parameter. | 101 | * @param paramName The name of the parameter. |
94 | */ | 102 | */ |
@@ -98,11 +106,11 @@ public abstract class ParamField extends JPanel { | @@ -98,11 +106,11 @@ public abstract class ParamField extends JPanel { | ||
98 | this.mainView = mainView; | 106 | this.mainView = mainView; |
99 | this.paramName = paramName; | 107 | this.paramName = paramName; |
100 | 108 | ||
101 | - this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); | ||
102 | - this.setMaximumSize(new Dimension(MAX_FIELD_WIDTH, FIELD_HEIGHT)); | 109 | + setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); |
110 | + setMaximumSize(new Dimension(ParamField.MAX_FIELD_WIDTH, ParamField.FIELD_HEIGHT)); | ||
103 | String strLabel = paramName.replaceAll("_", " ").trim(); | 111 | String strLabel = paramName.replaceAll("_", " ").trim(); |
104 | JLabel label = new JLabel(strLabel.substring(0, 1).toUpperCase() + strLabel.substring(1)); | 112 | JLabel label = new JLabel(strLabel.substring(0, 1).toUpperCase() + strLabel.substring(1)); |
105 | - label.setPreferredSize(new Dimension(LABEL_WIDTH, FIELD_HEIGHT)); | 113 | + label.setPreferredSize(new Dimension(ParamField.LABEL_WIDTH, ParamField.FIELD_HEIGHT)); |
106 | this.add(label); | 114 | this.add(label); |
107 | // TODO: Add tooltip text based on rr.table_column.column_description | 115 | // TODO: Add tooltip text based on rr.table_column.column_description |
108 | } | 116 | } |
@@ -110,25 +118,26 @@ public abstract class ParamField extends JPanel { | @@ -110,25 +118,26 @@ public abstract class ParamField extends JPanel { | ||
110 | /** | 118 | /** |
111 | * The string field is used for parameter with a `String` class. It is a simple JTextField with | 119 | * The string field is used for parameter with a `String` class. It is a simple JTextField with |
112 | * no verification. The parameter is sent to the controller each time it is modified. | 120 | * no verification. The parameter is sent to the controller each time it is modified. |
113 | - * | 121 | + * |
114 | * @author N. Jourdane | 122 | * @author N. Jourdane |
115 | */ | 123 | */ |
116 | public static class StringField extends ParamField implements TextFieldListener { | 124 | public static class StringField extends ParamField implements TextFieldListener { |
117 | - /** The serial version UID (affected with a random number). */ | ||
118 | - private static final long serialVersionUID = 24219488975302068L; | 125 | + /** The serial version UID. */ |
126 | + private static final long serialVersionUID = 1L; | ||
127 | + | ||
119 | /** The JTextField used to put the parameter value. */ | 128 | /** The JTextField used to put the parameter value. */ |
120 | JTextField field; | 129 | JTextField field; |
121 | 130 | ||
122 | /** | 131 | /** |
123 | * Method constructor for the string field. | 132 | * Method constructor for the string field. |
124 | - * | 133 | + * |
125 | * @param mainView The main view of the application. | 134 | * @param mainView The main view of the application. |
126 | * @param paramName The name of the parameter. | 135 | * @param paramName The name of the parameter. |
127 | */ | 136 | */ |
128 | public StringField(EpnTapMainView mainView, String paramName) { | 137 | public StringField(EpnTapMainView mainView, String paramName) { |
129 | super(mainView, paramName); | 138 | super(mainView, paramName); |
130 | field = new JTextField(); | 139 | field = new JTextField(); |
131 | - addChangeListener(this, field); | 140 | + ParamField.addChangeListener(this, field); |
132 | this.add(field); | 141 | this.add(field); |
133 | } | 142 | } |
134 | 143 | ||
@@ -149,25 +158,26 @@ public abstract class ParamField extends JPanel { | @@ -149,25 +158,26 @@ public abstract class ParamField extends JPanel { | ||
149 | * The float field is used for parameter with a `Float` class. It is a JTextField which checks | 158 | * The float field is used for parameter with a `Float` class. It is a JTextField which checks |
150 | * if the content is a valid float. If the parameter is valid or if it is empty, then the float | 159 | * if the content is a valid float. If the parameter is valid or if it is empty, then the float |
151 | * value is sent to the controller. | 160 | * value is sent to the controller. |
152 | - * | 161 | + * |
153 | * @author N. Jourdane | 162 | * @author N. Jourdane |
154 | */ | 163 | */ |
155 | public static class FloatField extends ParamField implements TextFieldListener { | 164 | public static class FloatField extends ParamField implements TextFieldListener { |
156 | - /** The serial version UID (affected with a random number). */ | ||
157 | - private static final long serialVersionUID = -1880193152285564590L; | 165 | + /** The serial version UID. */ |
166 | + private static final long serialVersionUID = 1L; | ||
167 | + | ||
158 | /** The JTextField used to put the parameter value. */ | 168 | /** The JTextField used to put the parameter value. */ |
159 | JTextField field; | 169 | JTextField field; |
160 | 170 | ||
161 | /** | 171 | /** |
162 | * Method constructor | 172 | * Method constructor |
163 | - * | 173 | + * |
164 | * @param mainView The main view of the application. | 174 | * @param mainView The main view of the application. |
165 | * @param paramName The name of the parameter. | 175 | * @param paramName The name of the parameter. |
166 | */ | 176 | */ |
167 | public FloatField(EpnTapMainView mainView, String paramName) { | 177 | public FloatField(EpnTapMainView mainView, String paramName) { |
168 | super(mainView, paramName); | 178 | super(mainView, paramName); |
169 | field = new JTextField(); | 179 | field = new JTextField(); |
170 | - addChangeListener(this, field); | 180 | + ParamField.addChangeListener(this, field); |
171 | this.add(field); | 181 | this.add(field); |
172 | } | 182 | } |
173 | 183 | ||
@@ -196,20 +206,22 @@ public abstract class ParamField extends JPanel { | @@ -196,20 +206,22 @@ public abstract class ParamField extends JPanel { | ||
196 | * `time_min` and `time_max` parameters is concerned for now). These are JTextFields which check | 206 | * `time_min` and `time_max` parameters is concerned for now). These are JTextFields which check |
197 | * if the content is a valid date, according to DATE_FORMAT. If the parameter is valid or if it | 207 | * if the content is a valid date, according to DATE_FORMAT. If the parameter is valid or if it |
198 | * is empty, then the dates value are sent to the controller, in Julian Day format. | 208 | * is empty, then the dates value are sent to the controller, in Julian Day format. |
199 | - * | 209 | + * |
200 | * @author N. Jourdane | 210 | * @author N. Jourdane |
201 | */ | 211 | */ |
202 | public static class DateRangeField extends ParamField implements TextFieldListener { | 212 | public static class DateRangeField extends ParamField implements TextFieldListener { |
203 | - /** The serial version UID (affected with a random number). */ | ||
204 | - private static final long serialVersionUID = -7781309003911514777L; | 213 | + /** The serial version UID. */ |
214 | + private static final long serialVersionUID = 1L; | ||
215 | + | ||
205 | /** The JTextField used to put the parameter minimum value of the range. */ | 216 | /** The JTextField used to put the parameter minimum value of the range. */ |
206 | JTextField fieldMin; | 217 | JTextField fieldMin; |
218 | + | ||
207 | /** The JTextField used to put the parameter maximum value of the range. */ | 219 | /** The JTextField used to put the parameter maximum value of the range. */ |
208 | JTextField fieldMax; | 220 | JTextField fieldMax; |
209 | 221 | ||
210 | /** | 222 | /** |
211 | * Method constructor | 223 | * Method constructor |
212 | - * | 224 | + * |
213 | * @param mainView The main view of the application. | 225 | * @param mainView The main view of the application. |
214 | * @param paramName The name of the parameter. | 226 | * @param paramName The name of the parameter. |
215 | */ | 227 | */ |
@@ -217,16 +229,18 @@ public abstract class ParamField extends JPanel { | @@ -217,16 +229,18 @@ public abstract class ParamField extends JPanel { | ||
217 | super(mainView, paramName); | 229 | super(mainView, paramName); |
218 | this.add(new JLabel("min ")); | 230 | this.add(new JLabel("min ")); |
219 | fieldMin = new JTextField(); | 231 | fieldMin = new JTextField(); |
220 | - fieldMin.setName(MIN_SUFFIX); | ||
221 | - fieldMin.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); | ||
222 | - addChangeListener(this, fieldMin); | 232 | + fieldMin.setName(ParamField.MIN_SUFFIX); |
233 | + fieldMin.setPreferredSize( | ||
234 | + new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT)); | ||
235 | + ParamField.addChangeListener(this, fieldMin); | ||
223 | this.add(fieldMin); | 236 | this.add(fieldMin); |
224 | 237 | ||
225 | this.add(new JLabel("max ")); | 238 | this.add(new JLabel("max ")); |
226 | fieldMax = new JTextField(); | 239 | fieldMax = new JTextField(); |
227 | - fieldMax.setName(MAX_SUFFIX); | ||
228 | - fieldMax.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); | ||
229 | - addChangeListener(this, fieldMin); | 240 | + fieldMax.setName(ParamField.MAX_SUFFIX); |
241 | + fieldMax.setPreferredSize( | ||
242 | + new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT)); | ||
243 | + ParamField.addChangeListener(this, fieldMin); | ||
230 | this.add(fieldMax); | 244 | this.add(fieldMax); |
231 | } | 245 | } |
232 | 246 | ||
@@ -235,14 +249,14 @@ public abstract class ParamField extends JPanel { | @@ -235,14 +249,14 @@ public abstract class ParamField extends JPanel { | ||
235 | */ | 249 | */ |
236 | @Override | 250 | @Override |
237 | public void update(JTextField field) { | 251 | public void update(JTextField field) { |
238 | - DateFormat df = new SimpleDateFormat(DATE_FORMAT, Locale.ENGLISH); | 252 | + DateFormat df = new SimpleDateFormat(ParamField.DATE_FORMAT, Locale.ENGLISH); |
239 | if ("".equals(field.getText())) { | 253 | if ("".equals(field.getText())) { |
240 | field.setBackground(Color.WHITE); | 254 | field.setBackground(Color.WHITE); |
241 | mainView.event(Event.PARAMETER_REMOVED, paramName + field.getName()); | 255 | mainView.event(Event.PARAMETER_REMOVED, paramName + field.getName()); |
242 | - } else if (field.getText().matches(DATE_REGEX)) { | 256 | + } else if (field.getText().matches(ParamField.DATE_REGEX)) { |
243 | try { | 257 | try { |
244 | long date = df.parse(field.getText()).getTime(); | 258 | long date = df.parse(field.getText()).getTime(); |
245 | - date = Math.round((date / 86400000.0) + 2440587.5); // to JD | 259 | + date = Math.round(date / 86400000.0 + 2440587.5); // to JD |
246 | mainView.event(Event.PARAMETER_CHANGED, paramName + field.getName(), date); | 260 | mainView.event(Event.PARAMETER_CHANGED, paramName + field.getName(), date); |
247 | field.setBackground(Color.WHITE); | 261 | field.setBackground(Color.WHITE); |
248 | } catch (@SuppressWarnings("unused") ParseException e) { | 262 | } catch (@SuppressWarnings("unused") ParseException e) { |
@@ -259,33 +273,35 @@ public abstract class ParamField extends JPanel { | @@ -259,33 +273,35 @@ public abstract class ParamField extends JPanel { | ||
259 | * The float range field is used for couples of parameter with both a `Float` class. These are | 273 | * The float range field is used for couples of parameter with both a `Float` class. These are |
260 | * JTextFields which check if the content is a valid float. If the parameter is valid or if it | 274 | * JTextFields which check if the content is a valid float. If the parameter is valid or if it |
261 | * is empty, then the float value are sent to the controller. | 275 | * is empty, then the float value are sent to the controller. |
262 | - * | 276 | + * |
263 | * @author N. Jourdane | 277 | * @author N. Jourdane |
264 | */ | 278 | */ |
265 | public static class FloatRangeField extends ParamField implements TextFieldListener { | 279 | public static class FloatRangeField extends ParamField implements TextFieldListener { |
266 | - /** The serial version UID (affected with a random number). */ | ||
267 | - private static final long serialVersionUID = 7923358142882329015L; | 280 | + /** The serial version UID. */ |
281 | + private static final long serialVersionUID = 1L; | ||
282 | + | ||
268 | /** The JTextField used to put the parameter minimum value of the range. */ | 283 | /** The JTextField used to put the parameter minimum value of the range. */ |
269 | JTextField fieldMin; | 284 | JTextField fieldMin; |
285 | + | ||
270 | /** The JTextField used to put the parameter maximum value of the range. */ | 286 | /** The JTextField used to put the parameter maximum value of the range. */ |
271 | JTextField fieldMax; | 287 | JTextField fieldMax; |
272 | 288 | ||
273 | /** | 289 | /** |
274 | * Method constructor | 290 | * Method constructor |
275 | - * | 291 | + * |
276 | * @param mainView The main view of the application. | 292 | * @param mainView The main view of the application. |
277 | * @param paramName The name of the parameter. | 293 | * @param paramName The name of the parameter. |
278 | */ | 294 | */ |
279 | public FloatRangeField(EpnTapMainView mainView, String paramName) { | 295 | public FloatRangeField(EpnTapMainView mainView, String paramName) { |
280 | super(mainView, paramName); | 296 | super(mainView, paramName); |
281 | fieldMin = new JTextField(); | 297 | fieldMin = new JTextField(); |
282 | - fieldMin.setName(MIN_SUFFIX); | ||
283 | - addChangeListener(this, fieldMin); | 298 | + fieldMin.setName(ParamField.MIN_SUFFIX); |
299 | + ParamField.addChangeListener(this, fieldMin); | ||
284 | this.add(fieldMin); | 300 | this.add(fieldMin); |
285 | 301 | ||
286 | fieldMax = new JTextField(); | 302 | fieldMax = new JTextField(); |
287 | - fieldMax.setName(MAX_SUFFIX); | ||
288 | - addChangeListener(this, fieldMax); | 303 | + fieldMax.setName(ParamField.MAX_SUFFIX); |
304 | + ParamField.addChangeListener(this, fieldMax); | ||
289 | this.add(fieldMax); | 305 | this.add(fieldMax); |
290 | } | 306 | } |
291 | 307 | ||
@@ -314,16 +330,19 @@ public abstract class ParamField extends JPanel { | @@ -314,16 +330,19 @@ public abstract class ParamField extends JPanel { | ||
314 | * automatically filled with actual target names which begins by the entered characters, by | 330 | * automatically filled with actual target names which begins by the entered characters, by |
315 | * asking to an online resolver (RESOLVER_URL). The parameter is sent to the controller each | 331 | * asking to an online resolver (RESOLVER_URL). The parameter is sent to the controller each |
316 | * time it is updated, so it is possible to enter a parameter that the resolver do not know. | 332 | * time it is updated, so it is possible to enter a parameter that the resolver do not know. |
317 | - * | 333 | + * |
318 | * @author N. Jourdane | 334 | * @author N. Jourdane |
319 | */ | 335 | */ |
320 | public static class TargetNameField extends ParamField implements TextFieldListener { | 336 | public static class TargetNameField extends ParamField implements TextFieldListener { |
321 | - /** The serial version UID (affected with a random number). */ | ||
322 | - private static final long serialVersionUID = 5136431108894677113L; | 337 | + /** The serial version UID. */ |
338 | + private static final long serialVersionUID = 1L; | ||
339 | + | ||
323 | /** The comboBox to enter the target_name and display target name propositions. */ | 340 | /** The comboBox to enter the target_name and display target name propositions. */ |
324 | JComboBox<String> comboBox; | 341 | JComboBox<String> comboBox; |
342 | + | ||
325 | /** The JTextField related to the ComboBox, allowing to listen for text content update. */ | 343 | /** The JTextField related to the ComboBox, allowing to listen for text content update. */ |
326 | JTextField field; | 344 | JTextField field; |
345 | + | ||
327 | /** | 346 | /** |
328 | * The content of the last entered value. It is used to avoid recursions, because each time | 347 | * The content of the last entered value. It is used to avoid recursions, because each time |
329 | * an update event is detected, the resolver is called and the ComboBox is filled with new | 348 | * an update event is detected, the resolver is called and the ComboBox is filled with new |
@@ -344,11 +363,12 @@ public abstract class ParamField extends JPanel { | @@ -344,11 +363,12 @@ public abstract class ParamField extends JPanel { | ||
344 | lastContent = content; | 363 | lastContent = content; |
345 | comboBox.removeAllItems(); | 364 | comboBox.removeAllItems(); |
346 | try { | 365 | try { |
347 | - for (String s : getItems(content)) { | 366 | + for (String s : TargetNameField.getItems(content)) { |
348 | comboBox.addItem(s); | 367 | comboBox.addItem(s); |
349 | } | 368 | } |
350 | } catch (CantSendQueryException e) { | 369 | } catch (CantSendQueryException e) { |
351 | - logger.log(Level.WARNING, "Can't get table names for the resolver", e); | 370 | + ParamField.logger.log(Level.WARNING, |
371 | + "Can't get table names for the resolver", e); | ||
352 | } | 372 | } |
353 | comboBox.getEditor().setItem(content); | 373 | comboBox.getEditor().setItem(content); |
354 | } | 374 | } |
@@ -363,31 +383,33 @@ public abstract class ParamField extends JPanel { | @@ -363,31 +383,33 @@ public abstract class ParamField extends JPanel { | ||
363 | 383 | ||
364 | /** | 384 | /** |
365 | * Method constructor | 385 | * Method constructor |
366 | - * | 386 | + * |
367 | * @param mainView The main view of the application. | 387 | * @param mainView The main view of the application. |
368 | * @param paramName The name of the parameter. | 388 | * @param paramName The name of the parameter. |
369 | */ | 389 | */ |
370 | public TargetNameField(EpnTapMainView mainView, String paramName) { | 390 | public TargetNameField(EpnTapMainView mainView, String paramName) { |
371 | super(mainView, paramName); | 391 | super(mainView, paramName); |
372 | comboBox = new JComboBox<>(); | 392 | comboBox = new JComboBox<>(); |
373 | - comboBox.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); | 393 | + comboBox.setPreferredSize( |
394 | + new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT)); | ||
374 | 395 | ||
375 | comboBox.setEditable(true); | 396 | comboBox.setEditable(true); |
376 | field = (JTextField) comboBox.getEditor().getEditorComponent(); | 397 | field = (JTextField) comboBox.getEditor().getEditorComponent(); |
377 | - addChangeListener(this, field); | 398 | + ParamField.addChangeListener(this, field); |
378 | this.add(comboBox); | 399 | this.add(comboBox); |
379 | } | 400 | } |
380 | 401 | ||
381 | /** | 402 | /** |
382 | * The method used to get target names propositions by asking to the resolver. | 403 | * The method used to get target names propositions by asking to the resolver. |
383 | - * | 404 | + * |
384 | * @param begining The beginning of the target_name. | 405 | * @param begining The beginning of the target_name. |
385 | * @return An array of Strings corresponding to the target names got. | 406 | * @return An array of Strings corresponding to the target names got. |
386 | * @throws CantSendQueryException If the resolver do not work. | 407 | * @throws CantSendQueryException If the resolver do not work. |
387 | */ | 408 | */ |
388 | static String[] getItems(String begining) throws CantSendQueryException { | 409 | static String[] getItems(String begining) throws CantSendQueryException { |
389 | StringBuilder resolverResult; | 410 | StringBuilder resolverResult; |
390 | - resolverResult = VOTableConnection.sendGet(RESOLVER_URL, "q=\"" + begining + "\""); | 411 | + resolverResult = VOTableConnection.sendGet(ParamField.RESOLVER_URL, |
412 | + "q=\"" + begining + "\""); | ||
391 | JsonObject root = new JsonParser().parse(resolverResult.toString()).getAsJsonObject(); | 413 | JsonObject root = new JsonParser().parse(resolverResult.toString()).getAsJsonObject(); |
392 | int count = Integer.parseInt(root.get("count").toString()); | 414 | int count = Integer.parseInt(root.get("count").toString()); |
393 | String[] targetNames = new String[count]; | 415 | String[] targetNames = new String[count]; |
@@ -415,12 +437,13 @@ public abstract class ParamField extends JPanel { | @@ -415,12 +437,13 @@ public abstract class ParamField extends JPanel { | ||
415 | * https://voparis-confluence.obspm.fr/display/VES/4+-+EPN-TAP+queries#id-4-EPN-TAPqueries- | 437 | * https://voparis-confluence.obspm.fr/display/VES/4+-+EPN-TAP+queries#id-4-EPN-TAPqueries- |
416 | * __RefHeading__35_312326667_Toc3037660444.2.4DataProductType). The parameter is sent to the | 438 | * __RefHeading__35_312326667_Toc3037660444.2.4DataProductType). The parameter is sent to the |
417 | * controller each time it is updated. | 439 | * controller each time it is updated. |
418 | - * | 440 | + * |
419 | * @author N. Jourdane | 441 | * @author N. Jourdane |
420 | */ | 442 | */ |
421 | public static class DataProductTypeField extends ParamField { | 443 | public static class DataProductTypeField extends ParamField { |
422 | - /** The serial version UID (affected with a random number). */ | ||
423 | - private static final long serialVersionUID = -6362359909898369750L; | 444 | + /** The serial version UID. */ |
445 | + private static final long serialVersionUID = 1L; | ||
446 | + | ||
424 | /** The comboBox used to select the data product type. */ | 447 | /** The comboBox used to select the data product type. */ |
425 | JComboBox<DataProductType> comboBox; | 448 | JComboBox<DataProductType> comboBox; |
426 | 449 | ||
@@ -428,7 +451,7 @@ public abstract class ParamField extends JPanel { | @@ -428,7 +451,7 @@ public abstract class ParamField extends JPanel { | ||
428 | * An enumeration of all available data product types. Each values comes with an id because | 451 | * An enumeration of all available data product types. Each values comes with an id because |
429 | * EPN-TAP table can possibly be filled with the id instead of the name, so the query have | 452 | * EPN-TAP table can possibly be filled with the id instead of the name, so the query have |
430 | * to ask for both of them. | 453 | * to ask for both of them. |
431 | - * | 454 | + * |
432 | * @author N. Jourdane | 455 | * @author N. Jourdane |
433 | */ | 456 | */ |
434 | @SuppressWarnings("javadoc") | 457 | @SuppressWarnings("javadoc") |
@@ -442,12 +465,13 @@ public abstract class ParamField extends JPanel { | @@ -442,12 +465,13 @@ public abstract class ParamField extends JPanel { | ||
442 | 465 | ||
443 | /** The full name of the data product type, such as `Dynamic spectrum`. */ | 466 | /** The full name of the data product type, such as `Dynamic spectrum`. */ |
444 | private String name = ""; | 467 | private String name = ""; |
468 | + | ||
445 | /** The id of the data product type, such as `ds`. */ | 469 | /** The id of the data product type, such as `ds`. */ |
446 | private String id = ""; | 470 | private String id = ""; |
447 | 471 | ||
448 | /** | 472 | /** |
449 | * Method constructor for the enumeration. | 473 | * Method constructor for the enumeration. |
450 | - * | 474 | + * |
451 | * @param name The full name of the data product type, such as `Dynamic spectrum`. | 475 | * @param name The full name of the data product type, such as `Dynamic spectrum`. |
452 | * @param id The id of the data product type, such as `ds`. | 476 | * @param id The id of the data product type, such as `ds`. |
453 | */ | 477 | */ |
@@ -476,7 +500,7 @@ public abstract class ParamField extends JPanel { | @@ -476,7 +500,7 @@ public abstract class ParamField extends JPanel { | ||
476 | 500 | ||
477 | /** | 501 | /** |
478 | * Method constructor | 502 | * Method constructor |
479 | - * | 503 | + * |
480 | * @param mainView The main view of the application. | 504 | * @param mainView The main view of the application. |
481 | * @param paramName The name of the parameter. | 505 | * @param paramName The name of the parameter. |
482 | */ | 506 | */ |
@@ -484,7 +508,8 @@ public abstract class ParamField extends JPanel { | @@ -484,7 +508,8 @@ public abstract class ParamField extends JPanel { | ||
484 | super(mainView, paramName); | 508 | super(mainView, paramName); |
485 | comboBox = new JComboBox<>(DataProductType.values()); | 509 | comboBox = new JComboBox<>(DataProductType.values()); |
486 | comboBox.setSelectedItem(DataProductType.ALL); | 510 | comboBox.setSelectedItem(DataProductType.ALL); |
487 | - comboBox.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); | 511 | + comboBox.setPreferredSize( |
512 | + new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT)); | ||
488 | comboBox.addActionListener(new ActionListener() { | 513 | comboBox.addActionListener(new ActionListener() { |
489 | @Override | 514 | @Override |
490 | public void actionPerformed(ActionEvent e) { | 515 | public void actionPerformed(ActionEvent e) { |
@@ -513,19 +538,19 @@ public abstract class ParamField extends JPanel { | @@ -513,19 +538,19 @@ public abstract class ParamField extends JPanel { | ||
513 | * https://voparis-confluence.obspm.fr/display/VES/4+-+EPN-TAP+queries#id-4-EPN-TAPqueries- | 538 | * https://voparis-confluence.obspm.fr/display/VES/4+-+EPN-TAP+queries#id-4-EPN-TAPqueries- |
514 | * __RefHeading__39_312326667_Toc3037660464.2.6TargetClass). The parameter is sent to the | 539 | * __RefHeading__39_312326667_Toc3037660464.2.6TargetClass). The parameter is sent to the |
515 | * controller each time it is updated. | 540 | * controller each time it is updated. |
516 | - * | 541 | + * |
517 | * @author N. Jourdane | 542 | * @author N. Jourdane |
518 | */ | 543 | */ |
519 | public static class TargetClassField extends ParamField { | 544 | public static class TargetClassField extends ParamField { |
520 | - /** The serial version UID (affected with a random number). */ | ||
521 | - private static final long serialVersionUID = 6439475087727685080L; | 545 | + /** The serial version UID. */ |
546 | + private static final long serialVersionUID = 1L; | ||
522 | 547 | ||
523 | /** The comboBox used to select the target class. */ | 548 | /** The comboBox used to select the target class. */ |
524 | JComboBox<TargetClass> comboBox; | 549 | JComboBox<TargetClass> comboBox; |
525 | 550 | ||
526 | /** | 551 | /** |
527 | * An enumeration of all available target classes. | 552 | * An enumeration of all available target classes. |
528 | - * | 553 | + * |
529 | * @author N. Jourdane | 554 | * @author N. Jourdane |
530 | */ | 555 | */ |
531 | @SuppressWarnings("javadoc") | 556 | @SuppressWarnings("javadoc") |
@@ -541,7 +566,7 @@ public abstract class ParamField extends JPanel { | @@ -541,7 +566,7 @@ public abstract class ParamField extends JPanel { | ||
541 | 566 | ||
542 | /** | 567 | /** |
543 | * Method constructor for the enumeration. | 568 | * Method constructor for the enumeration. |
544 | - * | 569 | + * |
545 | * @param name The name of the target class. | 570 | * @param name The name of the target class. |
546 | */ | 571 | */ |
547 | TargetClass(String name) { | 572 | TargetClass(String name) { |
@@ -558,14 +583,15 @@ public abstract class ParamField extends JPanel { | @@ -558,14 +583,15 @@ public abstract class ParamField extends JPanel { | ||
558 | 583 | ||
559 | /** | 584 | /** |
560 | * Method constructor | 585 | * Method constructor |
561 | - * | 586 | + * |
562 | * @param mainView The main view of the application. | 587 | * @param mainView The main view of the application. |
563 | * @param paramName The name of the parameter. | 588 | * @param paramName The name of the parameter. |
564 | */ | 589 | */ |
565 | public TargetClassField(EpnTapMainView mainView, String paramName) { | 590 | public TargetClassField(EpnTapMainView mainView, String paramName) { |
566 | super(mainView, paramName); | 591 | super(mainView, paramName); |
567 | comboBox = new JComboBox<>(TargetClass.values()); | 592 | comboBox = new JComboBox<>(TargetClass.values()); |
568 | - comboBox.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); | 593 | + comboBox.setPreferredSize( |
594 | + new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT)); | ||
569 | comboBox.addActionListener(new ActionListener() { | 595 | comboBox.addActionListener(new ActionListener() { |
570 | @Override | 596 | @Override |
571 | public void actionPerformed(ActionEvent e) { | 597 | public void actionPerformed(ActionEvent e) { |
@@ -592,13 +618,13 @@ public abstract class ParamField extends JPanel { | @@ -592,13 +618,13 @@ public abstract class ParamField extends JPanel { | ||
592 | * The listener of text field, it aims to provide a simple way to listen a text field without to | 618 | * The listener of text field, it aims to provide a simple way to listen a text field without to |
593 | * override removeUpdate(DocumentEvent de), insertUpdate(DocumentEvent de) and | 619 | * override removeUpdate(DocumentEvent de), insertUpdate(DocumentEvent de) and |
594 | * changedUpdate(DocumentEvent de) on each field to listen. | 620 | * changedUpdate(DocumentEvent de) on each field to listen. |
595 | - * | 621 | + * |
596 | * @author N. Jourdane | 622 | * @author N. Jourdane |
597 | */ | 623 | */ |
598 | interface TextFieldListener { | 624 | interface TextFieldListener { |
599 | /** | 625 | /** |
600 | * When the content of the JTextField is updated. | 626 | * When the content of the JTextField is updated. |
601 | - * | 627 | + * |
602 | * @param field The JTextField. Is useful for classes containing several text fields, such | 628 | * @param field The JTextField. Is useful for classes containing several text fields, such |
603 | * as DateRangeField, to know which one triggered the event. | 629 | * as DateRangeField, to know which one triggered the event. |
604 | */ | 630 | */ |
@@ -607,7 +633,7 @@ public abstract class ParamField extends JPanel { | @@ -607,7 +633,7 @@ public abstract class ParamField extends JPanel { | ||
607 | 633 | ||
608 | /** | 634 | /** |
609 | * To add the listener. @see TextFieldListener | 635 | * To add the listener. @see TextFieldListener |
610 | - * | 636 | + * |
611 | * @param changeListener The listener of text fields. | 637 | * @param changeListener The listener of text fields. |
612 | * @param field The field to listen. | 638 | * @param field The field to listen. |
613 | */ | 639 | */ |
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/BottomBarPanel.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -29,27 +29,22 @@ import eu.omp.irap.vespa.epntapclient.view.EpnTapMainView; | @@ -29,27 +29,22 @@ 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 | - /** The serial version UID (affected with a random number). */ | ||
33 | - private static final long serialVersionUID = 8083897308526492902L; | 32 | + /** The serial version UID. */ |
33 | + private static final long serialVersionUID = 1L; | ||
34 | 34 | ||
35 | /** The logger for the class BottomBar. */ | 35 | /** The logger for the class BottomBar. */ |
36 | @SuppressWarnings("unused") | 36 | @SuppressWarnings("unused") |
37 | private static final Logger logger = Logger.getLogger(BottomBarPanel.class.getName()); | 37 | private static final Logger logger = Logger.getLogger(BottomBarPanel.class.getName()); |
38 | 38 | ||
39 | - /** The main view of the application. */ | ||
40 | - @SuppressWarnings("unused") | ||
41 | - private EpnTapMainView mainView; | ||
42 | - | ||
43 | /** A label to display several informations (aka. status bar). */ | 39 | /** A label to display several informations (aka. status bar). */ |
44 | private JLabel infoLabel; | 40 | private JLabel infoLabel; |
45 | 41 | ||
46 | /** | 42 | /** |
47 | * Method constructor for the bottom bar panel. | 43 | * Method constructor for the bottom bar panel. |
48 | - * | 44 | + * |
49 | * @param mainView The main view of the application. | 45 | * @param mainView The main view of the application. |
50 | */ | 46 | */ |
51 | public BottomBarPanel(EpnTapMainView mainView) { | 47 | public BottomBarPanel(EpnTapMainView mainView) { |
52 | - this.mainView = mainView; | ||
53 | setLayout(new BorderLayout()); | 48 | setLayout(new BorderLayout()); |
54 | infoLabel = new JLabel(); | 49 | infoLabel = new JLabel(); |
55 | this.add(infoLabel); | 50 | this.add(infoLabel); |
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/RequestPanel.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -41,7 +41,7 @@ import eu.omp.irap.vespa.epntapclient.view.ParamField.TargetNameField; | @@ -41,7 +41,7 @@ import eu.omp.irap.vespa.epntapclient.view.ParamField.TargetNameField; | ||
41 | 41 | ||
42 | /** | 42 | /** |
43 | * The view of the panel where the user builds the query. | 43 | * The view of the panel where the user builds the query. |
44 | - * | 44 | + * |
45 | * @author N. Jourdane | 45 | * @author N. Jourdane |
46 | */ | 46 | */ |
47 | public class RequestPanel extends JPanel implements ActionListener { | 47 | public class RequestPanel extends JPanel implements ActionListener { |
@@ -49,8 +49,8 @@ public class RequestPanel extends JPanel implements ActionListener { | @@ -49,8 +49,8 @@ public class RequestPanel extends JPanel implements ActionListener { | ||
49 | @SuppressWarnings("unused") | 49 | @SuppressWarnings("unused") |
50 | private static final Logger logger = Logger.getLogger(RequestPanel.class.getName()); | 50 | private static final Logger logger = Logger.getLogger(RequestPanel.class.getName()); |
51 | 51 | ||
52 | - /** The serial version UID (affected with a random number). */ | ||
53 | - private static final long serialVersionUID = 1262856496809315405L; | 52 | + /** The serial version UID. */ |
53 | + private static final long serialVersionUID = 1L; | ||
54 | 54 | ||
55 | /** The name of the button to send the query. */ | 55 | /** The name of the button to send the query. */ |
56 | private static final String BTN_NAME = "btnSend"; | 56 | private static final String BTN_NAME = "btnSend"; |
@@ -71,7 +71,7 @@ public class RequestPanel extends JPanel implements ActionListener { | @@ -71,7 +71,7 @@ public class RequestPanel extends JPanel implements ActionListener { | ||
71 | 71 | ||
72 | /** | 72 | /** |
73 | * Method constructor | 73 | * Method constructor |
74 | - * | 74 | + * |
75 | * @param mainView The EPN-TAP main view. | 75 | * @param mainView The EPN-TAP main view. |
76 | */ | 76 | */ |
77 | public RequestPanel(EpnTapMainView mainView) { | 77 | public RequestPanel(EpnTapMainView mainView) { |
@@ -97,7 +97,7 @@ public class RequestPanel extends JPanel implements ActionListener { | @@ -97,7 +97,7 @@ public class RequestPanel extends JPanel implements ActionListener { | ||
97 | 97 | ||
98 | /** | 98 | /** |
99 | * Build a JPanel containing graphical elements to build the query user-friendly. | 99 | * Build a JPanel containing graphical elements to build the query user-friendly. |
100 | - * | 100 | + * |
101 | * @return The JPanel. | 101 | * @return The JPanel. |
102 | */ | 102 | */ |
103 | private JPanel buildParamPanel() { | 103 | private JPanel buildParamPanel() { |
@@ -123,7 +123,7 @@ public class RequestPanel extends JPanel implements ActionListener { | @@ -123,7 +123,7 @@ public class RequestPanel extends JPanel implements ActionListener { | ||
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Build a JPanel containing a text-area where the query is displayed. | 125 | * Build a JPanel containing a text-area where the query is displayed. |
126 | - * | 126 | + * |
127 | * @return The JPanel. | 127 | * @return The JPanel. |
128 | */ | 128 | */ |
129 | private JPanel buildQueryPanel() { | 129 | private JPanel buildQueryPanel() { |
@@ -140,7 +140,7 @@ public class RequestPanel extends JPanel implements ActionListener { | @@ -140,7 +140,7 @@ public class RequestPanel extends JPanel implements ActionListener { | ||
140 | 140 | ||
141 | /** | 141 | /** |
142 | * Update the query JTextArea. | 142 | * Update the query JTextArea. |
143 | - * | 143 | + * |
144 | * @param query The string literal to put in the text-area, which will override the old content. | 144 | * @param query The string literal to put in the text-area, which will override the old content. |
145 | */ | 145 | */ |
146 | public void updateQueryArea(String query) { | 146 | public void updateQueryArea(String query) { |
@@ -149,16 +149,16 @@ public class RequestPanel extends JPanel implements ActionListener { | @@ -149,16 +149,16 @@ public class RequestPanel extends JPanel implements ActionListener { | ||
149 | 149 | ||
150 | /** | 150 | /** |
151 | * Build a JPanel containing the button(s), particularly the `Send` button. | 151 | * Build a JPanel containing the button(s), particularly the `Send` button. |
152 | - * | 152 | + * |
153 | * @return The JPanel . | 153 | * @return The JPanel . |
154 | */ | 154 | */ |
155 | private JPanel buildButtonPanel() { | 155 | private JPanel buildButtonPanel() { |
156 | JPanel buttonPanel = new JPanel(); | 156 | JPanel buttonPanel = new JPanel(); |
157 | JButton btnSend = new JButton("Send query"); | 157 | JButton btnSend = new JButton("Send query"); |
158 | - btnSend.setName(BTN_NAME); | 158 | + btnSend.setName(RequestPanel.BTN_NAME); |
159 | btnSend.addActionListener(this); | 159 | btnSend.addActionListener(this); |
160 | buttonPanel.add(btnSend); | 160 | buttonPanel.add(btnSend); |
161 | - buttonPanel.setMaximumSize(new Dimension(1000, BUTTON_PANEL_HEIGHT)); | 161 | + buttonPanel.setMaximumSize(new Dimension(1000, RequestPanel.BUTTON_PANEL_HEIGHT)); |
162 | 162 | ||
163 | return buttonPanel; | 163 | return buttonPanel; |
164 | } | 164 | } |
@@ -168,8 +168,8 @@ public class RequestPanel extends JPanel implements ActionListener { | @@ -168,8 +168,8 @@ public class RequestPanel extends JPanel implements ActionListener { | ||
168 | */ | 168 | */ |
169 | @Override | 169 | @Override |
170 | public void actionPerformed(ActionEvent evt) { | 170 | public void actionPerformed(ActionEvent evt) { |
171 | - if (((JButton) evt.getSource()).getName() == BTN_NAME) { | ||
172 | - this.mainView.event(Event.SEND_BUTTON_CLICKED, queryArea.getText()); | 171 | + if (((JButton) evt.getSource()).getName() == RequestPanel.BTN_NAME) { |
172 | + mainView.event(Event.SEND_BUTTON_CLICKED, queryArea.getText()); | ||
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 |
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -37,28 +37,17 @@ public class ResultsPanel extends JPanel { | @@ -37,28 +37,17 @@ public class ResultsPanel extends JPanel { | ||
37 | @SuppressWarnings("unused") | 37 | @SuppressWarnings("unused") |
38 | private static final Logger logger = Logger.getLogger(ResultsPanel.class.getName()); | 38 | private static final Logger logger = Logger.getLogger(ResultsPanel.class.getName()); |
39 | 39 | ||
40 | - /** The main view of the application. */ | ||
41 | - @SuppressWarnings("unused") | ||
42 | - private EpnTapMainView mainView; | ||
43 | - | ||
44 | - /** The generic view of the VOTable panel. */ | ||
45 | - @SuppressWarnings("unused") | ||
46 | - private VOTableView voTableView; | ||
47 | - | ||
48 | /** | 40 | /** |
49 | * Method constructor which customize the result panel, but don't build it from scratch since | 41 | * Method constructor which customize the result panel, but don't build it from scratch since |
50 | * VOTableView is already created by ResultController. | 42 | * VOTableView is already created by ResultController. |
51 | - * | 43 | + * |
52 | * @param mainView The main view of the application. | 44 | * @param mainView The main view of the application. |
53 | * @param voTableView The generic view of the VOTable panel. | 45 | * @param voTableView The generic view of the VOTable panel. |
54 | */ | 46 | */ |
55 | public ResultsPanel(EpnTapMainView mainView, VOTableView voTableView) { | 47 | public ResultsPanel(EpnTapMainView mainView, VOTableView voTableView) { |
56 | super(); | 48 | super(); |
57 | 49 | ||
58 | - this.mainView = mainView; | ||
59 | - this.voTableView = voTableView; | ||
60 | - | ||
61 | - this.setLayout(new BorderLayout()); | 50 | + setLayout(new BorderLayout()); |
62 | this.add(voTableView); | 51 | this.add(voTableView); |
63 | 52 | ||
64 | setPreferredSize(new Dimension(Dim.LEFT_PANEL_WIDTH + Dim.RIGHT_PANEL_WIDTH, | 53 | setPreferredSize(new Dimension(Dim.LEFT_PANEL_WIDTH + Dim.RIGHT_PANEL_WIDTH, |
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -33,32 +33,27 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; | @@ -33,32 +33,27 @@ 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 | - /** The serial version UID (affected with a random number). */ | ||
37 | - private static final long serialVersionUID = 7850369546415832758L; | 36 | + /** The serial version UID. */ |
37 | + private static final long serialVersionUID = 1L; | ||
38 | 38 | ||
39 | /** The logger for the class ServicesView. */ | 39 | /** The logger for the class ServicesView. */ |
40 | @SuppressWarnings("unused") | 40 | @SuppressWarnings("unused") |
41 | private static final Logger logger = Logger.getLogger(ServicesPanel.class.getName()); | 41 | private static final Logger logger = Logger.getLogger(ServicesPanel.class.getName()); |
42 | 42 | ||
43 | - /** The main view of the application. */ | ||
44 | - @SuppressWarnings("unused") | ||
45 | - private EpnTapMainView mainView; | ||
46 | - | ||
47 | /** The generic view of the VOTable panel. */ | 43 | /** The generic view of the VOTable panel. */ |
48 | private VOTableView voTableView; | 44 | private VOTableView voTableView; |
49 | 45 | ||
50 | /** | 46 | /** |
51 | * Method constructor which customize the services panel, but don't build it from scratch since | 47 | * Method constructor which customize the services panel, but don't build it from scratch since |
52 | * VOTableView is already created by ServicesController. Add also the JTable listener. | 48 | * VOTableView is already created by ServicesController. Add also the JTable listener. |
53 | - * | 49 | + * |
54 | * @param mainView The main view of the application. | 50 | * @param mainView The main view of the application. |
55 | * @param voTableView The generic view of the VOTable panel. | 51 | * @param voTableView The generic view of the VOTable panel. |
56 | */ | 52 | */ |
57 | public ServicesPanel(final EpnTapMainView mainView, final VOTableView voTableView) { | 53 | public ServicesPanel(final EpnTapMainView mainView, final VOTableView voTableView) { |
58 | super(); | 54 | super(); |
59 | - this.mainView = mainView; | ||
60 | this.voTableView = voTableView; | 55 | this.voTableView = voTableView; |
61 | - this.setLayout(new BorderLayout()); | 56 | + setLayout(new BorderLayout()); |
62 | this.add(voTableView); | 57 | this.add(voTableView); |
63 | 58 | ||
64 | setPreferredSize(new Dimension(Dim.LEFT_PANEL_WIDTH, Dim.TOP_PANEL_HEIGHT)); | 59 | setPreferredSize(new Dimension(Dim.LEFT_PANEL_WIDTH, Dim.TOP_PANEL_HEIGHT)); |
@@ -80,7 +75,7 @@ public class ServicesPanel extends JPanel { | @@ -80,7 +75,7 @@ public class ServicesPanel extends JPanel { | ||
80 | * @return The URL of the service corresponding to the row. | 75 | * @return The URL of the service corresponding to the row. |
81 | */ | 76 | */ |
82 | public String getServiceURL(int row) { | 77 | public String getServiceURL(int row) { |
83 | - return (String) this.voTableView.getValueAt(5, row); | 78 | + return (String) voTableView.getValueAt(5, row); |
84 | } | 79 | } |
85 | 80 | ||
86 | /** | 81 | /** |
@@ -88,6 +83,6 @@ public class ServicesPanel extends JPanel { | @@ -88,6 +83,6 @@ public class ServicesPanel extends JPanel { | ||
88 | * @return The table name of the service corresponding to the row. | 83 | * @return The table name of the service corresponding to the row. |
89 | */ | 84 | */ |
90 | public String getTableName(int row) { | 85 | public String getTableName(int row) { |
91 | - return (String) this.voTableView.getValueAt(2, row); | 86 | + return (String) voTableView.getValueAt(2, row); |
92 | } | 87 | } |
93 | } | 88 | } |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/VOTableApp.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -42,19 +42,19 @@ public class VOTableApp { | @@ -42,19 +42,19 @@ public class VOTableApp { | ||
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Main function to start the application as standalone. | 44 | * Main function to start the application as standalone. |
45 | - * | 45 | + * |
46 | * <pre> | 46 | * <pre> |
47 | * **Usage 1**: `VOtableApp pathToVOTable` | 47 | * **Usage 1**: `VOtableApp pathToVOTable` |
48 | * Display the VOTable stored in the specified XML file. | 48 | * Display the VOTable stored in the specified XML file. |
49 | * - `pathToVOTable`: The path to an XML file representing a VOtable; | 49 | * - `pathToVOTable`: The path to an XML file representing a VOtable; |
50 | - * | 50 | + * |
51 | * **Usage 2**: `VOtableApp targetURL type language query` | 51 | * **Usage 2**: `VOtableApp targetURL type language query` |
52 | * Display the VOTable resulting the service or registry request. | 52 | * Display the VOTable resulting the service or registry request. |
53 | * - `targetURL`: The URL of the service or registry to ask, ie `http://cdpp-epntap.cesr.fr`; | 53 | * - `targetURL`: The URL of the service or registry to ask, ie `http://cdpp-epntap.cesr.fr`; |
54 | * - `language`: The language of the query, ie `ADQL`; | 54 | * - `language`: The language of the query, ie `ADQL`; |
55 | * - `query`: The query in the specified language in double quotes, ie. `"SELECT * FROM amdadb.epn_core"` | 55 | * - `query`: The query in the specified language in double quotes, ie. `"SELECT * FROM amdadb.epn_core"` |
56 | * </pre> | 56 | * </pre> |
57 | - * | 57 | + * |
58 | * @param args The program arguments | 58 | * @param args The program arguments |
59 | */ | 59 | */ |
60 | public static void main(final String[] args) { | 60 | public static void main(final String[] args) { |
@@ -63,13 +63,14 @@ public class VOTableApp { | @@ -63,13 +63,14 @@ public class VOTableApp { | ||
63 | public void run() { | 63 | public void run() { |
64 | // TODO: Add option to export to CSV and HTML in CLI. | 64 | // TODO: Add option to export to CSV and HTML in CLI. |
65 | VOTableController voTableControl; | 65 | VOTableController voTableControl; |
66 | - logger.info("Lauching VOTable app with arguments:\n " + new Gson().toJson(args)); | 66 | + VOTableApp.logger |
67 | + .info("Lauching VOTable app with arguments:\n " + new Gson().toJson(args)); | ||
67 | if (args.length == 1) { | 68 | if (args.length == 1) { |
68 | try { | 69 | try { |
69 | voTableControl = new VOTableController(args[0]); | 70 | voTableControl = new VOTableController(args[0]); |
70 | } catch (VOTableException e) { | 71 | } catch (VOTableException e) { |
71 | System.console().writer().println("Error: " + e.getMessage()); | 72 | System.console().writer().println("Error: " + e.getMessage()); |
72 | - logger.log(Level.WARNING, e.getMessage(), e); | 73 | + VOTableApp.logger.log(Level.WARNING, e.getMessage(), e); |
73 | return; | 74 | return; |
74 | } | 75 | } |
75 | } else if (args.length == 3) { | 76 | } else if (args.length == 3) { |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableConnection.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -40,7 +40,7 @@ import eu.omp.irap.vespa.epntapclient.votable.utils.Const; | @@ -40,7 +40,7 @@ import eu.omp.irap.vespa.epntapclient.votable.utils.Const; | ||
40 | 40 | ||
41 | /** | 41 | /** |
42 | * This class provide HTTP connection support to send requests through POST / GET protocols. | 42 | * This class provide HTTP connection support to send requests through POST / GET protocols. |
43 | - * | 43 | + * |
44 | * @author N. Jourdane | 44 | * @author N. Jourdane |
45 | */ | 45 | */ |
46 | public final class VOTableConnection { | 46 | public final class VOTableConnection { |
@@ -77,9 +77,10 @@ public final class VOTableConnection { | @@ -77,9 +77,10 @@ public final class VOTableConnection { | ||
77 | throw new CantSendQueryException.MalformedURLException(uri, e); | 77 | throw new CantSendQueryException.MalformedURLException(uri, e); |
78 | } | 78 | } |
79 | 79 | ||
80 | - logger.info("request: " + uri + "?" + parameters); | 80 | + VOTableConnection.logger.info("request: " + uri + "?" + parameters); |
81 | try { | 81 | try { |
82 | - printRequestResult(sendGet(uri, parameters), voTablePath); | 82 | + VOTableConnection.printRequestResult(VOTableConnection.sendGet(uri, parameters), |
83 | + voTablePath); | ||
83 | } catch (IOException e) { | 84 | } catch (IOException e) { |
84 | throw new CantPrintRequestResultException(voTablePath, e); | 85 | throw new CantPrintRequestResultException(voTablePath, e); |
85 | } | 86 | } |
@@ -115,7 +116,7 @@ public final class VOTableConnection { | @@ -115,7 +116,7 @@ public final class VOTableConnection { | ||
115 | throw new CantOpenConnectionException(uri, e); | 116 | throw new CantOpenConnectionException(uri, e); |
116 | } | 117 | } |
117 | 118 | ||
118 | - con.setRequestProperty("User-Agent", USER_AGENT); | 119 | + con.setRequestProperty("User-Agent", VOTableConnection.USER_AGENT); |
119 | int code = -1; | 120 | int code = -1; |
120 | 121 | ||
121 | try { | 122 | try { |
@@ -134,7 +135,7 @@ public final class VOTableConnection { | @@ -134,7 +135,7 @@ public final class VOTableConnection { | ||
134 | } | 135 | } |
135 | in.close(); | 136 | in.close(); |
136 | } catch (IOException e1) { | 137 | } catch (IOException e1) { |
137 | - logger.log(Level.WARNING, "Can not get input stream", e1); | 138 | + VOTableConnection.logger.log(Level.WARNING, "Can not get input stream", e1); |
138 | try (BufferedReader in = new BufferedReader( | 139 | try (BufferedReader in = new BufferedReader( |
139 | new InputStreamReader(con.getErrorStream()))) { | 140 | new InputStreamReader(con.getErrorStream()))) { |
140 | while ((inputLine = in.readLine()) != null) { | 141 | while ((inputLine = in.readLine()) != null) { |
@@ -151,7 +152,7 @@ public final class VOTableConnection { | @@ -151,7 +152,7 @@ public final class VOTableConnection { | ||
151 | 152 | ||
152 | /** | 153 | /** |
153 | * Print result of the query in a file. | 154 | * Print result of the query in a file. |
154 | - * | 155 | + * |
155 | * @param response The request response content. | 156 | * @param response The request response content. |
156 | * @param resultFileName The name of the file where the request response content is writed. | 157 | * @param resultFileName The name of the file where the request response content is writed. |
157 | * @throws IOException File not found or bad encoding. | 158 | * @throws IOException File not found or bad encoding. |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableController.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -51,7 +51,7 @@ public class VOTableController { | @@ -51,7 +51,7 @@ public class VOTableController { | ||
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Method constructor | 53 | * Method constructor |
54 | - * | 54 | + * |
55 | * @param voTablePath The path of the VOTable XML file. | 55 | * @param voTablePath The path of the VOTable XML file. |
56 | * @throws VOTableException If something went wrong on the VOTable view or when filling table. | 56 | * @throws VOTableException If something went wrong on the VOTable view or when filling table. |
57 | */ | 57 | */ |
@@ -62,7 +62,7 @@ public class VOTableController { | @@ -62,7 +62,7 @@ public class VOTableController { | ||
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Method constructor | 64 | * Method constructor |
65 | - * | 65 | + * |
66 | * @param targetURL The URL of the registry to communicate (ie. "http://reg.g-vo.org"). | 66 | * @param targetURL The URL of the registry to communicate (ie. "http://reg.g-vo.org"). |
67 | * @param queryLanguage The language used for the queries (ie. "ADQL"). | 67 | * @param queryLanguage The language used for the queries (ie. "ADQL"). |
68 | * @param query The query to ask to the registry. | 68 | * @param query The query to ask to the registry. |
@@ -73,7 +73,7 @@ public class VOTableController { | @@ -73,7 +73,7 @@ public class VOTableController { | ||
73 | try { | 73 | try { |
74 | fillTable(VOTableConnection.sendQuery(targetURL, queryLanguage, query)); | 74 | fillTable(VOTableConnection.sendQuery(targetURL, queryLanguage, query)); |
75 | } catch (VOTableException e) { | 75 | } catch (VOTableException e) { |
76 | - logger.info("VOTableController error: " + e); | 76 | + VOTableController.logger.info("VOTableController error: " + e); |
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
@@ -114,7 +114,7 @@ public class VOTableController { | @@ -114,7 +114,7 @@ public class VOTableController { | ||
114 | throw new SeveralTablesException(voTablePath); | 114 | throw new SeveralTablesException(voTablePath); |
115 | } | 115 | } |
116 | 116 | ||
117 | - Table table = (Table) (voTable.getRESOURCE().get(0).getLINKAndTABLEOrRESOURCE().get(0)); | 117 | + Table table = (Table) voTable.getRESOURCE().get(0).getLINKAndTABLEOrRESOURCE().get(0); |
118 | 118 | ||
119 | VOTableDataParser dataParser; | 119 | VOTableDataParser dataParser; |
120 | try { | 120 | try { |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableDataParser.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -61,7 +61,7 @@ public class VOTableDataParser { | @@ -61,7 +61,7 @@ public class VOTableDataParser { | ||
61 | * In VOTables, data can be stored in 4 different serializations: BINARY, BINARY2, TABLEDATA and | 61 | * In VOTables, data can be stored in 4 different serializations: BINARY, BINARY2, TABLEDATA and |
62 | * FITS. This class aims to provide a unique way to get the data table, regardless of its | 62 | * FITS. This class aims to provide a unique way to get the data table, regardless of its |
63 | * serialization type. | 63 | * serialization type. |
64 | - * | 64 | + * |
65 | * @param table The table on which we want get the data. | 65 | * @param table The table on which we want get the data. |
66 | * @throws IOException If the VOTable data can not be parsed. | 66 | * @throws IOException If the VOTable data can not be parsed. |
67 | */ | 67 | */ |
@@ -78,18 +78,18 @@ public class VOTableDataParser { | @@ -78,18 +78,18 @@ public class VOTableDataParser { | ||
78 | for (int i = 0; i < fields.size(); i++) { | 78 | for (int i = 0; i < fields.size(); i++) { |
79 | columnsName[i] = fields.get(i).getName(); | 79 | columnsName[i] = fields.get(i).getName(); |
80 | } | 80 | } |
81 | - logger.info("Columns name: " + new Gson().toJson(columnsName)); | 81 | + VOTableDataParser.logger.info("Columns name: " + new Gson().toJson(columnsName)); |
82 | 82 | ||
83 | data = new ArrayList<>(); | 83 | data = new ArrayList<>(); |
84 | 84 | ||
85 | if (table.getDATA().getBINARY() != null) { | 85 | if (table.getDATA().getBINARY() != null) { |
86 | parseBinaryStream(table.getDATA().getBINARY().getSTREAM(), fields); | 86 | parseBinaryStream(table.getDATA().getBINARY().getSTREAM(), fields); |
87 | } else if (table.getDATA().getBINARY2() != null) { | 87 | } else if (table.getDATA().getBINARY2() != null) { |
88 | - parseBinary2Stream(table.getDATA().getBINARY2().getSTREAM(), fields); | 88 | + VOTableDataParser.parseBinary2Stream(table.getDATA().getBINARY2().getSTREAM(), fields); |
89 | } else if (table.getDATA().getTABLEDATA() != null) { | 89 | } else if (table.getDATA().getTABLEDATA() != null) { |
90 | - parseTableDataStream(table.getDATA().getTABLEDATA(), fields); | 90 | + VOTableDataParser.parseTableDataStream(table.getDATA().getTABLEDATA(), fields); |
91 | } else if (table.getDATA().getFITS() != null) { | 91 | } else if (table.getDATA().getFITS() != null) { |
92 | - parseFITSStream(table.getDATA().getFITS().getSTREAM(), fields); | 92 | + VOTableDataParser.parseFITSStream(table.getDATA().getFITS().getSTREAM(), fields); |
93 | } | 93 | } |
94 | 94 | ||
95 | Utils.printObject("voTableData", data); | 95 | Utils.printObject("voTableData", data); |
@@ -118,8 +118,9 @@ public class VOTableDataParser { | @@ -118,8 +118,9 @@ public class VOTableDataParser { | ||
118 | int i = 0; | 118 | int i = 0; |
119 | while (!column.equals(columnsName[i])) { | 119 | while (!column.equals(columnsName[i])) { |
120 | i++; | 120 | i++; |
121 | - if (i > columnsName.length) | 121 | + if (i > columnsName.length) { |
122 | throw new IllegalArgumentException("Column " + column + " not found in the table."); | 122 | throw new IllegalArgumentException("Column " + column + " not found in the table."); |
123 | + } | ||
123 | } | 124 | } |
124 | return i; | 125 | return i; |
125 | } | 126 | } |
@@ -166,8 +167,9 @@ public class VOTableDataParser { | @@ -166,8 +167,9 @@ public class VOTableDataParser { | ||
166 | */ | 167 | */ |
167 | public Object[] getRowByValue(int columnIndex, Object value) { | 168 | public Object[] getRowByValue(int columnIndex, Object value) { |
168 | for (Object[] row : data) { | 169 | for (Object[] row : data) { |
169 | - if (value.equals(row[columnIndex])) | 170 | + if (value.equals(row[columnIndex])) { |
170 | return row; | 171 | return row; |
172 | + } | ||
171 | } | 173 | } |
172 | throw new IndexOutOfBoundsException( | 174 | throw new IndexOutOfBoundsException( |
173 | "The value " + value + " is not found on the table at the column " + columnIndex); | 175 | "The value " + value + " is not found on the table at the column " + columnIndex); |
@@ -175,13 +177,13 @@ public class VOTableDataParser { | @@ -175,13 +177,13 @@ public class VOTableDataParser { | ||
175 | 177 | ||
176 | /** | 178 | /** |
177 | * get the data on its BINARY form. | 179 | * get the data on its BINARY form. |
178 | - * | 180 | + * |
179 | * @param voStream the data Stream in the VOTable Table. | 181 | * @param voStream the data Stream in the VOTable Table. |
180 | * @param fields The Fields corresponding to the Table. | 182 | * @param fields The Fields corresponding to the Table. |
181 | * @throws UnsupportedOperationException Data as arrays are not supported yet. | 183 | * @throws UnsupportedOperationException Data as arrays are not supported yet. |
182 | */ | 184 | */ |
183 | private void parseBinaryStream(Stream voStream, List<Field> fields) { | 185 | private void parseBinaryStream(Stream voStream, List<Field> fields) { |
184 | - logger.info("Parsing data in BINARY stream..."); | 186 | + VOTableDataParser.logger.info("Parsing data in BINARY stream..."); |
185 | String strStream = voStream.getValue().replaceAll("(\\r|\\n)", ""); | 187 | String strStream = voStream.getValue().replaceAll("(\\r|\\n)", ""); |
186 | 188 | ||
187 | stream = ByteBuffer.wrap(DatatypeConverter.parseBase64Binary(strStream)); | 189 | stream = ByteBuffer.wrap(DatatypeConverter.parseBase64Binary(strStream)); |
@@ -216,7 +218,7 @@ public class VOTableDataParser { | @@ -216,7 +218,7 @@ public class VOTableDataParser { | ||
216 | } else { | 218 | } else { |
217 | arraySize = Integer.parseInt(column.getArraysize()) * blockSize; | 219 | arraySize = Integer.parseInt(column.getArraysize()) * blockSize; |
218 | } | 220 | } |
219 | - if ((arraySize != blockSize) && !(dataType.equals(DataType.CHAR) | 221 | + if (arraySize != blockSize && !(dataType.equals(DataType.CHAR) |
220 | || dataType.equals(DataType.UNICODE_CHAR))) { | 222 | || dataType.equals(DataType.UNICODE_CHAR))) { |
221 | throw new UnsupportedOperationException("Numeric data as array are not supported."); | 223 | throw new UnsupportedOperationException("Numeric data as array are not supported."); |
222 | } | 224 | } |
@@ -252,7 +254,7 @@ public class VOTableDataParser { | @@ -252,7 +254,7 @@ public class VOTableDataParser { | ||
252 | } else if (dataType.equals(DataType.DOUBLE)) { | 254 | } else if (dataType.equals(DataType.DOUBLE)) { |
253 | row[nColumn] = stream.getDouble(); | 255 | row[nColumn] = stream.getDouble(); |
254 | } else { | 256 | } else { |
255 | - logger.warning("Data type " + dataType + " is not supported."); | 257 | + VOTableDataParser.logger.warning("Data type " + dataType + " is not supported."); |
256 | } | 258 | } |
257 | 259 | ||
258 | // logger.debug(columnsName[nColumn] + ": " + row[nColumn]) | 260 | // logger.debug(columnsName[nColumn] + ": " + row[nColumn]) |
@@ -271,7 +273,7 @@ public class VOTableDataParser { | @@ -271,7 +273,7 @@ public class VOTableDataParser { | ||
271 | * @param fields The Fields corresponding to the Table. | 273 | * @param fields The Fields corresponding to the Table. |
272 | */ | 274 | */ |
273 | private static void parseBinary2Stream(Stream stream, List<Field> fields) { | 275 | private static void parseBinary2Stream(Stream stream, List<Field> fields) { |
274 | - logger.info("Parsing data in BINARY2 stream..."); | 276 | + VOTableDataParser.logger.info("Parsing data in BINARY2 stream..."); |
275 | // TODO Implement parseBinary2Stream() | 277 | // TODO Implement parseBinary2Stream() |
276 | } | 278 | } |
277 | 279 | ||
@@ -280,7 +282,7 @@ public class VOTableDataParser { | @@ -280,7 +282,7 @@ public class VOTableDataParser { | ||
280 | * @param fields The Fields corresponding to the Table. | 282 | * @param fields The Fields corresponding to the Table. |
281 | */ | 283 | */ |
282 | private static void parseTableDataStream(TableData tabledata, List<Field> fields) { | 284 | private static void parseTableDataStream(TableData tabledata, List<Field> fields) { |
283 | - logger.info("Parsing data in TABLEDATA stream..."); | 285 | + VOTableDataParser.logger.info("Parsing data in TABLEDATA stream..."); |
284 | // TODO Implement parseTableDataStream() | 286 | // TODO Implement parseTableDataStream() |
285 | } | 287 | } |
286 | 288 | ||
@@ -289,7 +291,7 @@ public class VOTableDataParser { | @@ -289,7 +291,7 @@ public class VOTableDataParser { | ||
289 | * @param fields The Fields corresponding to the Table. | 291 | * @param fields The Fields corresponding to the Table. |
290 | */ | 292 | */ |
291 | private static void parseFITSStream(Stream stream, List<Field> fields) { | 293 | private static void parseFITSStream(Stream stream, List<Field> fields) { |
292 | - logger.info("Parsing data in FITS stream..."); | 294 | + VOTableDataParser.logger.info("Parsing data in FITS stream..."); |
293 | // TODO Implement parseFITSStream() | 295 | // TODO Implement parseFITSStream() |
294 | } | 296 | } |
295 | } | 297 | } |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableException.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -21,13 +21,12 @@ import java.io.IOException; | @@ -21,13 +21,12 @@ import java.io.IOException; | ||
21 | /** | 21 | /** |
22 | * VOTableException is the global exception for all the VOTable application. All other exceptions | 22 | * VOTableException is the global exception for all the VOTable application. All other exceptions |
23 | * should extend it. | 23 | * should extend it. |
24 | - * | 24 | + * |
25 | * @author N. Jourdane | 25 | * @author N. Jourdane |
26 | */ | 26 | */ |
27 | -@SuppressWarnings("serial") | ||
28 | public abstract class VOTableException extends Exception { | 27 | public abstract class VOTableException extends Exception { |
29 | - /** The serial version UID (affected with a random number). */ | ||
30 | - private static final long serialVersionUID = -5707662871529583209L; | 28 | + /** The serial version UID. */ |
29 | + private static final long serialVersionUID = 1L; | ||
31 | 30 | ||
32 | /** | 31 | /** |
33 | * @param message The message describing the exception displayed in the error dialog. | 32 | * @param message The message describing the exception displayed in the error dialog. |
@@ -47,6 +46,9 @@ public abstract class VOTableException extends Exception { | @@ -47,6 +46,9 @@ public abstract class VOTableException extends Exception { | ||
47 | /** Abstract exception for when the application can not send the query. */ | 46 | /** Abstract exception for when the application can not send the query. */ |
48 | public abstract static class CantSendQueryException extends VOTableException { | 47 | public abstract static class CantSendQueryException extends VOTableException { |
49 | 48 | ||
49 | + /** */ | ||
50 | + private static final long serialVersionUID = 1L; | ||
51 | + | ||
50 | /** | 52 | /** |
51 | * @param message The message describing the exception displayed in the error dialog. | 53 | * @param message The message describing the exception displayed in the error dialog. |
52 | */ | 54 | */ |
@@ -65,6 +67,9 @@ public abstract class VOTableException extends Exception { | @@ -65,6 +67,9 @@ public abstract class VOTableException extends Exception { | ||
65 | /** The URL is not correctly formated. */ | 67 | /** The URL is not correctly formated. */ |
66 | public static class MalformedURLException extends CantSendQueryException { | 68 | public static class MalformedURLException extends CantSendQueryException { |
67 | 69 | ||
70 | + /** */ | ||
71 | + private static final long serialVersionUID = 1L; | ||
72 | + | ||
68 | /** | 73 | /** |
69 | * @param uri The URI sent to the server. | 74 | * @param uri The URI sent to the server. |
70 | * @param e The exception thrown. | 75 | * @param e The exception thrown. |
@@ -77,6 +82,9 @@ public abstract class VOTableException extends Exception { | @@ -77,6 +82,9 @@ public abstract class VOTableException extends Exception { | ||
77 | /** Can not print the result in the file. */ | 82 | /** Can not print the result in the file. */ |
78 | public static class CantPrintRequestResultException extends CantSendQueryException { | 83 | public static class CantPrintRequestResultException extends CantSendQueryException { |
79 | 84 | ||
85 | + /** */ | ||
86 | + private static final long serialVersionUID = 1L; | ||
87 | + | ||
80 | /** | 88 | /** |
81 | * @param resultFilePath The path of the file where the query results should be stored. | 89 | * @param resultFilePath The path of the file where the query results should be stored. |
82 | * @param e The exception thrown. | 90 | * @param e The exception thrown. |
@@ -89,6 +97,9 @@ public abstract class VOTableException extends Exception { | @@ -89,6 +97,9 @@ public abstract class VOTableException extends Exception { | ||
89 | /** Can not open an HTTP connection to the specified URL. */ | 97 | /** Can not open an HTTP connection to the specified URL. */ |
90 | public static class CantOpenConnectionException extends CantSendQueryException { | 98 | public static class CantOpenConnectionException extends CantSendQueryException { |
91 | 99 | ||
100 | + /** */ | ||
101 | + private static final long serialVersionUID = 1L; | ||
102 | + | ||
92 | /** | 103 | /** |
93 | * @param uri The URI sent to the server. | 104 | * @param uri The URI sent to the server. |
94 | * @param e The exception thrown. | 105 | * @param e The exception thrown. |
@@ -101,6 +112,9 @@ public abstract class VOTableException extends Exception { | @@ -101,6 +112,9 @@ public abstract class VOTableException extends Exception { | ||
101 | /** Can not get the server response code for the request. */ | 112 | /** Can not get the server response code for the request. */ |
102 | public static class CantGetResponseCode extends CantSendQueryException { | 113 | public static class CantGetResponseCode extends CantSendQueryException { |
103 | 114 | ||
115 | + /** */ | ||
116 | + private static final long serialVersionUID = 1L; | ||
117 | + | ||
104 | /** | 118 | /** |
105 | * @param uri The URI sent to the server. | 119 | * @param uri The URI sent to the server. |
106 | * @param e The exception thrown. | 120 | * @param e The exception thrown. |
@@ -113,6 +127,9 @@ public abstract class VOTableException extends Exception { | @@ -113,6 +127,9 @@ public abstract class VOTableException extends Exception { | ||
113 | /** The server returned the bad response code (but not 400). */ | 127 | /** The server returned the bad response code (but not 400). */ |
114 | public static class BadResponseCodeException extends CantSendQueryException { | 128 | public static class BadResponseCodeException extends CantSendQueryException { |
115 | 129 | ||
130 | + /** */ | ||
131 | + private static final long serialVersionUID = 1L; | ||
132 | + | ||
116 | /** | 133 | /** |
117 | * @param uri The URI sent to the server. | 134 | * @param uri The URI sent to the server. |
118 | * @param responseCode The HTTP GET response code, which is bad. | 135 | * @param responseCode The HTTP GET response code, which is bad. |
@@ -126,6 +143,9 @@ public abstract class VOTableException extends Exception { | @@ -126,6 +143,9 @@ public abstract class VOTableException extends Exception { | ||
126 | /** Can not get the input stream of the result, neither the error stream. */ | 143 | /** Can not get the input stream of the result, neither the error stream. */ |
127 | public static class CantGetErrorStream extends CantSendQueryException { | 144 | public static class CantGetErrorStream extends CantSendQueryException { |
128 | 145 | ||
146 | + /** */ | ||
147 | + private static final long serialVersionUID = 1L; | ||
148 | + | ||
129 | /** | 149 | /** |
130 | * @param uri The URI sent to the server. | 150 | * @param uri The URI sent to the server. |
131 | * @param e The exception thrown. | 151 | * @param e The exception thrown. |
@@ -141,6 +161,9 @@ public abstract class VOTableException extends Exception { | @@ -141,6 +161,9 @@ public abstract class VOTableException extends Exception { | ||
141 | /** Abstract exception for when the application can not display the VOTable. */ | 161 | /** Abstract exception for when the application can not display the VOTable. */ |
142 | public abstract static class CantDisplayVOTableException extends VOTableException { | 162 | public abstract static class CantDisplayVOTableException extends VOTableException { |
143 | 163 | ||
164 | + /** */ | ||
165 | + private static final long serialVersionUID = 1L; | ||
166 | + | ||
144 | /** | 167 | /** |
145 | * @param message The message describing the exception displayed in the error dialog. | 168 | * @param message The message describing the exception displayed in the error dialog. |
146 | * @param e The exception thrown. | 169 | * @param e The exception thrown. |
@@ -159,6 +182,9 @@ public abstract class VOTableException extends Exception { | @@ -159,6 +182,9 @@ public abstract class VOTableException extends Exception { | ||
159 | /** Can not parse the VOTable because it doesn't match with the VOTable schema. */ | 182 | /** Can not parse the VOTable because it doesn't match with the VOTable schema. */ |
160 | public static class VOTableIsNotValidException extends CantDisplayVOTableException { | 183 | public static class VOTableIsNotValidException extends CantDisplayVOTableException { |
161 | 184 | ||
185 | + /** */ | ||
186 | + private static final long serialVersionUID = 1L; | ||
187 | + | ||
162 | /** | 188 | /** |
163 | * @param voTablePath The path of the VOTable. | 189 | * @param voTablePath The path of the VOTable. |
164 | * @param e The exception thrown. | 190 | * @param e The exception thrown. |
@@ -172,6 +198,9 @@ public abstract class VOTableException extends Exception { | @@ -172,6 +198,9 @@ public abstract class VOTableException extends Exception { | ||
172 | /** VOTable with more than one resource are not yet supported. */ | 198 | /** VOTable with more than one resource are not yet supported. */ |
173 | public static class SeveralResourcesException extends CantDisplayVOTableException { | 199 | public static class SeveralResourcesException extends CantDisplayVOTableException { |
174 | 200 | ||
201 | + /** */ | ||
202 | + private static final long serialVersionUID = 1L; | ||
203 | + | ||
175 | /** | 204 | /** |
176 | * @param voTablePath The path of the VOTable. | 205 | * @param voTablePath The path of the VOTable. |
177 | */ | 206 | */ |
@@ -184,6 +213,9 @@ public abstract class VOTableException extends Exception { | @@ -184,6 +213,9 @@ public abstract class VOTableException extends Exception { | ||
184 | /** VOTable with more than one resource are not yet supported. */ | 213 | /** VOTable with more than one resource are not yet supported. */ |
185 | public static class SeveralTablesException extends CantDisplayVOTableException { | 214 | public static class SeveralTablesException extends CantDisplayVOTableException { |
186 | 215 | ||
216 | + /** */ | ||
217 | + private static final long serialVersionUID = 1L; | ||
218 | + | ||
187 | /** | 219 | /** |
188 | * @param voTablePath The path of the VOTable. | 220 | * @param voTablePath The path of the VOTable. |
189 | */ | 221 | */ |
@@ -195,6 +227,9 @@ public abstract class VOTableException extends Exception { | @@ -195,6 +227,9 @@ public abstract class VOTableException extends Exception { | ||
195 | 227 | ||
196 | /** Can not change schema location on the VOTable file. */ | 228 | /** Can not change schema location on the VOTable file. */ |
197 | public static class CantModifyVOTableException extends CantDisplayVOTableException { | 229 | public static class CantModifyVOTableException extends CantDisplayVOTableException { |
230 | + /** */ | ||
231 | + private static final long serialVersionUID = 1L; | ||
232 | + | ||
198 | /** | 233 | /** |
199 | * @param voTablePath The path of the VOTable. | 234 | * @param voTablePath The path of the VOTable. |
200 | * @param e The exception thrown. | 235 | * @param e The exception thrown. |
@@ -206,6 +241,9 @@ public abstract class VOTableException extends Exception { | @@ -206,6 +241,9 @@ public abstract class VOTableException extends Exception { | ||
206 | 241 | ||
207 | /** There is an error in the VOTable. */ | 242 | /** There is an error in the VOTable. */ |
208 | public static class ErrorMessageInVOTableException extends CantDisplayVOTableException { | 243 | public static class ErrorMessageInVOTableException extends CantDisplayVOTableException { |
244 | + /** */ | ||
245 | + private static final long serialVersionUID = 1L; | ||
246 | + | ||
209 | /** | 247 | /** |
210 | * @param errorInfo The information about the error, which comes from the VOTable itself | 248 | * @param errorInfo The information about the error, which comes from the VOTable itself |
211 | * from the "INFO" node. | 249 | * from the "INFO" node. |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableParser.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -74,12 +74,12 @@ public final class VOTableParser { | @@ -74,12 +74,12 @@ public final class VOTableParser { | ||
74 | VOTABLE voTable; | 74 | VOTABLE voTable; |
75 | JAXBContext jc; | 75 | JAXBContext jc; |
76 | try { | 76 | try { |
77 | - changeVOTableSchemaLocation(voTablePath); | 77 | + VOTableParser.changeVOTableSchemaLocation(voTablePath); |
78 | } catch (IOException e) { | 78 | } catch (IOException e) { |
79 | throw new CantModifyVOTableException(voTablePath, e); | 79 | throw new CantModifyVOTableException(voTablePath, e); |
80 | } | 80 | } |
81 | try { | 81 | try { |
82 | - jc = JAXBContext.newInstance(VOTABLE_MODEL_PACKAGE); | 82 | + jc = JAXBContext.newInstance(VOTableParser.VOTABLE_MODEL_PACKAGE); |
83 | Unmarshaller unmarshaller = jc.createUnmarshaller(); | 83 | Unmarshaller unmarshaller = jc.createUnmarshaller(); |
84 | voTable = (VOTABLE) unmarshaller.unmarshal(new File(voTablePath)); | 84 | voTable = (VOTABLE) unmarshaller.unmarshal(new File(voTablePath)); |
85 | } catch (JAXBException e) { | 85 | } catch (JAXBException e) { |
@@ -94,7 +94,7 @@ public final class VOTableParser { | @@ -94,7 +94,7 @@ public final class VOTableParser { | ||
94 | * allows JAXB to parse the VOTable even it's not the same namespace than the XSD. Because | 94 | * allows JAXB to parse the VOTable even it's not the same namespace than the XSD. Because |
95 | * VOTables schemas are retro-compatibles, there is no problem to parse a VOTable with a XML | 95 | * VOTables schemas are retro-compatibles, there is no problem to parse a VOTable with a XML |
96 | * schema with a higher version. In the same way, this method check if the file is a valid XML. | 96 | * schema with a higher version. In the same way, this method check if the file is a valid XML. |
97 | - * | 97 | + * |
98 | * @param voTablePath The path of the VOTable XML file. | 98 | * @param voTablePath The path of the VOTable XML file. |
99 | * @throws IOException Can not read or write the XML file. | 99 | * @throws IOException Can not read or write the XML file. |
100 | */ | 100 | */ |
@@ -107,12 +107,14 @@ public final class VOTableParser { | @@ -107,12 +107,14 @@ public final class VOTableParser { | ||
107 | NamedNodeMap votAttrs = doc.getFirstChild().getAttributes(); | 107 | NamedNodeMap votAttrs = doc.getFirstChild().getAttributes(); |
108 | 108 | ||
109 | String version = votAttrs.getNamedItem("version").getTextContent(); | 109 | String version = votAttrs.getNamedItem("version").getTextContent(); |
110 | - if (version != JAXB_VOTABLE_VERSION) { | ||
111 | - logger.info("VOTable version is " + version + ", changing VOTable svhema to " | ||
112 | - + JAXB_VOTABLE_VERSION); | ||
113 | - votAttrs.getNamedItem("xmlns").setTextContent(VOTABLE_SHEMA + JAXB_VOTABLE_VERSION); | 110 | + if (version != VOTableParser.JAXB_VOTABLE_VERSION) { |
111 | + VOTableParser.logger | ||
112 | + .info("VOTable version is " + version + ", changing VOTable svhema to " | ||
113 | + + VOTableParser.JAXB_VOTABLE_VERSION); | ||
114 | + votAttrs.getNamedItem("xmlns").setTextContent( | ||
115 | + VOTableParser.VOTABLE_SHEMA + VOTableParser.JAXB_VOTABLE_VERSION); | ||
114 | } else { | 116 | } else { |
115 | - logger.info("VOTable version is " + version + ", everything is ok."); | 117 | + VOTableParser.logger.info("VOTable version is " + version + ", everything is ok."); |
116 | } | 118 | } |
117 | 119 | ||
118 | Transformer transformer = TransformerFactory.newInstance().newTransformer(); | 120 | Transformer transformer = TransformerFactory.newInstance().newTransformer(); |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/utils/Const.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -18,7 +18,7 @@ package eu.omp.irap.vespa.epntapclient.votable.utils; | @@ -18,7 +18,7 @@ package eu.omp.irap.vespa.epntapclient.votable.utils; | ||
18 | 18 | ||
19 | /** | 19 | /** |
20 | * This class defines widely-used constants. | 20 | * This class defines widely-used constants. |
21 | - * | 21 | + * |
22 | * @author N. Jourdane | 22 | * @author N. Jourdane |
23 | */ | 23 | */ |
24 | public class Const { | 24 | public class Const { |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/utils/Utils.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -39,7 +39,7 @@ public class Utils { | @@ -39,7 +39,7 @@ public class Utils { | ||
39 | /** | 39 | /** |
40 | * StringJoiner has the same purpose of Java 8 StringJoiner, it has been rewritten for Java7 | 40 | * StringJoiner has the same purpose of Java 8 StringJoiner, it has been rewritten for Java7 |
41 | * compatibility. | 41 | * compatibility. |
42 | - * | 42 | + * |
43 | * @author N. Jourdane | 43 | * @author N. Jourdane |
44 | */ | 44 | */ |
45 | public static class StringJoiner { | 45 | public static class StringJoiner { |
@@ -52,18 +52,18 @@ public class Utils { | @@ -52,18 +52,18 @@ public class Utils { | ||
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Method constructor for the String joiner. | 54 | * Method constructor for the String joiner. |
55 | - * | 55 | + * |
56 | * @param separator The string joiner separator to put between each word, ie. ';'. | 56 | * @param separator The string joiner separator to put between each word, ie. ';'. |
57 | */ | 57 | */ |
58 | public StringJoiner(String separator) { | 58 | public StringJoiner(String separator) { |
59 | this.separator = separator; | 59 | this.separator = separator; |
60 | - this.list = new ArrayList<>(); | 60 | + list = new ArrayList<>(); |
61 | string = ""; | 61 | string = ""; |
62 | } | 62 | } |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * add a new word to the joiner. | 65 | * add a new word to the joiner. |
66 | - * | 66 | + * |
67 | * @param text The word to add. | 67 | * @param text The word to add. |
68 | */ | 68 | */ |
69 | public void add(String text) { | 69 | public void add(String text) { |
@@ -82,7 +82,7 @@ public class Utils { | @@ -82,7 +82,7 @@ public class Utils { | ||
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Print the specified object in JSON format in a file on the temporary directory. | 84 | * Print the specified object in JSON format in a file on the temporary directory. |
85 | - * | 85 | + * |
86 | * @param title The name of the file. | 86 | * @param title The name of the file. |
87 | * @param obj the object to print in a file. | 87 | * @param obj the object to print in a file. |
88 | * @return The path of the file. | 88 | * @return The path of the file. |
@@ -95,9 +95,9 @@ public class Utils { | @@ -95,9 +95,9 @@ public class Utils { | ||
95 | writer.write(json); | 95 | writer.write(json); |
96 | 96 | ||
97 | } catch (IOException e) { | 97 | } catch (IOException e) { |
98 | - logger.warning("Can not print in the file " + path + e); | 98 | + Utils.logger.warning("Can not print in the file " + path + e); |
99 | } | 99 | } |
100 | - logger.info("A json file representing " + title + " (" + obj.getClass().getName() | 100 | + Utils.logger.info("A json file representing " + title + " (" + obj.getClass().getName() |
101 | + ") has been created on " + path); | 101 | + ") has been created on " + path); |
102 | 102 | ||
103 | return path; | 103 | return path; |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | 3 | * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. |
4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | 4 | * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 |
5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | 5 | * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. |
6 | - * | 6 | + * |
7 | * This program is free software: you can | 7 | * This program is free software: you can |
8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published | 8 | * redistribute it and/or modify it under the terms of the GNU General Public License as published |
9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | 9 | * by the Free Software Foundation, either version 3 of the License, or (at your option) any later |
@@ -32,7 +32,7 @@ import eu.omp.irap.vespa.epntapclient.votable.utils.Utils; | @@ -32,7 +32,7 @@ import eu.omp.irap.vespa.epntapclient.votable.utils.Utils; | ||
32 | 32 | ||
33 | /** | 33 | /** |
34 | * The main class of the View of the application. | 34 | * The main class of the View of the application. |
35 | - * | 35 | + * |
36 | * @author N. Jourdane | 36 | * @author N. Jourdane |
37 | */ | 37 | */ |
38 | public class VOTableView extends JPanel implements TableModelListener { | 38 | public class VOTableView extends JPanel implements TableModelListener { |
@@ -40,8 +40,8 @@ public class VOTableView extends JPanel implements TableModelListener { | @@ -40,8 +40,8 @@ public class VOTableView extends JPanel implements TableModelListener { | ||
40 | static final Logger logger = Logger.getLogger(VOTableView.class.getName()); | 40 | static final Logger logger = Logger.getLogger(VOTableView.class.getName()); |
41 | 41 | ||
42 | // TODO: Create class VOTableCLI the view for a CLI usage | 42 | // TODO: Create class VOTableCLI the view for a CLI usage |
43 | - /** The serial version UID (affected with a random number). */ | ||
44 | - private static final long serialVersionUID = -6131752938586134234L; | 43 | + /** The serial version UID. */ |
44 | + private static final long serialVersionUID = 1L; | ||
45 | 45 | ||
46 | /** The JTable component where the data are displayed. */ | 46 | /** The JTable component where the data are displayed. */ |
47 | JTable table; | 47 | JTable table; |
@@ -54,8 +54,8 @@ public class VOTableView extends JPanel implements TableModelListener { | @@ -54,8 +54,8 @@ public class VOTableView extends JPanel implements TableModelListener { | ||
54 | */ | 54 | */ |
55 | public VOTableView() { | 55 | public VOTableView() { |
56 | tableData = new DefaultTableModel() { | 56 | tableData = new DefaultTableModel() { |
57 | - /** The serial version UID (affected with a random number). */ | ||
58 | - private static final long serialVersionUID = 8195913508549662555L; | 57 | + /** The serial version UID. */ |
58 | + private static final long serialVersionUID = 1L; | ||
59 | 59 | ||
60 | @Override | 60 | @Override |
61 | public boolean isCellEditable(int row, int column) { | 61 | public boolean isCellEditable(int row, int column) { |
@@ -75,7 +75,7 @@ public class VOTableView extends JPanel implements TableModelListener { | @@ -75,7 +75,7 @@ public class VOTableView extends JPanel implements TableModelListener { | ||
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Fill the JTable. | 77 | * Fill the JTable. |
78 | - * | 78 | + * |
79 | * @param columns the column names | 79 | * @param columns the column names |
80 | * @param data The VoTable data displayed on the JTable | 80 | * @param data The VoTable data displayed on the JTable |
81 | */ | 81 | */ |
@@ -83,8 +83,9 @@ public class VOTableView extends JPanel implements TableModelListener { | @@ -83,8 +83,9 @@ public class VOTableView extends JPanel implements TableModelListener { | ||
83 | Object[][] values = data.toArray(new Object[data.size()][]); | 83 | Object[][] values = data.toArray(new Object[data.size()][]); |
84 | Utils.printObject("tableData", values); | 84 | Utils.printObject("tableData", values); |
85 | tableData.setDataVector(values, columns); | 85 | tableData.setDataVector(values, columns); |
86 | - if (values.length != 0) | 86 | + if (values.length != 0) { |
87 | table.setRowSelectionInterval(0, 0); | 87 | table.setRowSelectionInterval(0, 0); |
88 | + } | ||
88 | } | 89 | } |
89 | 90 | ||
90 | /** | 91 | /** |
@@ -106,8 +107,9 @@ public class VOTableView extends JPanel implements TableModelListener { | @@ -106,8 +107,9 @@ public class VOTableView extends JPanel implements TableModelListener { | ||
106 | 107 | ||
107 | @Override | 108 | @Override |
108 | public void tableChanged(TableModelEvent e) { | 109 | public void tableChanged(TableModelEvent e) { |
109 | - if (e.getType() != TableModelEvent.UPDATE) | 110 | + if (e.getType() != TableModelEvent.UPDATE) { |
110 | return; | 111 | return; |
112 | + } | ||
111 | } | 113 | } |
112 | 114 | ||
113 | } | 115 | } |