setName.setEditable(true);
setName.addItemListener(this);
setName.getEditor().addActionListener(this);
- SetNamePanel.setLayout(new BorderLayout());
- SetNamePanel.setMinimumSize(new Dimension(300, 35));
- SetNamePanel.add(setName, BorderLayout.WEST);
+ 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));
+ // setNameLabel.setHorizontalAlignment(FlowLayout.LEFT);
+ setNameInfo.add(setNameLabel);
+ setNameInfo.add(setName);
// initial button visibility
updatepref.setVisible(false);
deletepref.setVisible(false);
revertpref.setVisible(false);
createpref.setVisible(false);
JPanel setsavebuts = new JPanel();
- setsavebuts.setMinimumSize(new Dimension(150, 35));
- setsavebuts.setLayout(new FlowLayout());
- setsavebuts.add(createpref, BorderLayout.CENTER);
- setsavebuts.add(updatepref, BorderLayout.CENTER);
- setsavebuts.add(revertpref, BorderLayout.EAST);
- setsavebuts.add(deletepref, BorderLayout.EAST);
- SetNamePanel.add(setsavebuts, BorderLayout.EAST);
+ setsavebuts.setLayout(new FlowLayout(FlowLayout.LEFT)); // GridLayout(1,2));
+ ((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));
+ buttonArea.add(setsavebuts);
+ SetNamePanel.add(setNameInfo);
+ SetNamePanel.add(buttonArea);
setDetails.add(setDescrView, BorderLayout.CENTER);
// setDetails.setPreferredSize(new Dimension(360, 100));
jobParameters.setBorder(new TitledBorder("Parameters"));
lastParmSet = curname;
isUserPreset = true;
initArgSetModified();
+ syncSetNamesWithStore();
}
}
jobOptions.setLayout(new GridLayout(optSet.size(), 1));
refreshParamLayout();
paramPane.validate();
- validate();
+ revalidate();
}
private boolean isModified()
if (b && modifiedElements.size() > 0)
{
makeSetNameValid(!isUserPreset);
+ SetNamePanel.revalidate();
}
updateButtonDisplay();
}
while (_getUserPreset(tnm) != null)
{
tnm = nm + " (" + (++i) + ")";
+ renamed=true;
}
if (i > 0)
{
}
if (!makeupdate)
{
- setName.setSelectedItem(curSetName = nm);
+ setName.addItem(curSetName = nm);
+ setName.setSelectedItem(curSetName);
+ }
+ if (renamed)
+ {
+ settingDialog=false; // we need this name change to be registered.
+ argSetModified(setName, renamed);
}
settingDialog = stn;
}
{
cb = addOption(opt);
}
- cb.enabled.setSelected(true); // initial state for an option.
+ cb.enabled.setSelected(string!=null); // initial state for an option.
if (string != null)
{
if (opt.getPossibleValues().contains(string))
{
return null;
}
+ Option opt=null;
try
{
- Option opt = jalview.ws.jws2.ParameterUtils.copyOption(option);
+ opt = jalview.ws.jws2.ParameterUtils.copyOption(option);
if (val.getSelectedItem() != null)
{
e.printStackTrace();
return null;
}
- return option;
+ return opt;
}
public void actionPerformed(ActionEvent e)
{
if (initVal != null)
{
- notmod |= initVal.equals(val.getSelectedItem());
+ notmod &= initVal.equals(val.getSelectedItem());
} else {
- notmod |= false;
+ // compare against default service setting
+ notmod &= option.getDefaultValue()==null || option.getDefaultValue().equals(val.getSelectedItem());
}
}
else
{
- notmod |= initVal == null;
+ notmod &= initVal == null;
}
argSetModified(this, !notmod);
}
protected void refreshParamLayout()
{
- int s = 100;
+ FlowLayout fl = new FlowLayout();
+ paramList.setLayout(fl);
+ int s = 2*fl.getVgap();
for (ParamBox pbox : paramSet.values())
{
- s += pbox.getBoxHeight();
+ s += fl.getVgap()+pbox.getBoxHeight(); // getBoxHeight();
}
paramList.setPreferredSize(new Dimension(PARAM_WIDTH, s));
- paramList.setLayout(new FlowLayout());
validate();
}
if (isModified())
{
String lsetname = (curSetName != null) ? curSetName : lastParmSet;
+ if (lsetname.equals(setname)) {
+ // setname was just edited - so ignore this event.
+ return;
+ }
+ settingDialog=true;
System.out.println("Prompting to save " + lsetname);
if (javax.swing.JOptionPane.showConfirmDialog(this,
- "Parameter set is modifed - save ?", "Save changes ?",
+ "Parameter set '"+lsetname+"' is modifed\nsave ?", "Save changes ?",
javax.swing.JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION)
{
- System.out.println("Saving for " + setname);
- _storeCurrentPreset(curSetName);
+ System.out.println("Saving for " + lsetname);
+ _storeCurrentPreset(lsetname);
}
}