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