diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java index 6fda4d3..3047b68 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java @@ -69,13 +69,9 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener JOptionPane.showMessageDialog(view, e.getMessage(), message, JOptionPane.ERROR_MESSAGE); } - /* - * @see - * eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelListener#displayInfo(java.lang.String) - */ @Override public void displayInfo(String message) { - view.getResultsPanel().getStatusBar().setText(message); + view.getResultsPanel().setStatusBarText(message); } /** diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelListener.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelListener.java index 312403d..dd75be6 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelListener.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelListener.java @@ -30,6 +30,13 @@ public interface MainPanelListener { void displayError(String message, Exception e); /** + * Display an informative message in the status bar. + * + * @param message The message to display. + */ + void displayInfo(String message); + + /** * Ask the main panel to send the query. */ void sendQuery(); diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java index 24fc078..e9bf271 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java @@ -44,7 +44,7 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis /** * Constructor of ResultPanelCtrl. - * + * * @param listener The listener of the main panel. */ public ResultPanelCtrl(MainPanelListener listener) { @@ -52,6 +52,12 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis view = new ResultPanelView(this); } + @Override + public void displayInfo(String shortMessage, String detailledMessage) { + super.displayInfo(shortMessage, detailledMessage); + listener.displayInfo(shortMessage); + } + /** * @return The view of the result panel. Used in MainPanelCtrl to add panels in the main window. */ diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java index 8fb3089..af773d7 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java @@ -38,8 +38,8 @@ public class ResultPanelView extends VOTableView { /** The GUI element of the button to save the result of the query. */ private JButton fileButton; - /** A label to display several informations (aka. status bar). */ - private JLabel infoLabel; + /** A status bar, to display several informative messages. */ + private JLabel statusBar; /** The listener of the result panel. */ ResultPanelListener listener; @@ -61,12 +61,12 @@ public class ResultPanelView extends VOTableView { * Build the panel and add graphical elements to it. */ public void buildResultPanel() { - JPanel statusBar = new JPanel(); - statusBar.setLayout(new BorderLayout()); - statusBar.add(getInfoLabel()); - statusBar.add(getFileButton(), BorderLayout.EAST); + JPanel bottomBar = new JPanel(); + bottomBar.setLayout(new BorderLayout()); + bottomBar.add(getStatusBar(), BorderLayout.CENTER); + bottomBar.add(getFileButton(), BorderLayout.EAST); - add(statusBar, BorderLayout.SOUTH); + add(bottomBar, BorderLayout.SOUTH); } /** @@ -91,19 +91,22 @@ public class ResultPanelView extends VOTableView { } /** - * Returns the info label, create it if doesn't exist. + * Returns the status bar, create it if doesn't exist. * - * @return The info label. + * @return The status bar. */ - public JLabel getInfoLabel() { - return infoLabel == null ? new JLabel() : infoLabel; + public JLabel getStatusBar() { + if (statusBar == null) { + statusBar = new JLabel(""); + } + return statusBar; } /** * @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 void setStatusBarText(String infoText) { + getStatusBar().setText(infoText); } } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java index d010b0e..eda639c 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java @@ -58,6 +58,12 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane view = new ServicesPanelView(this); } + @Override + public void displayInfo(String message) { + super.displayInfo(message); + listener.displayInfo(message); + } + /** * @return The list of services target Urls selected by the user on the service panel. */ @@ -78,12 +84,12 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane List newTablesNames = new ArrayList<>(); List newServicesUrls = new ArrayList<>(); - int idxServiceUrl = view.getTable().getColumn("access_url").getModelIndex(); int idxTableName = view.getTable().getColumn("table_name").getModelIndex(); + int idxServiceUrl = view.getTable().getColumn("access_url").getModelIndex(); for (int row : view.getSelectedRows()) { - newTablesNames.add((String) view.getValueAt(idxServiceUrl, row)); - newServicesUrls.add((String) view.getValueAt(idxTableName, row)); + newTablesNames.add((String) view.getValueAt(idxTableName, row)); + newServicesUrls.add((String) view.getValueAt(idxServiceUrl, row)); } services.updateSelectedServices(newTablesNames, newServicesUrls); listener.updateQuery(); -- libgit2 0.21.2