From 6527ace832100b68eb2177aa2c4551e6b58e350b Mon Sep 17 00:00:00 2001 From: Jean-Michel Glorian Date: Fri, 13 May 2016 15:16:55 +0200 Subject: [PATCH] access to dataproduct combobox field --- src/main/java/eu/omp/irap/vespa/epntapclient/gui/ParamField.java | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/ParamField.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/ParamField.java index 58cd18b..f150c88 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/ParamField.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/ParamField.java @@ -449,7 +449,7 @@ public abstract class ParamField extends JPanel { * @author N. Jourdane */ @SuppressWarnings("javadoc") - enum DataProductType { + public enum DataProductType { // @noformat ALL("All", "all"), IM("Image", "im"), SP("Spectrum", "sp"), DS("Dynamic spectrum", "ds"), SC("Spectral cube", "sc"), PR("Profile", "pr"), @@ -502,18 +502,28 @@ public abstract class ParamField extends JPanel { */ 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() { + this.add(getComboBox()); + } - @Override - public void actionPerformed(ActionEvent e) { - update(); - } - }); - 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