Commit 5576be0112cb4856ea9ce4d0321bddd32519050a

Authored by Nathanael Jourdane
1 parent d9985692
Exists in master

Make panels resizable and add a linewrap to queryArea.

src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java
... ... @@ -56,7 +56,7 @@ public class EpnTapMainApp {
56 56 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
57 57 frame.setContentPane(epnTapControl.getView());
58 58 frame.setVisible(true);
59   - frame.setSize(1000, 600);
  59 + frame.pack();
60 60 frame.setLocationRelativeTo(null);
61 61 });
62 62 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java
... ... @@ -17,9 +17,14 @@
17 17 package eu.omp.irap.vespa.epntapclient.view;
18 18  
19 19 import java.awt.BorderLayout;
  20 +import java.awt.Dimension;
20 21  
21 22 import javax.swing.JOptionPane;
22 23 import javax.swing.JPanel;
  24 +import javax.swing.JSplitPane;
  25 +
  26 +import org.apache.logging.log4j.LogManager;
  27 +import org.apache.logging.log4j.Logger;
23 28  
24 29 import eu.omp.irap.vespa.epntapclient.controller.EpnTapController;
25 30 import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView;
... ... @@ -29,6 +34,9 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView;
29 34 */
30 35 public class EpnTapMainView extends JPanel {
31 36  
  37 + /** The logger for this class. */
  38 + static final Logger logger = LogManager.getLogger(EpnTapMainView.class);
  39 +
32 40 /** The serial version UID (affected with a random number). */
33 41 private static final long serialVersionUID = -1233290271099283814L;
34 42  
... ... @@ -58,10 +66,10 @@ public class EpnTapMainView extends JPanel {
58 66 this.resultsView = resultsView;
59 67 this.requestView = new RequestView(this);
60 68  
  69 + setLayout(new BorderLayout());
61 70 buildWindow();
62 71  
63 72 // TODO: Support multi-selection
64   -
65 73 servicesView.getTable().getSelectionModel().addListSelectionListener(
66 74 e -> controller.setSelectedService(servicesView.getTable().getSelectedRow()));
67 75 }
... ... @@ -91,13 +99,20 @@ public class EpnTapMainView extends JPanel {
91 99 * Build and fill the GUI.
92 100 */
93 101 public void buildWindow() {
94   - JPanel northPanel = new JPanel(new BorderLayout());
95   - northPanel.add(servicesView, BorderLayout.WEST);
96   - northPanel.add(requestView, BorderLayout.CENTER);
  102 + JSplitPane northPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, servicesView,
  103 + requestView);
97 104  
98   - setLayout(new BorderLayout());
99   - add(northPanel, BorderLayout.NORTH);
100   - add(resultsView, BorderLayout.CENTER);
  105 + servicesView.setMinimumSize(new Dimension(100, 50));
  106 + servicesView.setPreferredSize(new Dimension(300, 300));
  107 +
  108 + requestView.setMinimumSize(new Dimension(100, 50));
  109 + requestView.setPreferredSize(new Dimension(200, 200));
  110 +
  111 + resultsView.setMinimumSize(new Dimension(200, 50));
  112 + resultsView.setPreferredSize(new Dimension(600, 100));
  113 +
  114 + JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, northPanel, resultsView);
  115 + add(mainPanel, BorderLayout.CENTER);
101 116 }
102 117  
103 118 /**
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/view/RequestView.java
... ... @@ -57,6 +57,7 @@ public class RequestView extends JPanel implements ActionListener {
57 57 this.mainView = mainView;
58 58 JLabel queryTitle = new JLabel("Query for the selected service");
59 59 queryArea = new JTextArea(Queries.SAMPLE_AMDA_QUERY);
  60 + queryArea.setLineWrap(true);
60 61 JButton button = new JButton("Send query");
61 62 button.setName("btnSend");
62 63 setLayout(new BorderLayout());
... ...