Blame view

src/main/java/eu/omp/irap/vespa/epntapclient/gui/EpnTapMainView.java 3.92 KB
1353e182   Nathanael Jourdane   Add minimal eleme...
1
2
3
4
5
/*
 * 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.
1e543ea0   Nathanael Jourdane   Code clean-up
6
 *
1353e182   Nathanael Jourdane   Add minimal eleme...
7
8
9
10
11
12
13
14
15
16
17
18
19
 * 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
 * <http://www.gnu.org/licenses/>.
 */

package eu.omp.irap.vespa.epntapclient.view;

import java.awt.BorderLayout;
1353e182   Nathanael Jourdane   Add minimal eleme...
20
21
22

import javax.swing.JOptionPane;
import javax.swing.JPanel;
5576be01   Nathanael Jourdane   Make panels resiz...
23
import javax.swing.JSplitPane;
5576be01   Nathanael Jourdane   Make panels resiz...
24

0f1bce56   Nathanael Jourdane   Use a listerner i...
25
import eu.omp.irap.vespa.epntapclient.controller.ViewListener;
5af53be7   Nathanael Jourdane   Make the applicat...
26
27
28
29
import eu.omp.irap.vespa.epntapclient.view.panels.BottomBarPanel;
import eu.omp.irap.vespa.epntapclient.view.panels.RequestPanel;
import eu.omp.irap.vespa.epntapclient.view.panels.ResultsPanel;
import eu.omp.irap.vespa.epntapclient.view.panels.ServicesPanel;
1353e182   Nathanael Jourdane   Add minimal eleme...
30
31
32
import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView;

/**
a227a22d   Nathanael Jourdane   Add comments.
33
 * The main view of the application, which manage all the other views.
1e543ea0   Nathanael Jourdane   Code clean-up
34
 *
1353e182   Nathanael Jourdane   Add minimal eleme...
35
36
37
 * @author N. Jourdane
 */
public class EpnTapMainView extends JPanel {
aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
38

1e543ea0   Nathanael Jourdane   Code clean-up
39
40
	/** The serial version UID. */
	private static final long serialVersionUID = 1L;
1353e182   Nathanael Jourdane   Add minimal eleme...
41

1353e182   Nathanael Jourdane   Add minimal eleme...
42
	/** The JPanel where the VOTable results is displayed. */
5af53be7   Nathanael Jourdane   Make the applicat...
43
	private ResultsPanel resultsPanel;
1353e182   Nathanael Jourdane   Add minimal eleme...
44
45

	/** The JPanel where the list of services is displayed. */
5af53be7   Nathanael Jourdane   Make the applicat...
46
	private ServicesPanel servicesPanel;
1353e182   Nathanael Jourdane   Add minimal eleme...
47

a227a22d   Nathanael Jourdane   Add comments.
48
	/** The JPanel where the user build the query. */
5af53be7   Nathanael Jourdane   Make the applicat...
49
	private RequestPanel requestPanel;
1353e182   Nathanael Jourdane   Add minimal eleme...
50

a227a22d   Nathanael Jourdane   Add comments.
51
	/** The status bar. */
5af53be7   Nathanael Jourdane   Make the applicat...
52
	private BottomBarPanel bottomBarPanel;
c57c07b1   Nathanael Jourdane   Add the bottom ba...
53

aa2a59ba   Nathanael Jourdane   [coding style] 2 ...
54

1353e182   Nathanael Jourdane   Add minimal eleme...
55
	/**
a227a22d   Nathanael Jourdane   Add comments.
56
	 * The main view constructor, which create all the panels.
1e543ea0   Nathanael Jourdane   Code clean-up
57
	 *
a227a22d   Nathanael Jourdane   Add comments.
58
59
	 * @param voTableServicesView The view to put in the services panel, built by ServicesController
	 * @param voTableResultsView The view to put in the results panel, built by ResultsController.
1353e182   Nathanael Jourdane   Add minimal eleme...
60
	 */
5af53be7   Nathanael Jourdane   Make the applicat...
61

0f1bce56   Nathanael Jourdane   Use a listerner i...
62
63
64
65
66
67
	public EpnTapMainView(ViewListener viewListener, VOTableView voTableServicesView,
			VOTableView voTableResultsView) {
		servicesPanel = new ServicesPanel(viewListener, voTableServicesView);
		resultsPanel = new ResultsPanel(viewListener, voTableResultsView);
		requestPanel = new RequestPanel(viewListener);
		bottomBarPanel = new BottomBarPanel(viewListener);
4ce406a8   Nathanael Jourdane   Add build() class...
68
		buildMainView();
43c14591   Nathanael Jourdane   View: Add methods...
69
	}
1353e182   Nathanael Jourdane   Add minimal eleme...
70

a227a22d   Nathanael Jourdane   Add comments.
71
	/**
a227a22d   Nathanael Jourdane   Add comments.
72
	 * @return The JPanel where the VOTable result is displayed.
1353e182   Nathanael Jourdane   Add minimal eleme...
73
	 */
5af53be7   Nathanael Jourdane   Make the applicat...
74
75
	public ResultsPanel getResultsPanel() {
		return resultsPanel;
1353e182   Nathanael Jourdane   Add minimal eleme...
76
77
78
	}

