JAL-3438 spotless for 2.11.2.0
[jalview.git] / src / jalview / gui / OptsAndParamsPage.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.gui;
22
23 import java.awt.BorderLayout;
24 import java.awt.Component;
25 import java.awt.Dimension;
26 import java.awt.Font;
27 import java.awt.GridLayout;
28 import java.awt.Rectangle;
29 import java.awt.event.ActionEvent;
30 import java.awt.event.ActionListener;
31 import java.awt.event.FocusAdapter;
32 import java.awt.event.FocusEvent;
33 import java.awt.event.KeyEvent;
34 import java.awt.event.KeyListener;
35 import java.awt.event.MouseEvent;
36 import java.awt.event.MouseListener;
37 import java.net.URL;
38 import java.util.ArrayList;
39 import java.util.List;
40 import java.util.Map;
41
42 import javax.swing.JButton;
43 import javax.swing.JCheckBox;
44 import javax.swing.JComboBox;
45 import javax.swing.JComponent;
46 import javax.swing.JLabel;
47 import javax.swing.JMenuItem;
48 import javax.swing.JPanel;
49 import javax.swing.JPopupMenu;
50 import javax.swing.JScrollPane;
51 import javax.swing.JTextArea;
52 import javax.swing.JTextField;
53 import javax.swing.border.TitledBorder;
54 import javax.swing.event.ChangeEvent;
55 import javax.swing.event.ChangeListener;
56
57 import jalview.util.MessageManager;
58 import jalview.ws.params.ArgumentI;
59 import jalview.ws.params.OptionI;
60 import jalview.ws.params.ParameterI;
61 import jalview.ws.params.ValueConstrainI;
62 import jalview.ws.params.ValueConstrainI.ValueType;
63 import net.miginfocom.swing.MigLayout;
64
65 /**
66  * GUI generator/manager for options and parameters. Originally abstracted from
67  * the WsJobParameters dialog box.
68  * 
69  * @author jprocter
70  * 
71  */
72 public class OptsAndParamsPage
73 {
74   /**
75    * compact or verbose style parameters
76    */
77   boolean compact = false;
78
79   public class OptionBox extends JPanel
80           implements MouseListener, ActionListener
81   {
82     JCheckBox enabled = new JCheckBox();
83
84     final URL finfo;
85
86     boolean hasLink = false;
87
88     boolean initEnabled = false;
89
90     String initVal = null;
91
92     OptionI option;
93
94     JLabel optlabel = new JLabel();
95
96     JComboBox<String> val = new JComboBox<>();
97
98     public OptionBox(OptionI opt)
99     {
100       option = opt;
101       setLayout(new BorderLayout());
102       enabled.setSelected(opt.isRequired()); // TODO: lock required options
103       enabled.setFont(new Font("Verdana", Font.PLAIN, 11));
104       enabled.setText("");
105       enabled.setText(opt.getName());
106       enabled.addActionListener(this);
107       finfo = option.getFurtherDetails();
108       String desc = opt.getDescription();
109       if (finfo != null)
110       {
111         hasLink = true;
112
113         enabled.setToolTipText(JvSwingUtils.wrapTooltip(true,
114                 ((desc == null || desc.trim().length() == 0)
115                         ? MessageManager.getString(
116                                 "label.opt_and_params_further_details")
117                         : desc) + "<br><img src=\"" + linkImageURL
118                         + "\"/>"));
119         enabled.addMouseListener(this);
120       }
121       else
122       {
123         if (desc != null && desc.trim().length() > 0)
124         {
125           enabled.setToolTipText(
126                   JvSwingUtils.wrapTooltip(true, opt.getDescription()));
127         }
128       }
129       add(enabled, BorderLayout.NORTH);
130       for (String str : opt.getPossibleValues())
131       {
132         val.addItem(str);
133       }
134       val.setSelectedItem(opt.getValue());
135       if (opt.getPossibleValues().size() > 1)
136       {
137         setLayout(new GridLayout(1, 2));
138         val.addActionListener(this);
139         add(val, BorderLayout.SOUTH);
140       }
141       // TODO: add actionListeners for popup (to open further info),
142       // and to update list of parameters if an option is enabled
143       // that takes a value. JBPNote: is this TODO still valid ?
144       setInitialValue();
145     }
146
147     @Override
148     public void actionPerformed(ActionEvent e)
149     {
150       if (e.getSource() != enabled)
151       {
152         enabled.setSelected(true);
153       }
154       checkIfModified();
155     }
156
157     private void checkIfModified()
158     {
159       boolean notmod = (initEnabled == enabled.isSelected());
160       if (enabled.isSelected())
161       {
162         if (initVal != null)
163         {
164           notmod &= initVal.equals(val.getSelectedItem());
165         }
166         else
167         {
168           // compare against default service setting
169           notmod &= option.getValue() == null
170                   || option.getValue().equals(val.getSelectedItem());
171         }
172       }
173       else
174       {
175         notmod &= (initVal != null) ? initVal.equals(val.getSelectedItem())
176                 : val.getSelectedItem() != initVal;
177       }
178       poparent.argSetModified(this, !notmod);
179     }
180
181     public OptionI getOptionIfEnabled()
182     {
183       if (!enabled.isSelected())
184       {
185         return null;
186       }
187       OptionI opt = option.copy();
188       if (opt.getPossibleValues() != null
189               && opt.getPossibleValues().size() == 1)
190       {
191         // Hack to make sure the default value for an enabled option with only
192         // one value is actually returned
193         opt.setValue(opt.getPossibleValues().get(0));
194       }
195       if (val.getSelectedItem() != null)
196       {
197         opt.setValue((String) val.getSelectedItem());
198       }
199       else
200       {
201         if (option.getValue() != null)
202         {
203           opt.setValue(option.getValue());
204         }
205       }
206       return opt;
207     }
208
209     @Override
210     public void mouseClicked(MouseEvent e)
211     {
212       if (e.isPopupTrigger()) // for Windows
213       {
214         showUrlPopUp(this, finfo.toString(), e.getX(), e.getY());
215       }
216     }
217
218     @Override
219     public void mouseEntered(MouseEvent e)
220     {
221       // TODO Auto-generated method stub
222
223     }
224
225     @Override
226     public void mouseExited(MouseEvent e)
227     {
228       // TODO Auto-generated method stub
229
230     }
231
232     @Override
233     public void mousePressed(MouseEvent e)
234     {
235       if (e.isPopupTrigger()) // Mac
236       {
237         showUrlPopUp(this, finfo.toString(), e.getX(), e.getY());
238       }
239     }
240
241     @Override
242     public void mouseReleased(MouseEvent e)
243     {
244     }
245
246     public void resetToDefault(boolean setDefaultParams)
247     {
248       enabled.setSelected(false);
249       if (option.isRequired()
250               || (setDefaultParams && option.getValue() != null))
251       {
252         // Apply default value
253         selectOption(option, option.getValue());
254       }
255     }
256
257     public void setInitialValue()
258     {
259       initEnabled = enabled.isSelected();
260       if (option.getPossibleValues() != null
261               && option.getPossibleValues().size() > 1)
262       {
263         initVal = (String) val.getSelectedItem();
264       }
265       else
266       {
267         initVal = (initEnabled) ? (String) val.getSelectedItem() : null;
268       }
269     }
270
271   }
272
273   public class ParamBox extends JPanel
274           implements ChangeListener, ActionListener, MouseListener
275   {
276     boolean adjusting = false;
277
278     boolean choice = false;
279
280     JComboBox<String> choicebox;
281
282     JPanel controlPanel = new JPanel();
283
284     boolean descisvisible = false;
285
286     JScrollPane descPanel = new JScrollPane();
287
288     final URL finfo;
289
290     boolean integ = false;
291
292     String lastVal;
293
294     ParameterI parameter;
295
296     final OptsParametersContainerI pmdialogbox;
297
298     JPanel settingPanel = new JPanel();
299
300     JButton showDesc = new JButton();
301
302     Slider slider = null;
303
304     JTextArea string = new JTextArea();
305
306     ValueConstrainI validator = null;
307
308     JTextField valueField = null;
309
310     public ParamBox(final OptsParametersContainerI pmlayout,
311             ParameterI parm)
312     {
313       pmdialogbox = pmlayout;
314       finfo = parm.getFurtherDetails();
315       validator = parm.getValidValue();
316       parameter = parm;
317       if (validator != null)
318       {
319         integ = validator.getType() == ValueType.Integer;
320       }
321       else
322       {
323         if (parameter.getPossibleValues() != null)
324         {
325           choice = true;
326         }
327       }
328
329       if (!compact)
330       {
331         makeExpanderParam(parm);
332       }
333       else
334       {
335         makeCompactParam(parm);
336
337       }
338     }
339
340     private void makeCompactParam(ParameterI parm)
341     {
342       setLayout(new MigLayout("", "[][grow]"));
343
344       String ttipText = null;
345
346       controlPanel.setLayout(new BorderLayout());
347
348       if (parm.getDescription() != null
349               && parm.getDescription().trim().length() > 0)
350       {
351         // Only create description boxes if there actually is a description.
352         ttipText = (JvSwingUtils.wrapTooltip(true,
353                 parm.getDescription() + (finfo != null ? "<br><img src=\""
354                         + linkImageURL + "\"/>"
355                         + MessageManager.getString(
356                                 "label.opt_and_params_further_details")
357                         : "")));
358       }
359
360       JvSwingUtils.mgAddtoLayout(this, ttipText, new JLabel(parm.getName()),
361               controlPanel, "");
362       updateControls(parm);
363       validate();
364     }
365
366     private void makeExpanderParam(final ParameterI parm)
367     {
368       setPreferredSize(new Dimension(PARAM_WIDTH, PARAM_CLOSEDHEIGHT));
369       setBorder(new TitledBorder(parm.getName()));
370       setLayout(null);
371       showDesc.setFont(new Font("Verdana", Font.PLAIN, 6));
372       showDesc.setText("+");
373       string.setFont(new Font("Verdana", Font.PLAIN, 11));
374       string.setBackground(getBackground());
375
376       string.setEditable(false);
377       descPanel.getViewport().setView(string);
378
379       descPanel.setVisible(false);
380
381       JPanel firstrow = new JPanel();
382       firstrow.setLayout(null);
383       controlPanel.setLayout(new BorderLayout());
384       controlPanel.setBounds(new Rectangle(39, 10, PARAM_WIDTH - 70,
385               PARAM_CLOSEDHEIGHT - 50));
386       firstrow.add(controlPanel);
387       firstrow.setBounds(new Rectangle(10, 20, PARAM_WIDTH - 30,
388               PARAM_CLOSEDHEIGHT - 30));
389
390       final ParamBox me = this;
391
392       if (parm.getDescription() != null
393               && parm.getDescription().trim().length() > 0)
394       {
395         // Only create description boxes if there actually is a description.
396         if (finfo != null)
397         {
398           showDesc.setToolTipText(JvSwingUtils.wrapTooltip(true,
399                   MessageManager.formatMessage(
400                           "label.opt_and_params_show_brief_desc_image_link",
401                           new String[]
402                           { linkImageURL.toExternalForm() })));
403           showDesc.addMouseListener(this);
404         }
405         else
406         {
407           showDesc.setToolTipText(
408                   JvSwingUtils.wrapTooltip(true, MessageManager.getString(
409                           "label.opt_and_params_show_brief_desc")));
410         }
411         showDesc.addActionListener(new ActionListener()
412         {
413
414           @Override
415           public void actionPerformed(ActionEvent e)
416           {
417             descisvisible = !descisvisible;
418             descPanel.setVisible(descisvisible);
419             descPanel.getVerticalScrollBar().setValue(0);
420             me.setPreferredSize(new Dimension(PARAM_WIDTH,
421                     (descisvisible) ? PARAM_HEIGHT : PARAM_CLOSEDHEIGHT));
422             me.validate();
423             pmdialogbox.refreshParamLayout();
424           }
425         });
426         string.setWrapStyleWord(true);
427         string.setLineWrap(true);
428         string.setColumns(32);
429         string.setText(parm.getDescription());
430         showDesc.setBounds(new Rectangle(10, 10, 16, 16));
431         firstrow.add(showDesc);
432       }
433       add(firstrow);
434       validator = parm.getValidValue();
435       parameter = parm;
436       if (validator != null)
437       {
438         integ = validator.getType() == ValueType.Integer;
439       }
440       else
441       {
442         if (parameter.getPossibleValues() != null)
443         {
444           choice = true;
445         }
446       }
447       updateControls(parm);
448       descPanel.setBounds(new Rectangle(10, PARAM_CLOSEDHEIGHT,
449               PARAM_WIDTH - 20, PARAM_HEIGHT - PARAM_CLOSEDHEIGHT - 5));
450       add(descPanel);
451       validate();
452     }
453
454     /**
455      * Action on input in text field
456      */
457     @Override
458     public void actionPerformed(ActionEvent e)
459     {
460       if (adjusting)
461       {
462         return;
463       }
464       if (!choice)
465       {
466         updateSliderFromValueField();
467       }
468       checkIfModified();
469     }
470
471     private void checkIfModified()
472     {
473       Object cstate = getCurrentValue();
474       boolean modified = !cstate.equals(lastVal);
475       pmdialogbox.argSetModified(this, modified);
476     }
477
478     /**
479      * Answers the current value of the parameter, as text
480      * 
481      * @return
482      */
483     private String getCurrentValue()
484     {
485       return choice ? (String) choicebox.getSelectedItem()
486               : valueField.getText();
487     }
488
489     @Override
490     public int getBaseline(int width, int height)
491     {
492       return 0;
493     }
494
495     // from
496     // http://stackoverflow.com/questions/2743177/top-alignment-for-flowlayout
497     // helpful hint of using the Java 1.6 alignBaseLine property of FlowLayout
498     @Override
499     public Component.BaselineResizeBehavior getBaselineResizeBehavior()
500     {
501       return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
502     }
503
504     public int getBoxHeight()
505     {
506       return (descisvisible ? PARAM_HEIGHT : PARAM_CLOSEDHEIGHT);
507     }
508
509     public ParameterI getParameter()
510     {
511       ParameterI prm = parameter.copy();
512       if (choice)
513       {
514         prm.setValue((String) choicebox.getSelectedItem());
515       }
516       else
517       {
518         prm.setValue(valueField.getText());
519       }
520       return prm;
521     }
522
523     public void init()
524     {
525       // reset the widget's initial value.
526       lastVal = null;
527     }
528
529     @Override
530     public void mouseClicked(MouseEvent e)
531     {
532       if (e.isPopupTrigger()) // for Windows
533       {
534         showUrlPopUp(this, finfo.toString(), e.getX(), e.getY());
535       }
536     }
537
538     @Override
539     public void mouseEntered(MouseEvent e)
540     {
541       // TODO Auto-generated method stub
542
543     }
544
545     @Override
546     public void mouseExited(MouseEvent e)
547     {
548       // TODO Auto-generated method stub
549
550     }
551
552     @Override
553     public void mousePressed(MouseEvent e)
554     {
555       if (e.isPopupTrigger()) // for Mac
556       {
557         showUrlPopUp(this, finfo.toString(), e.getX(), e.getY());
558       }
559     }
560
561     @Override
562     public void mouseReleased(MouseEvent e)
563     {
564       // TODO Auto-generated method stub
565
566     }
567
568     /**
569      * Action on change of slider value
570      */
571     @Override
572     public void stateChanged(ChangeEvent e)
573     {
574       if (!adjusting)
575       {
576         float value = slider.getSliderValue();
577         valueField.setText(integ ? Integer.toString((int) value)
578                 : Float.toString(value));
579         checkIfModified();
580       }
581     }
582
583     public void updateControls(ParameterI parm)
584     {
585       adjusting = true;
586       boolean init = (choicebox == null && valueField == null);
587       if (init)
588       {
589         if (choice)
590         {
591           choicebox = new JComboBox<>();
592           choicebox.addActionListener(this);
593           controlPanel.add(choicebox, BorderLayout.CENTER);
594         }
595         else
596         {
597           valueField = new JTextField();
598           valueField.addActionListener(this);
599           valueField.addKeyListener(new KeyListener()
600           {
601
602             @Override
603             public void keyTyped(KeyEvent e)
604             {
605             }
606
607             @Override
608             public void keyReleased(KeyEvent e)
609             {
610               if (e.isActionKey())
611               {
612                 if (valueField.getText().trim().length() > 0)
613                 {
614                   actionPerformed(null);
615                 }
616               }
617             }
618
619             @Override
620             public void keyPressed(KeyEvent e)
621             {
622             }
623           });
624           valueField.addFocusListener(new FocusAdapter()
625           {
626
627             @Override
628             public void focusLost(FocusEvent e)
629             {
630               actionPerformed(null);
631             }
632
633           });
634           valueField.setPreferredSize(new Dimension(60, 25));
635           valueField.setText(parm.getValue());
636           slider = makeSlider(parm.getValidValue());
637           updateSliderFromValueField();
638           slider.addChangeListener(this);
639
640           controlPanel.add(slider, BorderLayout.WEST);
641           controlPanel.add(valueField, BorderLayout.EAST);
642         }
643       }
644
645       if (parm != null)
646       {
647         if (choice)
648         {
649           if (init)
650           {
651             List<String> vals = parm.getPossibleValues();
652             for (String val : vals)
653             {
654               choicebox.addItem(val);
655             }
656           }
657
658           if (parm.getValue() != null)
659           {
660             choicebox.setSelectedItem(parm.getValue());
661           }
662         }
663         else
664         {
665           valueField.setText(parm.getValue());
666         }
667       }
668       lastVal = getCurrentValue();
669       adjusting = false;
670     }
671
672     private Slider makeSlider(ValueConstrainI validValue)
673     {
674       if (validValue != null)
675       {
676         final Number minValue = validValue.getMin();
677         final Number maxValue = validValue.getMax();
678         if (minValue != null && maxValue != null)
679         {
680           return new Slider(minValue.floatValue(), maxValue.floatValue(),
681                   minValue.floatValue());
682         }
683       }
684
685       /*
686        * otherwise, a nominal slider which will not be visible
687        */
688       return new Slider(0, 100, 50);
689     }
690
691     public void updateSliderFromValueField()
692     {
693       if (validator != null)
694       {
695         final Number minValue = validator.getMin();
696         final Number maxValue = validator.getMax();
697         if (integ)
698         {
699           int iVal = 0;
700           try
701           {
702             valueField.setText(valueField.getText().trim());
703             iVal = Integer.valueOf(valueField.getText());
704             if (minValue != null && minValue.intValue() > iVal)
705             {
706               iVal = minValue.intValue();
707               // TODO: provide visual indication that hard limit was reached for
708               // this parameter
709             }
710             if (maxValue != null && maxValue.intValue() < iVal)
711             {
712               iVal = maxValue.intValue();
713             }
714           } catch (NumberFormatException e)
715           {
716             System.err.println(e.toString());
717           }
718           if (minValue != null || maxValue != null)
719           {
720             valueField.setText(String.valueOf(iVal));
721             slider.setSliderValue(iVal);
722           }
723           else
724           {
725             slider.setVisible(false);
726           }
727         }
728         else
729         {
730           float fVal = 0f;
731           try
732           {
733             valueField.setText(valueField.getText().trim());
734             fVal = Float.valueOf(valueField.getText());
735             if (minValue != null && minValue.floatValue() > fVal)
736             {
737               fVal = minValue.floatValue();
738               // TODO: provide visual indication that hard limit was reached for
739               // this parameter
740               // update value field to reflect any bound checking we performed.
741               valueField.setText("" + fVal);
742             }
743             if (maxValue != null && maxValue.floatValue() < fVal)
744             {
745               fVal = maxValue.floatValue();
746               // TODO: provide visual indication that hard limit was reached for
747               // this parameter
748               // update value field to reflect any bound checking we performed.
749               valueField.setText("" + fVal);
750             }
751           } catch (NumberFormatException e)
752           {
753             System.err.println(e.toString());
754           }
755           if (minValue != null && maxValue != null)
756           {
757             slider.setSliderModel(minValue.floatValue(),
758                     maxValue.floatValue(), fVal);
759           }
760           else
761           {
762             slider.setVisible(false);
763           }
764         }
765       }
766       else
767       {
768         if (!choice)
769         {
770           slider.setVisible(false);
771         }
772       }
773     }
774   }
775
776   public static final int PARAM_WIDTH = 340;
777
778   public static final int PARAM_HEIGHT = 150;
779
780   public static final int PARAM_CLOSEDHEIGHT = 80;
781
782   public OptsAndParamsPage(OptsParametersContainerI paramContainer)
783   {
784     this(paramContainer, false);
785   }
786
787   public OptsAndParamsPage(OptsParametersContainerI paramContainer,
788           boolean compact)
789   {
790     poparent = paramContainer;
791     this.compact = compact;
792   }
793
794   public static void showUrlPopUp(JComponent invoker, final String finfo,
795           int x, int y)
796   {
797
798     JPopupMenu mnu = new JPopupMenu();
799     JMenuItem mitem = new JMenuItem(
800             MessageManager.formatMessage("label.view_params", new String[]
801             { finfo }));
802     mitem.addActionListener(new ActionListener()
803     {
804
805       @Override
806       public void actionPerformed(ActionEvent e)
807       {
808         Desktop.showUrl(finfo);
809
810       }
811     });
812     mnu.add(mitem);
813     mnu.show(invoker, x, y);
814   }
815
816   URL linkImageURL = getClass().getResource("/images/link.gif");
817
818   Map<String, OptionBox> optSet = new java.util.LinkedHashMap<>();
819
820   Map<String, ParamBox> paramSet = new java.util.LinkedHashMap<>();
821
822   public Map<String, OptionBox> getOptSet()
823   {
824     return optSet;
825   }
826
827   public void setOptSet(Map<String, OptionBox> optSet)
828   {
829     this.optSet = optSet;
830   }
831
832   public Map<String, ParamBox> getParamSet()
833   {
834     return paramSet;
835   }
836
837   public void setParamSet(Map<String, ParamBox> paramSet)
838   {
839     this.paramSet = paramSet;
840   }
841
842   OptsParametersContainerI poparent;
843
844   OptionBox addOption(OptionI opt)
845   {
846     OptionBox cb = optSet.get(opt.getName());
847     if (cb == null)
848     {
849       cb = new OptionBox(opt);
850       optSet.put(opt.getName(), cb);
851       // jobOptions.add(cb, FlowLayout.LEFT);
852     }
853     return cb;
854   }
855
856   ParamBox addParameter(ParameterI arg)
857   {
858     ParamBox pb = paramSet.get(arg.getName());
859     if (pb == null)
860     {
861       pb = new ParamBox(poparent, arg);
862       paramSet.put(arg.getName(), pb);
863       // paramList.add(pb);
864     }
865     pb.init();
866     // take the defaults from the parameter
867     pb.updateControls(arg);
868     return pb;
869   }
870
871   void selectOption(OptionI option, String string)
872   {
873     OptionBox cb = optSet.get(option.getName());
874     if (cb == null)
875     {
876       cb = addOption(option);
877     }
878     cb.enabled.setSelected(string != null); // initial state for an option.
879     if (string != null)
880     {
881       if (option.getPossibleValues().contains(string))
882       {
883         cb.val.setSelectedItem(string);
884       }
885       else
886       {
887         throw new Error(MessageManager.formatMessage(
888                 "error.invalid_value_for_option", new String[]
889                 { string, option.getName() }));
890       }
891
892     }
893     if (option.isRequired() && !cb.enabled.isSelected())
894     {
895       // TODO: indicate paramset is not valid.. option needs to be selected!
896     }
897     cb.setInitialValue();
898   }
899
900   void setParameter(ParameterI arg)
901   {
902     ParamBox pb = paramSet.get(arg.getName());
903     if (pb == null)
904     {
905       addParameter(arg);
906     }
907     else
908     {
909       pb.updateControls(arg);
910     }
911
912   }
913
914   /**
915    * recover options and parameters from GUI
916    * 
917    * @return
918    */
919   public List<ArgumentI> getCurrentSettings()
920   {
921     List<ArgumentI> argSet = new ArrayList<>();
922     for (OptionBox opts : getOptSet().values())
923     {
924       OptionI opt = opts.getOptionIfEnabled();
925       if (opt != null)
926       {
927         argSet.add(opt);
928       }
929     }
930     for (ParamBox parambox : getParamSet().values())
931     {
932       ParameterI parm = parambox.getParameter();
933       if (parm != null)
934       {
935         argSet.add(parm);
936       }
937     }
938
939     return argSet;
940   }
941
942 }