Commit 0d36b4b03408a493f01e4fd375ad2dd765f2689c

Authored by Nathanael Jourdane
1 parent 45faaeff
Exists in master

Use RequestPanelCtrl to manage the request view.

Showing 17 changed files with 217 additions and 181 deletions   Show diff stats
src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapController.java
... ... @@ -16,8 +16,6 @@
16 16  
17 17 package eu.omp.irap.vespa.epntapclient;
18 18  
19   -import java.util.HashMap;
20   -import java.util.Map;
21 19 import java.util.logging.Level;
22 20 import java.util.logging.Logger;
23 21  
... ... @@ -38,15 +36,14 @@ public class EpnTapController {
38 36 private static final Logger logger = Logger.getLogger(EpnTapController.class.getName());
39 37  
40 38 /** The controller of the VOTable displaying the list of services. */
41   - protected VOTableController servicesCtrl;
  39 + private VOTableController servicesCtrl;
42 40  
43 41 /** The controller of the VOTable displaying the result. */
44   - protected VOTableController resultsCtrl;
  42 + private VOTableController resultsCtrl;
45 43  
46   - /**
47   - * The parameters fields for the request.
48   - */
49   - protected Map<String, Object> paramValues = new HashMap<>();
  44 + private RequestCtrl requestCtrl;
  45 +
  46 + private String voTablePath;
50 47  
51 48  
52 49 /**
... ... @@ -56,6 +53,7 @@ public class EpnTapController {
56 53 String query = String.format(Queries.SELECT_ALL_TAP_SERVICES_WHERE_CORE,
57 54 ServiceCore.EPNCORE);
58 55 servicesCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL, query);
  56 + requestCtrl = new RequestCtrl(this);
59 57 }
60 58  
61 59 /**
... ... @@ -89,11 +87,11 @@ public class EpnTapController {
89 87 * path.
90 88 * @throws CantGetVOTableException Can not get the VOTable.
91 89 */
92   - public String sendQuery(String query, String tableServiceURL)
  90 + public void sendQuery(String query, String tableServiceURL)
93 91 throws CantGetVOTableException {
94 92 resultsCtrl = new VOTableController(tableServiceURL, query);
95 93 resultsCtrl.readTable();
96   - return resultsCtrl.getVOTablePath();
  94 + voTablePath = resultsCtrl.getVOTablePath();
97 95 }
98 96  
99 97 /**
... ... @@ -110,31 +108,8 @@ public class EpnTapController {
110 108 return servicesCtrl;
111 109 }
112 110  
113   - /**
114   - * Update a specified parameter
115   - *
116   - * @param paramName The name of the parameter.
117   - * @param paramValue The new value of the parameter
118   - */
119   - public void updateParameter(String paramName, Object paramValue) {
120   - paramValues.put(paramName, paramValue);
  111 + public RequestCtrl getRequestPanelCtrl() {
  112 + return requestCtrl;
121 113 }
122 114  
123   - /**
124   - * Remove a specified parameter.
125   - *
126   - * @param paramName the name of the parameter.
127   - */
128   - public void removeParameter(String paramName) {
129   - paramValues.remove(paramName);
130   - }
131   -
132   - /**
133   - * Get the values of all the parameters.
134   - *
135   - * @return A map containing all the values, as couples <key, value>.
136   - */
137   - public Map<String, Object> getParamValues() {
138   - return paramValues;
139   - }
140 115 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java
... ... @@ -23,7 +23,7 @@ import javax.swing.SwingUtilities;
23 23  
24 24 import com.google.gson.Gson;
25 25  
26   -import eu.omp.irap.vespa.epntapclient.gui.mainPanel.MainPanelController;
  26 +import eu.omp.irap.vespa.epntapclient.gui.mainPanel.MainPanelCtrl;
27 27 import eu.omp.irap.vespa.epntapclient.gui.mainPanel.MainPanelView;
28 28  
29 29 /**
... ... @@ -56,7 +56,7 @@ public class EpnTapMainApp {
56 56 return;
57 57 }
58 58  
59   - MainPanelController guiCtrl = new MainPanelController();
  59 + MainPanelCtrl guiCtrl = new MainPanelCtrl();
60 60 guiCtrl.readServices();
61 61 SwingUtilities.invokeLater(EpnTapMainApp.run(guiCtrl.getView(), "EPN-TAP client"));
62 62 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/RequestCtrl.java
... ... @@ -40,14 +40,17 @@ public class RequestCtrl {
40 40 /** The URL of the resolver used for the `target name` field. */
41 41 private static final String RESOLVER_URL = "http://voparis-registry.obspm.fr/ssodnet/1/autocomplete";
42 42  
43   - /**
44   - * The parameters fields for the request.
45   - */
  43 + /** The parameters fields for the request. */
46 44 protected Map<String, Object> paramValues = new HashMap<>();
47 45  
  46 + private EpnTapController epnTapCtrl;
  47 +
48 48  
49 49 public RequestCtrl() {
  50 + }
50 51  
  52 + public RequestCtrl(EpnTapController epnTapCtrl) {
  53 + this.epnTapCtrl = epnTapCtrl;
51 54 }
52 55  
53 56 /**
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainPanel/MainPanelController.java renamed to src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainPanel/MainPanelCtrl.java
... ... @@ -26,49 +26,90 @@ import java.util.logging.Logger;
26 26 import javax.swing.JOptionPane;
27 27  
28 28 import eu.omp.irap.vespa.epntapclient.EpnTapController;
  29 +import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelCtrl;
29 30 import eu.omp.irap.vespa.epntapclient.service.Queries;
  31 +import eu.omp.irap.vespa.epntapclient.service.ServiceCore;
  32 +import eu.omp.irap.vespa.votable.Consts;
30 33 import eu.omp.irap.vespa.votable.controller.CantGetVOTableException;
  34 +import eu.omp.irap.vespa.votable.controller.VOTableController;
31 35  
32 36 /**
33 37 * @author N. Jourdane
34 38 */
35   -public class MainPanelController extends EpnTapController implements ViewListener {
  39 +public class MainPanelCtrl extends EpnTapController implements ViewListener {
36 40  
37 41 /** The logger for the class GUIController. */
38   - private static final Logger logger = Logger.getLogger(MainPanelController.class.getName());
  42 + private static final Logger logger = Logger.getLogger(MainPanelCtrl.class.getName());
  43 +
  44 + private RequestPanelCtrl requestPanelCtrl;
  45 +
  46 + private VOTableController servicesPanelCtrl;
  47 +
  48 + private VOTableController resultPanelCtrl;
39 49  
40 50 private MainPanelView mainView;
41 51  
42 52 private String voTablePath;
43 53  
  54 + // TODO: ร  dรฉplacer dans ServicePanelCtrl
  55 +
44 56 /** The name of the table selected by the user on the table list panel. */
45 57 private String selectedTableName;
46 58  
47 59 /** The URL of the service corresponding to the selected table. */
48   - private String selectedTableServiceURL;
  60 + private String selectedServiceURL;
49 61  
50 62 private int nbMaxResult = 10;
51 63  
52 64  
53   - public MainPanelController() {
54   - super();
  65 + public MainPanelCtrl() {
  66 + String query = String.format(Queries.SELECT_ALL_TAP_SERVICES_WHERE_CORE,
  67 + ServiceCore.EPNCORE);
  68 + servicesPanelCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL, query);
  69 + resultPanelCtrl = new VOTableController();
  70 + requestPanelCtrl = new RequestPanelCtrl(this);
55 71 mainView = new MainPanelView(this);
56 72 }
57 73  
58 74 @Override
59 75 public void readServices() {
60 76 try {
61   - servicesCtrl.readTable();
  77 + servicesPanelCtrl.readTable();
62 78 } catch (CantGetVOTableException e) {
63 79 displayError("Can not get services.", e);
64 80 }
65   - mainView.getServicesPanel().fillTable(servicesCtrl.getVOTableData());
  81 + mainView.getServicesPanel().fillTable(servicesPanelCtrl.getVOTableData());
  82 + }
  83 +
  84 + public void sendQuery(String query) {
  85 + logger.info("Sending query: " + query + " on " + selectedServiceURL);
  86 + try {
  87 + resultPanelCtrl.updateVOTable(selectedServiceURL, query);
  88 + voTablePath = resultPanelCtrl.getVOTablePath();
  89 + mainView.getResultsPanel().fillTable(resultPanelCtrl.getVOTableData());
  90 + } catch (CantGetVOTableException e) {
  91 + displayError("Can not send the query.", e);
  92 + MainPanelCtrl.logger.log(Level.WARNING, "Can not send query.", e);
  93 + }
  94 + }
  95 +
  96 + @Override
  97 + public RequestPanelCtrl getRequestPanelCtrl() {
  98 + return requestPanelCtrl;
66 99 }
67 100  
68 101 public MainPanelView getView() {
69 102 return mainView;
70 103 }
71 104  
  105 + public String getSelectedTableName() {
  106 + return selectedTableName;
  107 + }
  108 +
  109 + public String getSelectedServiceURL() {
  110 + return selectedServiceURL;
  111 + }
  112 +
72 113 /** Update the row selected by the user on the Services Panel. */
73 114 @Override
74 115 public void onServiceSelected(int selectedServiceRow) {
... ... @@ -77,20 +118,6 @@ public class MainPanelController extends EpnTapController implements ViewListene
77 118 updateService(url, tableName);
78 119 }
79 120  
80   - /** Send the specified query on selectedTableServiceURL */
81   - @Override
82   - public void onSendButtonClicked(String query) {
83   - MainPanelController.logger.info("Sending query: " + query + " on " + selectedTableServiceURL);
84   - try {
85   - voTablePath = sendQuery(query, selectedTableServiceURL);
86   - } catch (CantGetVOTableException e) {
87   - displayError("Can not send the query.", e);
88   - MainPanelController.logger.log(Level.WARNING, "Can not send query.", e);
89   - }
90   -
91   - mainView.getResultsPanel().fillTable(resultsCtrl.getVOTableData());
92   - }
93   -
94 121 @Override
95 122 public void displayError(String message, Exception e) {
96 123 logger.log(Level.SEVERE, message, e);
... ... @@ -106,41 +133,17 @@ public class MainPanelController extends EpnTapController implements ViewListene
106 133 // TODO create exception
107 134 mainView.displayError("Can not save the file.",
108 135 "Check that you can write on the specified directory.");
109   - MainPanelController.logger.log(Level.WARNING, "Can not save the file.", e);
  136 + MainPanelCtrl.logger.log(Level.WARNING, "Can not save the file.", e);
110 137 }
111 138 }
112 139  
113   - /** Update a query parameter in the parameter list. */
114   - @Override
115   - public void onParameterChanged(String paramName, Object paramValue) {
116   - updateParameter(paramName, paramValue);
117   - updateQueryArea();
118   - MainPanelController.logger.info("uploaded " + paramName + ": " + paramValue);
119   - }
120   -
121   - /** Remove a query parameter from the parameters list. */
122   - @Override
123   - public void onParameterRemoved(String paramName) {
124   - removeParameter(paramName);
125   - updateQueryArea();
126   - MainPanelController.logger.info("removed " + paramName);
127   - }
128   -
129   - /**
130   - * Update the query area with a working ADQL query, based on the parameters list.
131   - */
132   - private void updateQueryArea() {
133   - String query = Queries.getQuery(selectedTableName, paramValues, getNbMaxResult());
134   - mainView.getRequestPanel().updateQueryArea(query);
135   - }
136   -
137 140 /**
138 141 * @return the nb max of result
139 142 */
140 143 public int getNbMaxResult() {
141 144 return nbMaxResult;
142 145 }
143   -
  146 +
144 147 /**
145 148 * set the nb max of result for a query
146 149 */
... ... @@ -150,11 +153,11 @@ public class MainPanelController extends EpnTapController implements ViewListene
150 153  
151 154 public void updateService(String serviceURL, String tableName) {
152 155 if (!tableName.equals(selectedTableName)) {
153   - selectedTableServiceURL = serviceURL;
  156 + selectedServiceURL = serviceURL;
154 157 selectedTableName = tableName;
155   - updateQueryArea();
156   - MainPanelController.logger.info("Selected table: " + selectedTableName + " - service: "
157   - + selectedTableServiceURL);
  158 + requestPanelCtrl.updateQueryArea();
  159 + MainPanelCtrl.logger.info("Selected table: " + selectedTableName + " - service: "
  160 + + selectedServiceURL);
158 161 }
159 162 }
160 163  
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainPanel/MainPanelView.java
... ... @@ -38,7 +38,7 @@ public class MainPanelView extends JPanel {
38 38 private static final long serialVersionUID = 1L;
39 39  
40 40 /** The JPanel where the VOTable results is displayed. */
41   - private ResultPanelView resultsPanel;
  41 + private ResultPanelView resultPanel;
42 42  
43 43 /** The JPanel where the list of services is displayed. */
44 44 private ServicesPanelView servicesPanel;
... ... @@ -54,10 +54,10 @@ public class MainPanelView extends JPanel {
54 54 * @param voTableResultsView The view to put in the results panel, built by ResultsController.
55 55 */
56 56  
57   - public MainPanelView(ViewListener viewListener) {
58   - servicesPanel = new ServicesPanelView(viewListener);
59   - resultsPanel = new ResultPanelView(viewListener);
60   - requestPanel = new RequestPanelView(viewListener);
  57 + public MainPanelView(MainPanelCtrl mainPanelCtrl) {
  58 + servicesPanel = new ServicesPanelView(mainPanelCtrl);
  59 + resultPanel = new ResultPanelView(mainPanelCtrl);
  60 + requestPanel = mainPanelCtrl.getRequestPanelCtrl().getView();
61 61 buildMainView();
62 62 }
63 63  
... ... @@ -69,7 +69,7 @@ public class MainPanelView extends JPanel {
69 69  
70 70 JSplitPane northPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, servicesPanel,
71 71 requestPanel);
72   - JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, northPanel, resultsPanel);
  72 + JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, northPanel, resultPanel);
73 73  
74 74 add(mainPanel, BorderLayout.CENTER);
75 75  
... ... @@ -88,10 +88,10 @@ public class MainPanelView extends JPanel {
88 88 requestPanel.setMinimumSize(
89 89 new Dimension(GUIDim.RIGHT_PANEL_MIN_WIDTH, GUIDim.TOP_PANEL_MIN_HEIGHT));
90 90  
91   - resultsPanel.setPreferredSize(
  91 + resultPanel.setPreferredSize(
92 92 new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH + GUIDim.RIGHT_PANEL_MIN_WIDTH,
93 93 GUIDim.BOTTOM_PANEL_HEIGHT));
94   - resultsPanel.setMinimumSize(
  94 + resultPanel.setMinimumSize(
95 95 new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH + GUIDim.RIGHT_PANEL_MIN_WIDTH,
96 96 GUIDim.BOTTOM_PANEL_MIN_HEIGHT));
97 97 }
... ... @@ -100,7 +100,7 @@ public class MainPanelView extends JPanel {
100 100 * @return The JPanel where the VOTable result is displayed.
101 101 */
102 102 public ResultPanelView getResultsPanel() {
103   - return resultsPanel;
  103 + return resultPanel;
104 104 }
105 105  
106 106 /**
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainPanel/ViewListener.java
... ... @@ -34,31 +34,10 @@ public interface ViewListener {
34 34 void onServiceSelected(int selectedService);
35 35  
36 36 /**
37   - * When the `Send query` button is clicked.
38   - *
39   - * @param query The query to send.
40   - */
41   - void onSendButtonClicked(String query);
42   -
43   - /**
44 37 * When the `Download VOTable` button is clicked.
45 38 *
46 39 * @param outputFile The file to copy the VOTable.
47 40 */
48 41 void onDownloadButtonClicked(File outputFile);
49 42  
50   - /**
51   - * When a parameter is removed on the parameter panel.
52   - *
53   - * @param paramName The name of the parameter as described in REG-TAP specifications.
54   - * @param paramValue The value of the parameter to update.
55   - */
56   - void onParameterChanged(String paramName, Object paramValue);
57   -
58   - /**
59   - * When a parameter is updated to a valid value on the parameter panel.
60   - *
61   - * @param paramName The name of the parameter as described in REG-TAP specifications.
62   - */
63   - void onParameterRemoved(String paramName);
64 43 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelCtrl.java
... ... @@ -18,11 +18,89 @@ package eu.omp.irap.vespa.epntapclient.gui.requestpanel;
18 18  
19 19 import java.util.logging.Logger;
20 20  
  21 +import eu.omp.irap.vespa.epntapclient.RequestCtrl;
  22 +import eu.omp.irap.vespa.epntapclient.gui.mainPanel.MainPanelCtrl;
  23 +import eu.omp.irap.vespa.epntapclient.service.Queries;
  24 +
21 25 /**
22 26 * @author N. Jourdane
23 27 */
24   -public class RequestPanelCtrl {
  28 +public class RequestPanelCtrl extends RequestCtrl implements RequestPanelListener {
25 29  
26 30 /** The logger for the class RequestPanelCtrl. */
27 31 private static final Logger logger = Logger.getLogger(RequestPanelCtrl.class.getName());
  32 +
  33 + MainPanelCtrl mainPanelCtrl;
  34 +
  35 + RequestPanelView view;
  36 +
  37 +
  38 + /**
  39 + * Constructor of RequestPanelCtrl
  40 + *
  41 + * @param epnTapCtrl
  42 + */
  43 + public RequestPanelCtrl(MainPanelCtrl mainPanelCtrl) {
  44 + this.mainPanelCtrl = mainPanelCtrl;
  45 + view = new RequestPanelView(this);
  46 + }
  47 +
  48 + public void setMainPanelCtrl(MainPanelCtrl mainPanelCtrl) {
  49 + this.mainPanelCtrl = mainPanelCtrl;
  50 + view = new RequestPanelView(this);
  51 + }
  52 +
  53 + public RequestPanelView getView() {
  54 + return view;
  55 + }
  56 +
  57 + /*
  58 + * @see
  59 + * eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener#onSendButtonClicked(java
  60 + * .lang.String)
  61 + */
  62 + @Override
  63 + public void onSendButtonClicked(String query) {
  64 + mainPanelCtrl.sendQuery(query);
  65 + }
  66 +
  67 + /**
  68 + * Update the query area with a working ADQL query, based on the parameters list.
  69 + */
  70 + public void updateQueryArea() {
  71 + String query = Queries.getQuery(mainPanelCtrl.getSelectedTableName(), paramValues,
  72 + mainPanelCtrl.getNbMaxResult());
  73 + view.updateQueryArea(query);
  74 + }
  75 +
  76 + /**
  77 + * Update the query area with a working ADQL query, based on the parameters list.
  78 + */
  79 + // private void updateQueryArea() {
  80 + // mainPanelCtrl.updateQueryArea();
  81 + // }
  82 +
  83 + /*
  84 + * @see
  85 + * eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener#onParameterRemoved(java.
  86 + * lang.String)
  87 + */
  88 + @Override
  89 + public void onParameterRemoved(String paramName) {
  90 + removeParameter(paramName);
  91 + updateQueryArea();
  92 + logger.info("removed " + paramName);
  93 + }
  94 +
  95 + /*
  96 + * @see
  97 + * eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener#onParameterChanged(java.
  98 + * lang.String, java.lang.Object)
  99 + */
  100 + @Override
  101 + public void onParameterChanged(String paramName, Object paramValue) {
  102 + updateParameter(paramName, paramValue);
  103 + updateQueryArea();
  104 + logger.info("uploaded " + paramName + ": " + paramValue);
  105 + }
28 106 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelView.java
... ... @@ -29,7 +29,6 @@ import javax.swing.JButton;
29 29 import javax.swing.JPanel;
30 30 import javax.swing.JTextArea;
31 31  
32   -import eu.omp.irap.vespa.epntapclient.gui.mainPanel.ViewListener;
33 32 import eu.omp.irap.vespa.epntapclient.gui.requestpanel.paramfield.DataProductTypeField;
34 33 import eu.omp.irap.vespa.epntapclient.gui.requestpanel.paramfield.DateRangeField;
35 34 import eu.omp.irap.vespa.epntapclient.gui.requestpanel.paramfield.FloatRangeField;
... ... @@ -46,9 +45,6 @@ public class RequestPanelView extends JPanel {
46 45 /** The serial version UID. */
47 46 private static final long serialVersionUID = 1L;
48 47  
49   - /** The main view of the application. */
50   - protected ViewListener viewListener;
51   -
52 48 /** The text area where the user write the query. */
53 49 protected JTextArea queryArea;
54 50  
... ... @@ -68,14 +64,16 @@ public class RequestPanelView extends JPanel {
68 64 /** The height of the buttons panel. */
69 65 private static final int BUTTON_PANEL_HEIGHT = 20;
70 66  
  67 + private RequestPanelListener requestPanelListener;
  68 +
71 69  
72 70 /**
73 71 * Method constructor
74 72 *
75 73 * @param mainView The EPN-TAP main view.
76 74 */
77   - public RequestPanelView(ViewListener viewListener) {
78   - this.viewListener = viewListener;
  75 + public RequestPanelView(RequestPanelListener requestPanelListener) {
  76 + this.requestPanelListener = requestPanelListener;
79 77 buildRequestPanel();
80 78 }
81 79  
... ... @@ -113,10 +111,11 @@ public class RequestPanelView extends JPanel {
113 111 * @return the data product field
114 112 */
115 113 public DataProductTypeField getDataProductTypeField() {
116   - if(dataProductTypeField == null){
117   - dataProductTypeField = new DataProductTypeField(viewListener, "dataproduct_type");
  114 + if (dataProductTypeField == null) {
  115 + dataProductTypeField = new DataProductTypeField(requestPanelListener,
  116 + "dataproduct_type");
118 117 }
119   -
  118 +
120 119 return dataProductTypeField;
121 120 }
122 121  
... ... @@ -124,10 +123,10 @@ public class RequestPanelView extends JPanel {
124 123 * @return the spectral range field
125 124 */
126 125 public FloatRangeField getSpectralRangeField() {
127   - if (spectralRangeField == null){
128   - spectralRangeField = new FloatRangeField(viewListener, "spectral_range_");
  126 + if (spectralRangeField == null) {
  127 + spectralRangeField = new FloatRangeField(requestPanelListener, "spectral_range_");
129 128 }
130   -
  129 +
131 130 return spectralRangeField;
132 131 }
133 132  
... ... @@ -135,10 +134,10 @@ public class RequestPanelView extends JPanel {
135 134 * @return the time range field
136 135 */
137 136 public DateRangeField getTimeRangeField() {
138   - if (timeRangeField == null){
139   - timeRangeField = new DateRangeField(viewListener, "time_");
  137 + if (timeRangeField == null) {
  138 + timeRangeField = new DateRangeField(requestPanelListener, "time_");
140 139 }
141   -
  140 +
142 141 return timeRangeField;
143 142 }
144 143  
... ... @@ -146,10 +145,10 @@ public class RequestPanelView extends JPanel {
146 145 * @return the target name field
147 146 */
148 147 public TargetNameField getTargetNameField() {
149   - if(targetNameField == null){
150   - targetNameField = new TargetNameField(viewListener, "target_name");
  148 + if (targetNameField == null) {
  149 + targetNameField = new TargetNameField(requestPanelListener, "target_name");
151 150 }
152   -
  151 +
153 152 return targetNameField;
154 153 }
155 154  
... ... @@ -191,7 +190,7 @@ public class RequestPanelView extends JPanel {
191 190  
192 191 @Override
193 192 public void actionPerformed(ActionEvent e) {
194   - viewListener.onSendButtonClicked(queryArea.getText());
  193 + requestPanelListener.onSendButtonClicked(queryArea.getText());
195 194 }
196 195 });
197 196 buttonPanel.add(btnSend);
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DataProductTypeField.java
... ... @@ -24,7 +24,7 @@ import java.util.List;
24 24  
25 25 import javax.swing.JComboBox;
26 26  
27   -import eu.omp.irap.vespa.epntapclient.gui.mainPanel.ViewListener;
  27 +import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener;
28 28  
29 29 /**
30 30 * The data product type field is used only for the `dataproduct_type` parameter. It is a ComboBox
... ... @@ -50,8 +50,8 @@ public class DataProductTypeField extends ParamField {
50 50 * @param viewListener The main listener of the application.
51 51 * @param paramName The name of the parameter.
52 52 */
53   - public DataProductTypeField(ViewListener viewListener, String paramName) {
54   - super(viewListener, paramName);
  53 + public DataProductTypeField(RequestPanelListener requestPanelListener, String paramName) {
  54 + super(requestPanelListener, paramName);
55 55 comboBox = new JComboBox<>(DataProductType.values());
56 56 comboBox.setSelectedItem(DataProductType.ALL);
57 57 comboBox.setPreferredSize(
... ... @@ -74,9 +74,9 @@ public class DataProductTypeField extends ParamField {
74 74 public void update() {
75 75 DataProductType item = (DataProductType) comboBox.getSelectedItem();
76 76 if (DataProductType.ALL.equals(item)) {
77   - viewListener.onParameterRemoved(paramName);
  77 + requestPanelListener.onParameterRemoved(paramName);
78 78 } else {
79   - viewListener.onParameterChanged(paramName, item.query());
  79 + requestPanelListener.onParameterChanged(paramName, item.query());
80 80 }
81 81 }
82 82  
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DateRangeField.java
... ... @@ -26,7 +26,7 @@ import java.util.Locale;
26 26 import javax.swing.JLabel;
27 27 import javax.swing.JTextField;
28 28  
29   -import eu.omp.irap.vespa.epntapclient.gui.mainPanel.ViewListener;
  29 +import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener;
30 30  
31 31 /**
32 32 * The date range field is used for couples of parameter with both a `Date` type (actually only
... ... @@ -60,8 +60,8 @@ public class DateRangeField extends ParamField implements TextFieldListener {
60 60 * @param viewListener The main view listener of the application.
61 61 * @param paramName The name of the parameter.
62 62 */
63   - public DateRangeField(ViewListener viewListener, String paramName) {
64   - super(viewListener, paramName);
  63 + public DateRangeField(RequestPanelListener requestPanelListener, String paramName) {
  64 + super(requestPanelListener, paramName);
65 65 this.add(new JLabel("min "));
66 66 fieldMin = new JTextField();
67 67 fieldMin.setName(MIN_SUFFIX);
... ... @@ -87,12 +87,12 @@ public class DateRangeField extends ParamField implements TextFieldListener {
87 87 DateFormat df = new SimpleDateFormat(DATE_FORMAT, Locale.ENGLISH);
88 88 if (field.getText().isEmpty()) {
89 89 field.setBackground(Color.WHITE);
90   - viewListener.onParameterRemoved(paramName + field.getName());
  90 + requestPanelListener.onParameterRemoved(paramName + field.getName());
91 91 } else if (field.getText().matches(DATE_REGEX)) {
92 92 try {
93 93 long date = df.parse(field.getText()).getTime();
94 94 date = Math.round(date / 86400000.0 + 2440587.5); // to JD
95   - viewListener.onParameterChanged(paramName + field.getName(),
  95 + requestPanelListener.onParameterChanged(paramName + field.getName(),
96 96 date);
97 97 field.setBackground(Color.WHITE);
98 98 } catch (@SuppressWarnings("unused") ParseException e) {
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatField.java
... ... @@ -20,7 +20,7 @@ import java.awt.Color;
20 20  
21 21 import javax.swing.JTextField;
22 22  
23   -import eu.omp.irap.vespa.epntapclient.gui.mainPanel.ViewListener;
  23 +import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener;
24 24  
25 25 /**
26 26 * The float field is used for parameter with a `Float` class. It is a JTextField which checks if
... ... @@ -44,8 +44,8 @@ public class FloatField extends ParamField implements TextFieldListener {
44 44 * @param viewListener The main view listener of the application.
45 45 * @param paramName The name of the parameter.
46 46 */
47   - public FloatField(ViewListener viewListener, String paramName) {
48   - super(viewListener, paramName);
  47 + public FloatField(RequestPanelListener requestPanelListener, String paramName) {
  48 + super(requestPanelListener, paramName);
49 49 field = new JTextField();
50 50 ParamField.addChangeListener(this, field);
51 51 this.add(field);
... ... @@ -58,11 +58,11 @@ public class FloatField extends ParamField implements TextFieldListener {
58 58 public void update(JTextField textField) {
59 59 if (textField.getText().isEmpty()) {
60 60 textField.setBackground(Color.WHITE);
61   - viewListener.onParameterRemoved(paramName);
  61 + requestPanelListener.onParameterRemoved(paramName);
62 62 } else {
63 63 try {
64 64 float value = Float.parseFloat(textField.getText());
65   - viewListener.onParameterChanged(paramName, value);
  65 + requestPanelListener.onParameterChanged(paramName, value);
66 66 textField.setBackground(Color.WHITE);
67 67 } catch (@SuppressWarnings("unused") NumberFormatException e) {
68 68 textField.setBackground(Color.PINK);
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatRangeField.java
... ... @@ -20,7 +20,7 @@ import java.awt.Color;
20 20  
21 21 import javax.swing.JTextField;
22 22  
23   -import eu.omp.irap.vespa.epntapclient.gui.mainPanel.ViewListener;
  23 +import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener;
24 24  
25 25 /**
26 26 * The float range field is used for couples of parameter with both a `Float` class. These are
... ... @@ -47,8 +47,8 @@ public class FloatRangeField extends ParamField implements TextFieldListener {
47 47 * @param viewListener The main view listener of the application.
48 48 * @param paramName The name of the parameter.
49 49 */
50   - public FloatRangeField(ViewListener viewListener, String paramName) {
51   - super(viewListener, paramName);
  50 + public FloatRangeField(RequestPanelListener requestPanelListener, String paramName) {
  51 + super(requestPanelListener, paramName);
52 52 fieldMin = new JTextField();
53 53 fieldMin.setName(ParamField.MIN_SUFFIX);
54 54 ParamField.addChangeListener(this, fieldMin);
... ... @@ -67,10 +67,10 @@ public class FloatRangeField extends ParamField implements TextFieldListener {
67 67 public void update(JTextField field) {
68 68 if (field.getText().isEmpty()) {
69 69 field.setBackground(Color.WHITE);
70   - viewListener.onParameterRemoved(paramName + field.getName());
  70 + requestPanelListener.onParameterRemoved(paramName + field.getName());
71 71 } else {
72 72 try {
73   - viewListener.onParameterChanged(paramName + field.getName(),
  73 + requestPanelListener.onParameterChanged(paramName + field.getName(),
74 74 Float.parseFloat(field.getText()));
75 75 field.setBackground(Color.WHITE);
76 76 } catch (@SuppressWarnings("unused") NumberFormatException e) {
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/ParamField.java
... ... @@ -26,7 +26,7 @@ import javax.swing.JTextField;
26 26 import javax.swing.event.DocumentEvent;
27 27 import javax.swing.event.DocumentListener;
28 28  
29   -import eu.omp.irap.vespa.epntapclient.gui.mainPanel.ViewListener;
  29 +import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener;
30 30  
31 31 /**
32 32 * A field used to set a service parameter to build the query (in the parameter panel). ParamField
... ... @@ -63,7 +63,7 @@ public abstract class ParamField extends JPanel {
63 63 static final String MAX_SUFFIX = "max";
64 64  
65 65 /** The main view of the application. */
66   - ViewListener viewListener;
  66 + RequestPanelListener requestPanelListener;
67 67  
68 68 /** The parameter name of the field */
69 69 String paramName;
... ... @@ -76,10 +76,10 @@ public abstract class ParamField extends JPanel {
76 76 * @param mainView The main view of the application.
77 77 * @param paramName The name of the parameter.
78 78 */
79   - public ParamField(ViewListener viewListener, String paramName) {
  79 + public ParamField(RequestPanelListener requestPanelListener, String paramName) {
80 80 super();
81 81  
82   - this.viewListener = viewListener;
  82 + this.requestPanelListener = requestPanelListener;
83 83 this.paramName = paramName;
84 84  
85 85 buildParamField();
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/StringField.java
... ... @@ -18,7 +18,7 @@ package eu.omp.irap.vespa.epntapclient.gui.requestpanel.paramfield;
18 18  
19 19 import javax.swing.JTextField;
20 20  
21   -import eu.omp.irap.vespa.epntapclient.gui.mainPanel.ViewListener;
  21 +import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener;
22 22  
23 23 /**
24 24 * The string field is used for parameter with a `String` class. It is a simple JTextField with no
... ... @@ -41,8 +41,8 @@ public class StringField extends ParamField implements TextFieldListener {
41 41 * @param mainView The main view of the application.
42 42 * @param paramName The name of the parameter.
43 43 */
44   - public StringField(ViewListener viewListener, String paramName) {
45   - super(viewListener, paramName);
  44 + public StringField(RequestPanelListener requestPanelListener, String paramName) {
  45 + super(requestPanelListener, paramName);
46 46 field = new JTextField();
47 47 ParamField.addChangeListener(this, field);
48 48 this.add(field);
... ... @@ -54,9 +54,9 @@ public class StringField extends ParamField implements TextFieldListener {
54 54 @Override
55 55 public void update(JTextField textField) {
56 56 if (textField.getText().isEmpty()) {
57   - viewListener.onParameterChanged(paramName, null);
  57 + requestPanelListener.onParameterChanged(paramName, null);
58 58 } else {
59   - viewListener.onParameterChanged(paramName, textField.getText());
  59 + requestPanelListener.onParameterChanged(paramName, textField.getText());
60 60 }
61 61 }
62 62 }
63 63 \ No newline at end of file
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetClassField.java
... ... @@ -22,7 +22,7 @@ import java.awt.event.ActionListener;
22 22  
23 23 import javax.swing.JComboBox;
24 24  
25   -import eu.omp.irap.vespa.epntapclient.gui.mainPanel.ViewListener;
  25 +import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener;
26 26  
27 27 /**
28 28 * The target class field is used only for the `target_class` parameter. It is a ComboBox filled
... ... @@ -48,8 +48,8 @@ public class TargetClassField extends ParamField {
48 48 * @param mainView The main view of the application.
49 49 * @param paramName The name of the parameter.
50 50 */
51   - public TargetClassField(ViewListener viewListener, String paramName) {
52   - super(viewListener, paramName);
  51 + public TargetClassField(RequestPanelListener requestPanelListener, String paramName) {
  52 + super(requestPanelListener, paramName);
53 53 comboBox = new JComboBox<>(TargetClass.values());
54 54 comboBox.setPreferredSize(
55 55 new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT));
... ... @@ -69,9 +69,9 @@ public class TargetClassField extends ParamField {
69 69 public void update() {
70 70 TargetClass value = (TargetClass) comboBox.getSelectedItem();
71 71 if (TargetClass.ALL.equals(value)) {
72   - viewListener.onParameterRemoved(paramName);
  72 + requestPanelListener.onParameterRemoved(paramName);
73 73 } else {
74   - viewListener.onParameterChanged(paramName, value.query());
  74 + requestPanelListener.onParameterChanged(paramName, value.query());
75 75 }
76 76 }
77 77  
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetNameField.java
... ... @@ -24,7 +24,7 @@ import javax.swing.JTextField;
24 24 import javax.swing.SwingUtilities;
25 25  
26 26 import eu.omp.irap.vespa.epntapclient.EpnTapGet;
27   -import eu.omp.irap.vespa.epntapclient.gui.mainPanel.ViewListener;
  27 +import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener;
28 28 import eu.omp.irap.vespa.votable.utils.CantSendQueryException;
29 29  
30 30 /**
... ... @@ -60,8 +60,8 @@ public class TargetNameField extends ParamField implements TextFieldListener {
60 60 * @param mainView The main view of the application.
61 61 * @param paramName The name of the parameter.
62 62 */
63   - public TargetNameField(ViewListener viewListener, String paramName) {
64   - super(viewListener, paramName);
  63 + public TargetNameField(RequestPanelListener requestPanelListener, String paramName) {
  64 + super(requestPanelListener, paramName);
65 65 comboBox = new JComboBox<>();
66 66 comboBox.setPreferredSize(
67 67 new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT));
... ... @@ -106,9 +106,9 @@ public class TargetNameField extends ParamField implements TextFieldListener {
106 106 comboBox.showPopup();
107 107 }
108 108 if (content.isEmpty()) {
109   - viewListener.onParameterRemoved(paramName);
  109 + requestPanelListener.onParameterRemoved(paramName);
110 110 } else {
111   - viewListener.onParameterChanged(paramName, content);
  111 + requestPanelListener.onParameterChanged(paramName, content);
112 112 }
113 113 }
114 114 }
... ...
src/test/java/eu/omp/irap/vespa/epntapclient/EpnTapConnectionTest.java
... ... @@ -140,7 +140,6 @@ public class EpnTapConnectionTest {
140 140  
141 141 Resource amda = null;
142 142 for (Resource resource : resources) {
143   - System.out.println(resource.getIdentifier());
144 143 if (AMDA_IVOID.equals(resource.getIdentifier())) {
145 144 amda = resource;
146 145 }
... ...