Commit 76a922bcec2b0e95b404cb3ca7359e15e84e5f99

Authored by Nathanael Jourdane
1 parent fd93317f
Exists in master

Improve Javadoc.

Showing 21 changed files with 373 additions and 137 deletions   Show diff stats
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java
... ... @@ -92,14 +92,23 @@ public class MainPanelCtrl extends EpnTapController {
92 92 return requestPanelCtrl;
93 93 }
94 94  
  95 + /**
  96 + * @return The controller of the service panel.
  97 + */
95 98 public ServicesPanelCtrl getServicePanelCtrl() {
96 99 return servicesPanelCtrl;
97 100 }
98 101  
  102 + /**
  103 + * @return The controller of the result panel.
  104 + */
99 105 public ResultPanelCtrl getResultPanelCtrl() {
100 106 return resultPanelCtrl;
101 107 }
102 108  
  109 + /**
  110 + * @return The main view of the application.
  111 + */
103 112 public MainPanelView getView() {
104 113 return view;
105 114 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelView.java
... ... @@ -50,8 +50,7 @@ public class MainPanelView extends JPanel {
50 50 /**
51 51 * The main view constructor, which create all the panels.
52 52 *
53   - * @param voTableServicesView The view to put in the services panel, built by ServicesController
54   - * @param voTableResultsView The view to put in the results panel, built by ResultsController.
  53 + * @param mainPanelCtrl The controller of the main panel.
55 54 */
56 55  
57 56 public MainPanelView(MainPanelCtrl mainPanelCtrl) {
... ... @@ -62,7 +61,7 @@ public class MainPanelView extends JPanel {
62 61 }
63 62  
64 63 /**
65   - * Build and fill the GUI.
  64 + * Build the panel and add GUI elements on it.
66 65 */
67 66 private void buildMainView() {
68 67 setLayout(new BorderLayout());
... ... @@ -77,6 +76,9 @@ public class MainPanelView extends JPanel {
77 76 setSizes();
78 77 }
79 78  
  79 + /**
  80 + * Set the preferred and minimum size of panels.
  81 + */
80 82 private void setSizes() {
81 83 servicesPanel.setPreferredSize(
82 84 new Dimension(GUIDim.LEFT_PANEL_WIDTH, GUIDim.TOP_PANEL_HEIGHT));
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelCtrl.java
... ... @@ -29,26 +29,26 @@ public class RequestPanelCtrl extends RequestCtrl implements RequestPanelListene
29 29 /** The logger for the class RequestPanelCtrl. */
30 30 private static final Logger LOGGER = Logger.getLogger(RequestPanelCtrl.class.getName());
31 31  
32   - MainPanelCtrl mainPanelCtrl;
  32 + /** The controller of the main panel. */
  33 + private MainPanelCtrl mainPanelCtrl;
33 34  
34   - RequestPanelView view;
  35 + /** The view of the request panel. */
  36 + private RequestPanelView view;
35 37  
36 38  
37 39 /**
38 40 * Constructor of RequestPanelCtrl
39 41 *
40   - * @param epnTapCtrl
  42 + * @param mainPanelCtrl The controller of the main panel.
41 43 */
42 44 public RequestPanelCtrl(MainPanelCtrl mainPanelCtrl) {
43 45 this.mainPanelCtrl = mainPanelCtrl;
44 46 view = new RequestPanelView(this);
45 47 }
46 48  
47   - public void setMainPanelCtrl(MainPanelCtrl mainPanelCtrl) {
48   - this.mainPanelCtrl = mainPanelCtrl;
49   - view = new RequestPanelView(this);
50   - }
51   -
  49 + /**
  50 + * @return The view of the request panel.
  51 + */
52 52 public RequestPanelView getView() {
53 53 return view;
54 54 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelListener.java
... ... @@ -22,24 +22,24 @@ package eu.omp.irap.vespa.epntapclient.gui.requestpanel;
22 22 public interface RequestPanelListener {
23 23  
24 24 /**
25   - * ...
26   - *
27   - * @param text
  25 + * Method called when the used click on the 'Send query' button.
  26 + *
  27 + * @param query The query
28 28 */
29   - void onSendButtonClicked(String text);
  29 + void onSendButtonClicked(String query);
30 30  
31 31 /**
32   - * ...
  32 + * Method called when the user remove a parameter with a parameter field.
33 33 *
34   - * @param paramName
  34 + * @param paramName The name of the removed parameter
35 35 */
36 36 void onParameterRemoved(String paramName);
37 37  
38 38 /**
39   - * ...
  39 + * Method called when the user change a parameter (add or update) with a parameter field.
40 40 *
41   - * @param paramName
42   - * @param query
  41 + * @param paramName The name of the changed parameter.
  42 + * @param paramValue The new value of the parameter.
43 43 */
44 44 void onParameterChanged(String paramName, Object paramValue);
45 45  
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelView.java
... ... @@ -45,74 +45,114 @@ public class RequestPanelView extends JPanel {
45 45 /** The serial version UID. */
46 46 private static final long serialVersionUID = 1L;
47 47  
  48 + /** The height of the buttons panel. */
  49 + private static final int BUTTON_PANEL_HEIGHT = 20;
  50 +
  51 + /** The listener for the request panel. */
  52 + RequestPanelListener listener;
  53 +
48 54 /** The text area where the user write the query. */
49 55 protected JTextArea queryArea;
50 56  
51   - /**
52   - * The parameters fields for the request.
53   - */
  57 + /** The parameters fields for the request. */
54 58 private List<ParamField> paramFields;
55 59  
  60 + /** A field to set the target_name parameter. */
56 61 private TargetNameField targetNameField;
57 62  
  63 + /** A field to set the time_range parameter. */
58 64 private DateRangeField timeRangeField;
59 65  
  66 + /** A field to set the spectral_range parameter. */
60 67 private FloatRangeField spectralRangeField;
61 68  
  69 + /** A field to set the dataproduct_type parameter. */
62 70 private DataProductTypeField dataProductTypeField;
63 71  
64   - /** The height of the buttons panel. */
65   - private static final int BUTTON_PANEL_HEIGHT = 20;
66   -
67   - RequestPanelListener requestPanelListener;
  72 + /** The GUI element of the button to send the query. */
  73 + private JButton buttonSend;
68 74  
69 75  
70 76 /**
71 77 * Method constructor
72 78 *
73   - * @param mainView The EPN-TAP main view.
  79 + * @param requestPanelListener The listener of the request panel view.
74 80 */
75 81 public RequestPanelView(RequestPanelListener requestPanelListener) {
76   - this.requestPanelListener = requestPanelListener;
  82 + listener = requestPanelListener;
77 83 buildRequestPanel();
78 84 }
79 85  
  86 + /**
  87 + * Add GUI elements to the request panel.
  88 + */
80 89 private void buildRequestPanel() {
81 90 setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
82 91  
83   - this.add(buildParamPanel(), this);
84   - this.add(buildQueryPanel(), this);
85   - this.add(buildButtonPanel(), this);
86   - }
  92 + JPanel queryPanel = new JPanel();
  93 + queryPanel.setBorder(BorderFactory.createTitledBorder("Query for the selected service(s)"));
  94 + queryPanel.setLayout(new BorderLayout());
  95 + queryPanel.add(getQueryArea(), BorderLayout.CENTER);
87 96  
88   - /**
89   - * Build a JPanel containing graphical elements to build the query user-friendly.
90   - *
91   - * @return The JPanel.
92   - */
93   - public JPanel buildParamPanel() {
94   - paramFields = new ArrayList<>();
95   - paramFields.add(getTargetNameField());
96   - paramFields.add(getTimeRangeField());
97   - paramFields.add(getSpectralRangeField());
98   - paramFields.add(getDataProductTypeField());
99 97 JPanel paramPanel = new JPanel();
100 98 paramPanel.setLayout(new BoxLayout(paramPanel, BoxLayout.Y_AXIS));
101 99 paramPanel.setBorder(BorderFactory.createTitledBorder("Query parameters"));
102   -
103   - for (ParamField field : paramFields) {
  100 + for (ParamField field : getParamFields()) {
104 101 paramPanel.add(field);
105 102 }
106 103  
107   - return paramPanel;
  104 + JPanel buttonPanel = new JPanel();
  105 + buttonPanel.add(getButtonSend());
  106 + buttonPanel.setMaximumSize(new Dimension(1000, BUTTON_PANEL_HEIGHT));
  107 +
  108 + this.add(paramPanel, this);
  109 + this.add(queryPanel, this);
  110 + this.add(buttonPanel, this);
108 111 }
109 112  
110 113 /**
111   - * @return the data product field
  114 + * Get the GUI element of the send button. If it doesn't exist, create it.
  115 + *
  116 + * @return The button.
  117 + */
  118 + public JButton getButtonSend() {
  119 + if (buttonSend == null) {
  120 + buttonSend = new JButton("Send query");
  121 + buttonSend.addActionListener(new ActionListener() {
  122 +
  123 + @Override
  124 + public void actionPerformed(ActionEvent e) {
  125 + listener.onSendButtonClicked(queryArea.getText());
  126 + }
  127 + });
  128 + }
  129 + return buttonSend;
  130 + }
  131 +
  132 + /**
  133 + * Get the GUI element of the parameters fields list. If it doesn't exist, create it.
  134 + *
  135 + * @return The parameters fields list.
  136 + */
  137 + public List<ParamField> getParamFields() {
  138 + if (paramFields == null) {
  139 + paramFields = new ArrayList<>();
  140 + paramFields.add(getTargetNameField());
  141 + paramFields.add(getTimeRangeField());
  142 + paramFields.add(getSpectralRangeField());
  143 + paramFields.add(getDataProductTypeField());
  144 + }
  145 + return paramFields;
  146 + }
  147 +
  148 + /**
  149 + * Get the GUI element of the data product field. If it doesn't exist, create it.
  150 + *
  151 + * @return The data product field.
112 152 */
113 153 public DataProductTypeField getDataProductTypeField() {
114 154 if (dataProductTypeField == null) {
115   - dataProductTypeField = new DataProductTypeField(requestPanelListener,
  155 + dataProductTypeField = new DataProductTypeField(listener,
116 156 "dataproduct_type");
117 157 }
118 158  
... ... @@ -120,82 +160,64 @@ public class RequestPanelView extends JPanel {
120 160 }
121 161  
122 162 /**
123   - * @return the spectral range field
  163 + * Get the GUI element of the spectral_range field. If it doesn't exist, create it.
  164 + *
  165 + * @return The spectral_range field.
124 166 */
125 167 public FloatRangeField getSpectralRangeField() {
126 168 if (spectralRangeField == null) {
127   - spectralRangeField = new FloatRangeField(requestPanelListener, "spectral_range_");
  169 + spectralRangeField = new FloatRangeField(listener, "spectral_range_");
128 170 }
129 171  
130 172 return spectralRangeField;
131 173 }
132 174  
133 175 /**
134   - * @return the time range field
  176 + * Get the GUI element of the time range field. If it doesn't exist, create it.
  177 + *
  178 + * @return The time range field.
135 179 */
136 180 public DateRangeField getTimeRangeField() {
137 181 if (timeRangeField == null) {
138   - timeRangeField = new DateRangeField(requestPanelListener, "time_");
  182 + timeRangeField = new DateRangeField(listener, "time_");
139 183 }
140 184  
141 185 return timeRangeField;
142 186 }
143 187  
144 188 /**
145   - * @return the target name field
  189 + * Get the GUI element of the target name field. If it doesn't exist, create it.
  190 + *
  191 + * @return The target name field.
146 192 */
147 193 public TargetNameField getTargetNameField() {
148 194 if (targetNameField == null) {
149   - targetNameField = new TargetNameField(requestPanelListener, "target_name");
  195 + targetNameField = new TargetNameField(listener, "target_name");
150 196 }
151 197  
152 198 return targetNameField;
153 199 }
154 200  
155 201 /**
156   - * Build a JPanel containing a text-area where the query is displayed.
  202 + * Get the GUI element of the query area. If it doesn't exist, create it.
157 203 *
158   - * @return The JPanel.
  204 + * @return The target query area.
159 205 */
160   - private JPanel buildQueryPanel() {
161   - JPanel queryPanel = new JPanel();
162   - queryPanel.setBorder(BorderFactory.createTitledBorder("Query for the selected service(s)"));
163   - queryArea = new JTextArea("");
164   - queryArea.setToolTipText("The query sent to the service(s).");
165   - queryArea.setLineWrap(true);
166   - queryPanel.setLayout(new BorderLayout());
167   - queryPanel.add(queryArea, BorderLayout.CENTER);
168   -
169   - return queryPanel;
  206 + public JTextArea getQueryArea() {
  207 + if (queryArea == null) {
  208 + queryArea = new JTextArea("");
  209 + queryArea.setToolTipText("The query sent to the service(s).");
  210 + queryArea.setLineWrap(true);
  211 + }
  212 + return queryArea;
170 213 }
171 214  
172 215 /**
173   - * Update the query JTextArea.
  216 + * Update the query in the JTextArea.
174 217 *
175 218 * @param query The string literal to put in the text-area, which will override the old content.
176 219 */
177 220 public void updateQueryArea(String query) {
178 221 queryArea.setText(query);
179 222 }
180   -
181   - /**
182   - * Build a JPanel containing the button(s), particularly the `Send` button.
183   - *
184   - * @return The JPanel .
185   - */
186   - private JPanel buildButtonPanel() {
187   - JPanel buttonPanel = new JPanel();
188   - JButton btnSend = new JButton("Send query");
189   - btnSend.addActionListener(new ActionListener() {
190   -
191   - @Override
192   - public void actionPerformed(ActionEvent e) {
193   - requestPanelListener.onSendButtonClicked(queryArea.getText());
194   - }
195   - });
196   - buttonPanel.add(btnSend);
197   - buttonPanel.setMaximumSize(new Dimension(1000, BUTTON_PANEL_HEIGHT));
198   -
199   - return buttonPanel;
200   - }
201 223 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DataProductTypeField.java
... ... @@ -41,7 +41,7 @@ public class DataProductTypeField extends ParamField {
41 41 private static final long serialVersionUID = 1L;
42 42  
43 43 /** The comboBox used to select the data product type. */
44   - JComboBox<DataProductType> comboBox;
  44 + private JComboBox<DataProductType> comboBox;
45 45  
46 46  
47 47 /**
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DateRangeField.java
... ... @@ -48,10 +48,10 @@ public class DateRangeField extends ParamField implements TextFieldListener {
48 48 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)$)";
49 49  
50 50 /** The JTextField used to put the parameter minimum value of the range. */
51   - JTextField fieldMin;
  51 + private JTextField fieldMin;
52 52  
53 53 /** The JTextField used to put the parameter maximum value of the range. */
54   - JTextField fieldMax;
  54 + private JTextField fieldMax;
55 55  
56 56  
57 57 /**
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatField.java
... ... @@ -35,7 +35,7 @@ public class FloatField extends ParamField implements TextFieldListener {
35 35 private static final long serialVersionUID = 1L;
36 36  
37 37 /** The JTextField used to put the parameter value. */
38   - JTextField field;
  38 + private JTextField field;
39 39  
40 40  
41 41 /**
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatRangeField.java
... ... @@ -35,10 +35,10 @@ public class FloatRangeField extends ParamField implements TextFieldListener {
35 35 private static final long serialVersionUID = 1L;
36 36  
37 37 /** The JTextField used to put the parameter minimum value of the range. */
38   - JTextField fieldMin;
  38 + private JTextField fieldMin;
39 39  
40 40 /** The JTextField used to put the parameter maximum value of the range. */
41   - JTextField fieldMax;
  41 + private JTextField fieldMax;
42 42  
43 43  
44 44 /**
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/ParamField.java
... ... @@ -42,31 +42,31 @@ public abstract class ParamField extends JPanel {
42 42 private static final long serialVersionUID = 1L;
43 43  
44 44 /** The logger for the class ParamField. */
45   - static final Logger LOGGER = Logger.getLogger(ParamField.class.getName());
  45 + protected static final Logger LOGGER = Logger.getLogger(ParamField.class.getName());
46 46  
47 47 /** The minimum width of the field. */
48   - static final int MIN_FIELD_WIDTH = 30;
  48 + protected static final int MIN_FIELD_WIDTH = 30;
49 49  
50 50 /** The preferred field height. */
51   - static final int FIELD_HEIGHT = 20;
  51 + protected static final int FIELD_HEIGHT = 20;
52 52  
53 53 /** The maximum width of the field. */
54   - static final int MAX_FIELD_WIDTH = 400;
  54 + protected static final int MAX_FIELD_WIDTH = 400;
55 55  
56 56 /** The preferred label width. */
57   - static final int LABEL_WIDTH = 140;
  57 + protected static final int LABEL_WIDTH = 140;
58 58  
59 59 /** The suffix used in REG-TAP parameters names, indicating that it's a beginning of a range. */
60   - static final String MIN_SUFFIX = "min";
  60 + protected static final String MIN_SUFFIX = "min";
61 61  
62 62 /** The suffix used in REG-TAP parameters names, indicating that it is a end of a range. */
63   - static final String MAX_SUFFIX = "max";
  63 + protected static final String MAX_SUFFIX = "max";
64 64  
65 65 /** The main view of the application. */
66   - RequestPanelListener requestPanelListener;
  66 + protected RequestPanelListener requestPanelListener;
67 67  
68 68 /** The parameter name of the field */
69   - String paramName;
  69 + protected String paramName;
70 70  
71 71  
72 72 /**
... ... @@ -85,6 +85,9 @@ public abstract class ParamField extends JPanel {
85 85 buildParamField();
86 86 }
87 87  
  88 + /**
  89 + * Build the panel and add GUI elements on it.
  90 + */
88 91 private void buildParamField() {
89 92 setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
90 93  
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/StringField.java
... ... @@ -32,7 +32,7 @@ public class StringField extends ParamField implements TextFieldListener {
32 32 private static final long serialVersionUID = 1L;
33 33  
34 34 /** The JTextField used to put the parameter value. */
35   - JTextField field;
  35 + private JTextField field;
36 36  
37 37  
38 38 /**
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetClassField.java
... ... @@ -39,7 +39,7 @@ public class TargetClassField extends ParamField {
39 39 private static final long serialVersionUID = 1L;
40 40  
41 41 /** The comboBox used to select the target class. */
42   - JComboBox<TargetClass> comboBox;
  42 + private JComboBox<TargetClass> comboBox;
43 43  
44 44  
45 45 /**
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetNameField.java
... ... @@ -41,17 +41,17 @@ public class TargetNameField extends ParamField implements TextFieldListener {
41 41 private static final long serialVersionUID = 1L;
42 42  
43 43 /** The comboBox to enter the target_name and display target name propositions. */
44   - JComboBox<String> comboBox;
  44 + private JComboBox<String> comboBox;
45 45  
46 46 /** The JTextField related to the ComboBox, allowing to listen for text content update. */
47   - JTextField field;
  47 + private JTextField field;
48 48  
49 49 /**
50 50 * The content of the last entered value. It is used to avoid recursions, because each time an
51 51 * update event is detected, the resolver is called and the ComboBox is filled with new values,
52 52 * which trigger a new event.
53 53 */
54   - String lastContent;
  54 + private String lastContent;
55 55  
56 56  
57 57 /**
... ... @@ -70,6 +70,11 @@ public class TargetNameField extends ParamField implements TextFieldListener {
70 70 this.add(comboBox);
71 71 }
72 72  
  73 + /**
  74 + * Constructor of TargetNameField without listener, in order to use only GUI elements.
  75 + *
  76 + * @param paraName The name of the parameter.
  77 + */
73 78 public TargetNameField(String paraName) {
74 79 this(new RequestPanelListener() {
75 80  
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java
... ... @@ -20,8 +20,6 @@ import java.io.File;
20 20 import java.io.IOException;
21 21 import java.nio.file.Files;
22 22 import java.nio.file.Paths;
23   -import java.util.logging.Level;
24   -import java.util.logging.Logger;
25 23  
26 24 import eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelCtrl;
27 25 import eu.omp.irap.vespa.votable.controller.VOTableController;
... ... @@ -31,14 +29,18 @@ import eu.omp.irap.vespa.votable.controller.VOTableController;
31 29 */
32 30 public class ResultPanelCtrl extends VOTableController implements ResultPanelListener {
33 31  
34   - /** The logger for the class ResultPanelCtrl. */
35   - private static final Logger LOGGER = Logger.getLogger(ResultPanelCtrl.class.getName());
36   -
  32 + /** The controller of the main panel. */
37 33 private MainPanelCtrl mainPanelCtrl;
38 34  
  35 + /** The result panel view. */
39 36 private ResultPanelView view;
40 37  
41 38  
  39 + /**
  40 + * Constructor of ResultPanelCtrl.
  41 + *
  42 + * @param mainPanelCtrl The controller of the main panel.
  43 + */
42 44 public ResultPanelCtrl(MainPanelCtrl mainPanelCtrl) {
43 45 this.mainPanelCtrl = mainPanelCtrl;
44 46 view = new ResultPanelView(this);
... ... @@ -50,10 +52,12 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis
50 52 Files.copy(Paths.get(voTablePath), Paths.get(file.getAbsolutePath()));
51 53 } catch (IOException e) {
52 54 mainPanelCtrl.displayError("Can not save the file.", e);
53   - LOGGER.log(Level.WARNING, "Can not save the file.", e);
54 55 }
55 56 }
56 57  
  58 + /**
  59 + * @return The view of the result panel.
  60 + */
57 61 public ResultPanelView getView() {
58 62 return view;
59 63 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelListener.java
... ... @@ -23,6 +23,11 @@ import java.io.File;
23 23 */
24 24 public interface ResultPanelListener {
25 25  
26   - /** Copy the VOTable to a specified location. */
  26 + /**
  27 + * Copy the VOTable to a specified location.
  28 + *
  29 + * @param file The file selected by the user in the FileChooser pop-up, corresponding to the
  30 + * place where save the VOTable.
  31 + */
27 32 public void onDownloadButtonClicked(File file);
28 33 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java
... ... @@ -35,11 +35,13 @@ public class ResultPanelView extends VOTableView {
35 35 /** The serial version UID. */
36 36 private static final long serialVersionUID = 1L;
37 37  
38   - ResultPanelListener viewListener;
  38 + /** The listener of the result panel. */
  39 + ResultPanelListener listener;
39 40  
40 41 /** A label to display several informations (aka. status bar). */
41 42 private JLabel infoLabel;
42 43  
  44 + /** The GUI element of the button to save the result of the query. */
43 45 private JButton fileButton;
44 46  
45 47  
... ... @@ -50,23 +52,19 @@ public class ResultPanelView extends VOTableView {
50 52 * @param mainView The main view of the application.
51 53 * @param voTableView The generic view of the VOTable panel.
52 54 */
53   - public ResultPanelView(ResultPanelListener viewListener) {
  55 + public ResultPanelView(ResultPanelListener listener) {
54 56 super();
55   - this.viewListener = viewListener;
  57 + this.listener = listener;
56 58 buildResultPanel();
57 59 }
58 60  
59 61 public void buildResultPanel() {
60   - add(buildBottomBar(), BorderLayout.SOUTH);
61   - }
62   -
63   - private JPanel buildBottomBar() {
64 62 JPanel statusBar = new JPanel();
65 63 statusBar.setLayout(new BorderLayout());
66 64 statusBar.add(getInfoLabel());
67 65 statusBar.add(getFileButton(), BorderLayout.EAST);
68 66  
69   - return statusBar;
  67 + add(statusBar, BorderLayout.SOUTH);
70 68 }
71 69  
72 70 public JLabel getInfoLabel() {
... ... @@ -89,7 +87,7 @@ public class ResultPanelView extends VOTableView {
89 87 public void actionPerformed(ActionEvent e) {
90 88 final JFileChooser fc = new JFileChooser();
91 89 fc.showOpenDialog(ResultPanelView.this);
92   - viewListener.onDownloadButtonClicked(fc.getSelectedFile());
  90 + listener.onDownloadButtonClicked(fc.getSelectedFile());
93 91 }
94 92 });
95 93 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java
... ... @@ -32,16 +32,16 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane
32 32 /** The logger for the class ServicesPanelCtrl. */
33 33 private static final Logger LOGGER = Logger.getLogger(ServicesPanelCtrl.class.getName());
34 34  
  35 + private MainPanelCtrl mainPanelCtrl;
  36 +
  37 + private ServicesPanelView view;
  38 +
35 39 /** The name of the table selected by the user on the table list panel. */
36 40 private String selectedTableName;
37 41  
38 42 /** The URL of the service corresponding to the selected table. */
39 43 private String selectedServiceURL;
40 44  
41   - private MainPanelCtrl mainPanelCtrl;
42   -
43   - private ServicesPanelView view;
44   -
45 45  
46 46 public ServicesPanelCtrl(MainPanelCtrl mainPanelCtrl) {
47 47 this.mainPanelCtrl = mainPanelCtrl;
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelView.java
... ... @@ -37,7 +37,7 @@ public class ServicesPanelView extends VOTableView {
37 37 /** The serial version UID. */
38 38 private static final long serialVersionUID = 1L;
39 39  
40   - ServicesPanelListener viewListener;
  40 + ServicesPanelListener listener;
41 41  
42 42 private JButton serviceButton;
43 43  
... ... @@ -55,7 +55,7 @@ public class ServicesPanelView extends VOTableView {
55 55 */
56 56 public ServicesPanelView(final ServicesPanelListener viewListener) {
57 57 super();
58   - this.viewListener = viewListener;
  58 + this.listener = viewListener;
59 59 buildServicesPanel();
60 60 }
61 61  
... ... @@ -64,7 +64,7 @@ public class ServicesPanelView extends VOTableView {
64 64  
65 65 @Override
66 66 public void valueChanged(ListSelectionEvent evt) {
67   - viewListener.onServiceSelected(getTable().getSelectedRow());
  67 + listener.onServiceSelected(getTable().getSelectedRow());
68 68 }
69 69 });
70 70  
... ... @@ -98,7 +98,7 @@ public class ServicesPanelView extends VOTableView {
98 98  
99 99 @Override
100 100 public void actionPerformed(ActionEvent e) {
101   - viewListener.onServiceSelected(-1);
  101 + listener.onServiceSelected(-1);
102 102 }
103 103 });
104 104 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/service/Service.java
... ... @@ -21,31 +21,88 @@ package eu.omp.irap.vespa.epntapclient.service;
21 21 */
22 22 public class Service {
23 23  
  24 + /**
  25 + * The ivoid of the service: <br/>
  26 + * <em>Unambiguous reference to the resource conforming to the IVOA
  27 + * standard for identifiers.</em>
  28 + */
24 29 private String ivoid;
25 30  
  31 + /**
  32 + * The title of the service: <br/>
  33 + * <em>The full name given to the resource.</em>
  34 + */
26 35 private String title;
27 36  
  37 + /**
  38 + * The short_name of the service: <br/>
  39 + * <em> A short name or abbreviation given to something. This name will be used where brief
  40 + * annotations for the re- source name are required. Applications may use it to refer to the
  41 + * resource in a compact display. One word or a few letters is recommended. No more than sixteen
  42 + * characters are allowed.</em>
  43 + */
28 44 private String shortName;
29 45  
  46 + /**
  47 + * The type of the service: <br/>
  48 + * <em>Resource type (something like vs:datacollection, vs:catalogservice, etc).</em>
  49 + */
30 50 private String type;
31 51  
  52 + /**
  53 + * The description of the service: <br/>
  54 + * <em>An account of the nature of the resource.</em>
  55 + */
32 56 private String description;
33 57  
  58 + /**
  59 + * The creator of the service: <br/>
  60 + * <em>The creator(s) of the resource in the order given by the resource record author, separated by
  61 + * semicolons.</em>
  62 + */
34 63 private String creator;
35 64  
  65 + /**
  66 + * The content_level of the service: <br/>
  67 + * <em> A hash-separated list of content levels specifying the intended audience.</em>
  68 + */
36 69 private String contentLevel;
37 70  
  71 + /**
  72 + * The reference_rul of the service: <br/>
  73 + * <em>URL pointing to a human-readable document describing this resource.</em>
  74 + */
38 75 private String referenceURL;
39 76  
  77 + /**
  78 + * The created date of the service, as a string: <br/>
  79 + * <em>The UTC date and time this resource metadata de- scription was created. This timestamp must
  80 + * not be in the future. This time is not required to be accurate; it should be at least
  81 + * accurate to the day. Any insignificant time elds should be set to zero.</em>
  82 + */
40 83 private String created;
41 84  
  85 + /**
  86 + * The updated date of the service, as a string: <br/>
  87 + * <em> The UTC date this resource metadata description was last updated. This timestamp must not be
  88 + * in the future. This time is not required to be accurate; it should be at least accurate to
  89 + * the day. Any insignificant time elds should be set to zero.</em>
  90 + */
42 91 private String updated;
43 92  
44 93  
45   - Service(String ivoid) {
  94 + /**
  95 + * Constructor of Service
  96 + *
  97 + * @param ivoid The ivoID of the service.
  98 + */
  99 + public Service(String ivoid) {
46 100 this.ivoid = ivoid;
47 101 }
48 102  
  103 + /**
  104 + * @return true if all parameter of the service are not null.
  105 + */
49 106 public boolean isValid() {
50 107 boolean isValid = ivoid != null && title != null && shortName != null;
51 108 isValid = isValid && type != null && description != null && creator != null;
... ... @@ -53,78 +110,173 @@ public class Service {
53 110 return isValid && updated != null;
54 111 }
55 112  
  113 + /**
  114 + * Get the service {@link #title}.
  115 + *
  116 + * @return The service {@link #title}.
  117 + */
56 118 public String getTitle() {
57 119 return title;
58 120 }
59 121  
60   - public void setTitle(String resTitle) {
61   - title = resTitle;
  122 + /**
  123 + * Set the service {@link #title}.
  124 + *
  125 + * @param title The service {@link #title}
  126 + */
  127 + public void setTitle(String title) {
  128 + this.title = title;
62 129 }
63 130  
  131 + /**
  132 + * Get the service {@link #shortName}.
  133 + *
  134 + * @return The service {@link #shortName}.
  135 + */
64 136 public String getShortName() {
65 137 return shortName;
66 138 }
67 139  
  140 + /**
  141 + * Set the service {@link #shortName}.
  142 + *
  143 + * @param shortName The service {@link #shortName}
  144 + */
68 145 public void setShortName(String shortName) {
69 146 this.shortName = shortName;
70 147 }
71 148  
  149 + /**
  150 + * Get the service {@link #type}.
  151 + *
  152 + * @return The service {@link #type}.
  153 + */
72 154 public String getType() {
73 155 return type;
74 156 }
75 157  
  158 + /**
  159 + * Set the service {@link #type}.
  160 + *
  161 + * @param type The service {@link #type}
  162 + */
76 163 public void setType(String type) {
77 164 this.type = type;
78 165 }
79 166  
  167 + /**
  168 + * Get the service {@link #description}.
  169 + *
  170 + * @return The service {@link #description}.
  171 + */
80 172 public String getDescription() {
81 173 return description;
82 174 }
83 175  
  176 + /**
  177 + * Set the service {@link #description}.
  178 + *
  179 + * @param description The service {@link #description}
  180 + */
84 181 public void setDescription(String description) {
85 182 this.description = description;
86 183 }
87 184  
  185 + /**
  186 + * Get the service {@link #creator}.
  187 + *
  188 + * @return The service {@link #creator}.
  189 + */
88 190 public String getCreator() {
89 191 return creator;
90 192 }
91 193  
  194 + /**
  195 + * Set the service {@link #creator}.
  196 + *
  197 + * @param creator The service {@link #creator}
  198 + */
92 199 public void setCreator(String creator) {
93 200 this.creator = creator;
94 201 }
95 202  
  203 + /**
  204 + * Get the service {@link #contentLevel}.
  205 + *
  206 + * @return The service {@link #contentLevel}.
  207 + */
96 208 public String getContentLevel() {
97 209 return contentLevel;
98 210 }
99 211  
  212 + /**
  213 + * Set the service {@link #contentLevel}.
  214 + *
  215 + * @param contentLevel The service {@link #contentLevel}
  216 + */
100 217 public void setContentLevel(String contentLevel) {
101 218 this.contentLevel = contentLevel;
102 219 }
103 220  
  221 + /**
  222 + * Get the service {@link #referenceURL}.
  223 + *
  224 + * @return The service {@link #referenceURL}.
  225 + */
104 226 public String getReferenceURL() {
105 227 return referenceURL;
106 228 }
107 229  
  230 + /**
  231 + * Set the service {@link #referenceURL}.
  232 + *
  233 + * @param referenceURL The service {@link #referenceURL}
  234 + */
108 235 public void setReferenceURL(String referenceURL) {
109 236 this.referenceURL = referenceURL;
110 237 }
111 238  
  239 + /**
  240 + * Get the service {@link #created} date.
  241 + *
  242 + * @return The service {@link #created} date.
  243 + */
112 244 public String getCreated() {
113 245 return created;
114 246 }
115 247  
  248 + /**
  249 + * Set the service {@link #created}.
  250 + *
  251 + * @param created The service {@link #created}
  252 + */
116 253 public void setCreated(String created) {
117 254 this.created = created;
118 255 }
119 256  
  257 + /**
  258 + * Get the service {@link #updated} date.
  259 + *
  260 + * @return The service {@link #updated} date.
  261 + */
120 262 public String getUpdated() {
121 263 return updated;
122 264 }
123 265  
  266 + /**
  267 + * Set the service {@link #updated}.
  268 + *
  269 + * @param updated The service {@link #updated}
  270 + */
124 271 public void setUpdated(String updated) {
125 272 this.updated = updated;
126 273 }
127 274  
  275 + /**
  276 + * Get the service {@link #ivoid}.
  277 + *
  278 + * @return The service {@link #ivoid}.
  279 + */
128 280 public String getIvoid() {
129 281 return ivoid;
130 282 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCore.java
... ... @@ -20,11 +20,20 @@ package eu.omp.irap.vespa.epntapclient.service;
20 20 * @author N. Jourdane
21 21 */
22 22 public enum ServiceCore {
23   - OBSCORE("ObsCore"), EPNCORE("EpnCore");
  23 + /** The ObsCore service appellation, used in several queries. */
  24 + OBSCORE("ObsCore"),
  25 + /** The EpnCore service appellation, used in several queries. */
  26 + EPNCORE("EpnCore");
24 27  
  28 + /** The type of the service (ie. ObsCore, EpnCore, etc.). */
25 29 private String type;
26 30  
27 31  
  32 + /**
  33 + * Constructor of ServiceCore enumeration.
  34 + *
  35 + * @param type The type of the service (ie. ObsCore, EpnCore, etc.).
  36 + */
28 37 ServiceCore(String type) {
29 38 this.type = type;
30 39 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCtrl.java
... ... @@ -41,12 +41,20 @@ import eu.omp.irap.vespa.votable.votabledata.VOTableDataParser;
41 41 */
42 42 public class ServiceCtrl {
43 43  
  44 + /** The date format used to serialize date parameters. */
44 45 public static final String DATE_FORMAT = "yyyy/MM/dd HH:mm:ss";
45 46  
46 47  
  48 + /** Private constructor to hide the implicit public one. */
47 49 private ServiceCtrl() {
48 50 }
49 51  
  52 + /**
  53 + * Parse a Resource and returns the corresponding Service.
  54 + *
  55 + * @param resource the resource to parse.
  56 + * @return The corresponding service.
  57 + */
50 58 public static final Service getService(Resource resource) {
51 59 Service service = new Service(resource.getIdentifier());
52 60 service.setTitle(resource.getTitle());
... ... @@ -74,6 +82,13 @@ public class ServiceCtrl {
74 82 return service;
75 83 }
76 84  
  85 + /**
  86 + * Parse a VOTableData and returns the corresponding list of services.
  87 + *
  88 + * @param data The VOTableData of the service, created by the VOTable parser. Each row of the
  89 + * data set is a service.
  90 + * @return The corresponding list of service.
  91 + */
77 92 public static final List<Service> getServices(VOTableData data) {
78 93 List<Service> services = new ArrayList<>();
79 94 for (int i = 0; i < data.getNbRows(); i++) {
... ... @@ -93,10 +108,22 @@ public class ServiceCtrl {
93 108 return services;
94 109 }
95 110  
  111 + /**
  112 + * @param query The query to get the service.
  113 + * @return The VOTableData
  114 + * @throws CantGetVOTableException Can not get the VOTable.
  115 + */
96 116 public static VOTableData getVoTableData(String query) throws CantGetVOTableException {
97 117 return getVoTableData(getVoTable(query));
98 118 }
99 119  
  120 + /**
  121 + * Parse a VOTable and returns the corresponding VOTableData.
  122 + *
  123 + * @param voTable The VOTable parsed.
  124 + * @return The corresponding VOTableData.
  125 + * @throws CantGetVOTableException Can not get the VOTable.
  126 + */
100 127 public static VOTableData getVoTableData(VOTABLE voTable) throws CantGetVOTableException {
101 128 VOTableController.checkVOTable(voTable);
102 129  
... ...