8a0fe770d9b6b356904150e97dde733edbb807e3
[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.JSlider;
57 import javax.swing.JTextArea;
58 import javax.swing.JTextField;
59 import javax.swing.border.TitledBorder;
60 import javax.swing.event.ChangeEvent;
61 import javax.swing.event.ChangeListener;
62
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 implements MouseListener,
80           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 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
114                 .wrapTooltip(
115                         true,
116                         ((desc == null || desc.trim().length() == 0) ? MessageManager
117                                 .getString("label.opt_and_params_further_details ")
118                                 : desc)
119                                 + "<br><img src=\"" + linkImageURL + "\"/>"));
120         enabled.addMouseListener(this);
121       }
122       else
123       {
124         if (desc != null && desc.trim().length() > 0)
125         {
126           enabled.setToolTipText(JvSwingUtils.wrapTooltip(true,
127                   opt.getDescription()));
128         }
129       }
130       add(enabled, BorderLayout.NORTH);
131       for (Object str : opt.getPossibleValues())
132       {
133         val.addItem((String) str);
134       }
135       val.setSelectedItem((String) opt.getValue());
136       if (opt.getPossibleValues().size() > 1)
137       {
138         setLayout(new GridLayout(1, 2));
139         val.addActionListener(this);
140         add(val, BorderLayout.SOUTH);
141       }
142       // TODO: add actionListeners for popup (to open further info),
143       // and to update list of parameters if an option is enabled
144       // that takes a value. JBPNote: is this TODO still valid ?
145       setInitialValue();
146     }
147
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     public void mouseClicked(MouseEvent e)
210     {
211       if (javax.swing.SwingUtilities.isRightMouseButton(e))
212       {
213         showUrlPopUp(this, finfo.toString(), e.getX(), e.getY());
214       }
215     }
216
217     public void mouseEntered(MouseEvent e)
218     {
219       // TODO Auto-generated method stub
220
221     }
222
223     public void mouseExited(MouseEvent e)
224     {
225       // TODO Auto-generated method stub
226
227     }
228
229     public void mousePressed(MouseEvent e)
230     {
231       // TODO Auto-generated method stub
232
233     }
234
235     public void mouseReleased(MouseEvent e)
236     {
237       // TODO Auto-generated method stub
238
239     }
240
241     public void resetToDefault(boolean setDefaultParams)
242     {
243       enabled.setSelected(false);
244       if (option.isRequired()
245               || (setDefaultParams && option.getValue() != null))
246       {
247         // Apply default value
248         selectOption(option, option.getValue());
249       }
250     }
251
252     public void setInitialValue()
253     {
254       initEnabled = enabled.isSelected();
255       if (option.getPossibleValues() != null
256               && option.getPossibleValues().size() > 1)
257       {
258         initVal = (String) val.getSelectedItem();
259       }
260       else
261       {
262         initVal = (initEnabled) ? (String) val.getSelectedItem() : null;
263       }
264     }
265
266   }
267
268   public class ParamBox extends JPanel implements ChangeListener,
269           ActionListener, MouseListener
270   {
271     boolean adjusting = false;
272
273     boolean choice = false;
274
275     JComboBox choicebox;
276
277     JPanel controlPanel = new JPanel();
278
279     boolean descisvisible = false;
280
281     JScrollPane descPanel = new JScrollPane();
282
283     final URL finfo;
284
285     boolean integ = false;
286
287     Object lastVal;
288
289     ParameterI parameter;
290
291     final OptsParametersContainerI pmdialogbox;
292
293     JPanel settingPanel = new JPanel();
294
295     JButton showDesc = new JButton();
296
297     JSlider slider = null;
298
299     JTextArea string = new JTextArea();
300
301     ValueConstrainI validator = null;
302
303     JTextField valueField = null;
304
305     public ParamBox(final OptsParametersContainerI pmlayout, ParameterI parm)
306     {
307       pmdialogbox = pmlayout;
308       finfo = parm.getFurtherDetails();
309       validator = parm.getValidValue();
310       parameter = parm;
311       if (validator != null)
312       {
313         integ = validator.getType() == ValueType.Integer;
314       }
315       else
316       {
317         if (parameter.getPossibleValues() != null)
318         {
319           choice = true;
320         }
321       }
322
323       if (!compact)
324       {
325         makeExpanderParam(parm);
326       }
327       else
328       {
329         makeCompactParam(parm);
330
331       }
332     }
333
334     private void makeCompactParam(ParameterI parm)
335     {
336       setLayout(new MigLayout("", "[][grow]"));
337
338       String ttipText = null;
339
340       controlPanel.setLayout(new BorderLayout());
341
342       if (parm.getDescription() != null
343               && parm.getDescription().trim().length() > 0)
344       {
345         // Only create description boxes if there actually is a description.
346         ttipText = (JvSwingUtils
347                 .wrapTooltip(
348                         true,
349                         parm.getDescription()
350                                 + (finfo != null ? "<br><img src=\""
351                                         + linkImageURL
352                                         + "\"/>"
353                                         + MessageManager
354                                                 .getString("label.opt_and_params_further_detail")
355                                         : "")));
356       }
357
358       JvSwingUtils.mgAddtoLayout(this, ttipText,
359               new JLabel(parm.getName()), controlPanel, "");
360       updateControls(parm);
361       validate();
362     }
363
364     private void makeExpanderParam(ParameterI parm)
365     {
366       setPreferredSize(new Dimension(PARAM_WIDTH, PARAM_CLOSEDHEIGHT));
367       setBorder(new TitledBorder(parm.getName()));
368       setLayout(null);
369       showDesc.setFont(new Font("Verdana", Font.PLAIN, 6));
370       showDesc.setText("+");
371       string.setFont(new Font("Verdana", Font.PLAIN, 11));
372       string.setBackground(getBackground());
373
374       string.setEditable(false);
375       descPanel.getViewport().setView(string);
376
377       descPanel.setVisible(false);
378
379       JPanel firstrow = new JPanel();
380       firstrow.setLayout(null);
381       controlPanel.setLayout(new BorderLayout());
382       controlPanel.setBounds(new Rectangle(39, 10, PARAM_WIDTH - 70,
383               PARAM_CLOSEDHEIGHT - 50));
384       firstrow.add(controlPanel);
385       firstrow.setBounds(new Rectangle(10, 20, PARAM_WIDTH - 30,
386               PARAM_CLOSEDHEIGHT - 30));
387
388       final ParamBox me = this;
389
390       if (parm.getDescription() != null
391               && parm.getDescription().trim().length() > 0)
392       {
393         // Only create description boxes if there actually is a description.
394         if (finfo != null)
395         {
396           showDesc.setToolTipText(JvSwingUtils.wrapTooltip(
397                   true,
398                   MessageManager
399                           .formatMessage(
400                                   "label.opt_and_params_show_brief_desc_image_link",
401                                   new String[] { linkImageURL
402                                           .toExternalForm() })));
403           showDesc.addMouseListener(this);
404         }
405         else
406         {
407           showDesc.setToolTipText(JvSwingUtils.wrapTooltip(
408                   true,
409                   MessageManager
410                           .getString("label.opt_and_params_show_brief_desc")));
411         }
412         showDesc.addActionListener(new ActionListener()
413         {
414
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     public void actionPerformed(ActionEvent e)
455     {
456       if (adjusting)
457       {
458         return;
459       }
460       if (!choice)
461       {
462         updateSliderFromValueField();
463       }
464       checkIfModified();
465     }
466
467     private void checkIfModified()
468     {
469       Object cstate = updateSliderFromValueField();
470       boolean notmod = false;
471       if (cstate.getClass() == lastVal.getClass())
472       {
473         if (cstate instanceof int[])
474         {
475           notmod = (((int[]) cstate)[0] == ((int[]) lastVal)[0]);
476         }
477         else if (cstate instanceof float[])
478         {
479           notmod = (((float[]) cstate)[0] == ((float[]) lastVal)[0]);
480         }
481         else if (cstate instanceof String[])
482         {
483           notmod = (((String[]) cstate)[0].equals(((String[]) lastVal)[0]));
484         }
485       }
486       pmdialogbox.argSetModified(this, !notmod);
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     public void mouseClicked(MouseEvent e)
530     {
531       if (javax.swing.SwingUtilities.isRightMouseButton(e))
532       {
533         showUrlPopUp(this, finfo.toString(), e.getX(), e.getY());
534       }
535     }
536
537     public void mouseEntered(MouseEvent e)
538     {
539       // TODO Auto-generated method stub
540
541     }
542
543     public void mouseExited(MouseEvent e)
544     {
545       // TODO Auto-generated method stub
546
547     }
548
549     public void mousePressed(MouseEvent e)
550     {
551       // TODO Auto-generated method stub
552
553     }
554
555     public void mouseReleased(MouseEvent e)
556     {
557       // TODO Auto-generated method stub
558
559     }
560
561     public void stateChanged(ChangeEvent e)
562     {
563       if (!adjusting)
564       {
565         valueField.setText(""
566                 + ((integ) ? ("" + (int) slider.getValue())
567                         : ("" + (float) (slider.getValue() / 1000f))));
568         checkIfModified();
569       }
570
571     }
572
573     public void updateControls(ParameterI parm)
574     {
575       adjusting = true;
576       boolean init = (choicebox == null && valueField == null);
577       if (init)
578       {
579         if (choice)
580         {
581           choicebox = new JComboBox();
582           choicebox.addActionListener(this);
583           controlPanel.add(choicebox, BorderLayout.CENTER);
584         }
585         else
586         {
587           slider = new JSlider();
588           slider.addChangeListener(this);
589           valueField = new JTextField();
590           valueField.addActionListener(this);
591           valueField.addKeyListener(new KeyListener()
592           {
593
594             @Override
595             public void keyTyped(KeyEvent e)
596             {
597             }
598
599             @Override
600             public void keyReleased(KeyEvent e)
601             {
602               if (e.isActionKey())
603               {
604                 if (valueField.getText().trim().length() > 0)
605                 {
606                   actionPerformed(null);
607                 }
608               }
609             }
610
611             @Override
612             public void keyPressed(KeyEvent e)
613             {
614             }
615           });
616           valueField.setPreferredSize(new Dimension(60, 25));
617           controlPanel.add(slider, BorderLayout.WEST);
618           controlPanel.add(valueField, BorderLayout.EAST);
619
620         }
621       }
622
623       if (parm != null)
624       {
625         if (choice)
626         {
627           if (init)
628           {
629             List vals = parm.getPossibleValues();
630             for (Object val : vals)
631             {
632               choicebox.addItem(val);
633             }
634           }
635
636           if (parm.getValue() != null)
637           {
638             choicebox.setSelectedItem(parm.getValue());
639           }
640         }
641         else
642         {
643           valueField.setText(parm.getValue());
644         }
645       }
646       lastVal = updateSliderFromValueField();
647       adjusting = false;
648     }
649
650     public Object updateSliderFromValueField()
651     {
652       int iVal;
653       float fVal;
654       if (validator != null)
655       {
656         if (integ)
657         {
658           iVal = 0;
659           try
660           {
661             valueField.setText(valueField.getText().trim());
662             iVal = Integer.valueOf(valueField.getText());
663             if (validator.getMin() != null
664                     && validator.getMin().intValue() > iVal)
665             {
666               iVal = validator.getMin().intValue();
667               // TODO: provide visual indication that hard limit was reached for
668               // this parameter
669             }
670             if (validator.getMax() != null
671                     && validator.getMax().intValue() < iVal)
672             {
673               iVal = validator.getMax().intValue();
674               // TODO: provide visual indication that hard limit was reached for
675               // this parameter
676             }
677           } catch (Exception e)
678           {
679           }
680           ;
681           // update value field to reflect any bound checking we performed.
682           valueField.setText("" + iVal);
683           if (validator.getMin() != null && validator.getMax() != null)
684           {
685             slider.getModel().setRangeProperties(iVal, 1,
686                     validator.getMin().intValue(),
687                     validator.getMax().intValue() + 1, true);
688           }
689           else
690           {
691             slider.setVisible(false);
692           }
693           return new int[] { iVal };
694         }
695         else
696         {
697           fVal = 0f;
698           try
699           {
700             valueField.setText(valueField.getText().trim());
701             fVal = Float.valueOf(valueField.getText());
702             if (validator.getMin() != null
703                     && validator.getMin().floatValue() > fVal)
704             {
705               fVal = validator.getMin().floatValue();
706               // TODO: provide visual indication that hard limit was reached for
707               // this parameter
708               // update value field to reflect any bound checking we performed.
709               valueField.setText("" + fVal);
710             }
711             if (validator.getMax() != null
712                     && validator.getMax().floatValue() < fVal)
713             {
714               fVal = validator.getMax().floatValue();
715               // TODO: provide visual indication that hard limit was reached for
716               // this parameter
717               // update value field to reflect any bound checking we performed.
718               valueField.setText("" + fVal);
719             }
720           } catch (Exception e)
721           {
722           }
723           ;
724           if (validator.getMin() != null && validator.getMax() != null)
725           {
726             slider.getModel().setRangeProperties((int) (fVal * 1000f), 1,
727                     (int) (validator.getMin().floatValue() * 1000f),
728                     1 + (int) (validator.getMax().floatValue() * 1000f),
729                     true);
730           }
731           else
732           {
733             slider.setVisible(false);
734           }
735           return new float[] { fVal };
736         }
737       }
738       else
739       {
740         if (!choice)
741         {
742           slider.setVisible(false);
743           return new String[] { valueField.getText().trim() };
744         }
745         else
746         {
747           return new String[] { (String) choicebox.getSelectedItem() };
748         }
749       }
750
751     }
752   }
753
754   public static final int PARAM_WIDTH = 340;
755
756   public static final int PARAM_HEIGHT = 150;
757
758   public static final int PARAM_CLOSEDHEIGHT = 80;
759
760   public OptsAndParamsPage(OptsParametersContainerI paramContainer)
761   {
762     this(paramContainer, false);
763   }
764
765   public OptsAndParamsPage(OptsParametersContainerI paramContainer,
766           boolean compact)
767   {
768     poparent = paramContainer;
769     this.compact = compact;
770   }
771
772   public static void showUrlPopUp(JComponent invoker, final String finfo,
773           int x, int y)
774   {
775
776     JPopupMenu mnu = new JPopupMenu();
777     JMenuItem mitem = new JMenuItem(MessageManager.formatMessage(
778             "label.view_params", new String[] { finfo }));
779     mitem.addActionListener(new ActionListener()
780     {
781
782       @Override
783       public void actionPerformed(ActionEvent e)
784       {
785         Desktop.showUrl(finfo);
786
787       }
788     });
789     mnu.add(mitem);
790     mnu.show(invoker, x, y);
791   }
792
793   URL linkImageURL = getClass().getResource("/images/link.gif");
794
795   Map<String, OptionBox> optSet = new java.util.LinkedHashMap<String, OptionBox>();
796
797   Map<String, ParamBox> paramSet = new java.util.LinkedHashMap<String, ParamBox>();
798
799   public Map<String, OptionBox> getOptSet()
800   {
801     return optSet;
802   }
803
804   public void setOptSet(Map<String, OptionBox> optSet)
805   {
806     this.optSet = optSet;
807   }
808
809   public Map<String, ParamBox> getParamSet()
810   {
811     return paramSet;
812   }
813
814   public void setParamSet(Map<String, ParamBox> paramSet)
815   {
816     this.paramSet = paramSet;
817   }
818
819   OptsParametersContainerI poparent;
820
821   OptionBox addOption(OptionI opt)
822   {
823     OptionBox cb = optSet.get(opt.getName());
824     if (cb == null)
825     {
826       cb = new OptionBox(opt);
827       optSet.put(opt.getName(), cb);
828       // jobOptions.add(cb, FlowLayout.LEFT);
829     }
830     return cb;
831   }
832
833   ParamBox addParameter(ParameterI arg)
834   {
835     ParamBox pb = paramSet.get(arg.getName());
836     if (pb == null)
837     {
838       pb = new ParamBox(poparent, arg);
839       paramSet.put(arg.getName(), pb);
840       // paramList.add(pb);
841     }
842     pb.init();
843     // take the defaults from the parameter
844     pb.updateControls(arg);
845     return pb;
846   }
847
848   void selectOption(OptionI option, String string)
849   {
850     OptionBox cb = optSet.get(option.getName());
851     if (cb == null)
852     {
853       cb = addOption(option);
854     }
855     cb.enabled.setSelected(string != null); // initial state for an option.
856     if (string != null)
857     {
858       if (option.getPossibleValues().contains(string))
859       {
860         cb.val.setSelectedItem(string);
861       }
862       else
863       {
864         throw new Error(MessageManager.formatMessage(
865                 "error.invalid_value_for_option", new String[] { string,
866                     option.getName() }));
867       }
868
869     }
870     if (option.isRequired() && !cb.enabled.isSelected())
871     {
872       // TODO: indicate paramset is not valid.. option needs to be selected!
873     }
874     cb.setInitialValue();
875   }
876
877   void setParameter(ParameterI arg)
878   {
879     ParamBox pb = paramSet.get(arg.getName());
880     if (pb == null)
881     {
882       addParameter(arg);
883     }
884     else
885     {
886       pb.updateControls(arg);
887     }
888
889   }
890
891   /**
892    * recover options and parameters from GUI
893    * 
894    * @return
895    */
896   public List<ArgumentI> getCurrentSettings()
897   {
898     List<ArgumentI> argSet = new ArrayList<ArgumentI>();
899     for (OptionBox opts : getOptSet().values())
900     {
901       OptionI opt = opts.getOptionIfEnabled();
902       if (opt != null)
903       {
904         argSet.add(opt);
905       }
906     }
907     for (ParamBox parambox : getParamSet().values())
908     {
909       ParameterI parm = parambox.getParameter();
910       if (parm != null)
911       {
912         argSet.add(parm);
913       }
914     }
915
916     return argSet;
917   }
918
919 }