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