diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java new file mode 100644 index 0000000..6824d23 --- /dev/null +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java @@ -0,0 +1,57 @@ +/* + * 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; + +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +import eu.omp.irap.vespa.epntapclient.controller.EpnTapController; +import eu.omp.irap.vespa.epntapclient.utils.Log; + +/** + * Simple class to have a main function to launch the EPNTap client. + * + * @author N. Jourdane + */ +public class EpnTapMainApp { + /** + * Main function to start the application as standalone. + * + * @param args The program arguments (not used). + */ + public static void main(String[] args) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + EpnTapController epnTapControl = new EpnTapController(); + Log.LOGGER.info("Lauching EPN-TAP application..."); + if (args.length != 0) { + System.out.println("Usage: EpnTapMainApp"); + return; + } + + JFrame frame = new JFrame("EPN-TAP client"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setContentPane(epnTapControl.getView()); + frame.setVisible(true); + // frame.pack(); + frame.setSize(800, 600); + frame.setLocationRelativeTo(null); + } + }); + } +} 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 new file mode 100644 index 0000000..3f31526 --- /dev/null +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/controller/EpnTapController.java @@ -0,0 +1,62 @@ +/* + * 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.controller; + +import eu.omp.irap.vespa.epntapclient.view.EpnTapMainView; +import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableController; + +/** + * @author N. Jourdane + */ +public class EpnTapController { + /** The view of EPN-TAP application. */ + EpnTapMainView view; + + /** The controller of the VOTable displaying the query results. */ + VOTableController resultsController; + + /** The controller of the VOTable displaying the list of services. */ + VOTableController servicesController; + + /** + * Method constructor + */ + public EpnTapController() { + view = new EpnTapMainView(); + } + + /** + * @return the EPN-TAP view. + */ + public EpnTapMainView getView() { + return view; + } + + /** + * @return The controller of the VOTable displaying the query results. + */ + public VOTableController getResultsController() { + return resultsController; + } + + /** + * @return The controller of the VOTable displaying the list of services. + */ + public VOTableController getServicesController() { + return servicesController; + } +} 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 new file mode 100644 index 0000000..7cc7601 --- /dev/null +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java @@ -0,0 +1,100 @@ +/* + * 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 javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextArea; + +import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; + +/** + * @author N. Jourdane + */ +public class EpnTapMainView extends JPanel { + + /** The serial version UID (affected with a random number). */ + private static final long serialVersionUID = -1233290271099283814L; + + /** The JPanel where the VOTable results is displayed. */ + private VOTableView results; + + /** The JPanel where the list of services is displayed. */ + private VOTableView services; + + /** The text area where the user put its requests. */ + private JTextArea queryArea; + + /** + * The constructor of the view. + */ + public EpnTapMainView() { + services = new VOTableView(); + results = new VOTableView(); + queryArea = new JTextArea(""); + + String[] sColumns = { "service name", "service value" }; + String[][] sValues = { { "s1", "s2" }, { "789", "357" } }; + services.buildArray(sColumns, sValues); + + String[] rColumns = { "result name", "result value" }; + String[][] rValues = { { "r1", "r2" }, { "123", "456" } }; + results.buildArray(rColumns, rValues); + + buildWindow(); + } + + /** + * @return The JPanel where the VOTable results is displayed. + */ + public VOTableView getResults() { + return results; + } + + /** + * @return The JPanel where the list of services is displayed. + */ + public VOTableView getServices() { + return services; + } + + /** + * Build and fill the GUI. + */ + public void buildWindow() { + JPanel northPanel = new JPanel(new BorderLayout()); + northPanel.add(services, BorderLayout.WEST); + northPanel.add(queryArea, BorderLayout.CENTER); + + setLayout(new BorderLayout()); + add(northPanel, BorderLayout.NORTH); + add(results, BorderLayout.CENTER); + } + + /** + * Display an error. + * + * @param title The title of the error. + * @param message The message of the error. + */ + public void displayError(String title, String message) { + JOptionPane.showMessageDialog(this, message, title, JOptionPane.ERROR_MESSAGE); + } + +} -- libgit2 0.21.2