Commit d393913eb760e32f3c4de647b5fd60b3004f1379

Authored by Nathanael Jourdane
1 parent 1375d734
Exists in master

Move the Runnable inside the MainPanelCtrl in order to load the GUI before the data.

src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java
@@ -18,9 +18,6 @@ package eu.omp.irap.vespa.epntapclient; @@ -18,9 +18,6 @@ package eu.omp.irap.vespa.epntapclient;
18 18
19 import java.util.logging.Logger; 19 import java.util.logging.Logger;
20 20
21 -import javax.swing.JFrame;  
22 -import javax.swing.SwingUtilities;  
23 -  
24 import com.google.gson.Gson; 21 import com.google.gson.Gson;
25 22
26 import eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelCtrl; 23 import eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelCtrl;
@@ -49,36 +46,12 @@ public class EpnTapMainApp { @@ -49,36 +46,12 @@ public class EpnTapMainApp {
49 * @param args The program arguments (not used). 46 * @param args The program arguments (not used).
50 */ 47 */
51 public static void main(final String[] args) { 48 public static void main(final String[] args) {
52 - EpnTapMainApp.LOGGER.info("Lauching EPNTAP app with arguments: " + new Gson().toJson(args)); 49 + LOGGER.info("Lauching EPNTAP app with arguments: " + new Gson().toJson(args));
53 if (args.length != 0) { 50 if (args.length != 0) {
54 - System.console().writer().println(EpnTapMainApp.WRONG_COMMAND); 51 + System.console().writer().println(WRONG_COMMAND);
55 return; 52 return;
56 } 53 }
57 -  
58 - SwingUtilities.invokeLater(run("EPN-TAP client")); 54 + MainPanelCtrl guiCtrl = new MainPanelCtrl();
  55 + guiCtrl.readServices();
59 } 56 }
60 -  
61 - /**  
62 - * Creates runnable used to run the application GUI.  
63 - *  
64 - * @param title The title of the application window.  
65 - * @return The runnable.  
66 - */  
67 - private static Runnable run(final String title) {  
68 - return new Runnable() {  
69 -  
70 - @Override  
71 - public void run() {  
72 - MainPanelCtrl guiCtrl = new MainPanelCtrl();  
73 - guiCtrl.readServices();  
74 - JFrame frame = new JFrame(title);  
75 - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
76 - frame.setContentPane(guiCtrl.getView());  
77 - frame.setVisible(true);  
78 - frame.pack();  
79 - frame.setLocationRelativeTo(null);  
80 - }  
81 - };  
82 - }  
83 -  
84 } 57 }
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java
@@ -20,7 +20,9 @@ import java.awt.Cursor; @@ -20,7 +20,9 @@ import java.awt.Cursor;
20 import java.util.logging.Level; 20 import java.util.logging.Level;
21 import java.util.logging.Logger; 21 import java.util.logging.Logger;
22 22
  23 +import javax.swing.JFrame;
23 import javax.swing.JOptionPane; 24 import javax.swing.JOptionPane;
  25 +import javax.swing.SwingUtilities;
24 import javax.swing.SwingWorker; 26 import javax.swing.SwingWorker;
25 27
26 import eu.omp.irap.vespa.epntapclient.epntap.EpnTapController; 28 import eu.omp.irap.vespa.epntapclient.epntap.EpnTapController;
@@ -61,6 +63,29 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener @@ -61,6 +63,29 @@ public class MainPanelCtrl extends EpnTapController implements MainPanelListener
61 resultsPanelCtrl = new ResultPanelCtrl(this); 63 resultsPanelCtrl = new ResultPanelCtrl(this);
62 requestPanelCtrl = new RequestPanelCtrl(this); 64 requestPanelCtrl = new RequestPanelCtrl(this);
63 view = new MainPanelView(this); 65 view = new MainPanelView(this);
  66 + SwingUtilities.invokeLater(run("EPN-TAP client", view));
  67 + }
  68 +
  69 + /**
  70 + * Creates runnable used to run the application GUI.
  71 + *
  72 + * @param title The title of the application window.
  73 + * @param view The view of the VOTable, created by the VOTableController.
  74 + * @return The runnable.
  75 + */
  76 + private static Runnable run(final String title, final MainPanelView view) {
  77 + return new Runnable() {
  78 +
  79 + @Override
  80 + public void run() {
  81 + JFrame frame = new JFrame(title);
  82 + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  83 + frame.setContentPane(view);
  84 + frame.setVisible(true);
  85 + frame.pack();
  86 + frame.setLocationRelativeTo(null);
  87 + }
  88 + };
64 } 89 }
65 90
66 @Override 91 @Override