From: jprocter Date: Fri, 3 Sep 2010 08:19:23 +0000 (+0000) Subject: parameter set serialization/deserialization and preset/userdefined parameter set... X-Git-Tag: Release_2_6~72 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6fbc6ebb2f261d9071e40fcf51b02584a2119aa2;p=jalview.git parameter set serialization/deserialization and preset/userdefined parameter set recall --- diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java index cbfa273..3facfa1 100644 --- a/src/jalview/gui/WsJobParameters.java +++ b/src/jalview/gui/WsJobParameters.java @@ -290,8 +290,8 @@ public class WsJobParameters extends JPanel implements ItemListener, setName.setEditable(true); setName.addItemListener(this); setName.getEditor().addActionListener(this); - JPanel setNameInfo=new JPanel(new FlowLayout(FlowLayout.LEFT)); - SetNamePanel.setLayout(new GridLayout(2,1)); + JPanel setNameInfo = new JPanel(new FlowLayout(FlowLayout.LEFT)); + SetNamePanel.setLayout(new GridLayout(2, 1)); SetNamePanel.setMinimumSize(new Dimension(300, 40)); JLabel setNameLabel = new JLabel("Parameter set: "); setNameLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); @@ -305,14 +305,14 @@ public class WsJobParameters extends JPanel implements ItemListener, createpref.setVisible(false); JPanel setsavebuts = new JPanel(); setsavebuts.setLayout(new FlowLayout(FlowLayout.LEFT)); // GridLayout(1,2)); - ((FlowLayout)setsavebuts.getLayout()).setHgap(10); - ((FlowLayout)setsavebuts.getLayout()).setVgap(0); + ((FlowLayout) setsavebuts.getLayout()).setHgap(10); + ((FlowLayout) setsavebuts.getLayout()).setVgap(0); setsavebuts.add(deletepref); setsavebuts.add(revertpref); setsavebuts.add(createpref); setsavebuts.add(updatepref); setsavebuts.setSize(new Dimension(150, 20)); - JPanel buttonArea=new JPanel(new GridLayout(1,1)); + JPanel buttonArea = new JPanel(new GridLayout(1, 1)); buttonArea.add(setsavebuts); SetNamePanel.add(setNameInfo); SetNamePanel.add(buttonArea); @@ -689,7 +689,7 @@ public class WsJobParameters extends JPanel implements ItemListener, while (_getUserPreset(tnm) != null) { tnm = nm + " (" + (++i) + ")"; - renamed=true; + renamed = true; } if (i > 0) { @@ -715,7 +715,7 @@ public class WsJobParameters extends JPanel implements ItemListener, } if (renamed) { - settingDialog=false; // we need this name change to be registered. + settingDialog = false; // we need this name change to be registered. argSetModified(setName, renamed); } settingDialog = stn; @@ -756,7 +756,7 @@ public class WsJobParameters extends JPanel implements ItemListener, { cb = addOption(opt); } - cb.enabled.setSelected(string!=null); // initial state for an option. + cb.enabled.setSelected(string != null); // initial state for an option. if (string != null) { if (opt.getPossibleValues().contains(string)) @@ -1224,7 +1224,7 @@ public class WsJobParameters extends JPanel implements ItemListener, { return null; } - Option opt=null; + Option opt = null; try { opt = jalview.ws.jws2.ParameterUtils.copyOption(option); @@ -1258,9 +1258,12 @@ public class WsJobParameters extends JPanel implements ItemListener, if (initVal != null) { notmod &= initVal.equals(val.getSelectedItem()); - } else { + } + else + { // compare against default service setting - notmod &= option.getDefaultValue()==null || option.getDefaultValue().equals(val.getSelectedItem()); + notmod &= option.getDefaultValue() == null + || option.getDefaultValue().equals(val.getSelectedItem()); } } else @@ -1340,10 +1343,10 @@ public class WsJobParameters extends JPanel implements ItemListener, { FlowLayout fl = new FlowLayout(); paramList.setLayout(fl); - int s = 2*fl.getVgap(); + int s = 2 * fl.getVgap(); for (ParamBox pbox : paramSet.values()) { - s += fl.getVgap()+pbox.getBoxHeight(); // getBoxHeight(); + s += fl.getVgap() + pbox.getBoxHeight(); // getBoxHeight(); } paramList.setPreferredSize(new Dimension(PARAM_WIDTH, s)); validate(); @@ -1458,6 +1461,46 @@ public class WsJobParameters extends JPanel implements ItemListener, } } } + { + System.out.println("Testing param write:"); + List writeparam = null, readparam = null; + try + { + writeparam = jalview.ws.jws2.ParameterUtils + .writeParameterSet( + pr.getArguments(lastserv.getRunnerConfig()), + " "); + System.out.println("Testing param read :"); + List