Commit a227a22d1655e6e47d68447bd3f98adfc6aa76f6

Authored by Nathanael Jourdane
1 parent 89e0ae9a
Exists in master

Add comments.

src/main/java/eu/omp/irap/vespa/epntapclient/controller/EpnTapController.java
@@ -30,6 +30,8 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableController; @@ -30,6 +30,8 @@ import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableController;
30 import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException; 30 import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException;
31 31
32 /** 32 /**
  33 + * The main controller which manage views and controllers.
  34 + *
33 * @author N. Jourdane 35 * @author N. Jourdane
34 */ 36 */
35 public class EpnTapController implements MainViewListener { 37 public class EpnTapController implements MainViewListener {
@@ -57,7 +59,7 @@ public class EpnTapController implements MainViewListener { @@ -57,7 +59,7 @@ public class EpnTapController implements MainViewListener {
57 private Map<String, Object> paramValues = new HashMap<>(); 59 private Map<String, Object> paramValues = new HashMap<>();
58 60
59 /** 61 /**
60 - * Method constructor 62 + * Method constructor, which initialize servicesController, resultsController and mainView.
61 */ 63 */
62 public EpnTapController() { 64 public EpnTapController() {
63 servicesController = new VOTableController(Const.DEFAULT_REGISTRY_URL, "ADQL", 65 servicesController = new VOTableController(Const.DEFAULT_REGISTRY_URL, "ADQL",
@@ -70,27 +72,29 @@ public class EpnTapController implements MainViewListener { @@ -70,27 +72,29 @@ public class EpnTapController implements MainViewListener {
70 } 72 }
71 73
72 /** 74 /**
73 - * @return the EPN-TAP view. 75 + * @return the EPN-TAP main view.
74 */ 76 */
75 public EpnTapMainView getView() { 77 public EpnTapMainView getView() {
76 return mainView; 78 return mainView;
77 } 79 }
78 80
79 /** 81 /**
80 - * @return The controller of the VOTable displaying the query results. 82 + * @return The controller of the VOTable which displays the result of the query.
81 */ 83 */
82 public VOTableController getResultsController() { 84 public VOTableController getResultsController() {
83 return resultsController; 85 return resultsController;
84 } 86 }
85 87
86 /** 88 /**
87 - * @return The controller of the VOTable displaying the list of services. 89 + * @return The controller of the VOTable which displays the list of services.
88 */ 90 */
89 public VOTableController getServicesController() { 91 public VOTableController getServicesController() {
90 return servicesController; 92 return servicesController;
91 } 93 }
92 94
93 /** 95 /**
  96 + * Update the row selected by the user on the Services Panel.
  97 + *
94 * @param row The row selected by the user on the Jtable. 98 * @param row The row selected by the user on the Jtable.
95 */ 99 */
96 public void updateSelected(int row) { 100 public void updateSelected(int row) {
@@ -105,24 +109,40 @@ public class EpnTapController implements MainViewListener { @@ -105,24 +109,40 @@ public class EpnTapController implements MainViewListener {
105 } 109 }
106 } 110 }
107 111
  112 + /**
  113 + * Remove a query parameter from the parameters list.
  114 + *
  115 + * @param paramName The name of the parameter as described in REG-TAP specifications.
  116 + */
108 public void removeParameter(String paramName) { 117 public void removeParameter(String paramName) {
109 paramValues.remove(paramName); 118 paramValues.remove(paramName);
110 updateQueryArea(); 119 updateQueryArea();
111 logger.info("removed " + paramName); 120 logger.info("removed " + paramName);
112 } 121 }
113 122
  123 + /**
  124 + * Update a query parameter in the parameter list.
  125 + *
  126 + * @param paramName The name of the parameter as described in REG-TAP specifications.
  127 + * @param value The value of the parameter to update.
  128 + */
114 public void updateParameter(String paramName, Object value) { 129 public void updateParameter(String paramName, Object value) {
115 paramValues.put(paramName, value); 130 paramValues.put(paramName, value);
116 updateQueryArea(); 131 updateQueryArea();
117 logger.info("uploaded " + paramName + ": " + value); 132 logger.info("uploaded " + paramName + ": " + value);
118 } 133 }
119 134
  135 + /**
  136 + * Update the query area with a working ADQL query, based on the parameters list.
  137 + */
120 private void updateQueryArea() { 138 private void updateQueryArea() {
121 String query = Queries.getQuery(selectedTableName, paramValues, 10); 139 String query = Queries.getQuery(selectedTableName, paramValues, 10);
122 mainView.getRequestPanel().updateQueryArea(query); 140 mainView.getRequestPanel().updateQueryArea(query);
123 } 141 }
124 142
125 /** 143 /**
  144 + * Send a query to the selected service on the services panel.
  145 + *
126 * @param query The query to send to the selected service. 146 * @param query The query to send to the selected service.
127 * @throws VOTableException Can not fill the Table 147 * @throws VOTableException Can not fill the Table
128 */ 148 */
@@ -132,8 +152,10 @@ public class EpnTapController implements MainViewListener { @@ -132,8 +152,10 @@ public class EpnTapController implements MainViewListener {
132 } 152 }
133 153
134 /** 154 /**
135 - * @param event  
136 - * @param args 155 + * This methods is called each time a graphical event is detected from a view.
  156 + *
  157 + * @param event The type of the detected event. @see Event
  158 + * @param args The possible arguments which comes with the event (ie. a row column).
137 */ 159 */
138 @Override 160 @Override
139 public void event(Event event, Object... args) { 161 public void event(Event event, Object... args) {
@@ -145,7 +167,7 @@ public class EpnTapController implements MainViewListener { @@ -145,7 +167,7 @@ public class EpnTapController implements MainViewListener {
145 case serviceSelected: 167 case serviceSelected:
146 updateSelected(((Integer) args[0]).intValue()); 168 updateSelected(((Integer) args[0]).intValue());
147 break; 169 break;
148 - case btnSearchClicked: 170 + case btnSendClicked:
149 sendQuery((String) object); 171 sendQuery((String) object);
150 break; 172 break;
151 case paramChanged: 173 case paramChanged:
src/main/java/eu/omp/irap/vespa/epntapclient/utils/Queries.java
@@ -24,6 +24,8 @@ import java.util.logging.Logger; @@ -24,6 +24,8 @@ import java.util.logging.Logger;
24 import eu.omp.irap.vespa.epntapclient.votable.Utils.StringJoiner; 24 import eu.omp.irap.vespa.epntapclient.votable.Utils.StringJoiner;
25 25
26 /** 26 /**
  27 + * Defines the queries and the query patterns usually used in the application.
  28 + *
27 * @author N. Jourdane 29 * @author N. Jourdane
28 */ 30 */
29 public final class Queries { 31 public final class Queries {
src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java
@@ -30,6 +30,8 @@ import eu.omp.irap.vespa.epntapclient.view.panels.ServicesPanel; @@ -30,6 +30,8 @@ import eu.omp.irap.vespa.epntapclient.view.panels.ServicesPanel;
30 import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; 30 import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView;
31 31
32 /** 32 /**
  33 + * The main view of the application, which manage all the other views.
  34 + *
33 * @author N. Jourdane 35 * @author N. Jourdane
34 */ 36 */
35 public class EpnTapMainView extends JPanel { 37 public class EpnTapMainView extends JPanel {
@@ -46,22 +48,35 @@ public class EpnTapMainView extends JPanel { @@ -46,22 +48,35 @@ public class EpnTapMainView extends JPanel {
46 /** The JPanel where the list of services is displayed. */ 48 /** The JPanel where the list of services is displayed. */
47 private ServicesPanel servicesPanel; 49 private ServicesPanel servicesPanel;
48 50
49 - /** The JPanel where the user put requests. */ 51 + /** The JPanel where the user build the query. */
50 private RequestPanel requestPanel; 52 private RequestPanel requestPanel;
51 53
52 - /** The JPanel where the user put requests. */ 54 + /** The status bar. */
53 private BottomBarPanel bottomBarPanel; 55 private BottomBarPanel bottomBarPanel;
54 56
  57 + /** The listener of the EpnTapMainView (usually the main controller) */
55 private MainViewListener mainViewListener; 58 private MainViewListener mainViewListener;
56 59
  60 + /**
  61 + * The interface for the main view listener, which listen for events.
  62 + *
  63 + * @author N. Jourdane
  64 + */
57 public interface MainViewListener { 65 public interface MainViewListener {
  66 + /**
  67 + * When an event is detected on the main view.
  68 + *
  69 + * @param event The event type. @see Event
  70 + * @param args The possible arguments which comes with the event (ie. a row number).
  71 + */
58 void event(Event event, Object... args); 72 void event(Event event, Object... args);
59 } 73 }
60 74
61 /** 75 /**
62 - * The constructor of the view. TODO: controlleur = รฉcouteur de la vue 76 + * The main view constructor, which create all the panels.
63 * 77 *
64 - * @param controller The EPN-TAP controller, allowing the EPN-TAP view to send events. 78 + * @param voTableServicesView The view to put in the services panel, built by ServicesController
  79 + * @param voTableResultsView The view to put in the results panel, built by ResultsController.
65 */ 80 */
66 81
67 public EpnTapMainView(VOTableView voTableServicesView, VOTableView voTableResultsView) { 82 public EpnTapMainView(VOTableView voTableServicesView, VOTableView voTableResultsView) {
@@ -69,23 +84,27 @@ public class EpnTapMainView extends JPanel { @@ -69,23 +84,27 @@ public class EpnTapMainView extends JPanel {
69 this.resultsPanel = new ResultsPanel(this, voTableResultsView); 84 this.resultsPanel = new ResultsPanel(this, voTableResultsView);
70 this.requestPanel = new RequestPanel(this); 85 this.requestPanel = new RequestPanel(this);
71 this.bottomBarPanel = new BottomBarPanel(this); 86 this.bottomBarPanel = new BottomBarPanel(this);
72 - setLayout(new BorderLayout());  
73 buildWindow(); 87 buildWindow();
74 } 88 }
75 89
  90 + /**
  91 + * Add a listener for the main view.
  92 + *
  93 + * @param listener A MainViewListener.
  94 + */
76 public void addMainViewListener(MainViewListener listener) { 95 public void addMainViewListener(MainViewListener listener) {
77 mainViewListener = listener; 96 mainViewListener = listener;
78 } 97 }
79 98
80 /** 99 /**
81 - * @return The JPanel where the VOTable results is displayed. 100 + * @return The JPanel where the VOTable result is displayed.
82 */ 101 */
83 public ResultsPanel getResultsPanel() { 102 public ResultsPanel getResultsPanel() {
84 return resultsPanel; 103 return resultsPanel;
85 } 104 }
86 105
87 /** 106 /**
88 - * @return The JPanel where the GUI elements to make the request are displayed. 107 + * @return The JPanel containing the GUI elements to build the query.
89 */ 108 */
90 public RequestPanel getRequestPanel() { 109 public RequestPanel getRequestPanel() {
91 return requestPanel; 110 return requestPanel;
@@ -99,7 +118,7 @@ public class EpnTapMainView extends JPanel { @@ -99,7 +118,7 @@ public class EpnTapMainView extends JPanel {
99 } 118 }
100 119
101 /** 120 /**
102 - * @return The JPanel where the list of services is displayed. 121 + * @return The status bar.
103 */ 122 */
104 public BottomBarPanel getBottomBarPanel() { 123 public BottomBarPanel getBottomBarPanel() {
105 return bottomBarPanel; 124 return bottomBarPanel;
@@ -109,18 +128,18 @@ public class EpnTapMainView extends JPanel { @@ -109,18 +128,18 @@ public class EpnTapMainView extends JPanel {
109 * Build and fill the GUI. 128 * Build and fill the GUI.
110 */ 129 */
111 public void buildWindow() { 130 public void buildWindow() {
  131 + setLayout(new BorderLayout());
  132 +
112 JSplitPane northPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, servicesPanel, 133 JSplitPane northPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, servicesPanel,
113 requestPanel); 134 requestPanel);
114 135
115 - // TODO: put requestView inside a JScrollPane.  
116 -  
117 JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, northPanel, resultsPanel); 136 JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, northPanel, resultsPanel);
118 add(mainPanel, BorderLayout.CENTER); 137 add(mainPanel, BorderLayout.CENTER);
119 add(bottomBarPanel, BorderLayout.SOUTH); 138 add(bottomBarPanel, BorderLayout.SOUTH);
120 } 139 }
121 140
122 /** 141 /**
123 - * Display an error. 142 + * Display an error message. Usually used each time an error happens.
124 * 143 *
125 * @param title The title of the error. 144 * @param title The title of the error.
126 * @param message The message of the error. 145 * @param message The message of the error.
@@ -130,6 +149,12 @@ public class EpnTapMainView extends JPanel { @@ -130,6 +149,12 @@ public class EpnTapMainView extends JPanel {
130 JOptionPane.ERROR_MESSAGE); 149 JOptionPane.ERROR_MESSAGE);
131 } 150 }
132 151
  152 + /**
  153 + * Get an event and send it to the listener of the main view.
  154 + *
  155 + * @param event The event type. @see Event
  156 + * @param args The possible arguments which comes with the event (ie. a row number).
  157 + */
133 public void event(Event event, Object... args) { 158 public void event(Event event, Object... args) {
134 mainViewListener.event(event, args); 159 mainViewListener.event(event, args);
135 } 160 }
src/main/java/eu/omp/irap/vespa/epntapclient/view/Event.java
@@ -20,5 +20,12 @@ package eu.omp.irap.vespa.epntapclient.view; @@ -20,5 +20,12 @@ package eu.omp.irap.vespa.epntapclient.view;
20 * @author N. Jourdane 20 * @author N. Jourdane
21 */ 21 */
22 public enum Event { 22 public enum Event {
23 - serviceSelected, btnSearchClicked, paramRemoved, paramChanged; 23 + /** When a service is selected on the service panel. */
  24 + serviceSelected,
  25 + /** When the `Send query` button is clicked. */
  26 + btnSendClicked,
  27 + /** When a parameter is removed on the parameter panel. */
  28 + paramRemoved,
  29 + /** When a parameter is updated to a valid value on the parameter panel. */
  30 + paramChanged;
24 } 31 }
src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java
@@ -45,6 +45,11 @@ import com.google.gson.JsonParser; @@ -45,6 +45,11 @@ import com.google.gson.JsonParser;
45 import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableConnection; 45 import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableConnection;
46 import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.SendQueryException; 46 import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.SendQueryException;
47 47
  48 +/**
  49 + * A field used to set a service parameter to build the query (in the parameter panel).
  50 + *
  51 + * @author N. Jourdane
  52 + */
48 public abstract class ParamField extends JPanel { 53 public abstract class ParamField extends JPanel {
49 /** */ 54 /** */
50 private static final long serialVersionUID = 6025994164004985362L; 55 private static final long serialVersionUID = 6025994164004985362L;
@@ -52,18 +57,29 @@ public abstract class ParamField extends JPanel { @@ -52,18 +57,29 @@ public abstract class ParamField extends JPanel {
52 /** The logger for the class ParamField. */ 57 /** The logger for the class ParamField. */
53 static final Logger logger = Logger.getLogger(ParamField.class.getName()); 58 static final Logger logger = Logger.getLogger(ParamField.class.getName());
54 59
  60 + /** The minimum width of the field. */
55 private static final int MIN_FIELD_WIDTH = 30; 61 private static final int MIN_FIELD_WIDTH = 30;
  62 + /** The preferred field height. */
56 private static final int FIELD_HEIGHT = 20; 63 private static final int FIELD_HEIGHT = 20;
  64 + /** The maximum width of the field. */
57 private static final int MAX_FIELD_WIDTH = 400; 65 private static final int MAX_FIELD_WIDTH = 400;
  66 + /** The preferred label width. */
58 private static final int LABEL_WIDTH = 140; 67 private static final int LABEL_WIDTH = 140;
59 68
  69 + /** The URL of the resolver used for the `target name` field. */
60 private static final String RESOLVER_URL = "http://voparis-registry.obspm.fr/ssodnet/1/autocomplete"; 70 private static final String RESOLVER_URL = "http://voparis-registry.obspm.fr/ssodnet/1/autocomplete";
  71 + /** The date format used in the DateRange field */
61 private static final String DATE_FORMAT = "dd/MM/yyyy"; 72 private static final String DATE_FORMAT = "dd/MM/yyyy";
  73 + /** The regex used to validate the Date fields */
62 private static final String DATE_REGEX = "(^(((0[1-9]|1[0-9]|2[0-8])[\\/](0[1-9]|1[012]))|((29|30|31)[\\/](0[13578]|1[02]))|((29|30)[\\/](0[4,6,9]|11)))[\\/](19|[2-9][0-9])\\d\\d$)|(^29[\\/]02[\\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)"; 74 private static final String DATE_REGEX = "(^(((0[1-9]|1[0-9]|2[0-8])[\\/](0[1-9]|1[012]))|((29|30|31)[\\/](0[13578]|1[02]))|((29|30)[\\/](0[4,6,9]|11)))[\\/](19|[2-9][0-9])\\d\\d$)|(^29[\\/]02[\\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)";
  75 + /** The suffix used in REG-TAP parameters names, indicating that it's a beginning of a range. */
63 private static final String MIN_SUFFIX = "min"; 76 private static final String MIN_SUFFIX = "min";
  77 + /** The suffix used in REG-TAP parameters names, indicating that it is a end of a range. */
64 private static final String MAX_SUFFIX = "max"; 78 private static final String MAX_SUFFIX = "max";
65 79
  80 + /** The main view of the application. */
66 protected EpnTapMainView mainView; 81 protected EpnTapMainView mainView;
  82 + /** The parameter name of the field */
67 protected String paramName; 83 protected String paramName;
68 84
69 public ParamField(EpnTapMainView mainView, String paramName) { 85 public ParamField(EpnTapMainView mainView, String paramName) {
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/BottomBarPanel.java
@@ -29,18 +29,25 @@ import eu.omp.irap.vespa.epntapclient.view.EpnTapMainView; @@ -29,18 +29,25 @@ import eu.omp.irap.vespa.epntapclient.view.EpnTapMainView;
29 * @author N. Jourdane 29 * @author N. Jourdane
30 */ 30 */
31 public class BottomBarPanel extends JPanel { 31 public class BottomBarPanel extends JPanel {
32 - /** */ 32 + /** The serial version UID (affected with a random number). */
33 private static final long serialVersionUID = 8083897308526492902L; 33 private static final long serialVersionUID = 8083897308526492902L;
34 34
35 /** The logger for the class BottomBar. */ 35 /** The logger for the class BottomBar. */
36 @SuppressWarnings("unused") 36 @SuppressWarnings("unused")
37 private static final Logger logger = Logger.getLogger(BottomBarPanel.class.getName()); 37 private static final Logger logger = Logger.getLogger(BottomBarPanel.class.getName());
38 38
  39 + /** The main view of the application. */
39 @SuppressWarnings("unused") 40 @SuppressWarnings("unused")
40 private EpnTapMainView mainView; 41 private EpnTapMainView mainView;
41 42
  43 + /** A label to display several informations (aka. status bar). */
42 private JLabel infoLabel; 44 private JLabel infoLabel;
43 45
  46 + /**
  47 + * Method constructor for the bottom bar panel.
  48 + *
  49 + * @param mainView The main view of the application.
  50 + */
44 public BottomBarPanel(EpnTapMainView mainView) { 51 public BottomBarPanel(EpnTapMainView mainView) {
45 this.mainView = mainView; 52 this.mainView = mainView;
46 setLayout(new BorderLayout()); 53 setLayout(new BorderLayout());
@@ -49,6 +56,9 @@ public class BottomBarPanel extends JPanel { @@ -49,6 +56,9 @@ public class BottomBarPanel extends JPanel {
49 this.add(new JButton("Get File"), BorderLayout.EAST); 56 this.add(new JButton("Get File"), BorderLayout.EAST);
50 } 57 }
51 58
  59 + /**
  60 + * @param infoText The text to display in the status-bar, which will override the old one.
  61 + */
52 public void setInfoText(String infoText) { 62 public void setInfoText(String infoText) {
53 infoLabel.setText(infoText); 63 infoLabel.setText(infoText);
54 } 64 }
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/RequestPanel.java
@@ -40,6 +40,8 @@ import eu.omp.irap.vespa.epntapclient.view.ParamField.FloatRangeField; @@ -40,6 +40,8 @@ import eu.omp.irap.vespa.epntapclient.view.ParamField.FloatRangeField;
40 import eu.omp.irap.vespa.epntapclient.view.ParamField.TargetNameField; 40 import eu.omp.irap.vespa.epntapclient.view.ParamField.TargetNameField;
41 41
42 /** 42 /**
  43 + * The view of the panel where the user builds the query.
  44 + *
43 * @author N. Jourdane 45 * @author N. Jourdane
44 */ 46 */
45 public class RequestPanel extends JPanel implements ActionListener { 47 public class RequestPanel extends JPanel implements ActionListener {
@@ -50,16 +52,15 @@ public class RequestPanel extends JPanel implements ActionListener { @@ -50,16 +52,15 @@ public class RequestPanel extends JPanel implements ActionListener {
50 /** The serial version UID (affected with a random number). */ 52 /** The serial version UID (affected with a random number). */
51 private static final long serialVersionUID = 1262856496809315405L; 53 private static final long serialVersionUID = 1262856496809315405L;
52 54
  55 + /** The name of the button to send the query. */
53 private static final String BTN_NAME = "btnSend"; 56 private static final String BTN_NAME = "btnSend";
54 57
55 - /** The EPN-TAP main view. */ 58 + /** The main view of the application. */
56 private EpnTapMainView mainView; 59 private EpnTapMainView mainView;
57 60
58 - /** The text area where the user put the query. */ 61 + /** The text area where the user write the query. */
59 private JTextArea queryArea; 62 private JTextArea queryArea;
60 63
61 - // TODO: Use one map for paramFields, paramValues, paramTypes.  
62 -  
63 /** 64 /**
64 * The parameters fields for the request. 65 * The parameters fields for the request.
65 */ 66 */
@@ -79,6 +80,7 @@ public class RequestPanel extends JPanel implements ActionListener { @@ -79,6 +80,7 @@ public class RequestPanel extends JPanel implements ActionListener {
79 setPreferredSize(new Dimension(Dim.RIGHT_PANEL_WIDTH, Dim.TOP_PANEL_HEIGHT)); 80 setPreferredSize(new Dimension(Dim.RIGHT_PANEL_WIDTH, Dim.TOP_PANEL_HEIGHT));
80 setMinimumSize(new Dimension(Dim.RIGHT_PANEL_MIN_WIDTH, Dim.TOP_PANEL_MIN_HEIGHT)); 81 setMinimumSize(new Dimension(Dim.RIGHT_PANEL_MIN_WIDTH, Dim.TOP_PANEL_MIN_HEIGHT));
81 82
  83 + // TODO: Use a JScrollPane.
82 // TODO: Get max row number from the GUI 84 // TODO: Get max row number from the GUI
83 85
84 this.add(buildParamPanel(), this); 86 this.add(buildParamPanel(), this);
@@ -86,17 +88,23 @@ public class RequestPanel extends JPanel implements ActionListener { @@ -86,17 +88,23 @@ public class RequestPanel extends JPanel implements ActionListener {
86 this.add(buildButtonPanel(), this); 88 this.add(buildButtonPanel(), this);
87 } 89 }
88 90
  91 + /**
  92 + * @return The main view of the application.
  93 + */
89 public EpnTapMainView getMainView() { 94 public EpnTapMainView getMainView() {
90 return mainView; 95 return mainView;
91 } 96 }
92 97
93 /** 98 /**
94 - * @return A JPanel containing graphical elements for the service parameters. 99 + * Build a JPanel containing graphical elements to build the query user-friendly.
  100 + *
  101 + * @return The JPanel.
95 */ 102 */
96 private JPanel buildParamPanel() { 103 private JPanel buildParamPanel() {
97 // TODO: new GUI field column to allow the user to select the comparison operator: 104 // TODO: new GUI field column to allow the user to select the comparison operator:
98 // - if the field is a String: listbox with 'xx', '%xx', 'xx%', and '%xx%'. 105 // - if the field is a String: listbox with 'xx', '%xx', 'xx%', and '%xx%'.
99 // - if the field is a numeric value: listbox with <, <=, =, =>, >. 106 // - if the field is a numeric value: listbox with <, <=, =, =>, >.
  107 + // TODO use enums for the parameters names
100 paramFields = new ArrayList<>(); 108 paramFields = new ArrayList<>();
101 paramFields.add(new TargetNameField(mainView, "target_name")); 109 paramFields.add(new TargetNameField(mainView, "target_name"));
102 paramFields.add(new DateRangeField(mainView, "time_")); 110 paramFields.add(new DateRangeField(mainView, "time_"));
@@ -114,7 +122,9 @@ public class RequestPanel extends JPanel implements ActionListener { @@ -114,7 +122,9 @@ public class RequestPanel extends JPanel implements ActionListener {
114 } 122 }
115 123
116 /** 124 /**
117 - * @return A JPanel containing graphical elements for the query. 125 + * Build a JPanel containing a text-area where the query is displayed.
  126 + *
  127 + * @return The JPanel.
118 */ 128 */
119 private JPanel buildQueryPanel() { 129 private JPanel buildQueryPanel() {
120 JPanel queryPanel = new JPanel(); 130 JPanel queryPanel = new JPanel();
@@ -129,14 +139,18 @@ public class RequestPanel extends JPanel implements ActionListener { @@ -129,14 +139,18 @@ public class RequestPanel extends JPanel implements ActionListener {
129 } 139 }
130 140
131 /** 141 /**
132 - * Update the query JTextArea according to the parameters values. 142 + * Update the query JTextArea.
  143 + *
  144 + * @param query The string literal to put in the text-area, which will override the old content.
133 */ 145 */
134 public void updateQueryArea(String query) { 146 public void updateQueryArea(String query) {
135 queryArea.setText(query); 147 queryArea.setText(query);
136 } 148 }
137 149
138 /** 150 /**
139 - * @return A JPanel containing the button(s). 151 + * Build a JPanel containing the button(s), particularly the `Send` button.
  152 + *
  153 + * @return The JPanel .
140 */ 154 */
141 private JPanel buildButtonPanel() { 155 private JPanel buildButtonPanel() {
142 JPanel buttonPanel = new JPanel(); 156 JPanel buttonPanel = new JPanel();
@@ -149,10 +163,13 @@ public class RequestPanel extends JPanel implements ActionListener { @@ -149,10 +163,13 @@ public class RequestPanel extends JPanel implements ActionListener {
149 return buttonPanel; 163 return buttonPanel;
150 } 164 }
151 165
  166 + /**
  167 + * This method is called when the user click on the `Send` button.
  168 + */
152 @Override 169 @Override
153 public void actionPerformed(ActionEvent evt) { 170 public void actionPerformed(ActionEvent evt) {
154 if (((JButton) evt.getSource()).getName() == BTN_NAME) { 171 if (((JButton) evt.getSource()).getName() == BTN_NAME) {
155 - this.mainView.event(Event.btnSearchClicked, queryArea.getText()); 172 + this.mainView.event(Event.btnSendClicked, queryArea.getText());
156 } 173 }
157 } 174 }
158 175
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java
@@ -34,13 +34,24 @@ public class ResultsPanel extends JPanel { @@ -34,13 +34,24 @@ public class ResultsPanel extends JPanel {
34 private static final long serialVersionUID = -3387526562625069156L; 34 private static final long serialVersionUID = -3387526562625069156L;
35 35
36 /** The logger for the class ResultPanel. */ 36 /** The logger for the class ResultPanel. */
  37 + @SuppressWarnings("unused")
37 private static final Logger logger = Logger.getLogger(ResultsPanel.class.getName()); 38 private static final Logger logger = Logger.getLogger(ResultsPanel.class.getName());
38 39
  40 + /** The main view of the application. */
39 @SuppressWarnings("unused") 41 @SuppressWarnings("unused")
40 private EpnTapMainView mainView; 42 private EpnTapMainView mainView;
41 43
  44 + /** The generic view of the VOTable panel. */
  45 + @SuppressWarnings("unused")
42 private VOTableView voTableView; 46 private VOTableView voTableView;
43 47
  48 + /**
  49 + * Method constructor which customize the result panel, but don't build it from scratch since
  50 + * VOTableView is already created by ResultController.
  51 + *
  52 + * @param mainView The main view of the application.
  53 + * @param voTableView The generic view of the VOTable panel.
  54 + */
44 public ResultsPanel(EpnTapMainView mainView, VOTableView voTableView) { 55 public ResultsPanel(EpnTapMainView mainView, VOTableView voTableView) {
45 super(); 56 super();
46 57
@@ -54,6 +65,5 @@ public class ResultsPanel extends JPanel { @@ -54,6 +65,5 @@ public class ResultsPanel extends JPanel {
54 Dim.BOTTOM_PANEL_HEIGHT)); 65 Dim.BOTTOM_PANEL_HEIGHT));
55 setMinimumSize(new Dimension(Dim.LEFT_PANEL_MIN_WIDTH + Dim.RIGHT_PANEL_MIN_WIDTH, 66 setMinimumSize(new Dimension(Dim.LEFT_PANEL_MIN_WIDTH + Dim.RIGHT_PANEL_MIN_WIDTH,
56 Dim.BOTTOM_PANEL_MIN_HEIGHT)); 67 Dim.BOTTOM_PANEL_MIN_HEIGHT));
57 -  
58 } 68 }
59 } 69 }
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java
@@ -33,17 +33,27 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView; @@ -33,17 +33,27 @@ import eu.omp.irap.vespa.epntapclient.votable.view.VOTableView;
33 * @author N. Jourdane 33 * @author N. Jourdane
34 */ 34 */
35 public class ServicesPanel extends JPanel { 35 public class ServicesPanel extends JPanel {
36 - /** */ 36 + /** The serial version UID (affected with a random number). */
37 private static final long serialVersionUID = 7850369546415832758L; 37 private static final long serialVersionUID = 7850369546415832758L;
38 38
39 /** The logger for the class ServicesView. */ 39 /** The logger for the class ServicesView. */
40 @SuppressWarnings("unused") 40 @SuppressWarnings("unused")
41 private static final Logger logger = Logger.getLogger(ServicesPanel.class.getName()); 41 private static final Logger logger = Logger.getLogger(ServicesPanel.class.getName());
42 42
  43 + /** The main view of the application. */
  44 + @SuppressWarnings("unused")
43 private EpnTapMainView mainView; 45 private EpnTapMainView mainView;
44 46
  47 + /** The generic view of the VOTable panel. */
45 private VOTableView voTableView; 48 private VOTableView voTableView;
46 49
  50 + /**
  51 + * Method constructor which customize the services panel, but don't build it from scratch since
  52 + * VOTableView is already created by ServicesController. Add also the JTable listener.
  53 + *
  54 + * @param mainView The main view of the application.
  55 + * @param voTableView The generic view of the VOTable panel.
  56 + */
47 public ServicesPanel(final EpnTapMainView mainView, final VOTableView voTableView) { 57 public ServicesPanel(final EpnTapMainView mainView, final VOTableView voTableView) {
48 super(); 58 super();
49 this.mainView = mainView; 59 this.mainView = mainView;
@@ -63,13 +73,20 @@ public class ServicesPanel extends JPanel { @@ -63,13 +73,20 @@ public class ServicesPanel extends JPanel {
63 voTableView.getTable().getSelectedRow()); 73 voTableView.getTable().getSelectedRow());
64 } 74 }
65 }); 75 });
66 -  
67 } 76 }
68 77
  78 + /**
  79 + * @param row The row index in the JTable element.
  80 + * @return The URL of the service corresponding to the row.
  81 + */
69 public String getServiceURL(int row) { 82 public String getServiceURL(int row) {
70 return (String) this.voTableView.getValueAt(5, row); 83 return (String) this.voTableView.getValueAt(5, row);
71 } 84 }
72 85
  86 + /**
  87 + * @param row The row index in the JTable element.
  88 + * @return The table name of the service corresponding to the row.
  89 + */
73 public String getTableName(int row) { 90 public String getTableName(int row) {
74 return (String) this.voTableView.getValueAt(2, row); 91 return (String) this.voTableView.getValueAt(2, row);
75 } 92 }
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableConnection.java
@@ -31,7 +31,6 @@ import java.util.Date; @@ -31,7 +31,6 @@ import java.util.Date;
31 import java.util.logging.Logger; 31 import java.util.logging.Logger;
32 32
33 import eu.omp.irap.vespa.epntapclient.utils.Const; 33 import eu.omp.irap.vespa.epntapclient.utils.Const;
34 -import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.BadRequestException;  
35 import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.SendQueryException; 34 import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableException.SendQueryException;
36 35
37 /** 36 /**
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableDataParser.java
@@ -92,7 +92,7 @@ public class VOTableDataParser { @@ -92,7 +92,7 @@ public class VOTableDataParser {
92 parseFITSStream(table.getDATA().getFITS().getSTREAM(), fields); 92 parseFITSStream(table.getDATA().getFITS().getSTREAM(), fields);
93 } 93 }
94 94
95 - String logPath = Utils.printObject("voTableData", data); 95 + Utils.printObject("voTableData", data);
96 } 96 }
97 97
98 /** 98 /**
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableException.java
@@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
17 package eu.omp.irap.vespa.epntapclient.votable.controller; 17 package eu.omp.irap.vespa.epntapclient.votable.controller;
18 18
19 import java.io.IOException; 19 import java.io.IOException;
20 -import java.util.logging.Logger;  
21 20
22 /** 21 /**
23 * VOTable Exception class. 22 * VOTable Exception class.
@@ -26,9 +25,6 @@ import java.util.logging.Logger; @@ -26,9 +25,6 @@ import java.util.logging.Logger;
26 */ 25 */
27 @SuppressWarnings({ "javadoc", "serial" }) 26 @SuppressWarnings({ "javadoc", "serial" })
28 public abstract class VOTableException extends Exception { 27 public abstract class VOTableException extends Exception {
29 - /** The logger for the class VOTableException. */  
30 - private static final Logger logger = Logger.getLogger(VOTableException.class.getName());  
31 -  
32 public VOTableException(String message) { 28 public VOTableException(String message) {
33 super(message); 29 super(message);
34 } 30 }
@@ -73,7 +69,6 @@ public abstract class VOTableException extends Exception { @@ -73,7 +69,6 @@ public abstract class VOTableException extends Exception {
73 } 69 }
74 } 70 }
75 71
76 - // The query is not valid.  
77 public static class ErrorInVOTableException extends VOTableException { 72 public static class ErrorInVOTableException extends VOTableException {
78 public ErrorInVOTableException(String errorInfo) { 73 public ErrorInVOTableException(String errorInfo) {
79 super("There is an error in the VOTable:\n" + errorInfo 74 super("There is an error in the VOTable:\n" + errorInfo
@@ -81,10 +76,4 @@ public abstract class VOTableException extends Exception { @@ -81,10 +76,4 @@ public abstract class VOTableException extends Exception {
81 } 76 }
82 } 77 }
83 78
84 - public static class BadRequestException extends VOTableException {  
85 - public BadRequestException(String message, String info) {  
86 - super(message);  
87 - }  
88 - }  
89 -  
90 } 79 }