Commit fc9c97aa217264b93fb93a660ff87c0e5779b74d

Authored by Nathanael Jourdane
1 parent 9b0dade9
Exists in master

Delete BottomBar class, build bottomBar in ResultView instead.

src/main/java/eu/omp/irap/vespa/epntapclient/gui/EpnTapMainView.java
... ... @@ -23,7 +23,6 @@ import javax.swing.JOptionPane;
23 23 import javax.swing.JPanel;
24 24 import javax.swing.JSplitPane;
25 25  
26   -import eu.omp.irap.vespa.epntapclient.gui.panels.BottomBarPanel;
27 26 import eu.omp.irap.vespa.epntapclient.gui.panels.RequestPanel;
28 27 import eu.omp.irap.vespa.epntapclient.gui.panels.ResultsPanel;
29 28 import eu.omp.irap.vespa.epntapclient.gui.panels.ServicesPanel;
... ... @@ -47,9 +46,6 @@ public class EpnTapMainView extends JPanel {
47 46 /** The JPanel where the user build the query. */
48 47 private RequestPanel requestPanel;
49 48  
50   - /** The status bar. */
51   - private BottomBarPanel bottomBarPanel;
52   -
53 49  
54 50 /**
55 51 * The main view constructor, which create all the panels.
... ... @@ -62,7 +58,6 @@ public class EpnTapMainView extends JPanel {
62 58 servicesPanel = new ServicesPanel(viewListener);
63 59 resultsPanel = new ResultsPanel(viewListener);
64 60 requestPanel = new RequestPanel(viewListener);
65   - bottomBarPanel = new BottomBarPanel(viewListener);
66 61 buildMainView();
67 62 }
68 63  
... ... @@ -77,7 +72,6 @@ public class EpnTapMainView extends JPanel {
77 72 JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, northPanel, resultsPanel);
78 73  
79 74 add(mainPanel, BorderLayout.CENTER);
80   - add(bottomBarPanel, BorderLayout.SOUTH);
81 75  
82 76 setSizes();
83 77 }
... ... @@ -123,13 +117,6 @@ public class EpnTapMainView extends JPanel {
123 117 }
124 118  
125 119 /**
126   - * @return The status bar.
127   - */
128   - public BottomBarPanel getBottomBarPanel() {
129   - return bottomBarPanel;
130   - }
131   -
132   - /**
133 120 * Display an error message. Usually used each time an error happens.
134 121 *
135 122 * @param title The title of the error.
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/BottomBarPanel.java deleted
... ... @@ -1,83 +0,0 @@
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.panels;
18   -
19   -import java.awt.BorderLayout;
20   -import java.awt.event.ActionEvent;
21   -import java.awt.event.ActionListener;
22   -
23   -import javax.swing.JButton;
24   -import javax.swing.JFileChooser;
25   -import javax.swing.JLabel;
26   -import javax.swing.JPanel;
27   -
28   -import eu.omp.irap.vespa.epntapclient.gui.ViewListener;
29   -
30   -/**
31   - * @author N. Jourdane
32   - */
33   -public class BottomBarPanel extends JPanel {
34   -
35   - /** The serial version UID. */
36   - private static final long serialVersionUID = 1L;
37   -
38   - /** A label to display several informations (aka. status bar). */
39   - private JLabel infoLabel;
40   -
41   - private ViewListener viewListener;
42   -
43   -
44   - /**
45   - * Method constructor for the bottom bar panel.
46   - *
47   - * @param mainView The main view of the application.
48   - */
49   - public BottomBarPanel(final ViewListener viewListener) {
50   - this.viewListener = viewListener;
51   - buildBottomBarPanel();
52   - }
53   -
54   - private void buildBottomBarPanel() {
55   - setLayout(new BorderLayout());
56   -
57   - infoLabel = new JLabel();
58   - this.add(infoLabel);
59   - this.add(buildGetFileButton(), BorderLayout.EAST);
60   - }
61   -
62   - private JButton buildGetFileButton() {
63   - JButton button = new JButton("Get File");
64   - button.addActionListener(new ActionListener() {
65   -
66   - @Override
67   - public void actionPerformed(ActionEvent e) {
68   - final JFileChooser fc = new JFileChooser();
69   - fc.showOpenDialog(BottomBarPanel.this);
70   - viewListener.onDownloadButtonClicked(fc.getSelectedFile());
71   - }
72   - });
73   - return button;
74   - }
75   -
76   - /**
77   - * @param infoText The text to display in the status-bar, which will override the old one.
78   - */
79   - public void setInfoText(String infoText) {
80   - infoLabel.setText(infoText);
81   - }
82   -
83   -}
src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ResultsPanel.java
... ... @@ -16,6 +16,15 @@
16 16  
17 17 package eu.omp.irap.vespa.epntapclient.gui.panels;
18 18  
  19 +import java.awt.BorderLayout;
  20 +import java.awt.event.ActionEvent;
  21 +import java.awt.event.ActionListener;
  22 +
  23 +import javax.swing.JButton;
  24 +import javax.swing.JFileChooser;
  25 +import javax.swing.JLabel;
  26 +import javax.swing.JPanel;
  27 +
19 28 import eu.omp.irap.vespa.epntapclient.gui.ViewListener;
20 29 import eu.omp.irap.vespa.votable.view.VOTableView;
21 30  
... ... @@ -29,6 +38,11 @@ public class ResultsPanel extends VOTableView {
29 38  
30 39 ViewListener viewListener;
31 40  
  41 + /** A label to display several informations (aka. status bar). */
  42 + private JLabel infoLabel;
  43 +
  44 + private JButton fileButton;
  45 +
32 46  
33 47 /**
34 48 * Method constructor which customize the result panel, but don't build it from scratch since
... ... @@ -40,5 +54,47 @@ public class ResultsPanel extends VOTableView {
40 54 public ResultsPanel(ViewListener viewListener) {
41 55 super();
42 56 this.viewListener = viewListener;
  57 + buildResultPanel();
  58 + }
  59 +
  60 + public void buildResultPanel() {
  61 + add(buildBottomBar(), BorderLayout.SOUTH);
43 62 }
  63 +
  64 + private JPanel buildBottomBar() {
  65 + JPanel statusBar = new JPanel();
  66 + statusBar.setLayout(new BorderLayout());
  67 + statusBar.add(getInfoLabel());
  68 + statusBar.add(getFileButton(), BorderLayout.EAST);
  69 +
  70 + return statusBar;
  71 + }
  72 +
  73 + public JLabel getInfoLabel() {
  74 + return infoLabel == null ? new JLabel() : infoLabel;
  75 + }
  76 +
  77 + /**
  78 + * @param infoText The text to display in the status-bar, which will override the old one.
  79 + */
  80 + public void setInfoText(String infoText) {
  81 + infoLabel.setText(infoText);
  82 + }
  83 +
  84 + public JButton getFileButton() {
  85 + if (fileButton == null) {
  86 + fileButton = new JButton("Get File");
  87 + fileButton.addActionListener(new ActionListener() {
  88 +
  89 + @Override
  90 + public void actionPerformed(ActionEvent e) {
  91 + final JFileChooser fc = new JFileChooser();
  92 + fc.showOpenDialog(ResultsPanel.this);
  93 + viewListener.onDownloadButtonClicked(fc.getSelectedFile());
  94 + }
  95 + });
  96 + }
  97 + return fileButton;
  98 + }
  99 +
44 100 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ServicesPanel.java
... ... @@ -83,31 +83,14 @@ public class ServicesPanel extends VOTableView {
83 83 return addServicePanel;
84 84 }
85 85  
86   - /**
87   - * What ?
88   - */
89 86 private JTextField getTableNameTextField() {
90   - if (tableNameTextField == null) {
91   - tableNameTextField = new JTextField(10);
92   - }
93   - return tableNameTextField;
  87 + return tableNameTextField == null ? new JTextField(10) : tableNameTextField;
94 88 }
95 89  
96   - /**
97   - * What ?
98   - */
99 90 private JTextField getServiceUrlTextField() {
100   - if (serviceUrlTextField == null) {
101   - serviceUrlTextField = new JTextField(10);
102   - }
103   - return serviceUrlTextField;
  91 + return serviceUrlTextField == null ? new JTextField(10) : serviceUrlTextField;
104 92 }
105 93  
106   - /**
107   - * What ?
108   - *
109   - * @return
110   - */
111 94 private JButton getServiceButton() {
112 95 if (serviceButton == null) {
113 96 serviceButton = new JButton("Set service");
... ...