JAL-3371 more fine-grained slider; set Param slider to initial default
[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<String> 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 (String 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     String 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     JTextArea string = new JTextArea();
304
305     ValueConstrainI validator = null;
306
307     JTextField valueField = null;
308
309     public ParamBox(final OptsParametersContainerI pmlayout,
310             ParameterI parm)
311     {
312       pmdialogbox = pmlayout;
313       finfo = parm.getFurtherDetails();
314       validator = parm.getValidValue();
315       parameter = parm;
316       if (validator != null)
317       {
318         integ = validator.getType() == ValueType.Integer;
319       }
320       else
321       {
322         if (parameter.getPossibleValues() != null)
323         {
324           choice = true;
325         }
326       }
327
328       if (!compact)
329       {
330         makeExpanderParam(parm);
331       }
332       else
333       {
334         makeCompactParam(parm);
335
336       }
337     }
338
339     private void makeCompactParam(ParameterI parm)
340     {
341       setLayout(new MigLayout("", "[][grow]"));
342
343       String ttipText = null;
344
345       controlPanel.setLayout(new BorderLayout());
346
347       if (parm.getDescription() != null
348               && parm.getDescription().trim().length() > 0)
349       {
350         // Only create description boxes if there actually is a description.
351         ttipText = (JvSwingUtils.wrapTooltip(true,
352                 parm.getDescription() + (finfo != null ? "<br><img src=\""
353                         + linkImageURL + "\"/>"
354                         + MessageManager.getString(
355                                 "label.opt_and_params_further_details")
356                         : "")));
357       }
358
359       JvSwingUtils.mgAddtoLayout(this, ttipText, new JLabel(parm.getName()),
360               controlPanel, "");
361       updateControls(parm);
362       validate();
363     }
364
365     private void makeExpanderParam(final ParameterI parm)
366     {
367       setPreferredSize(new Dimension(PARAM_WIDTH, PARAM_CLOSEDHEIGHT));
368       setBorder(new TitledBorder(parm.getName()));
369       setLayout(null);
370       showDesc.setFont(new Font("Verdana", Font.PLAIN, 6));
371       showDesc.setText("+");
372       string.setFont(new Font("Verdana", Font.PLAIN, 11));
373       string.setBackground(getBackground());
374
375       string.setEditable(false);
376       descPanel.getViewport().setView(string);
377
378       descPanel.setVisible(false);
379
380       JPanel firstrow = new JPanel();
381       firstrow.setLayout(null);
382       controlPanel.setLayout(new BorderLayout());
383       controlPanel.setBounds(new Rectangle(39, 10, PARAM_WIDTH - 70,
384               PARAM_CLOSEDHEIGHT - 50));
385       firstrow.add(controlPanel);
386       firstrow.setBounds(new Rectangle(10, 20, PARAM_WIDTH - 30,
387               PARAM_CLOSEDHEIGHT - 30));
388
389       final ParamBox me = this;
390
391       if (parm.getDescription() != null
392               && parm.getDescription().trim().length() > 0)
393       {
394         // Only create description boxes if there actually is a description.
395         if (finfo != null)
396         {
397           showDesc.setToolTipText(JvSwingUtils.wrapTooltip(true,
398                   MessageManager.formatMessage(
399                           "label.opt_and_params_show_brief_desc_image_link",
400                           new String[]
401                           { linkImageURL.toExternalForm() })));
402           showDesc.addMouseListener(this);
403         }
404         else
405         {
406           showDesc.setToolTipText(
407                   JvSwingUtils.wrapTooltip(true, MessageManager.getString(
408                           "label.opt_and_params_show_brief_desc")));
409         }
410         showDesc.addActionListener(new ActionListener()
411         {
412
413           @Override
414           public void actionPerformed(ActionEvent e)
415           {
416             descisvisible = !descisvisible;
417             descPanel.setVisible(descisvisible);
418             descPanel.getVerticalScrollBar().setValue(0);
419             me.setPreferredSize(new Dimension(PARAM_WIDTH,
420                     (descisvisible) ? PARAM_HEIGHT : PARAM_CLOSEDHEIGHT));
421             me.validate();
422             pmdialogbox.refreshParamLayout();
423           }
424         });
425         string.setWrapStyleWord(true);
426         string.setLineWrap(true);
427         string.setColumns(32);
428         string.setText(parm.getDescription());
429         showDesc.setBounds(new Rectangle(10, 10, 16, 16));
430         firstrow.add(showDesc);
431       }
432       add(firstrow);
433       validator = parm.getValidValue();
434       parameter = parm;
435       if (validator != null)
436       {
437         integ = validator.getType() == ValueType.Integer;
438       }
439       else
440       {
441         if (parameter.getPossibleValues() != null)
442         {
443           choice = true;
444         }
445       }
446       updateControls(parm);
447       descPanel.setBounds(new Rectangle(10, PARAM_CLOSEDHEIGHT,
448               PARAM_WIDTH - 20, PARAM_HEIGHT - PARAM_CLOSEDHEIGHT - 5));
449       add(descPanel);
450       validate();
451     }
452
453     /**
454      * Action on input in text field
455      */
456     @Override
457     public void actionPerformed(ActionEvent e)
458     {
459       if (adjusting)
460       {
461         return;
462       }
463       if (!choice)
464       {
465         updateSliderFromValueField();
466       }
467       checkIfModified();
468     }
469
470     private void checkIfModified()
471     {
472       Object cstate = getCurrentValue();
473       boolean modified = !cstate.equals(lastVal);
474       pmdialogbox.argSetModified(this, modified);
475     }
476
477     /**
478      * Answers the current value of the parameter, as text
479      * 
480      * @return
481      */
482     private String getCurrentValue()
483     {
484       return choice ? (String) choicebox.getSelectedItem()
485               : valueField.getText();
486     }
487
488     @Override
489     public int getBaseline(int width, int height)
490     {
491       return 0;
492     }
493
494     // from
495     // http://stackoverflow.com/questions/2743177/top-alignment-for-flowlayout
496     // helpful hint of using the Java 1.6 alignBaseLine property of FlowLayout
497     @Override
498     public Component.BaselineResizeBehavior getBaselineResizeBehavior()
499     {
500       return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
501     }
502
503     public int getBoxHeight()
504     {
505       return (descisvisible ? PARAM_HEIGHT : PARAM_CLOSEDHEIGHT);
506     }
507
508     public ParameterI getParameter()
509     {
510       ParameterI prm = parameter.copy();
511       if (choice)
512       {
513         prm.setValue((String) choicebox.getSelectedItem());
514       }
515       else
516       {
517         prm.setValue(valueField.getText());
518       }
519       return prm;
520     }
521
522     public void init()
523     {
524       // reset the widget's initial value.
525       lastVal = null;
526     }
527
528     @Override
529     public void mouseClicked(MouseEvent e)
530     {
531       if (e.isPopupTrigger()) // for Windows
532       {
533         showUrlPopUp(this, finfo.toString(), e.getX(), e.getY());
534       }
535     }
536
537     @Override
538     public void mouseEntered(MouseEvent e)
539     {
540       // TODO Auto-generated method stub
541
542     }
543
544     @Override
545     public void mouseExited(MouseEvent e)
546     {
547       // TODO Auto-generated method stub
548
549     }
550
551     @Override
552     public void mousePressed(MouseEvent e)
553     {
554       if (e.isPopupTrigger()) // for Mac
555       {
556         showUrlPopUp(this, finfo.toString(), e.getX(), e.getY());
557       }
558     }
559
560     @Override
561     public void mouseReleased(MouseEvent e)
562     {
563       // TODO Auto-generated method stub
564
565     }
566
567     /**
568      * Action on change of slider value
569      */
570     @Override
571     public void stateChanged(ChangeEvent e)
572     {
573       if (!adjusting)
574       {
575         float value = slider.getSliderValue();
576         valueField.setText(
577                 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.setPreferredSize(new Dimension(60, 25));
625           valueField.setText(parm.getValue());
626           slider = makeSlider(parm.getValidValue());
627           updateSliderFromValueField();
628           slider.addChangeListener(this);
629
630           controlPanel.add(slider, BorderLayout.WEST);
631           controlPanel.add(valueField, BorderLayout.EAST);
632         }
633       }
634
635       if (parm != null)
636       {
637         if (choice)
638         {
639           if (init)
640           {
641             List<String> vals = parm.getPossibleValues();
642             for (String val : vals)
643             {
644               choicebox.addItem(val);
645             }
646           }
647
648           if (parm.getValue() != null)
649           {
650             choicebox.setSelectedItem(parm.getValue());
651           }
652         }
653         else
654         {
655           valueField.setText(parm.getValue());
656         }
657       }
658       lastVal = getCurrentValue();
659       adjusting = false;
660     }
661
662     private Slider makeSlider(ValueConstrainI validValue)
663     {
664       if (validValue != null)
665       {
666         final Number minValue = validValue.getMin();
667         final Number maxValue = validValue.getMax();
668         if (minValue != null && maxValue != null)
669         {
670           return new Slider(minValue.floatValue(), maxValue.floatValue(),
671                   minValue.floatValue());
672         }
673       }
674
675       /*
676        * otherwise, a nominal slider which will not be visible
677        */
678       return new Slider(0, 100, 50);
679     }
680
681     public void updateSliderFromValueField()
682     {
683       if (validator != null)
684       {
685         final Number minValue = validator.getMin();
686         final Number maxValue = validator.getMax();
687         if (integ)
688         {
689           int iVal = 0;
690           try
691           {
692             valueField.setText(valueField.getText().trim());
693             iVal = Integer.valueOf(valueField.getText());
694             if (minValue != null
695                     && minValue.intValue() > iVal)
696             {
697               iVal = minValue.intValue();
698               // TODO: provide visual indication that hard limit was reached for
699               // this parameter
700             }
701             if (maxValue != null && maxValue.intValue() < iVal)
702             {
703               iVal = maxValue.intValue();
704             }
705           } catch (NumberFormatException e)
706           {
707             System.err.println(e.toString());
708           }
709           if (minValue != null || maxValue != null)
710           {
711             valueField.setText(String.valueOf(iVal));
712             slider.setSliderValue(iVal);
713           }
714           else
715           {
716             slider.setVisible(false);
717           }
718         }
719         else
720         {
721           float fVal = 0f;
722           try
723           {
724             valueField.setText(valueField.getText().trim());
725             fVal = Float.valueOf(valueField.getText());
726             if (minValue != null
727                     && minValue.floatValue() > fVal)
728             {
729               fVal = minValue.floatValue();
730               // TODO: provide visual indication that hard limit was reached for
731               // this parameter
732               // update value field to reflect any bound checking we performed.
733               valueField.setText("" + fVal);
734             }
735             if (maxValue != null
736                     && maxValue.floatValue() < fVal)
737             {
738               fVal = maxValue.floatValue();
739               // TODO: provide visual indication that hard limit was reached for
740               // this parameter
741               // update value field to reflect any bound checking we performed.
742               valueField.setText("" + fVal);
743             }
744           } catch (NumberFormatException e)
745           {
746             System.err.println(e.toString());
747           }
748           if (minValue != null && maxValue != null)
749           {
750             slider.setSliderModel(minValue.floatValue(),
751                     maxValue.floatValue(), fVal);
752           }
753           else
754           {
755             slider.setVisible(false);
756           }
757         }
758       }
759       else
760       {
761         if (!choice)
762         {
763           slider.setVisible(false);
764         }
765       }
766     }
767   }
768
769   public static final int PARAM_WIDTH = 340;
770
771   public static final int PARAM_HEIGHT = 150;
772
773   public static final int PARAM_CLOSEDHEIGHT = 80;
774
775   public OptsAndParamsPage(OptsParametersContainerI paramContainer)
776   {
777     this(paramContainer, false);
778   }
779
780   public OptsAndParamsPage(OptsParametersContainerI paramContainer,
781           boolean compact)
782   {
783     poparent = paramContainer;
784     this.compact = compact;
785   }
786
787   public static void showUrlPopUp(JComponent invoker, final String finfo,
788           int x, int y)
789   {
790
791     JPopupMenu mnu = new JPopupMenu();
792     JMenuItem mitem = new JMenuItem(
793             MessageManager.formatMessage("label.view_params", new String[]
794             { finfo }));
795     mitem.addActionListener(new ActionListener()
796     {
797
798       @Override
799       public void actionPerformed(ActionEvent e)
800       {
801         Desktop.showUrl(finfo);
802
803       }
804     });
805     mnu.add(mitem);
806     mnu.show(invoker, x, y);
807   }
808
809   URL linkImageURL = getClass().getResource("/images/link.gif");
810
811   Map<String, OptionBox> optSet = new java.util.LinkedHashMap<>();
812
813   Map<String, ParamBox> paramSet = new java.util.LinkedHashMap<>();
814
815   public Map<String, OptionBox> getOptSet()
816   {
817     return optSet;
818   }
819
820   public void setOptSet(Map<String, OptionBox> optSet)
821   {
822     this.optSet = optSet;
823   }
824
825   public Map<String, ParamBox> getParamSet()
826   {
827     return paramSet;
828   }
829
830   public void setParamSet(Map<String, ParamBox> paramSet)
831   {
832     this.paramSet = paramSet;
833   }
834
835   OptsParametersContainerI poparent;
836
837   OptionBox addOption(OptionI opt)
838   {
839     OptionBox cb = optSet.get(opt.getName());
840     if (cb == null)
841     {
842       cb = new OptionBox(opt);
843       optSet.put(opt.getName(), cb);
844       // jobOptions.add(cb, FlowLayout.LEFT);
845     }
846     return cb;
847   }
848
849   ParamBox addParameter(ParameterI arg)
850   {
851     ParamBox pb = paramSet.get(arg.getName());
852     if (pb == null)
853     {
854       pb = new ParamBox(poparent, arg);
855       paramSet.put(arg.getName(), pb);
856       // paramList.add(pb);
857     }
858     pb.init();
859     // take the defaults from the parameter
860     pb.updateControls(arg);
861     return pb;
862   }
863
864   void selectOption(OptionI option, String string)
865   {
866     OptionBox cb = optSet.get(option.getName());
867     if (cb == null)
868     {
869       cb = addOption(option);
870     }
871     cb.enabled.setSelected(string != null); // initial state for an option.
872     if (string != null)
873     {
874       if (option.getPossibleValues().contains(string))
875       {
876         cb.val.setSelectedItem(string);
877       }
878       else
879       {
880         throw new Error(MessageManager.formatMessage(
881                 "error.invalid_value_for_option", new String[]
882                 { string, option.getName() }));
883       }
884
885     }
886     if (option.isRequired() && !cb.enabled.isSelected())
887     {
888       // TODO: indicate paramset is not valid.. option needs to be selected!
889     }
890     cb.setInitialValue();
891   }
892
893   void setParameter(ParameterI arg)
894   {
895     ParamBox pb = paramSet.get(arg.getName());
896     if (pb == null)
897     {
898       addParameter(arg);
899     }
900     else
901     {
902       pb.updateControls(arg);
903     }
904
905   }
906
907   /**
908    * recover options and parameters from GUI
909    * 
910    * @return
911    */
912   public List<ArgumentI> getCurrentSettings()
913   {
914     List<ArgumentI> argSet = new ArrayList<>();
915     for (OptionBox opts : getOptSet().values())
916     {
917       OptionI opt = opts.getOptionIfEnabled();
918       if (opt != null)
919       {
920         argSet.add(opt);
921       }
922     }
923     for (ParamBox parambox : getParamSet().values())
924     {
925       ParameterI parm = parambox.getParameter();
926       if (parm != null)
927       {
928         argSet.add(parm);
929       }
930     }
931
932     return argSet;
933   }
934
935 }