From 5af53be70ea4e57d24f2f054740499e3ce2f69f8 Mon Sep 17 00:00:00 2001 From: Nathanael Jourdane Date: Mon, 14 Mar 2016 11:14:27 +0100 Subject: [PATCH] Make the application more MVC. --- src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java | 2 +- src/main/java/eu/omp/irap/vespa/epntapclient/controller/EpnTapController.java | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------- src/main/java/eu/omp/irap/vespa/epntapclient/view/BottomBar.java | 44 -------------------------------------------- src/main/java/eu/omp/irap/vespa/epntapclient/view/Dim.java | 42 ++++++++++++++++++++++++++++++++++++++++++ src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java | 112 +++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------- src/main/java/eu/omp/irap/vespa/epntapclient/view/Event.java | 24 ++++++++++++++++++++++++ src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------- src/main/java/eu/omp/irap/vespa/epntapclient/view/RequestView.java | 174 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/BottomBarPanel.java | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/RequestPanel.java | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java | 4 ++++ 13 files changed, 558 insertions(+), 340 deletions(-) delete mode 100644 src/main/java/eu/omp/irap/vespa/epntapclient/view/BottomBar.java create mode 100644 src/main/java/eu/omp/irap/vespa/epntapclient/view/Dim.java create mode 100644 src/main/java/eu/omp/irap/vespa/epntapclient/view/Event.java delete mode 100644 src/main/java/eu/omp/irap/vespa/epntapclient/view/RequestView.java create mode 100644 src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/BottomBarPanel.java create mode 100644 src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/RequestPanel.java create mode 100644 src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java create mode 100644 src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java index 4504b54..c9584eb 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java @@ -45,8 +45,8 @@ public class EpnTapMainApp { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - EpnTapController epnTapControl = new EpnTapController(); logger.info("Lauching EPN-TAP application..."); + EpnTapController epnTapControl = new EpnTapController(); if (args.length != 0) { System.console().writer().println("Usage: EpnTapMainApp"); return; diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/controller/EpnTapController.java b/src/main/java/eu/omp/irap/vespa/epntapclient/controller/EpnTapController.java index 6c442ef..e562345 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/controller/EpnTapController.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/controller/EpnTapController.java @@ -16,24 +16,28 @@ package eu.omp.irap.vespa.epntapclient.controller; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; import java.util.logging.Logger; import eu.omp.irap.vespa.epntapclient.utils.Const; import eu.omp.irap.vespa.epntapclient.utils.Queries; import eu.omp.irap.vespa.epntapclient.view.EpnTapMainView; +import eu.omp.irap.vespa.epntapclient.view.EpnTapMainView.MainViewListener; +import eu.omp.irap.vespa.epntapclient.view.Event; import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableController; import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException; -import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; /** * @author N. Jourdane */ -public class EpnTapController { +public class EpnTapController implements MainViewListener { /** The logger for the class EpnTapController. */ Logger logger = Logger.getLogger(EpnTapController.class.getName()); /** The view of EPN-TAP application. */ - EpnTapMainView view; + EpnTapMainView mainView; /** The controller of the VOTable displaying the list of services. */ VOTableController servicesController; @@ -48,17 +52,21 @@ public class EpnTapController { String selectedTableServiceURL; /** + * The parameters fields for the request. + */ + private Map paramValues = new HashMap<>(); + + /** * Method constructor */ public EpnTapController() { servicesController = new VOTableController(Const.DEFAULT_REGISTRY_URL, "ADQL", Queries.GET_EPN_TAP_SERVICES); - resultsController = new VOTableController(); - VOTableView serviceView = servicesController.getView(); - VOTableView resultsView = resultsController.getView(); - view = new EpnTapMainView(this, serviceView, resultsView); + mainView = new EpnTapMainView(this, servicesController.getView(), + resultsController.getView()); + mainView.addMainViewListener(this); updateSelected(0); } @@ -66,7 +74,7 @@ public class EpnTapController { * @return the EPN-TAP view. */ public EpnTapMainView getView() { - return view; + return mainView; } /** @@ -87,19 +95,32 @@ public class EpnTapController { * @param row The row selected by the user on the Jtable. */ public void updateSelected(int row) { - String serviceURL = (String) view.getServicesView().getValueAt(5, row); - String tableName = (String) view.getServicesView().getValueAt(2, row); + String serviceURL = mainView.getServicesPanel().getServiceURL(row); + String tableName = mainView.getServicesPanel().getTableName(row); if (!tableName.equals(selectedTableName)) { selectedTableServiceURL = serviceURL; selectedTableName = tableName; - view.getRequestView().updateQueryArea(); + updateQueryArea(); logger.info("Selected table: " + selectedTableName + " - service: " + selectedTableServiceURL); } } - public String getSelectedTable() { - return selectedTableName; + public void removeParameter(String paramName) { + paramValues.remove(paramName); + updateQueryArea(); + logger.info("removed " + paramName); + } + + public void updateParameter(String paramName, Object value) { + paramValues.put(paramName, value); + updateQueryArea(); + logger.info("uploaded " + paramName + ": " + value); + } + + private void updateQueryArea() { + String query = Queries.getQuery(selectedTableName, paramValues, 10); + mainView.getRequestPanel().updateQueryArea(query); } /** @@ -110,4 +131,35 @@ public class EpnTapController { logger.info("Sending query: " + query + " on " + selectedTableServiceURL); resultsController.fillTable(selectedTableServiceURL, "ADQL", query); } + + /** + * @param event + * @param args + */ + public void event(Event event, Object[] args) { + logger.info("new event: " + event.toString()); + + try { + switch (event) { + case serviceSelected: + updateSelected((int) args[0]); + break; + case btnSearchClicked: + sendQuery((String) args[0]); + break; + case paramChanged: + updateParameter((String) args[0], args[1]); + break; + case paramRemoved: + removeParameter((String) args[0]); + break; + default: + logger.warning("Event " + event.toString() + " detected but is not implemented."); + } + } catch (Exception e) { + mainView.displayError("Error", "An unexpected error occured: " + e.getMessage() + + ".\nPlease report it to the developper team."); + logger.log(Level.SEVERE, "Error occured when " + event.toString(), e); + } + } } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/BottomBar.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/BottomBar.java deleted file mode 100644 index a0d364a..0000000 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/view/BottomBar.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.view; - -import java.awt.BorderLayout; -import java.util.logging.Logger; - -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; - -/** - * @author N. Jourdane - */ -public class BottomBar extends JPanel { - /** The logger for the class BottomBar. */ - private static final Logger logger = Logger.getLogger(BottomBar.class.getName()); - JLabel infoLabel; - - BottomBar(EpnTapMainView mainView) { - setLayout(new BorderLayout()); - infoLabel = new JLabel(); - this.add(infoLabel); - this.add(new JButton("Get File"), BorderLayout.EAST); - } - - public void setInfoText(String infoText) { - infoLabel.setText(infoText); - } -} diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/Dim.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/Dim.java new file mode 100644 index 0000000..ad8d499 --- /dev/null +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/Dim.java @@ -0,0 +1,42 @@ +/* + * 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.view; + +/** + * A simple class containing GUI panel and elements dimensions. + * + * @author N. Jourdane + */ +public class Dim { + /** The width of the left panel (services view). */ + public static final int LEFT_PANEL_WIDTH = 400; + /** The minimum width of the left panel (services view). */ + public static final int LEFT_PANEL_MIN_WIDTH = 150; + /** The width of the right panel (request view). */ + public static final int RIGHT_PANEL_WIDTH = 400; + /** The minimum width of the right panel (request view). */ + public static final int RIGHT_PANEL_MIN_WIDTH = 220; + + /** The height of the top panel (request view and services view). */ + public static final int TOP_PANEL_HEIGHT = 250; + /** The minimum height of the top panel (request view and services view). */ + public static final int TOP_PANEL_MIN_HEIGHT = 190; + /** The height of the bottom panel (result view). */ + public static final int BOTTOM_PANEL_HEIGHT = 150; + /** The minimum height of the bottom panel (result view). */ + public static final int BOTTOM_PANEL_MIN_HEIGHT = 100; +} diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java index 25c22b9..6d04351 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java @@ -17,16 +17,17 @@ package eu.omp.irap.vespa.epntapclient.view; import java.awt.BorderLayout; -import java.awt.Dimension; import java.util.logging.Logger; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JSplitPane; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; import eu.omp.irap.vespa.epntapclient.controller.EpnTapController; +import eu.omp.irap.vespa.epntapclient.view.panels.BottomBarPanel; +import eu.omp.irap.vespa.epntapclient.view.panels.RequestPanel; +import eu.omp.irap.vespa.epntapclient.view.panels.ResultsPanel; +import eu.omp.irap.vespa.epntapclient.view.panels.ServicesPanel; import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; /** @@ -39,124 +40,89 @@ public class EpnTapMainView extends JPanel { /** The serial version UID (affected with a random number). */ private static final long serialVersionUID = -1233290271099283814L; + /** The main EPN-TAP main controller */ + private EpnTapController controller; + /** The JPanel where the VOTable results is displayed. */ - private VOTableView resultsView; + private ResultsPanel resultsPanel; /** The JPanel where the list of services is displayed. */ - private VOTableView servicesView; + private ServicesPanel servicesPanel; /** The JPanel where the user put requests. */ - private RequestView requestView; + private RequestPanel requestPanel; /** The JPanel where the user put requests. */ - private BottomBar bottomBar; + private BottomBarPanel bottomBarPanel; - /** The main EPN-TAP main controller */ - private EpnTapController controller; + private MainViewListener mainViewListener; - /** The width of the left panel (services view). */ - static final int LEFT_PANEL_WIDTH = 400; - /** The minimum width of the left panel (services view). */ - static final int LEFT_PANEL_MIN_WIDTH = 150; - /** The width of the right panel (request view). */ - static final int RIGHT_PANEL_WIDTH = 400; - /** The minimum width of the right panel (request view). */ - static final int RIGHT_PANEL_MIN_WIDTH = 220; - - /** The height of the top panel (request view and services view). */ - static final int TOP_PANEL_HEIGHT = 250; - /** The minimum height of the top panel (request view and services view). */ - static final int TOP_PANEL_MIN_HEIGHT = 190; - /** The height of the bottom panel (result view). */ - static final int BOTTOM_PANEL_HEIGHT = 150; - /** The minimum height of the bottom panel (result view). */ - static final int BOTTOM_PANEL_MIN_HEIGHT = 100; + public interface MainViewListener { + void event(Event event, Object... args); + } /** - * The constructor of the view. + * The constructor of the view. TODO: controlleur = écouteur de la vue * * @param controller The EPN-TAP controller, allowing the EPN-TAP view to send events. - * @param servicesView The JPanel representing the table of services. - * @param resultsView The JPanel representing the table of results. */ - public EpnTapMainView(final EpnTapController controller, final VOTableView servicesView, - VOTableView resultsView) { + + public EpnTapMainView(final EpnTapController controller, VOTableView voTableServicesView, + VOTableView voTableResultsView) { this.controller = controller; - this.servicesView = servicesView; - this.resultsView = resultsView; - this.requestView = new RequestView(this); - this.bottomBar = new BottomBar(this); + this.servicesPanel = new ServicesPanel(this, voTableServicesView); + this.resultsPanel = new ResultsPanel(this, voTableResultsView); + this.requestPanel = new RequestPanel(this); + this.bottomBarPanel = new BottomBarPanel(this); setLayout(new BorderLayout()); buildWindow(); - - // TODO: Support multi-selection - servicesView.getTable().getSelectionModel() - .addListSelectionListener(new ListSelectionListener() { - public void valueChanged(ListSelectionEvent evt) { - controller.updateSelected(servicesView.getTable().getSelectedRow()); - } - }); } - /** - * @return The main EPNT-TAP controller. - */ - public EpnTapController getController() { - return controller; + public void addMainViewListener(MainViewListener listener) { + mainViewListener = listener; } /** * @return The JPanel where the VOTable results is displayed. */ - public VOTableView getResultsView() { - return resultsView; + public ResultsPanel getResultsPanel() { + return resultsPanel; } /** * @return The JPanel where the GUI elements to make the request are displayed. */ - public RequestView getRequestView() { - return requestView; + public RequestPanel getRequestPanel() { + return requestPanel; } /** * @return The JPanel where the list of services is displayed. */ - public VOTableView getServicesView() { - return servicesView; + public ServicesPanel getServicesPanel() { + return servicesPanel; } /** * @return The JPanel where the list of services is displayed. */ - public BottomBar getBottomBar() { - return bottomBar; + public BottomBarPanel getBottomBarPanel() { + return bottomBarPanel; } /** * Build and fill the GUI. */ public void buildWindow() { - JSplitPane northPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, servicesView, - requestView); - - servicesView.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, TOP_PANEL_HEIGHT)); - servicesView.setMinimumSize(new Dimension(LEFT_PANEL_MIN_WIDTH, TOP_PANEL_MIN_HEIGHT)); + JSplitPane northPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, servicesPanel, + requestPanel); // TODO: put requestView inside a JScrollPane. - requestView.setPreferredSize(new Dimension(RIGHT_PANEL_WIDTH, TOP_PANEL_HEIGHT)); - requestView.setMinimumSize(new Dimension(RIGHT_PANEL_MIN_WIDTH, TOP_PANEL_MIN_HEIGHT)); - resultsView.setPreferredSize( - new Dimension(LEFT_PANEL_WIDTH + RIGHT_PANEL_WIDTH, BOTTOM_PANEL_HEIGHT)); - resultsView.setMinimumSize( - new Dimension(LEFT_PANEL_MIN_WIDTH + RIGHT_PANEL_MIN_WIDTH, - BOTTOM_PANEL_MIN_HEIGHT)); - - JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, northPanel, resultsView); + JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, northPanel, resultsPanel); add(mainPanel, BorderLayout.CENTER); - add(bottomBar, BorderLayout.SOUTH); + add(bottomBarPanel, BorderLayout.SOUTH); } /** @@ -170,4 +136,8 @@ public class EpnTapMainView extends JPanel { JOptionPane.ERROR_MESSAGE); } + public void event(Event event, Object... args) { + mainViewListener.event(event, args); + } + } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/Event.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/Event.java new file mode 100644 index 0000000..945be06 --- /dev/null +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/Event.java @@ -0,0 +1,24 @@ +/* + * 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.view; + +/** + * @author N. Jourdane + */ +public enum Event { + serviceSelected, btnSearchClicked, paramRemoved, paramChanged; +} diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java index 87c2651..fb906cb 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java @@ -61,11 +61,15 @@ public abstract class ParamField extends JPanel { private static final String MIN_SUFFIX = "min"; private static final String MAX_SUFFIX = "max"; - protected static RequestView requestView; + protected static EpnTapMainView mainView; protected String paramName; - public ParamField(RequestView requestView, String paramName) { + public ParamField(EpnTapMainView mainView, String paramName) { super(); + + this.mainView = mainView; + this.paramName = paramName; + this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.setMaximumSize(new Dimension(MAX_FIELD_WIDTH, FIELD_HEIGHT)); String strLabel = paramName.replaceAll("_", " ").trim(); @@ -73,15 +77,13 @@ public abstract class ParamField extends JPanel { label.setPreferredSize(new Dimension(LABEL_WIDTH, FIELD_HEIGHT)); this.add(label); // TODO: Add tooltip text based on rr.table_column.column_description - this.requestView = requestView; - this.paramName = paramName; } public static class StringField extends ParamField implements TextFieldListener { JTextField field; - StringField(RequestView requestView, String paramName) { - super(requestView, paramName); + public StringField(EpnTapMainView mainView, String paramName) { + super(mainView, paramName); field = new JTextField(); addChangeListener(this, field); this.add(field); @@ -89,9 +91,9 @@ public abstract class ParamField extends JPanel { public void update(JTextField field) { if ("".equals(field.getText())) { - requestView.updateParam(paramName, null); + mainView.event(Event.paramChanged, paramName, null); } else { - requestView.updateParam(paramName, field.getText()); + mainView.event(Event.paramChanged, paramName, field.getText()); } } } @@ -99,8 +101,8 @@ public abstract class ParamField extends JPanel { public static class FloatField extends ParamField implements TextFieldListener { JTextField field; - FloatField(RequestView requestView, String paramName) { - super(requestView, paramName); + public FloatField(EpnTapMainView mainView, String paramName) { + super(mainView, paramName); field = new JTextField(); addChangeListener(this, field); this.add(field); @@ -109,10 +111,11 @@ public abstract class ParamField extends JPanel { public void update(JTextField field) { if ("".equals(field.getText())) { field.setBackground(Color.WHITE); - requestView.updateParam(paramName, null); + mainView.event(Event.paramRemoved, paramName); } else { try { - requestView.updateParam(paramName, Float.parseFloat(field.getText())); + mainView.event(Event.paramChanged, paramName, + Float.parseFloat(field.getText())); field.setBackground(Color.WHITE); } catch (NumberFormatException e) { field.setBackground(Color.PINK); @@ -125,8 +128,8 @@ public abstract class ParamField extends JPanel { JTextField fieldMin; JTextField fieldMax; - DateRangeField(RequestView requestView, String paramName) { - super(requestView, paramName); + public DateRangeField(EpnTapMainView mainView, String paramName) { + super(mainView, paramName); this.add(new JLabel("min ")); fieldMin = new JTextField(); fieldMin.setName(MIN_SUFFIX); @@ -146,12 +149,12 @@ public abstract class ParamField extends JPanel { DateFormat df = new SimpleDateFormat(DATE_FORMAT, Locale.ENGLISH); if ("".equals(field.getText())) { field.setBackground(Color.WHITE); - requestView.updateParam(paramName + field.getName(), null); + mainView.event(Event.paramRemoved, paramName + field.getName()); } else if (field.getText().matches(DATE_REGEX)) { try { long date = df.parse(field.getText()).getTime(); - date = (Math.round((date / 86400000.0) + 2440587.5)); // to JD - requestView.updateParam(paramName + field.getName(), date); + date = Math.round((date / 86400000.0) + 2440587.5); // to JD + mainView.event(Event.paramChanged, paramName + field.getName(), date); field.setBackground(Color.WHITE); } catch (ParseException e) { field.setBackground(Color.PINK); @@ -167,8 +170,8 @@ public abstract class ParamField extends JPanel { JTextField fieldMin; JTextField fieldMax; - FloatRangeField(RequestView requestView, String paramName) { - super(requestView, paramName); + public FloatRangeField(EpnTapMainView mainView, String paramName) { + super(mainView, paramName); fieldMin = new JTextField(); fieldMin.setName(MIN_SUFFIX); addChangeListener(this, fieldMin); @@ -183,10 +186,10 @@ public abstract class ParamField extends JPanel { public void update(JTextField field) { if ("".equals(field.getText())) { field.setBackground(Color.WHITE); - requestView.updateParam(paramName + field.getName(), null); + mainView.event(Event.paramRemoved, paramName + field.getName()); } else { try { - requestView.updateParam(paramName + field.getName(), + mainView.event(Event.paramChanged, paramName + field.getName(), Float.parseFloat(field.getText())); field.setBackground(Color.WHITE); } catch (NumberFormatException e) { @@ -201,8 +204,8 @@ public abstract class ParamField extends JPanel { JTextField field; String lastContent; - TargetNameField(RequestView requestView, String paramName) { - super(requestView, paramName); + public TargetNameField(EpnTapMainView mainView, String paramName) { + super(mainView, paramName); comboBox = new JComboBox(); comboBox.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); @@ -234,16 +237,21 @@ public abstract class ParamField extends JPanel { Runnable updateComboBox = new Runnable() { @Override public void run() { - System.out.println("run updateComboBox"); String content = field.getText(); - if (content.length() >= 2 && !content.equals(lastContent)) { - lastContent = content; - comboBox.removeAllItems(); - for (String s : getItems(content)) { - comboBox.addItem(s); + if (!content.equals(lastContent)) { + if (content.length() >= 2) { + lastContent = content; + comboBox.removeAllItems(); + for (String s : getItems(content)) { + comboBox.addItem(s); + } + comboBox.getEditor().setItem(content); + } + if ("".equals(content)) { + mainView.event(Event.paramRemoved, paramName); + } else { + mainView.event(Event.paramChanged, paramName, content); } - comboBox.getEditor().setItem(content); - requestView.updateParam(paramName, content); } } }; @@ -256,8 +264,8 @@ public abstract class ParamField extends JPanel { public static class DataProductTypeField extends ParamField { JComboBox comboBox; - DataProductTypeField(RequestView requestView, String paramName) { - super(requestView, paramName); + public DataProductTypeField(EpnTapMainView mainView, String paramName) { + super(mainView, paramName); comboBox = new JComboBox(getItems().keySet().toArray()); comboBox.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); comboBox.addActionListener(new ActionListener() { @@ -291,15 +299,19 @@ public abstract class ParamField extends JPanel { List item = new ArrayList(); item.add(key.replace(" ", "-").toLowerCase()); item.add(getItems().get(key)); - requestView.updateParam(paramName, "All".equals(key) ? null : item); + if ("All".equals(key)) { + mainView.event(Event.paramRemoved, paramName); + } else { + mainView.event(Event.paramChanged, paramName, item); + } } } public static class TargetClassField extends ParamField { JComboBox comboBox; - TargetClassField(RequestView requestView, String paramName) { - super(requestView, paramName); + public TargetClassField(EpnTapMainView mainView, String paramName) { + super(mainView, paramName); comboBox = new JComboBox(getItems()); comboBox.setPreferredSize(new Dimension(MIN_FIELD_WIDTH, FIELD_HEIGHT)); comboBox.addActionListener(new ActionListener() { @@ -318,7 +330,11 @@ public abstract class ParamField extends JPanel { private void onUpdate() { String value = comboBox.getSelectedItem().toString().replace(" ", "_").toLowerCase(); - requestView.updateParam(paramName, "All".equals(value) ? null : value); + if ("All".equals(value)) { + mainView.event(Event.paramRemoved, paramName); + } else { + mainView.event(Event.paramChanged, paramName, value); + } } } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/RequestView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/RequestView.java deleted file mode 100644 index 61a99b1..0000000 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/view/RequestView.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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.view; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -import javax.swing.BorderFactory; -import javax.swing.BoxLayout; -import javax.swing.JButton; -import javax.swing.JPanel; -import javax.swing.JTextArea; - -import eu.omp.irap.vespa.epntapclient.utils.Queries; -import eu.omp.irap.vespa.epntapclient.view.ParamField.DataProductTypeField; -import eu.omp.irap.vespa.epntapclient.view.ParamField.DateRangeField; -import eu.omp.irap.vespa.epntapclient.view.ParamField.FloatRangeField; -import eu.omp.irap.vespa.epntapclient.view.ParamField.TargetNameField; -import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException; - -/** - * @author N. Jourdane - */ -public class RequestView extends JPanel implements ActionListener { - /** The logger for the class RequestView. */ - private static final Logger logger = Logger.getLogger(RequestView.class.getName()); - - /** The serial version UID (affected with a random number). */ - private static final long serialVersionUID = 1262856496809315405L; - - /** The EPN-TAP main view. */ - private EpnTapMainView mainView; - - /** The text area where the user put the query. */ - private JTextArea queryArea; - - // TODO: Use one map for paramFields, paramValues, paramTypes. - - /** - * The parameters fields for the request. - */ - private List paramFields; - - /** - * The parameters fields for the request. - */ - private Map paramValues; - - /** The height of the buttons panel. */ - private static final int BUTTON_PANEL_HEIGHT = 20; - - /** - * Method constructor - * - * @param mainView The EPN-TAP main view. - */ - public RequestView(EpnTapMainView mainView) { - this.mainView = mainView; - setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - - // TODO: Get max row number from the GUI - - paramValues = new HashMap<>(); - - this.add(buildParamPanel(), this); - this.add(buildQueryPanel(), this); - this.add(buildButtonPanel(), this); - } - - /** - * @return A JPanel containing graphical elements for the service parameters. - */ - private JPanel buildParamPanel() { - // TODO: new GUI field column to allow the user to select the comparison operator: - // - if the field is a String: listbox with 'xx', '%xx', 'xx%', and '%xx%'. - // - if the field is a numeric value: listbox with <, <=, =, =>, >. - paramFields = new ArrayList(); - paramFields.add(new TargetNameField(this, "target_name")); - paramFields.add(new DateRangeField(this, "time_")); - paramFields.add(new FloatRangeField(this, "spectral_range_")); - paramFields.add(new DataProductTypeField(this, "dataproduct_type")); - JPanel paramPanel = new JPanel(); - paramPanel.setLayout(new BoxLayout(paramPanel, BoxLayout.Y_AXIS)); - paramPanel.setBorder(BorderFactory.createTitledBorder("Query parameters")); - - for (ParamField field : paramFields) { - paramPanel.add(field); - } - - return paramPanel; - } - - /** - * @return A JPanel containing graphical elements for the query. - */ - private JPanel buildQueryPanel() { - JPanel queryPanel = new JPanel(); - queryPanel.setBorder(BorderFactory.createTitledBorder("Query for the selected service(s)")); - queryArea = new JTextArea(""); - queryArea.setToolTipText("The query sent to the service(s)."); - queryArea.setLineWrap(true); - queryPanel.setLayout(new BorderLayout()); - queryPanel.add(queryArea, BorderLayout.CENTER); - - return queryPanel; - } - - public void updateParam(String paramName, Object value) { - if (value == null) { - paramValues.remove(paramName); - logger.info("removed " + paramName); - } else { - paramValues.put(paramName, value); - logger.info("uploaded " + paramName + ": " + value); - } - updateQueryArea(); - } - - /** - * Update the query JTextArea according to the parameters values. - */ - public void updateQueryArea() { - String tableName = mainView.getController().getSelectedTable(); - queryArea.setText(Queries.getQuery(tableName, paramValues, 10)); - } - - /** - * @return A JPanel containing the button(s). - */ - private JPanel buildButtonPanel() { - JPanel buttonPanel = new JPanel(); - JButton btnSend = new JButton("Send query"); - btnSend.setName("btnSend"); - btnSend.addActionListener(this); - buttonPanel.add(btnSend); - buttonPanel.setMaximumSize( - new Dimension(1000, BUTTON_PANEL_HEIGHT)); - - return buttonPanel; - } - - @Override - public void actionPerformed(ActionEvent evt) { - if (((JButton) evt.getSource()).getName() == "btnSend") { - try { - mainView.getController().sendQuery(queryArea.getText()); - } catch (VOTableException e) { - logger.warning("Can not send query when clicking on the send button." + e); - } - } - } - -} diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/BottomBarPanel.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/BottomBarPanel.java new file mode 100644 index 0000000..3a92368 --- /dev/null +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/BottomBarPanel.java @@ -0,0 +1,46 @@ +/* + * 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.view.panels; + +import java.awt.BorderLayout; +import java.util.logging.Logger; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; + +import eu.omp.irap.vespa.epntapclient.view.EpnTapMainView; + +/** + * @author N. Jourdane + */ +public class BottomBarPanel extends JPanel { + /** The logger for the class BottomBar. */ + private static final Logger logger = Logger.getLogger(BottomBarPanel.class.getName()); + JLabel infoLabel; + + public BottomBarPanel(EpnTapMainView mainView) { + setLayout(new BorderLayout()); + infoLabel = new JLabel(); + this.add(infoLabel); + this.add(new JButton("Get File"), BorderLayout.EAST); + } + + public void setInfoText(String infoText) { + infoLabel.setText(infoText); + } +} diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/RequestPanel.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/RequestPanel.java new file mode 100644 index 0000000..53b2423 --- /dev/null +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/RequestPanel.java @@ -0,0 +1,158 @@ +/* + * 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.view.panels; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Logger; + +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JTextArea; + +import eu.omp.irap.vespa.epntapclient.view.Dim; +import eu.omp.irap.vespa.epntapclient.view.EpnTapMainView; +import eu.omp.irap.vespa.epntapclient.view.Event; +import eu.omp.irap.vespa.epntapclient.view.ParamField; +import eu.omp.irap.vespa.epntapclient.view.ParamField.DataProductTypeField; +import eu.omp.irap.vespa.epntapclient.view.ParamField.DateRangeField; +import eu.omp.irap.vespa.epntapclient.view.ParamField.FloatRangeField; +import eu.omp.irap.vespa.epntapclient.view.ParamField.TargetNameField; + +/** + * @author N. Jourdane + */ +public class RequestPanel extends JPanel implements ActionListener { + /** The logger for the class RequestView. */ + private static final Logger logger = Logger.getLogger(RequestPanel.class.getName()); + + /** The serial version UID (affected with a random number). */ + private static final long serialVersionUID = 1262856496809315405L; + + private static final String BTN_NAME = "btnSend"; + + /** The EPN-TAP main view. */ + private EpnTapMainView mainView; + + /** The text area where the user put the query. */ + private JTextArea queryArea; + + // TODO: Use one map for paramFields, paramValues, paramTypes. + + /** + * The parameters fields for the request. + */ + private List paramFields; + + /** The height of the buttons panel. */ + private static final int BUTTON_PANEL_HEIGHT = 20; + + /** + * Method constructor + * + * @param mainView The EPN-TAP main view. + */ + public RequestPanel(EpnTapMainView mainView) { + this.mainView = mainView; + setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + setPreferredSize(new Dimension(Dim.RIGHT_PANEL_WIDTH, Dim.TOP_PANEL_HEIGHT)); + setMinimumSize(new Dimension(Dim.RIGHT_PANEL_MIN_WIDTH, Dim.TOP_PANEL_MIN_HEIGHT)); + + // TODO: Get max row number from the GUI + + this.add(buildParamPanel(), this); + this.add(buildQueryPanel(), this); + this.add(buildButtonPanel(), this); + } + + public EpnTapMainView getMainView() { + return mainView; + } + + /** + * @return A JPanel containing graphical elements for the service parameters. + */ + private JPanel buildParamPanel() { + // TODO: new GUI field column to allow the user to select the comparison operator: + // - if the field is a String: listbox with 'xx', '%xx', 'xx%', and '%xx%'. + // - if the field is a numeric value: listbox with <, <=, =, =>, >. + paramFields = new ArrayList(); + paramFields.add(new TargetNameField(mainView, "target_name")); + paramFields.add(new DateRangeField(mainView, "time_")); + paramFields.add(new FloatRangeField(mainView, "spectral_range_")); + paramFields.add(new DataProductTypeField(mainView, "dataproduct_type")); + JPanel paramPanel = new JPanel(); + paramPanel.setLayout(new BoxLayout(paramPanel, BoxLayout.Y_AXIS)); + paramPanel.setBorder(BorderFactory.createTitledBorder("Query parameters")); + + for (ParamField field : paramFields) { + paramPanel.add(field); + } + + return paramPanel; + } + + /** + * @return A JPanel containing graphical elements for the query. + */ + private JPanel buildQueryPanel() { + JPanel queryPanel = new JPanel(); + queryPanel.setBorder(BorderFactory.createTitledBorder("Query for the selected service(s)")); + queryArea = new JTextArea(""); + queryArea.setToolTipText("The query sent to the service(s)."); + queryArea.setLineWrap(true); + queryPanel.setLayout(new BorderLayout()); + queryPanel.add(queryArea, BorderLayout.CENTER); + + return queryPanel; + } + + /** + * Update the query JTextArea according to the parameters values. + */ + public void updateQueryArea(String query) { + queryArea.setText(query); + } + + /** + * @return A JPanel containing the button(s). + */ + private JPanel buildButtonPanel() { + JPanel buttonPanel = new JPanel(); + JButton btnSend = new JButton("Send query"); + btnSend.setName(BTN_NAME); + btnSend.addActionListener(this); + buttonPanel.add(btnSend); + buttonPanel.setMaximumSize(new Dimension(1000, BUTTON_PANEL_HEIGHT)); + + return buttonPanel; + } + + @Override + public void actionPerformed(ActionEvent evt) { + if (((JButton) evt.getSource()).getName() == BTN_NAME) { + this.mainView.event(Event.btnSearchClicked, queryArea.getText()); + } + } + +} diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java new file mode 100644 index 0000000..0bec476 --- /dev/null +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java @@ -0,0 +1,54 @@ +/* + * 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.view.panels; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.util.logging.Logger; + +import javax.swing.JPanel; + +import eu.omp.irap.vespa.epntapclient.view.Dim; +import eu.omp.irap.vespa.epntapclient.view.EpnTapMainView; +import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; + +/** + * @author N. Jourdane + */ +public class ResultsPanel extends JPanel { + /** The logger for the class ResultPanel. */ + private static final Logger logger = Logger.getLogger(ResultsPanel.class.getName()); + + EpnTapMainView mainView; + VOTableView voTableView; + + public ResultsPanel(EpnTapMainView mainView, VOTableView voTableView) { + super(); + + this.mainView = mainView; + this.voTableView = voTableView; + + this.setLayout(new BorderLayout()); + this.add(voTableView); + + setPreferredSize(new Dimension(Dim.LEFT_PANEL_WIDTH + Dim.RIGHT_PANEL_WIDTH, + Dim.BOTTOM_PANEL_HEIGHT)); + setMinimumSize(new Dimension(Dim.LEFT_PANEL_MIN_WIDTH + Dim.RIGHT_PANEL_MIN_WIDTH, + Dim.BOTTOM_PANEL_MIN_HEIGHT)); + + } +} diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java new file mode 100644 index 0000000..3395e2a --- /dev/null +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java @@ -0,0 +1,70 @@ +/* + * 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.view.panels; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.util.logging.Logger; + +import javax.swing.JPanel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import eu.omp.irap.vespa.epntapclient.view.Dim; +import eu.omp.irap.vespa.epntapclient.view.EpnTapMainView; +import eu.omp.irap.vespa.epntapclient.view.Event; +import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; + +/** + * @author N. Jourdane + */ +public class ServicesPanel extends JPanel { + /** The logger for the class ServicesView. */ + private static final Logger logger = Logger.getLogger(ServicesPanel.class.getName()); + + EpnTapMainView mainView; + VOTableView voTableView; + + public ServicesPanel(final EpnTapMainView mainView, final VOTableView voTableView) { + super(); + this.mainView = mainView; + this.voTableView = voTableView; + + this.setLayout(new BorderLayout()); + this.add(voTableView); + + setPreferredSize(new Dimension(Dim.LEFT_PANEL_WIDTH, Dim.TOP_PANEL_HEIGHT)); + setMinimumSize(new Dimension(Dim.LEFT_PANEL_MIN_WIDTH, Dim.TOP_PANEL_MIN_HEIGHT)); + + // TODO: Support multi-selection + voTableView.getTable().getSelectionModel() + .addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent evt) { + mainView.event(Event.serviceSelected, + voTableView.getTable().getSelectedRow()); + } + }); + } + + public String getServiceURL(int row) { + return (String) this.voTableView.getValueAt(5, row); + } + + public String getTableName(int row) { + return (String) this.voTableView.getValueAt(2, row); + } +} diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java index 79be658..579502b 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java @@ -29,6 +29,8 @@ import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; +import eu.omp.irap.vespa.epntapclient.votable.Utils; + /** * The main class of the View of the application. * @@ -79,6 +81,7 @@ public class VOTableView extends JPanel implements TableModelListener { */ public void fillTable(String[] columns, List data) { Object[][] values = data.toArray(new Object[data.size()][]); + Utils.printObject("tableData", values); tableData.setDataVector(values, columns); table.setRowSelectionInterval(0, 0); } @@ -97,6 +100,7 @@ public class VOTableView extends JPanel implements TableModelListener { * content. */ public Object getValueAt(int column, int row) { + Object val = tableData.getValueAt(row, column); return tableData.getValueAt(row, column); } -- libgit2 0.21.2