From 76c297d803a1689b24b763427dad94d9ae24b894 Mon Sep 17 00:00:00 2001 From: Jean-Michel Glorian Date: Tue, 17 May 2016 10:15:36 +0200 Subject: [PATCH] Expose the combobox of the Data product field --- src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DataProductTypeField.java | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) 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 7fd4e5c..ef1ce6d 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 @@ -52,20 +52,30 @@ public class DataProductTypeField extends ParamField { */ public DataProductTypeField(ViewListener viewListener, String paramName) { super(viewListener, paramName); - comboBox = new JComboBox<>(DataProductType.values()); - comboBox.setSelectedItem(DataProductType.ALL); - comboBox.setPreferredSize( - new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT)); - - comboBox.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - update(); - } - }); + this.add(getComboBox()); + } - this.add(comboBox); + /** + * @return + * + */ + public JComboBox getComboBox() { + if (comboBox == null) { + comboBox = new JComboBox<>(DataProductType.values()); + comboBox.setSelectedItem(DataProductType.ALL); + comboBox.setPreferredSize( + new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT)); + + comboBox.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + update(); + } + }); + } + + return comboBox; } /** -- libgit2 0.21.2