From 76a922bcec2b0e95b404cb3ca7359e15e84e5f99 Mon Sep 17 00:00:00 2001 From: Nathanael Jourdane Date: Wed, 18 May 2016 13:16:06 +0200 Subject: [PATCH] Improve Javadoc. --- src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java | 9 +++++++++ src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelView.java | 8 +++++--- src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelCtrl.java | 16 ++++++++-------- src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelListener.java | 18 +++++++++--------- src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelView.java | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------- src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DataProductTypeField.java | 2 +- src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DateRangeField.java | 4 ++-- src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatField.java | 2 +- src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatRangeField.java | 4 ++-- src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/ParamField.java | 21 ++++++++++++--------- src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/StringField.java | 2 +- src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetClassField.java | 2 +- src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetNameField.java | 11 ++++++++--- src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java | 16 ++++++++++------ src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelListener.java | 7 ++++++- src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java | 16 +++++++--------- src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java | 8 ++++---- src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelView.java | 8 ++++---- src/main/java/eu/omp/irap/vespa/epntapclient/service/Service.java | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCore.java | 11 ++++++++++- src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCtrl.java | 27 +++++++++++++++++++++++++++ 21 files changed, 373 insertions(+), 137 deletions(-) diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java index a55d21d..82f7319 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelCtrl.java @@ -92,14 +92,23 @@ public class MainPanelCtrl extends EpnTapController { return requestPanelCtrl; } + /** + * @return The controller of the service panel. + */ public ServicesPanelCtrl getServicePanelCtrl() { return servicesPanelCtrl; } + /** + * @return The controller of the result panel. + */ public ResultPanelCtrl getResultPanelCtrl() { return resultPanelCtrl; } + /** + * @return The main view of the application. + */ public MainPanelView getView() { return view; } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelView.java index 46b360f..8efc5bb 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelView.java @@ -50,8 +50,7 @@ public class MainPanelView extends JPanel { /** * The main view constructor, which create all the panels. * - * @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. + * @param mainPanelCtrl The controller of the main panel. */ public MainPanelView(MainPanelCtrl mainPanelCtrl) { @@ -62,7 +61,7 @@ public class MainPanelView extends JPanel { } /** - * Build and fill the GUI. + * Build the panel and add GUI elements on it. */ private void buildMainView() { setLayout(new BorderLayout()); @@ -77,6 +76,9 @@ public class MainPanelView extends JPanel { setSizes(); } + /** + * Set the preferred and minimum size of panels. + */ private void setSizes() { servicesPanel.setPreferredSize( new Dimension(GUIDim.LEFT_PANEL_WIDTH, GUIDim.TOP_PANEL_HEIGHT)); diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelCtrl.java index deafc88..6973762 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelCtrl.java @@ -29,26 +29,26 @@ public class RequestPanelCtrl extends RequestCtrl implements RequestPanelListene /** The logger for the class RequestPanelCtrl. */ private static final Logger LOGGER = Logger.getLogger(RequestPanelCtrl.class.getName()); - MainPanelCtrl mainPanelCtrl; + /** The controller of the main panel. */ + private MainPanelCtrl mainPanelCtrl; - RequestPanelView view; + /** The view of the request panel. */ + private RequestPanelView view; /** * Constructor of RequestPanelCtrl * - * @param epnTapCtrl + * @param mainPanelCtrl The controller of the main panel. */ public RequestPanelCtrl(MainPanelCtrl mainPanelCtrl) { this.mainPanelCtrl = mainPanelCtrl; view = new RequestPanelView(this); } - public void setMainPanelCtrl(MainPanelCtrl mainPanelCtrl) { - this.mainPanelCtrl = mainPanelCtrl; - view = new RequestPanelView(this); - } - + /** + * @return The view of the request panel. + */ public RequestPanelView getView() { return view; } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelListener.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelListener.java index 890d2fc..5dfd744 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelListener.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelListener.java @@ -22,24 +22,24 @@ package eu.omp.irap.vespa.epntapclient.gui.requestpanel; public interface RequestPanelListener { /** - * ... - * - * @param text + * Method called when the used click on the 'Send query' button. + * + * @param query The query */ - void onSendButtonClicked(String text); + void onSendButtonClicked(String query); /** - * ... + * Method called when the user remove a parameter with a parameter field. * - * @param paramName + * @param paramName The name of the removed parameter */ void onParameterRemoved(String paramName); /** - * ... + * Method called when the user change a parameter (add or update) with a parameter field. * - * @param paramName - * @param query + * @param paramName The name of the changed parameter. + * @param paramValue The new value of the parameter. */ void onParameterChanged(String paramName, Object paramValue); diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelView.java index 69d9182..e21de23 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelView.java @@ -45,74 +45,114 @@ public class RequestPanelView extends JPanel { /** The serial version UID. */ private static final long serialVersionUID = 1L; + /** The height of the buttons panel. */ + private static final int BUTTON_PANEL_HEIGHT = 20; + + /** The listener for the request panel. */ + RequestPanelListener listener; + /** The text area where the user write the query. */ protected JTextArea queryArea; - /** - * The parameters fields for the request. - */ + /** The parameters fields for the request. */ private List paramFields; + /** A field to set the target_name parameter. */ private TargetNameField targetNameField; + /** A field to set the time_range parameter. */ private DateRangeField timeRangeField; + /** A field to set the spectral_range parameter. */ private FloatRangeField spectralRangeField; + /** A field to set the dataproduct_type parameter. */ private DataProductTypeField dataProductTypeField; - /** The height of the buttons panel. */ - private static final int BUTTON_PANEL_HEIGHT = 20; - - RequestPanelListener requestPanelListener; + /** The GUI element of the button to send the query. */ + private JButton buttonSend; /** * Method constructor * - * @param mainView The EPN-TAP main view. + * @param requestPanelListener The listener of the request panel view. */ public RequestPanelView(RequestPanelListener requestPanelListener) { - this.requestPanelListener = requestPanelListener; + listener = requestPanelListener; buildRequestPanel(); } + /** + * Add GUI elements to the request panel. + */ private void buildRequestPanel() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - this.add(buildParamPanel(), this); - this.add(buildQueryPanel(), this); - this.add(buildButtonPanel(), this); - } + JPanel queryPanel = new JPanel(); + queryPanel.setBorder(BorderFactory.createTitledBorder("Query for the selected service(s)")); + queryPanel.setLayout(new BorderLayout()); + queryPanel.add(getQueryArea(), BorderLayout.CENTER); - /** - * Build a JPanel containing graphical elements to build the query user-friendly. - * - * @return The JPanel. - */ - public JPanel buildParamPanel() { - paramFields = new ArrayList<>(); - paramFields.add(getTargetNameField()); - paramFields.add(getTimeRangeField()); - paramFields.add(getSpectralRangeField()); - paramFields.add(getDataProductTypeField()); JPanel paramPanel = new JPanel(); paramPanel.setLayout(new BoxLayout(paramPanel, BoxLayout.Y_AXIS)); paramPanel.setBorder(BorderFactory.createTitledBorder("Query parameters")); - - for (ParamField field : paramFields) { + for (ParamField field : getParamFields()) { paramPanel.add(field); } - return paramPanel; + JPanel buttonPanel = new JPanel(); + buttonPanel.add(getButtonSend()); + buttonPanel.setMaximumSize(new Dimension(1000, BUTTON_PANEL_HEIGHT)); + + this.add(paramPanel, this); + this.add(queryPanel, this); + this.add(buttonPanel, this); } /** - * @return the data product field + * Get the GUI element of the send button. If it doesn't exist, create it. + * + * @return The button. + */ + public JButton getButtonSend() { + if (buttonSend == null) { + buttonSend = new JButton("Send query"); + buttonSend.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + listener.onSendButtonClicked(queryArea.getText()); + } + }); + } + return buttonSend; + } + + /** + * Get the GUI element of the parameters fields list. If it doesn't exist, create it. + * + * @return The parameters fields list. + */ + public List getParamFields() { + if (paramFields == null) { + paramFields = new ArrayList<>(); + paramFields.add(getTargetNameField()); + paramFields.add(getTimeRangeField()); + paramFields.add(getSpectralRangeField()); + paramFields.add(getDataProductTypeField()); + } + return paramFields; + } + + /** + * Get the GUI element of the data product field. If it doesn't exist, create it. + * + * @return The data product field. */ public DataProductTypeField getDataProductTypeField() { if (dataProductTypeField == null) { - dataProductTypeField = new DataProductTypeField(requestPanelListener, + dataProductTypeField = new DataProductTypeField(listener, "dataproduct_type"); } @@ -120,82 +160,64 @@ public class RequestPanelView extends JPanel { } /** - * @return the spectral range field + * Get the GUI element of the spectral_range field. If it doesn't exist, create it. + * + * @return The spectral_range field. */ public FloatRangeField getSpectralRangeField() { if (spectralRangeField == null) { - spectralRangeField = new FloatRangeField(requestPanelListener, "spectral_range_"); + spectralRangeField = new FloatRangeField(listener, "spectral_range_"); } return spectralRangeField; } /** - * @return the time range field + * Get the GUI element of the time range field. If it doesn't exist, create it. + * + * @return The time range field. */ public DateRangeField getTimeRangeField() { if (timeRangeField == null) { - timeRangeField = new DateRangeField(requestPanelListener, "time_"); + timeRangeField = new DateRangeField(listener, "time_"); } return timeRangeField; } /** - * @return the target name field + * Get the GUI element of the target name field. If it doesn't exist, create it. + * + * @return The target name field. */ public TargetNameField getTargetNameField() { if (targetNameField == null) { - targetNameField = new TargetNameField(requestPanelListener, "target_name"); + targetNameField = new TargetNameField(listener, "target_name"); } return targetNameField; } /** - * Build a JPanel containing a text-area where the query is displayed. + * Get the GUI element of the query area. If it doesn't exist, create it. * - * @return The JPanel. + * @return The target query area. */ - private JPanel buildQueryPanel() { - JPanel queryPanel = new JPanel(); - queryPanel.setBorder(BorderFactory.createTitledBorder("Query for the selected service(s)")); - queryArea = new JTextArea(""); - queryArea.setToolTipText("The query sent to the service(s)."); - queryArea.setLineWrap(true); - queryPanel.setLayout(new BorderLayout()); - queryPanel.add(queryArea, BorderLayout.CENTER); - - return queryPanel; + public JTextArea getQueryArea() { + if (queryArea == null) { + queryArea = new JTextArea(""); + queryArea.setToolTipText("The query sent to the service(s)."); + queryArea.setLineWrap(true); + } + return queryArea; } /** - * Update the query JTextArea. + * Update the query in the JTextArea. * * @param query The string literal to put in the text-area, which will override the old content. */ public void updateQueryArea(String query) { queryArea.setText(query); } - - /** - * Build a JPanel containing the button(s), particularly the `Send` button. - * - * @return The JPanel . - */ - private JPanel buildButtonPanel() { - JPanel buttonPanel = new JPanel(); - JButton btnSend = new JButton("Send query"); - btnSend.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - requestPanelListener.onSendButtonClicked(queryArea.getText()); - } - }); - buttonPanel.add(btnSend); - buttonPanel.setMaximumSize(new Dimension(1000, BUTTON_PANEL_HEIGHT)); - - return buttonPanel; - } } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DataProductTypeField.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DataProductTypeField.java index 4fe1f6b..3a9231b 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DataProductTypeField.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DataProductTypeField.java @@ -41,7 +41,7 @@ public class DataProductTypeField extends ParamField { private static final long serialVersionUID = 1L; /** The comboBox used to select the data product type. */ - JComboBox comboBox; + private JComboBox comboBox; /** diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DateRangeField.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DateRangeField.java index 916cb53..5bc6b3f 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DateRangeField.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DateRangeField.java @@ -48,10 +48,10 @@ public class DateRangeField extends ParamField implements TextFieldListener { 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)$)"; /** The JTextField used to put the parameter minimum value of the range. */ - JTextField fieldMin; + private JTextField fieldMin; /** The JTextField used to put the parameter maximum value of the range. */ - JTextField fieldMax; + private JTextField fieldMax; /** diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatField.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatField.java index b6d2eb8..f92aaee 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatField.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatField.java @@ -35,7 +35,7 @@ public class FloatField extends ParamField implements TextFieldListener { private static final long serialVersionUID = 1L; /** The JTextField used to put the parameter value. */ - JTextField field; + private JTextField field; /** diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatRangeField.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatRangeField.java index 006c5e5..158aa12 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatRangeField.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatRangeField.java @@ -35,10 +35,10 @@ public class FloatRangeField extends ParamField implements TextFieldListener { private static final long serialVersionUID = 1L; /** The JTextField used to put the parameter minimum value of the range. */ - JTextField fieldMin; + private JTextField fieldMin; /** The JTextField used to put the parameter maximum value of the range. */ - JTextField fieldMax; + private JTextField fieldMax; /** diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/ParamField.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/ParamField.java index c7400dd..de837fe 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/ParamField.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/ParamField.java @@ -42,31 +42,31 @@ public abstract class ParamField extends JPanel { private static final long serialVersionUID = 1L; /** The logger for the class ParamField. */ - static final Logger LOGGER = Logger.getLogger(ParamField.class.getName()); + protected static final Logger LOGGER = Logger.getLogger(ParamField.class.getName()); /** The minimum width of the field. */ - static final int MIN_FIELD_WIDTH = 30; + protected static final int MIN_FIELD_WIDTH = 30; /** The preferred field height. */ - static final int FIELD_HEIGHT = 20; + protected static final int FIELD_HEIGHT = 20; /** The maximum width of the field. */ - static final int MAX_FIELD_WIDTH = 400; + protected static final int MAX_FIELD_WIDTH = 400; /** The preferred label width. */ - static final int LABEL_WIDTH = 140; + protected static final int LABEL_WIDTH = 140; /** The suffix used in REG-TAP parameters names, indicating that it's a beginning of a range. */ - static final String MIN_SUFFIX = "min"; + protected static final String MIN_SUFFIX = "min"; /** The suffix used in REG-TAP parameters names, indicating that it is a end of a range. */ - static final String MAX_SUFFIX = "max"; + protected static final String MAX_SUFFIX = "max"; /** The main view of the application. */ - RequestPanelListener requestPanelListener; + protected RequestPanelListener requestPanelListener; /** The parameter name of the field */ - String paramName; + protected String paramName; /** @@ -85,6 +85,9 @@ public abstract class ParamField extends JPanel { buildParamField(); } + /** + * Build the panel and add GUI elements on it. + */ private void buildParamField() { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/StringField.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/StringField.java index 7908ab6..594d4a5 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/StringField.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/StringField.java @@ -32,7 +32,7 @@ public class StringField extends ParamField implements TextFieldListener { private static final long serialVersionUID = 1L; /** The JTextField used to put the parameter value. */ - JTextField field; + private JTextField field; /** diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetClassField.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetClassField.java index b2b76d4..6546392 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetClassField.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetClassField.java @@ -39,7 +39,7 @@ public class TargetClassField extends ParamField { private static final long serialVersionUID = 1L; /** The comboBox used to select the target class. */ - JComboBox comboBox; + private JComboBox comboBox; /** diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetNameField.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetNameField.java index fb8ee1f..29e7a59 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetNameField.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetNameField.java @@ -41,17 +41,17 @@ public class TargetNameField extends ParamField implements TextFieldListener { private static final long serialVersionUID = 1L; /** The comboBox to enter the target_name and display target name propositions. */ - JComboBox comboBox; + private JComboBox comboBox; /** The JTextField related to the ComboBox, allowing to listen for text content update. */ - JTextField field; + private JTextField field; /** * The content of the last entered value. It is used to avoid recursions, because each time an * update event is detected, the resolver is called and the ComboBox is filled with new values, * which trigger a new event. */ - String lastContent; + private String lastContent; /** @@ -70,6 +70,11 @@ public class TargetNameField extends ParamField implements TextFieldListener { this.add(comboBox); } + /** + * Constructor of TargetNameField without listener, in order to use only GUI elements. + * + * @param paraName The name of the parameter. + */ public TargetNameField(String paraName) { this(new RequestPanelListener() { diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java index 6756c14..35e6e02 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java @@ -20,8 +20,6 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.logging.Level; -import java.util.logging.Logger; import eu.omp.irap.vespa.epntapclient.gui.mainpanel.MainPanelCtrl; import eu.omp.irap.vespa.votable.controller.VOTableController; @@ -31,14 +29,18 @@ import eu.omp.irap.vespa.votable.controller.VOTableController; */ public class ResultPanelCtrl extends VOTableController implements ResultPanelListener { - /** The logger for the class ResultPanelCtrl. */ - private static final Logger LOGGER = Logger.getLogger(ResultPanelCtrl.class.getName()); - + /** The controller of the main panel. */ private MainPanelCtrl mainPanelCtrl; + /** The result panel view. */ private ResultPanelView view; + /** + * Constructor of ResultPanelCtrl. + * + * @param mainPanelCtrl The controller of the main panel. + */ public ResultPanelCtrl(MainPanelCtrl mainPanelCtrl) { this.mainPanelCtrl = mainPanelCtrl; view = new ResultPanelView(this); @@ -50,10 +52,12 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis Files.copy(Paths.get(voTablePath), Paths.get(file.getAbsolutePath())); } catch (IOException e) { mainPanelCtrl.displayError("Can not save the file.", e); - LOGGER.log(Level.WARNING, "Can not save the file.", e); } } + /** + * @return The view of the result panel. + */ public ResultPanelView getView() { return view; } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelListener.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelListener.java index 4fa13b5..805a180 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelListener.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelListener.java @@ -23,6 +23,11 @@ import java.io.File; */ public interface ResultPanelListener { - /** Copy the VOTable to a specified location. */ + /** + * Copy the VOTable to a specified location. + * + * @param file The file selected by the user in the FileChooser pop-up, corresponding to the + * place where save the VOTable. + */ public void onDownloadButtonClicked(File file); } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java index 575d715..0d667d8 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java @@ -35,11 +35,13 @@ public class ResultPanelView extends VOTableView { /** The serial version UID. */ private static final long serialVersionUID = 1L; - ResultPanelListener viewListener; + /** The listener of the result panel. */ + ResultPanelListener listener; /** A label to display several informations (aka. status bar). */ private JLabel infoLabel; + /** The GUI element of the button to save the result of the query. */ private JButton fileButton; @@ -50,23 +52,19 @@ public class ResultPanelView extends VOTableView { * @param mainView The main view of the application. * @param voTableView The generic view of the VOTable panel. */ - public ResultPanelView(ResultPanelListener viewListener) { + public ResultPanelView(ResultPanelListener listener) { super(); - this.viewListener = viewListener; + this.listener = listener; buildResultPanel(); } public void buildResultPanel() { - add(buildBottomBar(), BorderLayout.SOUTH); - } - - private JPanel buildBottomBar() { JPanel statusBar = new JPanel(); statusBar.setLayout(new BorderLayout()); statusBar.add(getInfoLabel()); statusBar.add(getFileButton(), BorderLayout.EAST); - return statusBar; + add(statusBar, BorderLayout.SOUTH); } public JLabel getInfoLabel() { @@ -89,7 +87,7 @@ public class ResultPanelView extends VOTableView { public void actionPerformed(ActionEvent e) { final JFileChooser fc = new JFileChooser(); fc.showOpenDialog(ResultPanelView.this); - viewListener.onDownloadButtonClicked(fc.getSelectedFile()); + listener.onDownloadButtonClicked(fc.getSelectedFile()); } }); } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java index 2cc2d53..1389315 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java @@ -32,16 +32,16 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane /** The logger for the class ServicesPanelCtrl. */ private static final Logger LOGGER = Logger.getLogger(ServicesPanelCtrl.class.getName()); + private MainPanelCtrl mainPanelCtrl; + + private ServicesPanelView view; + /** The name of the table selected by the user on the table list panel. */ private String selectedTableName; /** The URL of the service corresponding to the selected table. */ private String selectedServiceURL; - private MainPanelCtrl mainPanelCtrl; - - private ServicesPanelView view; - public ServicesPanelCtrl(MainPanelCtrl mainPanelCtrl) { this.mainPanelCtrl = mainPanelCtrl; diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelView.java index a2f8b65..9c44635 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelView.java @@ -37,7 +37,7 @@ public class ServicesPanelView extends VOTableView { /** The serial version UID. */ private static final long serialVersionUID = 1L; - ServicesPanelListener viewListener; + ServicesPanelListener listener; private JButton serviceButton; @@ -55,7 +55,7 @@ public class ServicesPanelView extends VOTableView { */ public ServicesPanelView(final ServicesPanelListener viewListener) { super(); - this.viewListener = viewListener; + this.listener = viewListener; buildServicesPanel(); } @@ -64,7 +64,7 @@ public class ServicesPanelView extends VOTableView { @Override public void valueChanged(ListSelectionEvent evt) { - viewListener.onServiceSelected(getTable().getSelectedRow()); + listener.onServiceSelected(getTable().getSelectedRow()); } }); @@ -98,7 +98,7 @@ public class ServicesPanelView extends VOTableView { @Override public void actionPerformed(ActionEvent e) { - viewListener.onServiceSelected(-1); + listener.onServiceSelected(-1); } }); } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/service/Service.java b/src/main/java/eu/omp/irap/vespa/epntapclient/service/Service.java index 82635e0..0832cbd 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/service/Service.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/service/Service.java @@ -21,31 +21,88 @@ package eu.omp.irap.vespa.epntapclient.service; */ public class Service { + /** + * The ivoid of the service:
+ * Unambiguous reference to the resource conforming to the IVOA + * standard for identifiers. + */ private String ivoid; + /** + * The title of the service:
+ * The full name given to the resource. + */ private String title; + /** + * The short_name of the service:
+ * A short name or abbreviation given to something. This name will be used where brief + * annotations for the re- source name are required. Applications may use it to refer to the + * resource in a compact display. One word or a few letters is recommended. No more than sixteen + * characters are allowed. + */ private String shortName; + /** + * The type of the service:
+ * Resource type (something like vs:datacollection, vs:catalogservice, etc). + */ private String type; + /** + * The description of the service:
+ * An account of the nature of the resource. + */ private String description; + /** + * The creator of the service:
+ * The creator(s) of the resource in the order given by the resource record author, separated by + * semicolons. + */ private String creator; + /** + * The content_level of the service:
+ * A hash-separated list of content levels specifying the intended audience. + */ private String contentLevel; + /** + * The reference_rul of the service:
+ * URL pointing to a human-readable document describing this resource. + */ private String referenceURL; + /** + * The created date of the service, as a string:
+ * The UTC date and time this resource metadata de- scription was created. This timestamp must + * not be in the future. This time is not required to be accurate; it should be at least + * accurate to the day. Any insignificant time elds should be set to zero. + */ private String created; + /** + * The updated date of the service, as a string:
+ * The UTC date this resource metadata description was last updated. This timestamp must not be + * in the future. This time is not required to be accurate; it should be at least accurate to + * the day. Any insignificant time elds should be set to zero. + */ private String updated; - Service(String ivoid) { + /** + * Constructor of Service + * + * @param ivoid The ivoID of the service. + */ + public Service(String ivoid) { this.ivoid = ivoid; } + /** + * @return true if all parameter of the service are not null. + */ public boolean isValid() { boolean isValid = ivoid != null && title != null && shortName != null; isValid = isValid && type != null && description != null && creator != null; @@ -53,78 +110,173 @@ public class Service { return isValid && updated != null; } + /** + * Get the service {@link #title}. + * + * @return The service {@link #title}. + */ public String getTitle() { return title; } - public void setTitle(String resTitle) { - title = resTitle; + /** + * Set the service {@link #title}. + * + * @param title The service {@link #title} + */ + public void setTitle(String title) { + this.title = title; } + /** + * Get the service {@link #shortName}. + * + * @return The service {@link #shortName}. + */ public String getShortName() { return shortName; } + /** + * Set the service {@link #shortName}. + * + * @param shortName The service {@link #shortName} + */ public void setShortName(String shortName) { this.shortName = shortName; } + /** + * Get the service {@link #type}. + * + * @return The service {@link #type}. + */ public String getType() { return type; } + /** + * Set the service {@link #type}. + * + * @param type The service {@link #type} + */ public void setType(String type) { this.type = type; } + /** + * Get the service {@link #description}. + * + * @return The service {@link #description}. + */ public String getDescription() { return description; } + /** + * Set the service {@link #description}. + * + * @param description The service {@link #description} + */ public void setDescription(String description) { this.description = description; } + /** + * Get the service {@link #creator}. + * + * @return The service {@link #creator}. + */ public String getCreator() { return creator; } + /** + * Set the service {@link #creator}. + * + * @param creator The service {@link #creator} + */ public void setCreator(String creator) { this.creator = creator; } + /** + * Get the service {@link #contentLevel}. + * + * @return The service {@link #contentLevel}. + */ public String getContentLevel() { return contentLevel; } + /** + * Set the service {@link #contentLevel}. + * + * @param contentLevel The service {@link #contentLevel} + */ public void setContentLevel(String contentLevel) { this.contentLevel = contentLevel; } + /** + * Get the service {@link #referenceURL}. + * + * @return The service {@link #referenceURL}. + */ public String getReferenceURL() { return referenceURL; } + /** + * Set the service {@link #referenceURL}. + * + * @param referenceURL The service {@link #referenceURL} + */ public void setReferenceURL(String referenceURL) { this.referenceURL = referenceURL; } + /** + * Get the service {@link #created} date. + * + * @return The service {@link #created} date. + */ public String getCreated() { return created; } + /** + * Set the service {@link #created}. + * + * @param created The service {@link #created} + */ public void setCreated(String created) { this.created = created; } + /** + * Get the service {@link #updated} date. + * + * @return The service {@link #updated} date. + */ public String getUpdated() { return updated; } + /** + * Set the service {@link #updated}. + * + * @param updated The service {@link #updated} + */ public void setUpdated(String updated) { this.updated = updated; } + /** + * Get the service {@link #ivoid}. + * + * @return The service {@link #ivoid}. + */ public String getIvoid() { return ivoid; } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCore.java b/src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCore.java index 4fdf87d..525fef1 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCore.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCore.java @@ -20,11 +20,20 @@ package eu.omp.irap.vespa.epntapclient.service; * @author N. Jourdane */ public enum ServiceCore { - OBSCORE("ObsCore"), EPNCORE("EpnCore"); + /** The ObsCore service appellation, used in several queries. */ + OBSCORE("ObsCore"), + /** The EpnCore service appellation, used in several queries. */ + EPNCORE("EpnCore"); + /** The type of the service (ie. ObsCore, EpnCore, etc.). */ private String type; + /** + * Constructor of ServiceCore enumeration. + * + * @param type The type of the service (ie. ObsCore, EpnCore, etc.). + */ ServiceCore(String type) { this.type = type; } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCtrl.java b/src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCtrl.java index 717324a..3278698 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCtrl.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCtrl.java @@ -41,12 +41,20 @@ import eu.omp.irap.vespa.votable.votabledata.VOTableDataParser; */ public class ServiceCtrl { + /** The date format used to serialize date parameters. */ public static final String DATE_FORMAT = "yyyy/MM/dd HH:mm:ss"; + /** Private constructor to hide the implicit public one. */ private ServiceCtrl() { } + /** + * Parse a Resource and returns the corresponding Service. + * + * @param resource the resource to parse. + * @return The corresponding service. + */ public static final Service getService(Resource resource) { Service service = new Service(resource.getIdentifier()); service.setTitle(resource.getTitle()); @@ -74,6 +82,13 @@ public class ServiceCtrl { return service; } + /** + * Parse a VOTableData and returns the corresponding list of services. + * + * @param data The VOTableData of the service, created by the VOTable parser. Each row of the + * data set is a service. + * @return The corresponding list of service. + */ public static final List getServices(VOTableData data) { List services = new ArrayList<>(); for (int i = 0; i < data.getNbRows(); i++) { @@ -93,10 +108,22 @@ public class ServiceCtrl { return services; } + /** + * @param query The query to get the service. + * @return The VOTableData + * @throws CantGetVOTableException Can not get the VOTable. + */ public static VOTableData getVoTableData(String query) throws CantGetVOTableException { return getVoTableData(getVoTable(query)); } + /** + * Parse a VOTable and returns the corresponding VOTableData. + * + * @param voTable The VOTable parsed. + * @return The corresponding VOTableData. + * @throws CantGetVOTableException Can not get the VOTable. + */ public static VOTableData getVoTableData(VOTABLE voTable) throws CantGetVOTableException { VOTableController.checkVOTable(voTable); -- libgit2 0.21.2