Commit 49cc21eafbf1267592be0d31fe5b08ace8c434e2
1 parent
857e4845
Exists in
master
Use a status bar to display message while sending/parsing the query.
Showing
5 changed files
with
40 additions
and
22 deletions
Show diff stats
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java
@@ -69,13 +69,9 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener | @@ -69,13 +69,9 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener | ||
69 | JOptionPane.showMessageDialog(view, e.getMessage(), message, JOptionPane.ERROR_MESSAGE); | 69 | JOptionPane.showMessageDialog(view, e.getMessage(), message, JOptionPane.ERROR_MESSAGE); |
70 | } | 70 | } |
71 | 71 | ||
72 | - /* | ||
73 | - * @see | ||
74 | - * eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelListener#displayInfo(java.lang.String) | ||
75 | - */ | ||
76 | @Override | 72 | @Override |
77 | public void displayInfo(String message) { | 73 | public void displayInfo(String message) { |
78 | - view.getResultsPanel().getStatusBar().setText(message); | 74 | + view.getResultsPanel().setStatusBarText(message); |
79 | } | 75 | } |
80 | 76 | ||
81 | /** | 77 | /** |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelListener.java
@@ -30,6 +30,13 @@ public interface MainPanelListener { | @@ -30,6 +30,13 @@ public interface MainPanelListener { | ||
30 | void displayError(String message, Exception e); | 30 | void displayError(String message, Exception e); |
31 | 31 | ||
32 | /** | 32 | /** |
33 | + * Display an informative message in the status bar. | ||
34 | + * | ||
35 | + * @param message The message to display. | ||
36 | + */ | ||
37 | + void displayInfo(String message); | ||
38 | + | ||
39 | + /** | ||
33 | * Ask the main panel to send the query. | 40 | * Ask the main panel to send the query. |
34 | */ | 41 | */ |
35 | void sendQuery(); | 42 | void sendQuery(); |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java
@@ -44,7 +44,7 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis | @@ -44,7 +44,7 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis | ||
44 | 44 | ||
45 | /** | 45 | /** |
46 | * Constructor of ResultPanelCtrl. | 46 | * Constructor of ResultPanelCtrl. |
47 | - * | 47 | + * |
48 | * @param listener The listener of the main panel. | 48 | * @param listener The listener of the main panel. |
49 | */ | 49 | */ |
50 | public ResultPanelCtrl(MainPanelListener listener) { | 50 | public ResultPanelCtrl(MainPanelListener listener) { |
@@ -52,6 +52,12 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis | @@ -52,6 +52,12 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis | ||
52 | view = new ResultPanelView(this); | 52 | view = new ResultPanelView(this); |
53 | } | 53 | } |
54 | 54 | ||
55 | + @Override | ||
56 | + public void displayInfo(String shortMessage, String detailledMessage) { | ||
57 | + super.displayInfo(shortMessage, detailledMessage); | ||
58 | + listener.displayInfo(shortMessage); | ||
59 | + } | ||
60 | + | ||
55 | /** | 61 | /** |
56 | * @return The view of the result panel. Used in MainPanelCtrl to add panels in the main window. | 62 | * @return The view of the result panel. Used in MainPanelCtrl to add panels in the main window. |
57 | */ | 63 | */ |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java
@@ -38,8 +38,8 @@ public class ResultPanelView extends VOTableView { | @@ -38,8 +38,8 @@ public class ResultPanelView extends VOTableView { | ||
38 | /** The GUI element of the button to save the result of the query. */ | 38 | /** The GUI element of the button to save the result of the query. */ |
39 | private JButton fileButton; | 39 | private JButton fileButton; |
40 | 40 | ||
41 | - /** A label to display several informations (aka. status bar). */ | ||
42 | - private JLabel infoLabel; | 41 | + /** A status bar, to display several informative messages. */ |
42 | + private JLabel statusBar; | ||
43 | 43 | ||
44 | /** The listener of the result panel. */ | 44 | /** The listener of the result panel. */ |
45 | ResultPanelListener listener; | 45 | ResultPanelListener listener; |
@@ -61,12 +61,12 @@ public class ResultPanelView extends VOTableView { | @@ -61,12 +61,12 @@ public class ResultPanelView extends VOTableView { | ||
61 | * Build the panel and add graphical elements to it. | 61 | * Build the panel and add graphical elements to it. |
62 | */ | 62 | */ |
63 | public void buildResultPanel() { | 63 | public void buildResultPanel() { |
64 | - JPanel statusBar = new JPanel(); | ||
65 | - statusBar.setLayout(new BorderLayout()); | ||
66 | - statusBar.add(getInfoLabel()); | ||
67 | - statusBar.add(getFileButton(), BorderLayout.EAST); | 64 | + JPanel bottomBar = new JPanel(); |
65 | + bottomBar.setLayout(new BorderLayout()); | ||
66 | + bottomBar.add(getStatusBar(), BorderLayout.CENTER); | ||
67 | + bottomBar.add(getFileButton(), BorderLayout.EAST); | ||
68 | 68 | ||
69 | - add(statusBar, BorderLayout.SOUTH); | 69 | + add(bottomBar, BorderLayout.SOUTH); |
70 | } | 70 | } |
71 | 71 | ||
72 | /** | 72 | /** |
@@ -91,19 +91,22 @@ public class ResultPanelView extends VOTableView { | @@ -91,19 +91,22 @@ public class ResultPanelView extends VOTableView { | ||
91 | } | 91 | } |
92 | 92 | ||
93 | /** | 93 | /** |
94 | - * Returns the info label, create it if doesn't exist. | 94 | + * Returns the status bar, create it if doesn't exist. |
95 | * | 95 | * |
96 | - * @return The info label. | 96 | + * @return The status bar. |
97 | */ | 97 | */ |
98 | - public JLabel getInfoLabel() { | ||
99 | - return infoLabel == null ? new JLabel() : infoLabel; | 98 | + public JLabel getStatusBar() { |
99 | + if (statusBar == null) { | ||
100 | + statusBar = new JLabel(""); | ||
101 | + } | ||
102 | + return statusBar; | ||
100 | } | 103 | } |
101 | 104 | ||
102 | /** | 105 | /** |
103 | * @param infoText The text to display in the status-bar, which will override the old one. | 106 | * @param infoText The text to display in the status-bar, which will override the old one. |
104 | */ | 107 | */ |
105 | - public void setInfoText(String infoText) { | ||
106 | - infoLabel.setText(infoText); | 108 | + public void setStatusBarText(String infoText) { |
109 | + getStatusBar().setText(infoText); | ||
107 | } | 110 | } |
108 | 111 | ||
109 | } | 112 | } |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java
@@ -58,6 +58,12 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane | @@ -58,6 +58,12 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane | ||
58 | view = new ServicesPanelView(this); | 58 | view = new ServicesPanelView(this); |
59 | } | 59 | } |
60 | 60 | ||
61 | + @Override | ||
62 | + public void displayInfo(String message) { | ||
63 | + super.displayInfo(message); | ||
64 | + listener.displayInfo(message); | ||
65 | + } | ||
66 | + | ||
61 | /** | 67 | /** |
62 | * @return The list of services target Urls selected by the user on the service panel. | 68 | * @return The list of services target Urls selected by the user on the service panel. |
63 | */ | 69 | */ |
@@ -78,12 +84,12 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane | @@ -78,12 +84,12 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane | ||
78 | List<String> newTablesNames = new ArrayList<>(); | 84 | List<String> newTablesNames = new ArrayList<>(); |
79 | List<String> newServicesUrls = new ArrayList<>(); | 85 | List<String> newServicesUrls = new ArrayList<>(); |
80 | 86 | ||
81 | - int idxServiceUrl = view.getTable().getColumn("access_url").getModelIndex(); | ||
82 | int idxTableName = view.getTable().getColumn("table_name").getModelIndex(); | 87 | int idxTableName = view.getTable().getColumn("table_name").getModelIndex(); |
88 | + int idxServiceUrl = view.getTable().getColumn("access_url").getModelIndex(); | ||
83 | 89 | ||
84 | for (int row : view.getSelectedRows()) { | 90 | for (int row : view.getSelectedRows()) { |
85 | - newTablesNames.add((String) view.getValueAt(idxServiceUrl, row)); | ||
86 | - newServicesUrls.add((String) view.getValueAt(idxTableName, row)); | 91 | + newTablesNames.add((String) view.getValueAt(idxTableName, row)); |
92 | + newServicesUrls.add((String) view.getValueAt(idxServiceUrl, row)); | ||
87 | } | 93 | } |
88 | services.updateSelectedServices(newTablesNames, newServicesUrls); | 94 | services.updateSelectedServices(newTablesNames, newServicesUrls); |
89 | listener.updateQuery(); | 95 | listener.updateQuery(); |