Commit 56349bdea7dccf58df154fa44867c08049c9a7cc

Authored by Nathanael Jourdane
1 parent 7573c47d
Exists in master

Add ResultsPanelCtrl and ResultsPanelsListeners, and fix #21.

src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapConnection.java
@@ -125,7 +125,7 @@ public class EpnTapConnection implements EpnTapInterface { @@ -125,7 +125,7 @@ public class EpnTapConnection implements EpnTapInterface {
125 @Override 125 @Override
126 public List<Granule> sendADQLQuery(String tapURL, String adqlQuery) throws VOTableException { 126 public List<Granule> sendADQLQuery(String tapURL, String adqlQuery) throws VOTableException {
127 VOTableCtrl voTableCtrl = new VOTableCtrl(); 127 VOTableCtrl voTableCtrl = new VOTableCtrl();
128 - voTableCtrl.acquireVOTable(tapURL, adqlQuery, false); 128 + voTableCtrl.acquireVOTable(tapURL, adqlQuery);
129 VOTableData data = voTableCtrl.getVOTableData(); 129 VOTableData data = voTableCtrl.getVOTableData();
130 130
131 List<Granule> granules; 131 List<Granule> granules;
@@ -139,7 +139,7 @@ public class EpnTapConnection implements EpnTapInterface { @@ -139,7 +139,7 @@ public class EpnTapConnection implements EpnTapInterface {
139 throws VOTableException { 139 throws VOTableException {
140 String query = String.format(enumeratedQuery.toString(), schemaName); 140 String query = String.format(enumeratedQuery.toString(), schemaName);
141 VOTableCtrl voTableCtrl = new VOTableCtrl(); 141 VOTableCtrl voTableCtrl = new VOTableCtrl();
142 - voTableCtrl.acquireVOTable(tapURL, query, false); 142 + voTableCtrl.acquireVOTable(tapURL, query);
143 VOTableData data = voTableCtrl.getVOTableData(); 143 VOTableData data = voTableCtrl.getVOTableData();
144 Debug.writeObject("data", data); 144 Debug.writeObject("data", data);
145 145
src/main/java/eu/omp/irap/vespa/epntapclient/epntap/EpnTapController.java
@@ -17,14 +17,12 @@ @@ -17,14 +17,12 @@
17 package eu.omp.irap.vespa.epntapclient.epntap; 17 package eu.omp.irap.vespa.epntapclient.epntap;
18 18
19 import java.util.List; 19 import java.util.List;
20 -import java.util.logging.Logger;  
21 20
22 import eu.omp.irap.vespa.epntapclient.epntap.request.RequestCtrl; 21 import eu.omp.irap.vespa.epntapclient.epntap.request.RequestCtrl;
23 import eu.omp.irap.vespa.epntapclient.epntap.service.Queries; 22 import eu.omp.irap.vespa.epntapclient.epntap.service.Queries;
24 import eu.omp.irap.vespa.epntapclient.epntap.service.ServiceCore; 23 import eu.omp.irap.vespa.epntapclient.epntap.service.ServiceCore;
25 import eu.omp.irap.vespa.epntapclient.epntap.service.ServicesList; 24 import eu.omp.irap.vespa.epntapclient.epntap.service.ServicesList;
26 import eu.omp.irap.vespa.votable.Consts; 25 import eu.omp.irap.vespa.votable.Consts;
27 -import eu.omp.irap.vespa.votable.utils.StringJoiner;  
28 import eu.omp.irap.vespa.votable.votable.VOTableCtrl; 26 import eu.omp.irap.vespa.votable.votable.VOTableCtrl;
29 import eu.omp.irap.vespa.votable.votable.VOTableException; 27 import eu.omp.irap.vespa.votable.votable.VOTableException;
30 28
@@ -35,14 +33,11 @@ import eu.omp.irap.vespa.votable.votable.VOTableException; @@ -35,14 +33,11 @@ import eu.omp.irap.vespa.votable.votable.VOTableException;
35 */ 33 */
36 public abstract class EpnTapController { 34 public abstract class EpnTapController {
37 35
38 - /** The logger for the class EpnTapController. */  
39 - private static final Logger LOGGER = Logger.getLogger(EpnTapController.class.getName());  
40 -  
41 /** The request controller, to manage requests. */ 36 /** The request controller, to manage requests. */
42 private RequestCtrl requestCtrl; 37 private RequestCtrl requestCtrl;
43 38
44 /** The controller of the VOTable displaying the result. */ 39 /** The controller of the VOTable displaying the result. */
45 - private VOTableCtrl resultsCtrl; 40 + private List<VOTableCtrl> resultsCtrls;
46 41
47 /** The controller of the VOTable displaying the list of services. */ 42 /** The controller of the VOTable displaying the list of services. */
48 private VOTableCtrl servicesCtrl; 43 private VOTableCtrl servicesCtrl;
@@ -62,7 +57,7 @@ public abstract class EpnTapController { @@ -62,7 +57,7 @@ public abstract class EpnTapController {
62 public void acquireServices() throws VOTableException { 57 public void acquireServices() throws VOTableException {
63 String query = String.format(Queries.SELECT_ALL_TAP_SERVICES_WHERE_CORE, 58 String query = String.format(Queries.SELECT_ALL_TAP_SERVICES_WHERE_CORE,
64 ServiceCore.EPNCORE); 59 ServiceCore.EPNCORE);
65 - getServicesCtrl().acquireVOTable(Consts.DEFAULT_REGISTRY_URL, query, true); 60 + getServicesCtrl().acquireVOTable(Consts.DEFAULT_REGISTRY_URL, query);
66 } 61 }
67 62
68 /** 63 /**
@@ -75,8 +70,8 @@ public abstract class EpnTapController { @@ -75,8 +70,8 @@ public abstract class EpnTapController {
75 /** 70 /**
76 * @return The controller of the VOTable which displays the result of the query. 71 * @return The controller of the VOTable which displays the result of the query.
77 */ 72 */
78 - public VOTableCtrl getResultsCtrl() {  
79 - return resultsCtrl; 73 + public List<VOTableCtrl> getResultsCtrls() {
  74 + return resultsCtrls;
80 } 75 }
81 76
82 /** 77 /**
@@ -94,17 +89,15 @@ public abstract class EpnTapController { @@ -94,17 +89,15 @@ public abstract class EpnTapController {
94 } 89 }
95 90
96 /** 91 /**
97 - * Send all the queries. 92 + * Send the query to all services.
98 * 93 *
99 * @param services The services to send the queries. 94 * @param services The services to send the queries.
100 */ 95 */
101 public void sendQueries(ServicesList services) { 96 public void sendQueries(ServicesList services) {
102 - List<String> servicesUrls = services.getTargetUrls();  
103 - LOGGER.info("Sending query(ies) at " + StringJoiner.join(servicesUrls));  
104 - for (int i = 0; i < servicesUrls.size(); i++) {  
105 - String query = getRequestCtrl().getQuery(services.getTableNames().get(i));  
106 - getResultsCtrl().acquireVOTable(servicesUrls.get(i), query, i != 0); 97 + for (int i = 0; i < services.getNbServices(); i++) {
  98 + VOTableCtrl resultCtrl = new VOTableCtrl();
  99 + String query = requestCtrl.getQuery(services.getTableNames().get(i));
  100 + resultCtrl.acquireVOTable(services.getTargetUrls().get(i), query);
107 } 101 }
108 -  
109 } 102 }
110 } 103 }
src/main/java/eu/omp/irap/vespa/epntapclient/epntap/service/ServiceCtrl.java
@@ -152,7 +152,7 @@ public class ServiceCtrl { @@ -152,7 +152,7 @@ public class ServiceCtrl {
152 */ 152 */
153 public static VOTABLE getVoTable(String query) throws VOTableException { 153 public static VOTABLE getVoTable(String query) throws VOTableException {
154 VOTableCtrl voTableCtrl = new VOTableCtrl(); 154 VOTableCtrl voTableCtrl = new VOTableCtrl();
155 - voTableCtrl.acquireVOTable(Consts.DEFAULT_REGISTRY_URL, query, false); 155 + voTableCtrl.acquireVOTable(Consts.DEFAULT_REGISTRY_URL, query);
156 return voTableCtrl.getVOTable(); 156 return voTableCtrl.getVOTable();
157 } 157 }
158 158
@@ -174,7 +174,7 @@ public class ServiceCtrl { @@ -174,7 +174,7 @@ public class ServiceCtrl {
174 */ 174 */
175 public static VOTableData getVoTableData(VOTABLE voTable) throws VOTableException { 175 public static VOTableData getVoTableData(VOTABLE voTable) throws VOTableException {
176 VOTableCtrl ctrl = new VOTableCtrl(); 176 VOTableCtrl ctrl = new VOTableCtrl();
177 - ctrl.acquireVOTable(voTable, false); 177 + ctrl.acquireVOTable(voTable);
178 Table table = (Table) voTable.getRESOURCE().get(0).getLINKAndTABLEOrRESOURCE().get(0); 178 Table table = (Table) voTable.getRESOURCE().get(0).getLINKAndTABLEOrRESOURCE().get(0);
179 VOTableDataParser dataParser = new VOTableDataParser("Services list", table); 179 VOTableDataParser dataParser = new VOTableDataParser("Services list", table);
180 dataParser.parseData(); 180 dataParser.parseData();
src/main/java/eu/omp/irap/vespa/epntapclient/epntap/service/ServicesList.java
@@ -53,6 +53,11 @@ public class ServicesList { @@ -53,6 +53,11 @@ public class ServicesList {
53 selectedTargetUrls = new ArrayList<>(); 53 selectedTargetUrls = new ArrayList<>();
54 } 54 }
55 55
  56 + /** @return The numbers of services (custom + selected) */
  57 + public int getNbServices() {
  58 + return customTargetUrls.size() + selectedTargetUrls.size();
  59 + }
  60 +
56 /** 61 /**
57 * @return the tableName 62 * @return the tableName
58 */ 63 */
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java
@@ -16,18 +16,22 @@ @@ -16,18 +16,22 @@
16 16
17 package eu.omp.irap.vespa.epntapclient.gui.mainpanel; 17 package eu.omp.irap.vespa.epntapclient.gui.mainpanel;
18 18
  19 +import java.awt.Cursor;
19 import java.io.File; 20 import java.io.File;
20 import java.io.IOException; 21 import java.io.IOException;
21 import java.nio.file.Files; 22 import java.nio.file.Files;
22 import java.nio.file.Paths; 23 import java.nio.file.Paths;
  24 +import java.util.ArrayList;
  25 +import java.util.List;
23 import java.util.logging.Level; 26 import java.util.logging.Level;
24 import java.util.logging.Logger; 27 import java.util.logging.Logger;
25 28
26 import javax.swing.JOptionPane; 29 import javax.swing.JOptionPane;
27 30
28 import eu.omp.irap.vespa.epntapclient.epntap.EpnTapController; 31 import eu.omp.irap.vespa.epntapclient.epntap.EpnTapController;
  32 +import eu.omp.irap.vespa.epntapclient.epntap.service.ServicesList;
29 import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelCtrl; 33 import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelCtrl;
30 -import eu.omp.irap.vespa.epntapclient.gui.resultpanel.ResultPanelCtrl; 34 +import eu.omp.irap.vespa.epntapclient.gui.resultpanel.ResultsPanelCtrl;
31 import eu.omp.irap.vespa.epntapclient.gui.servicespanel.ServicesPanelCtrl; 35 import eu.omp.irap.vespa.epntapclient.gui.servicespanel.ServicesPanelCtrl;
32 36
33 /** 37 /**
@@ -42,7 +46,7 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener @@ -42,7 +46,7 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener
42 RequestPanelCtrl requestPanelCtrl; 46 RequestPanelCtrl requestPanelCtrl;
43 47
44 /** The controller of the result panel. */ 48 /** The controller of the result panel. */
45 - ResultPanelCtrl resultsPanelCtrl; 49 + ResultsPanelCtrl resultsPanelCtrl;
46 50
47 /** The controller of the services panel. */ 51 /** The controller of the services panel. */
48 ServicesPanelCtrl servicesPanelCtrl; 52 ServicesPanelCtrl servicesPanelCtrl;
@@ -56,8 +60,8 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener @@ -56,8 +60,8 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener
56 */ 60 */
57 public MainPanelCtrl() { 61 public MainPanelCtrl() {
58 servicesPanelCtrl = new ServicesPanelCtrl(this); 62 servicesPanelCtrl = new ServicesPanelCtrl(this);
59 - resultsPanelCtrl = new ResultPanelCtrl(this);  
60 requestPanelCtrl = new RequestPanelCtrl(this); 63 requestPanelCtrl = new RequestPanelCtrl(this);
  64 + resultsPanelCtrl = new ResultsPanelCtrl(this);
61 view = new MainPanelView(this); 65 view = new MainPanelView(this);
62 } 66 }
63 67
@@ -82,19 +86,14 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener @@ -82,19 +86,14 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener
82 view.getStatusBarPanelView().setStatusBarText(shortMessage); 86 view.getStatusBarPanelView().setStatusBarText(shortMessage);
83 } 87 }
84 88
85 - /**  
86 - * @return The controller of the request panel.  
87 - */ 89 + /** @return The controller of the request panel. */
88 @Override 90 @Override
89 public RequestPanelCtrl getRequestCtrl() { 91 public RequestPanelCtrl getRequestCtrl() {
90 return requestPanelCtrl; 92 return requestPanelCtrl;
91 } 93 }
92 94
93 - /**  
94 - * @return The controller of the result panel.  
95 - */  
96 - @Override  
97 - public ResultPanelCtrl getResultsCtrl() { 95 + /** @return The controller of the result panel. */
  96 + public ResultsPanelCtrl getResultsCtrl() {
98 return resultsPanelCtrl; 97 return resultsPanelCtrl;
99 } 98 }
100 99
@@ -116,7 +115,7 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener @@ -116,7 +115,7 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener
116 @Override 115 @Override
117 public void saveCurrentVOTable(File file) { 116 public void saveCurrentVOTable(File file) {
118 try { 117 try {
119 - Files.copy(Paths.get(resultsPanelCtrl.getVOTablePath()), 118 + Files.copy(Paths.get(resultsPanelCtrl.getFocusedVOTablePath()),
120 Paths.get(file.getAbsolutePath())); 119 Paths.get(file.getAbsolutePath()));
121 } catch (IOException e) { 120 } catch (IOException e) {
122 displayError("Can not save the VOTable file.", e); 121 displayError("Can not save the VOTable file.", e);
@@ -125,7 +124,19 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener @@ -125,7 +124,19 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener
125 124
126 @Override 125 @Override
127 public void sendQueries() { 126 public void sendQueries() {
128 - sendQueries(servicesPanelCtrl.getServices()); 127 + ServicesList services = getServicesCtrl().getServices();
  128 + List<String> queries = new ArrayList<>();
  129 + for (String tableName : services.getTableNames()) {
  130 + queries.add(requestPanelCtrl.getQuery(tableName));
  131 + }
  132 + resultsPanelCtrl.sendQueries(services, queries);
  133 + }
  134 +
  135 + /* @see MainPanelListener */
  136 + @Override
  137 + public void setWaitMode(boolean enableWaitMode) {
  138 + int cursor = enableWaitMode ? Cursor.WAIT_CURSOR : Cursor.DEFAULT_CURSOR;
  139 + view.setCursor(Cursor.getPredefinedCursor(cursor));
129 } 140 }
130 141
131 @Override 142 @Override
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelListener.java
@@ -49,6 +49,13 @@ public interface MainPanelListener { @@ -49,6 +49,13 @@ public interface MainPanelListener {
49 /** Ask the main panel to send the query. */ 49 /** Ask the main panel to send the query. */
50 void sendQueries(); 50 void sendQueries();
51 51
  52 + /**
  53 + * Set the cursor in the VOTable view.
  54 + *
  55 + * @param enableWaitMode True to set the Wait cursor, false to set the default cursor.
  56 + */
  57 + void setWaitMode(boolean enableWaitMode);
  58 +
52 /** Ask the main panel to update the query. */ 59 /** Ask the main panel to update the query. */
53 void updateQuery(); 60 void updateQuery();
54 } 61 }
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelView.java
@@ -24,7 +24,7 @@ import javax.swing.JPanel; @@ -24,7 +24,7 @@ import javax.swing.JPanel;
24 import javax.swing.JSplitPane; 24 import javax.swing.JSplitPane;
25 25
26 import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelView; 26 import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelView;
27 -import eu.omp.irap.vespa.epntapclient.gui.resultpanel.ResultPanelView; 27 +import eu.omp.irap.vespa.epntapclient.gui.resultpanel.ResultsPanelView;
28 import eu.omp.irap.vespa.epntapclient.gui.servicespanel.ServicesPanelView; 28 import eu.omp.irap.vespa.epntapclient.gui.servicespanel.ServicesPanelView;
29 import eu.omp.irap.vespa.epntapclient.gui.statusbarpanel.StatusBarPanelView; 29 import eu.omp.irap.vespa.epntapclient.gui.statusbarpanel.StatusBarPanelView;
30 30
@@ -42,7 +42,7 @@ public class MainPanelView extends JPanel { @@ -42,7 +42,7 @@ public class MainPanelView extends JPanel {
42 private RequestPanelView requestPanel; 42 private RequestPanelView requestPanel;
43 43
44 /** The JPanel where the VOTable results is displayed. */ 44 /** The JPanel where the VOTable results is displayed. */
45 - private ResultPanelView resultPanel; 45 + private ResultsPanelView resultPanel;
46 46
47 /** The JPanel where the list of services is displayed. */ 47 /** The JPanel where the list of services is displayed. */
48 private ServicesPanelView servicesPanel; 48 private ServicesPanelView servicesPanel;
@@ -85,7 +85,7 @@ public class MainPanelView extends JPanel { @@ -85,7 +85,7 @@ public class MainPanelView extends JPanel {
85 /** 85 /**
86 * @return The JPanel where the VOTable result is displayed. 86 * @return The JPanel where the VOTable result is displayed.
87 */ 87 */
88 - public ResultPanelView getResultsPanel() { 88 + public ResultsPanelView getResultsPanel() {
89 return resultPanel; 89 return resultPanel;
90 } 90 }
91 91
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java renamed to src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultTabCtrl.java
@@ -16,36 +16,47 @@ @@ -16,36 +16,47 @@
16 16
17 package eu.omp.irap.vespa.epntapclient.gui.resultpanel; 17 package eu.omp.irap.vespa.epntapclient.gui.resultpanel;
18 18
19 -import java.awt.Cursor;  
20 import java.util.logging.Logger; 19 import java.util.logging.Logger;
21 20
22 import eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelListener; 21 import eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelListener;
  22 +import eu.omp.irap.vespa.votable.gui.VOTablePanelView;
23 import eu.omp.irap.vespa.votable.utils.StringJoiner; 23 import eu.omp.irap.vespa.votable.utils.StringJoiner;
24 import eu.omp.irap.vespa.votable.votable.VOTableCtrl; 24 import eu.omp.irap.vespa.votable.votable.VOTableCtrl;
25 25
26 /** 26 /**
27 * @author N. Jourdane 27 * @author N. Jourdane
28 */ 28 */
29 -public class ResultPanelCtrl extends VOTableCtrl implements ResultPanelListener { 29 +public class ResultTabCtrl extends VOTableCtrl implements ResultTabListener {
30 30
31 /** The logger for the class ResultPanelCtrl. */ 31 /** The logger for the class ResultPanelCtrl. */
32 - private static final Logger LOGGER = Logger.getLogger(ResultPanelCtrl.class.getName()); 32 + private static final Logger LOGGER = Logger.getLogger(ResultTabCtrl.class.getName());
33 33
34 /** The listener of the main panel. */ 34 /** The listener of the main panel. */
35 private MainPanelListener listener; 35 private MainPanelListener listener;
36 36
  37 + /** The result panel view, used to add the new tab into it. */
  38 + private ResultsPanelView resultsPanelView;
  39 +
  40 + /** The title of the tab (ie. The name of the service). */
  41 + private String title;
  42 +
37 /** The result panel view. */ 43 /** The result panel view. */
38 - private ResultPanelView view; 44 + private VOTablePanelView view;
39 45
40 46
41 /** 47 /**
42 * Constructor of ResultPanelCtrl. 48 * Constructor of ResultPanelCtrl.
43 * 49 *
44 * @param listener The listener of the main panel. 50 * @param listener The listener of the main panel.
  51 + * @param resultsPanelView The result panel view, used to add the new tab into it.
  52 + * @param title The title of the tab (ie. The name of the service).
45 */ 53 */
46 - public ResultPanelCtrl(MainPanelListener listener) { 54 + public ResultTabCtrl(MainPanelListener listener, ResultsPanelView resultsPanelView,
  55 + String title) {
47 this.listener = listener; 56 this.listener = listener;
48 - view = new ResultPanelView(this); 57 + this.resultsPanelView = resultsPanelView;
  58 + view = new VOTablePanelView(this);
  59 + this.title = title;
49 } 60 }
50 61
51 @Override 62 @Override
@@ -59,27 +70,26 @@ public class ResultPanelCtrl extends VOTableCtrl implements ResultPanelListener @@ -59,27 +70,26 @@ public class ResultPanelCtrl extends VOTableCtrl implements ResultPanelListener
59 } 70 }
60 71
61 @Override 72 @Override
62 - public void fillTable() {  
63 - view.addTable(voTableData); 73 + public void displayTable() {
  74 + view.fillTable(voTableData);
  75 + resultsPanelView.addTab(title, view);
64 } 76 }
65 77
66 /** 78 /**
67 * @return The result panel view. 79 * @return The result panel view.
68 */ 80 */
69 - public ResultPanelView getView() { 81 + public VOTablePanelView getView() {
70 return view; 82 return view;
71 } 83 }
72 84
73 @Override 85 @Override
74 public void onRowsSelected() { 86 public void onRowsSelected() {
75 - if (view.getSelectedIndex() != -1) {  
76 - LOGGER.info("Selected row(s): " + StringJoiner.join(view.getSelectedRows()));  
77 - } 87 + LOGGER.info("Selected row(s): " + StringJoiner.join(view.getSelectedRows()));
78 } 88 }
79 89
80 @Override 90 @Override
81 - public void setWaitCursor(boolean enableWaitcursor) {  
82 - int cursor = enableWaitcursor ? Cursor.WAIT_CURSOR : Cursor.DEFAULT_CURSOR;  
83 - view.setCursor(Cursor.getPredefinedCursor(cursor)); 91 + public void setWaitMode(boolean enableWaitMode) {
  92 + listener.setWaitMode(enableWaitMode);
84 } 93 }
  94 +
85 } 95 }
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelListener.java renamed to src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultTabListener.java
@@ -21,6 +21,6 @@ import eu.omp.irap.vespa.votable.gui.VOTablePanelListener; @@ -21,6 +21,6 @@ import eu.omp.irap.vespa.votable.gui.VOTablePanelListener;
21 /** 21 /**
22 * @author N. Jourdane 22 * @author N. Jourdane
23 */ 23 */
24 -public interface ResultPanelListener extends VOTablePanelListener { 24 +public interface ResultTabListener extends VOTablePanelListener {
25 25
26 } 26 }
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultsPanelCtrl.java 0 → 100644
@@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
  1 +/*
  2 + * This file is a part of EpnTAPClient.
  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
  5 + * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
  6 + *
  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
  9 + * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
  10 + * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY
  11 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12 + * PURPOSE. See the GNU General Public License for more details. You should have received a copy of
  13 + * the GNU General Public License along with this program. If not, see
  14 + * <http://www.gnu.org/licenses/>.
  15 + */
  16 +
  17 +package eu.omp.irap.vespa.epntapclient.gui.resultpanel;
  18 +
  19 +import java.util.List;
  20 +
  21 +import eu.omp.irap.vespa.epntapclient.epntap.service.ServicesList;
  22 +import eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelListener;
  23 +import eu.omp.irap.vespa.votable.gui.VOTablePanelView;
  24 +
  25 +/**
  26 + * @author N. Jourdane
  27 + */
  28 +public class ResultsPanelCtrl implements ResultsPanelListener {
  29 +
  30 + /** The listener of the main panel. */
  31 + private MainPanelListener listener;
  32 +
  33 + /** The result panel view. */
  34 + private ResultsPanelView view;
  35 +
  36 +
  37 + /**
  38 + * Constructor of ResultsPanelCtrl.
  39 + *
  40 + * @param listener The listener of the main panel.
  41 + */
  42 + public ResultsPanelCtrl(MainPanelListener listener) {
  43 + this.listener = listener;
  44 + view = new ResultsPanelView(this);
  45 + }
  46 +
  47 + /** @return The path of the VOTable related to the focused table. */
  48 + public String getFocusedVOTablePath() {
  49 + return ((VOTablePanelView) view.getSelectedComponent()).getVOTablePath();
  50 + }
  51 +
  52 + /** @return The view of the results panel. */
  53 + public ResultsPanelView getView() {
  54 + return view;
  55 + }
  56 +
  57 + /**
  58 + * Send a list of queries to the corresponding services.
  59 + *
  60 + * @param services The services targeted to send the queries
  61 + * @param queries The queries to send, in the same order that the list of services.
  62 + */
  63 + public void sendQueries(ServicesList services, List<String> queries) {
  64 + for (int i = 0; i < queries.size(); i++) {
  65 + String title = services.getTableNames().get(i).split("\\.")[0];
  66 + ResultTabCtrl resultCtrl = new ResultTabCtrl(listener, view, title);
  67 + resultCtrl.acquireVOTable(services.getTargetUrls().get(i), queries.get(i));
  68 + }
  69 + }
  70 +}
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultsPanelListener.java 0 → 100644
@@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
  1 +/*
  2 + * This file is a part of EpnTAPClient.
  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
  5 + * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
  6 + *
  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
  9 + * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
  10 + * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY
  11 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12 + * PURPOSE. See the GNU General Public License for more details. You should have received a copy of
  13 + * the GNU General Public License along with this program. If not, see
  14 + * <http://www.gnu.org/licenses/>.
  15 + */
  16 +
  17 +package eu.omp.irap.vespa.epntapclient.gui.resultpanel;
  18 +
  19 +
  20 +/**
  21 + *
  22 + * @author N. Jourdane
  23 + */
  24 +public interface ResultsPanelListener {
  25 +
  26 +}
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java renamed to src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultsPanelView.java
@@ -26,13 +26,13 @@ import eu.omp.irap.vespa.votable.votabledata.VOTableData; @@ -26,13 +26,13 @@ import eu.omp.irap.vespa.votable.votabledata.VOTableData;
26 /** 26 /**
27 * @author N. Jourdane 27 * @author N. Jourdane
28 */ 28 */
29 -public class ResultPanelView extends JTabbedPane { 29 +public class ResultsPanelView extends JTabbedPane {
30 30
31 /** The default serial version UID. */ 31 /** The default serial version UID. */
32 private static final long serialVersionUID = 1L; 32 private static final long serialVersionUID = 1L;
33 33
34 /** The listener of the result panel. */ 34 /** The listener of the result panel. */
35 - ResultPanelListener listener; 35 + ResultsPanelListener listener;
36 36
37 37
38 /** 38 /**
@@ -41,27 +41,8 @@ public class ResultPanelView extends JTabbedPane { @@ -41,27 +41,8 @@ public class ResultPanelView extends JTabbedPane {
41 * 41 *
42 * @param listener The listener of the result view. 42 * @param listener The listener of the result view.
43 */ 43 */
44 - public ResultPanelView(ResultPanelListener listener) { 44 + public ResultsPanelView(ResultsPanelListener listener) {
45 this.listener = listener; 45 this.listener = listener;
46 - buildResultPanel();  
47 - }  
48 -  
49 - /**  
50 - * Create a new tab and add a new VOTable into it.  
51 - *  
52 - * @param voTableData The VOTable data to add in a new tab.  
53 - */  
54 - public void addTable(VOTableData voTableData) {  
55 - VOTablePanelView voTablePanel = new VOTablePanelView(listener);  
56 - voTablePanel.fillTable(voTableData);  
57 - addTab(voTableData.getTitle(), voTablePanel);  
58 - }  
59 -  
60 - /**  
61 - * Build the panel and add graphical elements to it.  
62 - */  
63 - public void buildResultPanel() {  
64 - // setLayout(new BorderLayout());  
65 } 46 }
66 47
67 /** 48 /**
@@ -71,6 +52,11 @@ public class ResultPanelView extends JTabbedPane { @@ -71,6 +52,11 @@ public class ResultPanelView extends JTabbedPane {
71 return (VOTablePanelView) getComponentAt(getSelectedTab()); 52 return (VOTablePanelView) getComponentAt(getSelectedTab());
72 } 53 }
73 54
  55 + /** @return the VOTable view of each tab in the result panel. */
  56 + public VOTablePanelView[] getPanels() {
  57 + return (VOTablePanelView[]) getComponents();
  58 + }
  59 +
74 /** 60 /**
75 * @return The index of the selected tab. 61 * @return The index of the selected tab.
76 */ 62 */
src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java
@@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
16 16
17 package eu.omp.irap.vespa.epntapclient.gui.servicespanel; 17 package eu.omp.irap.vespa.epntapclient.gui.servicespanel;
18 18
19 -import java.awt.Cursor;  
20 import java.util.ArrayList; 19 import java.util.ArrayList;
21 import java.util.Arrays; 20 import java.util.Arrays;
22 import java.util.List; 21 import java.util.List;
@@ -57,13 +56,11 @@ public class ServicesPanelCtrl extends VOTableCtrl implements ServicesPanelListe @@ -57,13 +56,11 @@ public class ServicesPanelCtrl extends VOTableCtrl implements ServicesPanelListe
57 view = new ServicesPanelView(this); 56 view = new ServicesPanelView(this);
58 } 57 }
59 58
60 - /**  
61 - * Download and parse the list of services.  
62 - */ 59 + /** Download and parse the list of services. */
63 public void acquire() { 60 public void acquire() {
64 String getServicesQuery = String.format(Queries.SELECT_ALL_TAP_SERVICES_WHERE_CORE, 61 String getServicesQuery = String.format(Queries.SELECT_ALL_TAP_SERVICES_WHERE_CORE,
65 ServiceCore.EPNCORE); 62 ServiceCore.EPNCORE);
66 - acquireVOTable(Consts.DEFAULT_REGISTRY_URL, getServicesQuery, false); 63 + acquireVOTable(Consts.DEFAULT_REGISTRY_URL, getServicesQuery);
67 } 64 }
68 65
69 @Override 66 @Override
@@ -77,7 +74,7 @@ public class ServicesPanelCtrl extends VOTableCtrl implements ServicesPanelListe @@ -77,7 +74,7 @@ public class ServicesPanelCtrl extends VOTableCtrl implements ServicesPanelListe
77 } 74 }
78 75
79 @Override 76 @Override
80 - public void fillTable() { 77 + public void displayTable() {
81 view.fillTable(voTableData); 78 view.fillTable(voTableData);
82 } 79 }
83 80
@@ -129,8 +126,7 @@ public class ServicesPanelCtrl extends VOTableCtrl implements ServicesPanelListe @@ -129,8 +126,7 @@ public class ServicesPanelCtrl extends VOTableCtrl implements ServicesPanelListe
129 } 126 }
130 127
131 @Override 128 @Override
132 - public void setWaitCursor(boolean enableWaitcursor) {  
133 - int cursor = enableWaitcursor ? Cursor.WAIT_CURSOR : Cursor.DEFAULT_CURSOR;  
134 - view.setCursor(Cursor.getPredefinedCursor(cursor)); 129 + public void setWaitMode(boolean enableWaitMode) {
  130 + listener.setWaitMode(enableWaitMode);
135 } 131 }
136 } 132 }