	/**
a227a22d   Nathanael Jourdane   Add comments.
79
	 * @return The JPanel containing the GUI elements to build the query.
0b616d80   Nathanael Jourdane   Updtate the query...
80
	 */
5af53be7   Nathanael Jourdane   Make the applicat...
81
82
	public RequestPanel getRequestPanel() {
		return requestPanel;
0b616d80   Nathanael Jourdane   Updtate the query...
83
84
85
	}

	/**
1353e182   Nathanael Jourdane   Add minimal eleme...
86
87
	 * @return The JPanel where the list of services is displayed.
	 */
5af53be7   Nathanael Jourdane   Make the applicat...
88
89
	public ServicesPanel getServicesPanel() {
		return servicesPanel;
1353e182   Nathanael Jourdane   Add minimal eleme...
90
91
92
	}

	/**
a227a22d   Nathanael Jourdane   Add comments.
93
	 * @return The status bar.
c57c07b1   Nathanael Jourdane   Add the bottom ba...
94
	 */
5af53be7   Nathanael Jourdane   Make the applicat...
95
96
	public BottomBarPanel getBottomBarPanel() {
		return bottomBarPanel;
c57c07b1   Nathanael Jourdane   Add the bottom ba...
97
98
99
	}

	/**
1353e182   Nathanael Jourdane   Add minimal eleme...
100
101
	 * Build and fill the GUI.
	 */
4ce406a8   Nathanael Jourdane   Add build() class...
102
	private void buildMainView() {
a227a22d   Nathanael Jourdane   Add comments.
103
104
		setLayout(new BorderLayout());

5af53be7   Nathanael Jourdane   Make the applicat...
105
106
		JSplitPane northPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, servicesPanel,
				requestPanel);
5af53be7   Nathanael Jourdane   Make the applicat...
107
		JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, northPanel, resultsPanel);
4ce406a8   Nathanael Jourdane   Add build() class...
108

5576be01   Nathanael Jourdane   Make panels resiz...
109
		add(mainPanel, BorderLayout.CENTER);
5af53be7   Nathanael Jourdane   Make the applicat...
110
		add(bottomBarPanel, BorderLayout.SOUTH);
1353e182   Nathanael Jourdane   Add minimal eleme...
111
112
113
	}

	/**
a227a22d   Nathanael Jourdane   Add comments.
114
	 * Display an error message. Usually used each time an error happens.
1353e182   Nathanael Jourdane   Add minimal eleme...
115
116
117
118
119
	 *
	 * @param title The title of the error.
	 * @param message The message of the error.
	 */
	public void displayError(String title, String message) {
4cc84b63   Nathanael Jourdane   Add the possibili...
120
121
		JOptionPane.showMessageDialog(this, message, title,
				JOptionPane.ERROR_MESSAGE);
1353e182   Nathanael Jourdane   Add minimal eleme...
122
123
	}

1353e182   Nathanael Jourdane   Add minimal eleme...
124
}