diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/EpnTapMainView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/EpnTapMainView.java index 626ee2a..aa94ba1 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/EpnTapMainView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/EpnTapMainView.java @@ -23,7 +23,6 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JSplitPane; -import eu.omp.irap.vespa.epntapclient.gui.panels.BottomBarPanel; import eu.omp.irap.vespa.epntapclient.gui.panels.RequestPanel; import eu.omp.irap.vespa.epntapclient.gui.panels.ResultsPanel; import eu.omp.irap.vespa.epntapclient.gui.panels.ServicesPanel; @@ -47,9 +46,6 @@ public class EpnTapMainView extends JPanel { /** The JPanel where the user build the query. */ private RequestPanel requestPanel; - /** The status bar. */ - private BottomBarPanel bottomBarPanel; - /** * The main view constructor, which create all the panels. @@ -62,7 +58,6 @@ public class EpnTapMainView extends JPanel { servicesPanel = new ServicesPanel(viewListener); resultsPanel = new ResultsPanel(viewListener); requestPanel = new RequestPanel(viewListener); - bottomBarPanel = new BottomBarPanel(viewListener); buildMainView(); } @@ -77,7 +72,6 @@ public class EpnTapMainView extends JPanel { JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, northPanel, resultsPanel); add(mainPanel, BorderLayout.CENTER); - add(bottomBarPanel, BorderLayout.SOUTH); setSizes(); } @@ -123,13 +117,6 @@ public class EpnTapMainView extends JPanel { } /** - * @return The status bar. - */ - public BottomBarPanel getBottomBarPanel() { - return bottomBarPanel; - } - - /** * Display an error message. Usually used each time an error happens. * * @param title The title of the error. diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/BottomBarPanel.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/BottomBarPanel.java deleted file mode 100644 index 3971b90..0000000 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/BottomBarPanel.java +++ /dev/null @@ -1,83 +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.gui.panels; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JLabel; -import javax.swing.JPanel; - -import eu.omp.irap.vespa.epntapclient.gui.ViewListener; - -/** - * @author N. Jourdane - */ -public class BottomBarPanel extends JPanel { - - /** The serial version UID. */ - private static final long serialVersionUID = 1L; - - /** A label to display several informations (aka. status bar). */ - private JLabel infoLabel; - - private ViewListener viewListener; - - - /** - * Method constructor for the bottom bar panel. - * - * @param mainView The main view of the application. - */ - public BottomBarPanel(final ViewListener viewListener) { - this.viewListener = viewListener; - buildBottomBarPanel(); - } - - private void buildBottomBarPanel() { - setLayout(new BorderLayout()); - - infoLabel = new JLabel(); - this.add(infoLabel); - this.add(buildGetFileButton(), BorderLayout.EAST); - } - - private JButton buildGetFileButton() { - JButton button = new JButton("Get File"); - button.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - final JFileChooser fc = new JFileChooser(); - fc.showOpenDialog(BottomBarPanel.this); - viewListener.onDownloadButtonClicked(fc.getSelectedFile()); - } - }); - return button; - } - - /** - * @param infoText The text to display in the status-bar, which will override the old one. - */ - public void setInfoText(String infoText) { - infoLabel.setText(infoText); - } - -} diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ResultsPanel.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ResultsPanel.java index d66b7e6..2ae20a3 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ResultsPanel.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ResultsPanel.java @@ -16,6 +16,15 @@ package eu.omp.irap.vespa.epntapclient.gui.panels; +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; + import eu.omp.irap.vespa.epntapclient.gui.ViewListener; import eu.omp.irap.vespa.votable.view.VOTableView; @@ -29,6 +38,11 @@ public class ResultsPanel extends VOTableView { ViewListener viewListener; + /** A label to display several informations (aka. status bar). */ + private JLabel infoLabel; + + private JButton fileButton; + /** * Method constructor which customize the result panel, but don't build it from scratch since @@ -40,5 +54,47 @@ public class ResultsPanel extends VOTableView { public ResultsPanel(ViewListener viewListener) { super(); this.viewListener = viewListener; + buildResultPanel(); + } + + public void buildResultPanel() { + add(buildBottomBar(), BorderLayout.SOUTH); } + + private JPanel buildBottomBar() { + JPanel statusBar = new JPanel(); + statusBar.setLayout(new BorderLayout()); + statusBar.add(getInfoLabel()); + statusBar.add(getFileButton(), BorderLayout.EAST); + + return statusBar; + } + + public JLabel getInfoLabel() { + return infoLabel == null ? new JLabel() : infoLabel; + } + + /** + * @param infoText The text to display in the status-bar, which will override the old one. + */ + public void setInfoText(String infoText) { + infoLabel.setText(infoText); + } + + public JButton getFileButton() { + if (fileButton == null) { + fileButton = new JButton("Get File"); + fileButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + final JFileChooser fc = new JFileChooser(); + fc.showOpenDialog(ResultsPanel.this); + viewListener.onDownloadButtonClicked(fc.getSelectedFile()); + } + }); + } + return fileButton; + } + } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ServicesPanel.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ServicesPanel.java index d52ea8b..7b12483 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ServicesPanel.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ServicesPanel.java @@ -83,31 +83,14 @@ public class ServicesPanel extends VOTableView { return addServicePanel; } - /** - * What ? - */ private JTextField getTableNameTextField() { - if (tableNameTextField == null) { - tableNameTextField = new JTextField(10); - } - return tableNameTextField; + return tableNameTextField == null ? new JTextField(10) : tableNameTextField; } - /** - * What ? - */ private JTextField getServiceUrlTextField() { - if (serviceUrlTextField == null) { - serviceUrlTextField = new JTextField(10); - } - return serviceUrlTextField; + return serviceUrlTextField == null ? new JTextField(10) : serviceUrlTextField; } - /** - * What ? - * - * @return - */ private JButton getServiceButton() { if (serviceButton == null) { serviceButton = new JButton("Set service"); -- libgit2 0.21.2