diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/RequestCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/RequestCtrl.java index 77c6f6a..70ae6fa 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/RequestCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/RequestCtrl.java @@ -36,8 +36,12 @@ public class RequestCtrl { /** The URL of the resolver used for the `target name` field. */ private static final String RESOLVER_URL = "http://voparis-registry.obspm.fr/ssodnet/1/autocomplete"; + /** The text in the query to replaced by the actual table name. */ + protected static final String TABLE_NAME_KEYWORD = "#tablename#"; + /** The query template to get granules. */ - private static final String QUERY = "SELECT TOP %s target_name, target_class FROM %s%s"; + private static final String QUERY = "SELECT DISTINCT TOP %s %s FROM " + TABLE_NAME_KEYWORD + + "%s"; /** The parameters fields for the request. */ protected Map parameters = new HashMap<>(); @@ -63,10 +67,10 @@ public class RequestCtrl { /** * Build an ADQL from the table name, the parameter values and the max results. * - * @param tableName The name of the table, to put in FROM keyword. + * @param tableName The names of the tables, to put in the FROM keyword. * @return The query. */ - public String buildQuery(String tableName) { + public String buildQuery(List columnNames) { StringJoiner addJoin = new StringJoiner(" AND "); for (Map.Entry param : parameters.entrySet()) { if (param.getValue() instanceof ArrayList) { @@ -84,8 +88,7 @@ public class RequestCtrl { } } String where = addJoin.isEmpty() ? "" : " WHERE " + addJoin; - - return String.format(QUERY, nbMaxResult, tableName, where); + return String.format(QUERY, nbMaxResult, StringJoiner.join(columnNames), where); } /** @@ -132,7 +135,7 @@ public class RequestCtrl { /** * Get the parameters. - * + * * @return A map of couple . */ public Map getParameters() { diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java index ec5475a..58d4ed4 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java @@ -16,6 +16,7 @@ package eu.omp.irap.vespa.epntapclient.gui.mainpanel; +import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -26,11 +27,12 @@ import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelCtrl; import eu.omp.irap.vespa.epntapclient.gui.resultpanel.ResultPanelCtrl; import eu.omp.irap.vespa.epntapclient.gui.servicespanel.ServicesPanelCtrl; import eu.omp.irap.vespa.votable.controller.VOTableException; +import eu.omp.irap.vespa.votable.utils.StringJoiner; /** * @author N. Jourdane */ -public class MainPanelCtrl extends EpnTapController { +public class MainPanelCtrl extends EpnTapController implements MainPanelListener { /** The logger for the class GUIController. */ private static final Logger LOGGER = Logger.getLogger(MainPanelCtrl.class.getName()); @@ -53,7 +55,7 @@ public class MainPanelCtrl extends EpnTapController { */ public MainPanelCtrl() { servicesPanelCtrl = new ServicesPanelCtrl(this); - resultPanelCtrl = new ResultPanelCtrl(this); + resultPanelCtrl = new ResultPanelCtrl(); requestPanelCtrl = new RequestPanelCtrl(this); view = new MainPanelView(this); } @@ -74,10 +76,10 @@ public class MainPanelCtrl extends EpnTapController { * @param query The query to send. */ public void sendQuery(String query) { - String serviceURL = servicesPanelCtrl.getSelectedServiceURL(); - LOGGER.info("Sending query: " + query + " on " + serviceURL); + List selectedServicesUrls = servicesPanelCtrl.getSelectedServicesUrls(); + LOGGER.info("Sending query: " + query + " on " + StringJoiner.join(selectedServicesUrls)); try { - resultPanelCtrl.updateVOTable(serviceURL, query); + resultPanelCtrl.updateVOTable(StringJoiner.join(selectedServicesUrls), query); view.getResultsPanel().fillTable(resultPanelCtrl.getVOTableData()); } catch (VOTableException e) { displayError("Can not send the query.", e); @@ -118,4 +120,29 @@ public class MainPanelCtrl extends EpnTapController { LOGGER.log(Level.SEVERE, message, e); JOptionPane.showMessageDialog(view, e.getMessage(), message, JOptionPane.ERROR_MESSAGE); } + + @Override + public void updateQuery() { + requestPanelCtrl.updateQueryArea(); + } + + @Override + public void sendQuery() { + List servicesUrls = servicesPanelCtrl.getSelectedServicesUrls(); + List tableNames = servicesPanelCtrl.getSelectedTablesNames(); + try { + for (int i = 0; i < servicesUrls.size(); i++) { + String query = requestPanelCtrl.getQuery(tableNames.get(i)); + resultPanelCtrl.updateVOTable(servicesUrls.get(i), query); + } + } catch (VOTableException e) { + displayError("Can not update the VOTable.", e); + } + resultPanelCtrl.getView().fillTable(resultPanelCtrl.getVOTableData()); + } + + @Override + public List getTableNames() { + return servicesPanelCtrl.getSelectedTablesNames(); + } } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelListener.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelListener.java new file mode 100644 index 0000000..79a236c --- /dev/null +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelListener.java @@ -0,0 +1,31 @@ +/* + * This file is a part of EpnTAPClient. + * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. + * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 + * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. + * + * This program is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 3 of the License, or (at your option) any later + * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. You should have received a copy of + * the GNU General Public License along with this program. If not, see + * . + */ + +package eu.omp.irap.vespa.epntapclient.gui.mainpanel; + +import java.util.List; + +/** + * @author N. Jourdane + */ +public interface MainPanelListener { + + void updateQuery(); + + void sendQuery(); + + List getTableNames(); +} diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelCtrl.java index 6973762..c0a7662 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelCtrl.java @@ -16,10 +16,15 @@ package eu.omp.irap.vespa.epntapclient.gui.requestpanel; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; import java.util.logging.Logger; +import javax.swing.JOptionPane; + import eu.omp.irap.vespa.epntapclient.RequestCtrl; -import eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelCtrl; +import eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelListener; /** * @author N. Jourdane @@ -30,7 +35,7 @@ public class RequestPanelCtrl extends RequestCtrl implements RequestPanelListene private static final Logger LOGGER = Logger.getLogger(RequestPanelCtrl.class.getName()); /** The controller of the main panel. */ - private MainPanelCtrl mainPanelCtrl; + private MainPanelListener listener; /** The view of the request panel. */ private RequestPanelView view; @@ -39,10 +44,10 @@ public class RequestPanelCtrl extends RequestCtrl implements RequestPanelListene /** * Constructor of RequestPanelCtrl * - * @param mainPanelCtrl The controller of the main panel. + * @param listener The listener of the main view. */ - public RequestPanelCtrl(MainPanelCtrl mainPanelCtrl) { - this.mainPanelCtrl = mainPanelCtrl; + public RequestPanelCtrl(MainPanelListener listener) { + this.listener = listener; view = new RequestPanelView(this); } @@ -53,16 +58,28 @@ public class RequestPanelCtrl extends RequestCtrl implements RequestPanelListene return view; } + /** + * @return The text contained in the query area. + */ + public String getQuery(String tableName) { + return view.getQueryArea().getText().replace(TABLE_NAME_KEYWORD, tableName); + } + @Override - public void onSendButtonClicked(String query) { - mainPanelCtrl.sendQuery(query); + public void onSendButtonClicked() { + listener.sendQuery(); } /** * Update the query area with a working ADQL query, based on the parameters list. */ public void updateQueryArea() { - String query = buildQuery(mainPanelCtrl.getServicePanelCtrl().getSelectedTableName()); + // TODO: several services + // TODO: Add panel to enter column names. + List columnNames = new ArrayList<>(); + columnNames.add("target_name"); + columnNames.add("target_class"); + String query = buildQuery(columnNames); view.updateQueryArea(query); } @@ -79,4 +96,10 @@ public class RequestPanelCtrl extends RequestCtrl implements RequestPanelListene updateQueryArea(); LOGGER.info("uploaded " + paramName + ": " + paramValue); } + + @Override + public void onError(Exception e) { + LOGGER.log(Level.SEVERE, e.getMessage(), e); + JOptionPane.showMessageDialog(view, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); + } } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelListener.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelListener.java index 646ecd9..aa73e3e 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelListener.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelListener.java @@ -23,10 +23,8 @@ public interface RequestPanelListener { /** * Method called when the used click on the 'Send query' button. - * - * @param query The query */ - void onSendButtonClicked(String query); + void onSendButtonClicked(); /** * Method called when the user remove a parameter with a parameter field. @@ -43,4 +41,11 @@ public interface RequestPanelListener { */ void onParameterChanged(String paramName, Object paramValue); + /** + * Display an error to the user. + * + * @param e The error to display to the user. + */ + public void onError(Exception e); + } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelView.java index e21de23..d2e2ae7 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelView.java @@ -52,7 +52,7 @@ public class RequestPanelView extends JPanel { RequestPanelListener listener; /** The text area where the user write the query. */ - protected JTextArea queryArea; + private JTextArea queryArea; /** The parameters fields for the request. */ private List paramFields; @@ -122,7 +122,7 @@ public class RequestPanelView extends JPanel { @Override public void actionPerformed(ActionEvent e) { - listener.onSendButtonClicked(queryArea.getText()); + listener.onSendButtonClicked(); } }); } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetNameField.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetNameField.java index c0ab63c..7b2d8b6 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetNameField.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetNameField.java @@ -83,7 +83,7 @@ public class TargetNameField extends ParamField implements TextFieldListener { this(new RequestPanelListener() { @Override - public void onSendButtonClicked(String query) { + public void onSendButtonClicked() { /** No SendButtonClicked event, we just want the field itself. */ } @@ -96,6 +96,11 @@ public class TargetNameField extends ParamField implements TextFieldListener { public void onParameterChanged(String paramName, Object paramValue) { /** No ParameterChanged event, we just want the field itself. */ } + + @Override + public void onError(Exception e) { + /** No Error event, we just want the field itself. */ + } }, paraName); } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java index b9eaa1d..0dbef22 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java @@ -20,10 +20,15 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.List; +import java.util.logging.Level; import java.util.logging.Logger; -import eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelCtrl; +import javax.swing.JOptionPane; + import eu.omp.irap.vespa.votable.controller.VOTableController; +import eu.omp.irap.vespa.votable.controller.VOTableException.CantSaveVOTableException; +import eu.omp.irap.vespa.votable.utils.StringJoiner; /** * @author N. Jourdane @@ -33,29 +38,23 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis /** The logger for the class ResultPanelCtrl. */ private static final Logger LOGGER = Logger.getLogger(ResultPanelCtrl.class.getName()); - /** The controller of the main panel. */ - private MainPanelCtrl mainPanelCtrl; - /** The result panel view. */ private ResultPanelView view; /** * Constructor of ResultPanelCtrl. - * - * @param mainPanelCtrl The controller of the main panel. */ - public ResultPanelCtrl(MainPanelCtrl mainPanelCtrl) { - this.mainPanelCtrl = mainPanelCtrl; + public ResultPanelCtrl() { view = new ResultPanelView(this); } @Override - public void onDownloadButtonClicked(File file) { + public void onDownloadButtonClicked(File file) throws CantSaveVOTableException { try { Files.copy(Paths.get(voTablePath), Paths.get(file.getAbsolutePath())); } catch (IOException e) { - mainPanelCtrl.displayError("Can not save the file.", e); + throw new CantSaveVOTableException(file.getAbsolutePath(), e); } } @@ -67,7 +66,13 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis } @Override - public void onRowSelected(int selectedRow) { - LOGGER.info("Selected row: " + selectedRow); + public void onRowsSelected(List selectedRows) { + LOGGER.info("Selected row: " + StringJoiner.join(selectedRows)); + } + + @Override + public void onError(Exception e) { + LOGGER.log(Level.SEVERE, e.getMessage(), e); + JOptionPane.showMessageDialog(view, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelListener.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelListener.java index 87ed34d..7856f28 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelListener.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelListener.java @@ -18,6 +18,7 @@ package eu.omp.irap.vespa.epntapclient.gui.resultpanel; import java.io.File; +import eu.omp.irap.vespa.votable.controller.VOTableException.CantSaveVOTableException; import eu.omp.irap.vespa.votable.view.VOTableViewListener; /** @@ -26,10 +27,18 @@ import eu.omp.irap.vespa.votable.view.VOTableViewListener; public interface ResultPanelListener extends VOTableViewListener { /** - * Copy the VOTable to a specified location. + * This method is called when the user clicks on the download button. * * @param file The file selected by the user in the FileChooser pop-up, corresponding to the * place where save the VOTable. + * @throws CantSaveVOTableException The VOTable can not be saved at the specified location. */ - public void onDownloadButtonClicked(File file); + public void onDownloadButtonClicked(File file) throws CantSaveVOTableException; + + /** + * Display an error to the user. + * + * @param e The error to display to the user. + */ + public void onError(Exception e); } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java index d150004..e0a9382 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java @@ -25,6 +25,7 @@ import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JPanel; +import eu.omp.irap.vespa.votable.controller.VOTableException.CantSaveVOTableException; import eu.omp.irap.vespa.votable.view.VOTableView; /** @@ -96,10 +97,14 @@ public class ResultPanelView extends VOTableView { fileButton.addActionListener(new ActionListener() { @Override - public void actionPerformed(ActionEvent e) { + public void actionPerformed(ActionEvent evt) { final JFileChooser fc = new JFileChooser(); fc.showOpenDialog(ResultPanelView.this); - listener.onDownloadButtonClicked(fc.getSelectedFile()); + try { + listener.onDownloadButtonClicked(fc.getSelectedFile()); + } catch (CantSaveVOTableException e) { + listener.onError(e); + } } }); } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java index d166cd2..4b4f461 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java @@ -16,13 +16,16 @@ package eu.omp.irap.vespa.epntapclient.gui.servicespanel; +import java.util.ArrayList; +import java.util.List; import java.util.logging.Logger; -import eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelCtrl; +import eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelListener; import eu.omp.irap.vespa.epntapclient.service.Queries; import eu.omp.irap.vespa.epntapclient.service.ServiceCore; import eu.omp.irap.vespa.votable.Consts; import eu.omp.irap.vespa.votable.controller.VOTableController; +import eu.omp.irap.vespa.votable.utils.StringJoiner; /** * @author N. Jourdane @@ -32,26 +35,32 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane /** The logger for the class ServicesPanelCtrl. */ private static final Logger LOGGER = Logger.getLogger(ServicesPanelCtrl.class.getName()); - /** The controller of the main panel. */ - private MainPanelCtrl mainPanelCtrl; + /** The position of the column displaying the table names in the service table. */ + private static final int TABLE_NAME_COLUMN_POSITION = 4; + + /** The position of the column displaying the services target URLs in the service table. */ + private static final int SERVICE_URL_COLUMN_POSITION = 1; /** The view of the services panel. */ private ServicesPanelView view; - /** The name of the table selected by the user on the table list panel. */ - private String selectedTableName; + /** The list of services table names selected by the user on the service panel. */ + private List selectedTablesNames; + + /** The list of services target Urls selected by the user on the service panel. */ + private List selectedServicesUrls; - /** The URL of the service corresponding to the selected table. */ - private String selectedServiceURL; + /** The listener of the main panel. */ + private MainPanelListener listener; /** * Constructor of ServicesPanelCtrl * - * @param mainPanelCtrl The controller of the main panel. + * @param listener The listener of the main panel. */ - public ServicesPanelCtrl(MainPanelCtrl mainPanelCtrl) { - this.mainPanelCtrl = mainPanelCtrl; + public ServicesPanelCtrl(MainPanelListener listener) { + this.listener = listener; targetURL = Consts.DEFAULT_REGISTRY_URL; query = String.format(Queries.SELECT_ALL_TAP_SERVICES_WHERE_CORE, ServiceCore.EPNCORE); view = new ServicesPanelView(this); @@ -65,30 +74,41 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane } /** - * @return The table name of the service selected by the user on the services table list. + * @return The list of services table names selected by the user on the service panel. */ - public String getSelectedTableName() { - return selectedTableName; + public List getSelectedTablesNames() { + return selectedTablesNames; } /** - * @return The access URL of the service selected by the user on the services table list. + * @return The list of services target Urls selected by the user on the service panel. */ - public String getSelectedServiceURL() { - return selectedServiceURL; + public List getSelectedServicesUrls() { + return selectedServicesUrls; } @Override - public void onRowSelected(int selectedServiceRow) { - String serviceURL = view.getServiceURL(selectedServiceRow); - String tableName = view.getTableName(selectedServiceRow); - if (!tableName.equals(selectedTableName)) { - selectedServiceURL = serviceURL; - selectedTableName = tableName; - mainPanelCtrl.getRequestPanelCtrl().updateQueryArea(); - LOGGER.info( - "Selected table: " + selectedTableName + " - service: " + selectedServiceURL); + public void onRowsSelected(List selectedRows) { + List servicesUrls = new ArrayList<>(); + List tableNames = new ArrayList<>(); + String customServiceUrl = view.getServiceUrlTextField().getText(); + String customTableName = view.getTableNameTextField().getText(); + + for (int row : selectedRows) { + servicesUrls.add((String) view.getValueAt(SERVICE_URL_COLUMN_POSITION, row)); + tableNames.add((String) view.getValueAt(TABLE_NAME_COLUMN_POSITION, row)); + } + if (!customServiceUrl.isEmpty() && !customTableName.isEmpty()) { + servicesUrls.add(customServiceUrl); + tableNames.add(customTableName); } + + selectedServicesUrls = servicesUrls; + selectedTablesNames = tableNames; + LOGGER.info("Selected services URLs: " + StringJoiner.join(selectedServicesUrls)); + LOGGER.info("Selected tables names: " + StringJoiner.join(selectedTablesNames)); + + listener.updateQuery(); } } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelListener.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelListener.java index 58c2e83..a7d876d 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelListener.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelListener.java @@ -22,5 +22,5 @@ import eu.omp.irap.vespa.votable.view.VOTableViewListener; * @author N. Jourdane */ public interface ServicesPanelListener extends VOTableViewListener { - /* Nothing to listen yet except service selection, listened by VOTableViewListener. */ + } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelView.java index 4c2427e..21a9c27 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelView.java @@ -32,12 +32,6 @@ import eu.omp.irap.vespa.votable.view.VOTableView; */ public class ServicesPanelView extends VOTableView { - /** */ - private static final int TABLE_NAME_COLUMN_POSITION = 4; - - /** */ - private static final int SERVICE_URL_COLUMN_POSITION = 1; - /** The serial version UID. */ private static final long serialVersionUID = 1L; @@ -86,7 +80,7 @@ public class ServicesPanelView extends VOTableView { * * @return The table name JTextField. */ - private JTextField getTableNameTextField() { + public JTextField getTableNameTextField() { return tableNameTextField == null ? new JTextField(10) : tableNameTextField; } @@ -95,7 +89,7 @@ public class ServicesPanelView extends VOTableView { * * @return The service URL JTextField. */ - private JTextField getServiceUrlTextField() { + public JTextField getServiceUrlTextField() { return serviceUrlTextField == null ? new JTextField(10) : serviceUrlTextField; } @@ -113,32 +107,11 @@ public class ServicesPanelView extends VOTableView { @Override public void actionPerformed(ActionEvent e) { - listener.onRowSelected(-1); + listener.onRowsSelected(null); } }); } return serviceButton; } - /** - * @param row The row index in the JTable element. - * @return The URL of the service corresponding to the row. - */ - public String getServiceURL(int row) { - if (row == -1) { - return serviceUrlTextField.getText(); - } - return (String) getValueAt(SERVICE_URL_COLUMN_POSITION, row); - } - - /** - * @param row The row index in the JTable element. - * @return The table name of the service corresponding to the row. - */ - public String getTableName(int row) { - if (row == -1) { - return tableNameTextField.getText(); - } - return (String) getValueAt(TABLE_NAME_COLUMN_POSITION, row); - } } -- libgit2 0.21.2