Commit d349949e6f97322ff448126bfd0321323631ecb2

Authored by Nathanael Jourdane
1 parent a6dc855e
Exists in master

Create a JPanel for the status bar in order to add it from the main view.

src/main/java/eu/omp/irap/vespa/epntapclient/gui/statusbarpanel/StatusBarPanelView.java 0 → 100644
@@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
  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.statusbarpanel;
  18 +
  19 +import java.awt.BorderLayout;
  20 +
  21 +import javax.swing.JLabel;
  22 +import javax.swing.JPanel;
  23 +
  24 +/**
  25 + * @author N. Jourdane
  26 + */
  27 +public class StatusBarPanelView extends JPanel {
  28 +
  29 + /** The default serial version UID. */
  30 + private static final long serialVersionUID = 1L;
  31 +
  32 + /** A status bar, to display several informative messages. */
  33 + private JLabel statusBar;
  34 +
  35 +
  36 + /**
  37 + * Constructor of StatusBarPanelView, which build the view.
  38 + */
  39 + public StatusBarPanelView() {
  40 + setLayout(new BorderLayout());
  41 + add(getStatusBar(), BorderLayout.CENTER);
  42 + }
  43 +
  44 + /**
  45 + * Returns the status bar, create it if doesn't exist.
  46 + *
  47 + * @return The status bar.
  48 + */
  49 + public JLabel getStatusBar() {
  50 + if (statusBar == null) {
  51 + statusBar = new JLabel(".");
  52 + }
  53 + return statusBar;
  54 + }
  55 +
  56 + /**
  57 + * @param infoText The text to display in the status-bar, which will override the old one.
  58 + */
  59 + public void setStatusBarText(String infoText) {
  60 + getStatusBar().setText(infoText);
  61 + }
  62 +
  63 +}