JAL-1424 corrected typos in message text keys
[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(str);
134       }
135       val.setSelectedItem(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     @Override
149     public void actionPerformed(ActionEvent e)
150     {
151       if (e.getSource() != enabled)
152       {
153         enabled.setSelected(true);
154       }
155       checkIfModified();
156     }
157
158     private void checkIfModified()
159     {
160       boolean notmod = (initEnabled == enabled.isSelected());
161       if (enabled.isSelected())
162       {
163         if (initVal != null)
164         {
165           notmod &= initVal.equals(val.getSelectedItem());
166         }
167         else
168         {
169           // compare against default service setting
170           notmod &= option.getValue() == null
171                   || option.getValue().equals(val.getSelectedItem());
172         }
173       }
174       else
175       {
176         notmod &= (initVal != null) ? initVal.equals(val.getSelectedItem())
177                 : val.getSelectedItem() != initVal;
178       }
179       poparent.argSetModified(this, !notmod);
180     }
181
182     public OptionI getOptionIfEnabled()
183     {
184       if (!enabled.isSelected())
185       {
186         return null;
187       }
188       OptionI opt = option.copy();
189       if (opt.getPossibleValues() != null
190               && opt.getPossibleValues().size() == 1)
191       {
192         // Hack to make sure the default value for an enabled option with only
193         // one value is actually returned
194         opt.setValue(opt.getPossibleValues().get(0));
195       }
196       if (val.getSelectedItem() != null)
197       {
198         opt.setValue((String) val.getSelectedItem());
199       }
200       else
201       {
202         if (option.getValue() != null)
203         {
204           opt.setValue(option.getValue());
205         }
206       }
207       return opt;
208     }
209
210     @Override
211     public void mouseClicked(MouseEvent e)
212     {
213       if (e.isPopupTrigger())
214       {
215         showUrlPopUp(this, finfo.toString(), e.getX(), e.getY());
216       }
217     }
218
219     @Override
220     public void mouseEntered(MouseEvent e)
221     {
222       // TODO Auto-generated method stub
223
224     }
225
226     @Override
227     public void mouseExited(MouseEvent e)
228     {
229       // TODO Auto-generated method stub
230
231     }
232
233     @Override
234     public void mousePressed(MouseEvent e)
235     {
236       // TODO Auto-generated method stub
237
238     }
239
240     @Override
241     public void mouseReleased(MouseEvent e)
242     {
243       // TODO Auto-generated method stub
244
245     }
246
247     public void resetToDefault(boolean setDefaultParams)
248     {
249       enabled.setSelected(false);
250       if (option.isRequired()
251               || (setDefaultParams && option.getValue() != null))
252       {
253         // Apply default value
254         selectOption(option, option.getValue());
255       }
256     }
257
258     public void setInitialValue()
259     {
260       initEnabled = enabled.isSelected();
261       if (option.getPossibleValues() != null
262               && option.getPossibleValues().size() > 1)
263       {
264         initVal = (String) val.getSelectedItem();
265       }
266       else
267       {
268         initVal = (initEnabled) ? (String) val.getSelectedItem() : null;
269       }
270     }
271
272   }
273
274   public class ParamBox extends JPanel implements ChangeListener,
275           ActionListener, MouseListener
276   {
277     boolean adjusting = false;
278
279     boolean choice = false;
280
281     JComboBox choicebox;
282
283     JPanel controlPanel = new JPanel();
284
285     boolean descisvisible = false;
286
287     JScrollPane descPanel = new JScrollPane();
288
289     final URL finfo;
290
291     boolean integ = false;
292
293     Object lastVal;
294
295     ParameterI parameter;
296
297     final OptsParametersContainerI pmdialogbox;
298
299     JPanel settingPanel = new JPanel();
300
301     JButton showDesc = new JButton();
302
303     JSlider slider = null;
304
305     JTextArea string = new JTextArea();
306
307     ValueConstrainI validator = null;
308
309     JTextField valueField = null;
310
311     public ParamBox(final OptsParametersContainerI pmlayout, 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
353                 .wrapTooltip(
354                         true,
355                         parm.getDescription()
356                                 + (finfo != null ? "<br><img src=\""
357                                         + linkImageURL
358                                         + "\"/>"
359                                         + MessageManager
360                                                 .getString("label.opt_and_params_further_details")
361                                         : "")));
362       }
363
364       JvSwingUtils.mgAddtoLayout(this, ttipText,
365               new JLabel(parm.getName()), controlPanel, "");
366       updateControls(parm);
367       validate();
368     }
369
370     private void makeExpanderParam(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(
403                   true,
404                   MessageManager
405                           .formatMessage(
406                                   "label.opt_and_params_show_brief_desc_image_link",
407                                   new String[] { linkImageURL
408                                           .toExternalForm() })));
409           showDesc.addMouseListener(this);
410         }
411         else
412         {
413           showDesc.setToolTipText(JvSwingUtils.wrapTooltip(
414                   true,
415                   MessageManager
416                           .getString("label.opt_and_params_show_brief_desc")));
417         }
418         showDesc.addActionListener(new ActionListener()
419         {
420
421           @Override
422           public void actionPerformed(ActionEvent e)
423           {
424             descisvisible = !descisvisible;
425             descPanel.setVisible(descisvisible);
426             descPanel.getVerticalScrollBar().setValue(0);
427             me.setPreferredSize(new Dimension(PARAM_WIDTH,
428                     (descisvisible) ? PARAM_HEIGHT : PARAM_CLOSEDHEIGHT));
429             me.validate();
430             pmdialogbox.refreshParamLayout();
431           }
432         });
433         string.setWrapStyleWord(true);
434         string.setLineWrap(true);
435         string.setColumns(32);
436         string.setText(parm.getDescription());
437         showDesc.setBounds(new Rectangle(10, 10, 16, 16));
438         firstrow.add(showDesc);
439       }
440       add(firstrow);
441       validator = parm.getValidValue();
442       parameter = parm;
443       if (validator != null)
444       {
445         integ = validator.getType() == ValueType.Integer;
446       }
447       else
448       {
449         if (parameter.getPossibleValues() != null)
450         {
451           choice = true;
452         }
453       }
454       updateControls(parm);
455       descPanel.setBounds(new Rectangle(10, PARAM_CLOSEDHEIGHT,
456               PARAM_WIDTH - 20, PARAM_HEIGHT - PARAM_CLOSEDHEIGHT - 5));
457       add(descPanel);
458       validate();
459     }
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 = updateSliderFromValueField();
478       boolean notmod = false;
479       if (cstate.getClass() == lastVal.getClass())
480       {
481         if (cstate instanceof int[])
482         {
483           notmod = (((int[]) cstate)[0] == ((int[]) lastVal)[0]);
484         }
485         else if (cstate instanceof float[])
486         {
487           notmod = (((float[]) cstate)[0] == ((float[]) lastVal)[0]);
488         }
489         else if (cstate instanceof String[])
490         {
491           notmod = (((String[]) cstate)[0].equals(((String[]) lastVal)[0]));
492         }
493       }
494       pmdialogbox.argSetModified(this, !notmod);
495     }
496
497     @Override
498     public int getBaseline(int width, int height)
499     {
500       return 0;
501     }
502
503     // from
504     // http://stackoverflow.com/questions/2743177/top-alignment-for-flowlayout
505     // helpful hint of using the Java 1.6 alignBaseLine property of FlowLayout
506     @Override
507     public Component.BaselineResizeBehavior getBaselineResizeBehavior()
508     {
509       return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
510     }
511
512     public int getBoxHeight()
513     {
514       return (descisvisible ? PARAM_HEIGHT : PARAM_CLOSEDHEIGHT);
515     }
516
517     public ParameterI getParameter()
518     {
519       ParameterI prm = parameter.copy();
520       if (choice)
521       {
522         prm.setValue((String) choicebox.getSelectedItem());
523       }
524       else
525       {
526         prm.setValue(valueField.getText());
527       }
528       return prm;
529     }
530
531     public void init()
532     {
533       // reset the widget's initial value.
534       lastVal = null;
535     }
536
537     @Override
538     public void mouseClicked(MouseEvent e)
539     {
540       if (e.isPopupTrigger())
541       {
542         showUrlPopUp(this, finfo.toString(), e.getX(), e.getY());
543       }
544     }
545
546     @Override
547     public void mouseEntered(MouseEvent e)
548     {
549       // TODO Auto-generated method stub
550
551     }
552
553     @Override
554     public void mouseExited(MouseEvent e)
555     {
556       // TODO Auto-generated method stub
557
558     }
559
560     @Override
561     public void mousePressed(MouseEvent e)
562     {
563       // TODO Auto-generated method stub
564
565     }
566
567     @Override
568     public void mouseReleased(MouseEvent e)
569     {
570       // TODO Auto-generated method stub
571
572     }
573
574     @Override
575     public void stateChanged(ChangeEvent e)
576     {
577       if (!adjusting)
578       {
579         valueField.setText(""
580                 + ((integ) ? ("" + slider.getValue())
581                         : ("" + slider.getValue() / 1000f)));
582         checkIfModified();
583       }
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           slider = new JSlider();
602           slider.addChangeListener(this);
603           valueField = new JTextField();
604           valueField.addActionListener(this);
605           valueField.addKeyListener(new KeyListener()
606           {
607
608             @Override
609             public void keyTyped(KeyEvent e)
610             {
611             }
612
613             @Override
614             public void keyReleased(KeyEvent e)
615             {
616               if (e.isActionKey())
617               {
618                 if (valueField.getText().trim().length() > 0)
619                 {
620                   actionPerformed(null);
621                 }
622               }
623             }
624
625             @Override
626             public void keyPressed(KeyEvent e)
627             {
628             }
629           });
630           valueField.setPreferredSize(new Dimension(60, 25));
631           controlPanel.add(slider, BorderLayout.WEST);
632           controlPanel.add(valueField, BorderLayout.EAST);
633
634         }
635       }
636
637       if (parm != null)
638       {
639         if (choice)
640         {
641           if (init)
642           {
643             List vals = parm.getPossibleValues();
644             for (Object 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 = updateSliderFromValueField();
661       adjusting = false;
662     }
663
664     public Object updateSliderFromValueField()
665     {
666       int iVal;
667       float fVal;
668       if (validator != null)
669       {
670         if (integ)
671         {
672           iVal = 0;
673           try
674           {
675             valueField.setText(valueField.getText().trim());
676             iVal = Integer.valueOf(valueField.getText());
677             if (validator.getMin() != null
678                     && validator.getMin().intValue() > iVal)
679             {
680               iVal = validator.getMin().intValue();
681               // TODO: provide visual indication that hard limit was reached for
682               // this parameter
683             }
684             if (validator.getMax() != null
685                     && validator.getMax().intValue() < iVal)
686             {
687               iVal = validator.getMax().intValue();
688               // TODO: provide visual indication that hard limit was reached for
689               // this parameter
690             }
691           } catch (Exception e)
692           {
693           }
694           ;
695           // update value field to reflect any bound checking we performed.
696           valueField.setText("" + iVal);
697           if (validator.getMin() != null && validator.getMax() != null)
698           {
699             slider.getModel().setRangeProperties(iVal, 1,
700                     validator.getMin().intValue(),
701                     validator.getMax().intValue() + 1, true);
702           }
703           else
704           {
705             slider.setVisible(false);
706           }
707           return new int[] { iVal };
708         }
709         else
710         {
711           fVal = 0f;
712           try
713           {
714             valueField.setText(valueField.getText().trim());
715             fVal = Float.valueOf(valueField.getText());
716             if (validator.getMin() != null
717                     && validator.getMin().floatValue() > fVal)
718             {
719               fVal = validator.getMin().floatValue();
720               // TODO: provide visual indication that hard limit was reached for
721               // this parameter
722               // update value field to reflect any bound checking we performed.
723               valueField.setText("" + fVal);
724             }
725             if (validator.getMax() != null
726                     && validator.getMax().floatValue() < fVal)
727             {
728               fVal = validator.getMax().floatValue();
729               // TODO: provide visual indication that hard limit was reached for
730               // this parameter
731               // update value field to reflect any bound checking we performed.
732               valueField.setText("" + fVal);
733             }
734           } catch (Exception e)
735           {
736           }
737           ;
738           if (validator.getMin() != null && validator.getMax() != null)
739           {
740             slider.getModel().setRangeProperties((int) (fVal * 1000f), 1,
741                     (int) (validator.getMin().floatValue() * 1000f),
742                     1 + (int) (validator.getMax().floatValue() * 1000f),
743                     true);
744           }
745           else
746           {
747             slider.setVisible(false);
748           }
749           return new float[] { fVal };
750         }
751       }
752       else
753       {
754         if (!choice)
755         {
756           slider.setVisible(false);
757           return new String[] { valueField.getText().trim() };
758         }
759         else
760         {
761           return new String[] { (String) choicebox.getSelectedItem() };
762         }
763       }
764
765     }
766   }
767
768   public static final int PARAM_WIDTH = 340;
769
770   public static final int PARAM_HEIGHT = 150;
771
772   public static final int PARAM_CLOSEDHEIGHT = 80;
773
774   public OptsAndParamsPage(OptsParametersContainerI paramContainer)
775   {
776     this(paramContainer, false);
777   }
778
779   public OptsAndParamsPage(OptsParametersContainerI paramContainer,
780           boolean compact)
781   {
782     poparent = paramContainer;
783     this.compact = compact;
784   }
785
786   public static void showUrlPopUp(JComponent invoker, final String finfo,
787           int x, int y)
788   {
789
790     JPopupMenu mnu = new JPopupMenu();
791     JMenuItem mitem = new JMenuItem(MessageManager.formatMessage(
792             "label.view_params", new String[] { finfo }));
793     mitem.addActionListener(new ActionListener()
794     {
795
796       @Override
797       public void actionPerformed(ActionEvent e)
798       {
799         Desktop.showUrl(finfo);
800
801       }
802     });
803     mnu.add(mitem);
804     mnu.show(invoker, x, y);
805   }
806
807   URL linkImageURL = getClass().getResource("/images/link.gif");
808
809   Map<String, OptionBox> optSet = new java.util.LinkedHashMap<String, OptionBox>();
810
811   Map<String, ParamBox> paramSet = new java.util.LinkedHashMap<String, ParamBox>();
812
813   public Map<String, OptionBox> getOptSet()
814   {
815     return optSet;
816   }
817
818   public void setOptSet(Map<String, OptionBox> optSet)
819   {
820     this.optSet = optSet;
821   }
822
823   public Map<String, ParamBox> getParamSet()
824   {
825     return paramSet;
826   }
827
828   public void setParamSet(Map<String, ParamBox> paramSet)
829   {
830     this.paramSet = paramSet;
831   }
832
833   OptsParametersContainerI poparent;
834
835   OptionBox addOption(OptionI opt)
836   {
837     OptionBox cb = optSet.get(opt.getName());
838     if (cb == null)
839     {
840       cb = new OptionBox(opt);
841       optSet.put(opt.getName(), cb);
842       // jobOptions.add(cb, FlowLayout.LEFT);
843     }
844     return cb;
845   }
846
847   ParamBox addParameter(ParameterI arg)
848   {
849     ParamBox pb = paramSet.get(arg.getName());
850     if (pb == null)
851     {
852       pb = new ParamBox(poparent, arg);
853       paramSet.put(arg.getName(), pb);
854       // paramList.add(pb);
855     }
856     pb.init();
857     // take the defaults from the parameter
858     pb.updateControls(arg);
859     return pb;
860   }
861
862   void selectOption(OptionI option, String string)
863   {
864     OptionBox cb = optSet.get(option.getName());
865     if (cb == null)
866     {
867       cb = addOption(option);
868     }
869     cb.enabled.setSelected(string != null); // initial state for an option.
870     if (string != null)
871     {
872       if (option.getPossibleValues().contains(string))
873       {
874         cb.val.setSelectedItem(string);
875       }
876       else
877       {
878         throw new Error(MessageManager.formatMessage(
879                 "error.invalid_value_for_option", new String[] { string,
880                     option.getName() }));
881       }
882
883     }
884     if (option.isRequired() && !cb.enabled.isSelected())
885     {
886       // TODO: indicate paramset is not valid.. option needs to be selected!
887     }
888     cb.setInitialValue();
889   }
890
891   void setParameter(ParameterI arg)
892   {
893     ParamBox pb = paramSet.get(arg.getName());
894     if (pb == null)
895     {
896       addParameter(arg);
897     }
898     else
899     {
900       pb.updateControls(arg);
901     }
902
903   }
904
905   /**
906    * recover options and parameters from GUI
907    * 
908    * @return
909    */
910   public List<ArgumentI> getCurrentSettings()
911   {
912     List<ArgumentI> argSet = new ArrayList<ArgumentI>();
913     for (OptionBox opts : getOptSet().values())
914     {
915       OptionI opt = opts.getOptionIfEnabled();
916       if (opt != null)
917       {
918         argSet.add(opt);
919       }
920     }
921     for (ParamBox parambox : getParamSet().values())
922     {
923       ParameterI parm = parambox.getParameter();
924       if (parm != null)
925       {
926         argSet.add(parm);
927       }
928     }
929
930     return argSet;
931   }
932
933 }