Commit 6527ace832100b68eb2177aa2c4551e6b58e350b

Authored by Jean-Michel Glorian
1 parent ae96e793
Exists in master

access to dataproduct combobox field

src/main/java/eu/omp/irap/vespa/epntapclient/gui/ParamField.java
@@ -449,7 +449,7 @@ public abstract class ParamField extends JPanel { @@ -449,7 +449,7 @@ public abstract class ParamField extends JPanel {
449 * @author N. Jourdane 449 * @author N. Jourdane
450 */ 450 */
451 @SuppressWarnings("javadoc") 451 @SuppressWarnings("javadoc")
452 - enum DataProductType { 452 + public enum DataProductType {
453 // @noformat 453 // @noformat
454 ALL("All", "all"), IM("Image", "im"), SP("Spectrum", "sp"), 454 ALL("All", "all"), IM("Image", "im"), SP("Spectrum", "sp"),
455 DS("Dynamic spectrum", "ds"), SC("Spectral cube", "sc"), PR("Profile", "pr"), 455 DS("Dynamic spectrum", "ds"), SC("Spectral cube", "sc"), PR("Profile", "pr"),
@@ -502,18 +502,28 @@ public abstract class ParamField extends JPanel { @@ -502,18 +502,28 @@ public abstract class ParamField extends JPanel {
502 */ 502 */
503 public DataProductTypeField(ViewListener viewListener, String paramName) { 503 public DataProductTypeField(ViewListener viewListener, String paramName) {
504 super(viewListener, paramName); 504 super(viewListener, paramName);
505 - comboBox = new JComboBox<>(DataProductType.values());  
506 - comboBox.setSelectedItem(DataProductType.ALL);  
507 - comboBox.setPreferredSize(  
508 - new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT));  
509 - comboBox.addActionListener(new ActionListener() { 505 + this.add(getComboBox());
  506 + }
510 507
511 - @Override  
512 - public void actionPerformed(ActionEvent e) {  
513 - update();  
514 - }  
515 - });  
516 - this.add(comboBox); 508 + /**
  509 + * @return
  510 + *
  511 + */
  512 + public JComboBox<DataProductType> getComboBox() {
  513 + if (comboBox == null){
  514 + comboBox = new JComboBox<>(DataProductType.values());
  515 + comboBox.setSelectedItem(DataProductType.ALL);
  516 + comboBox.setPreferredSize(
  517 + new Dimension(ParamField.MIN_FIELD_WIDTH, ParamField.FIELD_HEIGHT));
  518 + comboBox.addActionListener(new ActionListener() {
  519 +
  520 + @Override
  521 + public void actionPerformed(ActionEvent e) {
  522 + update();
  523 + }
  524 + });
  525 + }
  526 + return comboBox;
517 } 527 }
518 528
519 /** 529 /**