X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FWsJobParameters.java;h=b3e40c120fb7d63beb3e328383926e3894fc931d;hb=9876fdccf311378e690c1f9e18db52675d427b89;hp=4f222bf43f9991119c8194acf3c62b7b108396e7;hpb=87ea83af3e209a8c3a4b19f9530a9c05b4541148;p=jalview.git
diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java
index 4f222bf..b3e40c1 100644
--- a/src/jalview/gui/WsJobParameters.java
+++ b/src/jalview/gui/WsJobParameters.java
@@ -1,19 +1,22 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
*
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
@@ -215,7 +218,8 @@ public class WsJobParameters extends JPanel implements ItemListener,
frame = new JDialog(Desktop.instance, true);
- frame.setTitle("Edit parameters for " + service.getActionText());
+ frame.setTitle(MessageManager.formatMessage("label.edit_params_for",
+ new String[] { service.getActionText() }));
Rectangle deskr = Desktop.instance.getBounds();
Dimension pref = this.getPreferredSize();
frame.setBounds(new Rectangle(
@@ -262,8 +266,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
}
});
- updatepref = JvSwingUtils.makeButton("Update",
- "Update this existing user parameter set.",
+ updatepref = JvSwingUtils.makeButton(
+ MessageManager.getString("action.update"),
+ MessageManager.getString("label.update_user_parameter_set"),
new ActionListener()
{
@@ -272,8 +277,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
update_actionPerformed(e);
}
});
- deletepref = JvSwingUtils.makeButton("Delete",
- "Delete the currently selected user parameter set.",
+ deletepref = JvSwingUtils.makeButton(
+ MessageManager.getString("action.delete"),
+ MessageManager.getString("label.delete_user_parameter_set"),
new ActionListener()
{
@@ -282,8 +288,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
delete_actionPerformed(e);
}
});
- createpref = JvSwingUtils.makeButton("Create",
- "Create a new parameter set with the current settings.",
+ createpref = JvSwingUtils.makeButton(
+ MessageManager.getString("action.create"),
+ MessageManager.getString("label.create_user_parameter_set"),
new ActionListener()
{
@@ -292,8 +299,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
create_actionPerformed(e);
}
});
- revertpref = JvSwingUtils.makeButton("Revert",
- "Undo all changes to the current parameter set",
+ revertpref = JvSwingUtils.makeButton(MessageManager
+ .getString("action.revert"), MessageManager
+ .getString("label.revert_changes_user_parameter_set"),
new ActionListener()
{
@@ -302,16 +310,20 @@ public class WsJobParameters extends JPanel implements ItemListener,
revert_actionPerformed(e);
}
});
- startjob = JvSwingUtils.makeButton("Start Job",
- "Start Job with current settings.", new ActionListener()
+ startjob = JvSwingUtils.makeButton(
+ MessageManager.getString("action.start_job"),
+ MessageManager.getString("label.start_job_current_settings"),
+ new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
startjob_actionPerformed(e);
}
});
- canceljob = JvSwingUtils.makeButton("Cancel Job",
- "Close this dialog and cancel job.", new ActionListener()
+ canceljob = JvSwingUtils.makeButton(
+ MessageManager.getString("action.cancel_job"),
+ MessageManager.getString("label.cancel_job_close_dialog"),
+ new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
@@ -319,7 +331,8 @@ public class WsJobParameters extends JPanel implements ItemListener,
}
});
- setDetails.setBorder(new TitledBorder("Details"));
+ setDetails.setBorder(new TitledBorder(MessageManager
+ .getString("label.details")));
setDetails.setLayout(new BorderLayout());
setDescr.setColumns(40);
setDescr.setWrapStyleWord(true);
@@ -327,9 +340,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
setDescr.setBackground(getBackground());
setDescr.setEditable(true);
setDescr.getDocument().addDocumentListener(this);
- setDescr.setToolTipText("Click to edit the notes for this parameter set.");
+ setDescr.setToolTipText(MessageManager
+ .getString("label.edit_notes_parameter_set"));
JScrollPane setDescrView = new JScrollPane();
- // setDescrView.setPreferredSize(new Dimension(350, 200));
setDescrView.getViewport().setView(setDescr);
setName.setEditable(true);
setName.addItemListener(this);
@@ -338,7 +351,8 @@ public class WsJobParameters extends JPanel implements ItemListener,
GridBagLayout gbl = new GridBagLayout();
SetNamePanel.setLayout(gbl);
- JLabel setNameLabel = new JLabel(MessageManager.getString("label.current_parameter_set_name"));
+ JLabel setNameLabel = new JLabel(
+ MessageManager.getString("label.current_parameter_set_name"));
setNameLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
setNameInfo.add(setNameLabel);
@@ -377,9 +391,11 @@ public class WsJobParameters extends JPanel implements ItemListener,
// paramPane.setPreferredSize(new Dimension(360, 400));
// paramPane.setPreferredSize(null);
- jobOptions.setBorder(new TitledBorder("Options"));
+ jobOptions.setBorder(new TitledBorder(MessageManager
+ .getString("label.options")));
jobOptions.setOpaque(true);
- paramList.setBorder(new TitledBorder("Parameters"));
+ paramList.setBorder(new TitledBorder(MessageManager
+ .getString("label.parameters")));
paramList.setOpaque(true);
JPanel bjo = new JPanel(new BorderLayout()), bjp = new JPanel(
new BorderLayout());
@@ -410,6 +426,11 @@ public class WsJobParameters extends JPanel implements ItemListener,
JPanel dialogpanel = new JPanel();
dialogpanel.add(startjob);
dialogpanel.add(canceljob);
+ // JAL-1580: setMaximumSize() doesn't work, so just size for the worst case:
+ // check for null is for JUnit usage
+ final int windowHeight = Desktop.instance == null ? 540
+ : Desktop.instance.getHeight();
+ setPreferredSize(new Dimension(540, windowHeight));
add(dialogpanel, BorderLayout.SOUTH);
validate();
}
@@ -417,7 +438,7 @@ public class WsJobParameters extends JPanel implements ItemListener,
protected void revert_actionPerformed(ActionEvent e)
{
reInitDialog(lastParmSet);
-
+ updateWebServiceMenus();
}
protected void update_actionPerformed(ActionEvent e)
@@ -446,6 +467,7 @@ public class WsJobParameters extends JPanel implements ItemListener,
_deleteUserPreset(lastParmSet);
}
reInitDialog(null); // service default
+ updateWebServiceMenus();
}
protected void create_actionPerformed(ActionEvent e)
@@ -456,7 +478,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
_storeCurrentPreset(curname);
lastParmSet = curname;
isUserPreset = true;
+ reInitDialog(curname);
initArgSetModified();
+ updateWebServiceMenus();
}
else
{
@@ -511,7 +535,7 @@ public class WsJobParameters extends JPanel implements ItemListener,
Hashtable exnames = new Hashtable();
for (int i = 0, iSize = setName.getItemCount(); i < iSize; i++)
{
- exnames.put((String) setName.getItemAt(i), setName.getItemAt(i));
+ exnames.put(setName.getItemAt(i), setName.getItemAt(i));
}
servicePresets = new Hashtable();
// Add the default entry - if not present already.
@@ -567,17 +591,17 @@ public class WsJobParameters extends JPanel implements ItemListener,
@SuppressWarnings("unchecked")
private void updateTable(WsParamSetI p, List jobArgset)
{
- boolean setDefaultParams=false;
+ boolean setDefaultParams = false;
if (lastParmSet == null)
{
isUserPreset = false;
// First call - so provide Service default settings
setName.setSelectedItem(lastSetName = SVC_DEF);
}
- if (p==null && SVC_DEF.equals(""+setName.getSelectedItem()))
+ if (p == null && SVC_DEF.equals("" + setName.getSelectedItem()))
{
// indicate that service defaults should be set if available
- setDefaultParams=true;
+ setDefaultParams = true;
}
// populate table from default parameter set.
List args = paramStore.getServiceParameters();
@@ -585,9 +609,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
// split to params and required arguments
{
int cw = 0;
- boolean optset=false;
+ boolean optset = false;
for (ArgumentI myarg : args)
- {
+ {
// Ideally, Argument would implement isRequired !
if (myarg instanceof ParameterI)
{
@@ -934,7 +958,7 @@ public class WsJobParameters extends JPanel implements ItemListener,
{
Vector services = new Vector();
services.addElement(args[p++]);
- Jws2Discoverer.setServiceUrls(services);
+ Jws2Discoverer.getDiscoverer().setServiceUrls(services);
}
try
{
@@ -1075,8 +1099,9 @@ public class WsJobParameters extends JPanel implements ItemListener,
}
WsJobParameters pgui = new WsJobParameters(lastserv,
new JabaPreset(lastserv, pr));
- JFrame jf = new JFrame("Parameters for "
- + lastserv.getActionText());
+ JFrame jf = new JFrame(MessageManager.formatMessage(
+ "label.ws_parameters_for",
+ new String[] { lastserv.getActionText() }));
JPanel cont = new JPanel(new BorderLayout());
pgui.validate();
cont.setPreferredSize(pgui.getPreferredSize());
@@ -1275,7 +1300,18 @@ public class WsJobParameters extends JPanel implements ItemListener,
SetNamePanel.validate();
validate();
settingDialog = false;
+ }
+ /**
+ * Rebuild the AlignFrame web service menus (after add/delete of a preset
+ * option).
+ */
+ protected void updateWebServiceMenus()
+ {
+ for (AlignFrame alignFrame : Desktop.getAlignFrames())
+ {
+ alignFrame.BuildWebServiceMenu();
+ }
}
String curSetName = null;
@@ -1386,7 +1422,7 @@ public class WsJobParameters extends JPanel implements ItemListener,
if (src.getParent() == setName)
{
// rename any existing records we know about for this set.
- String newname = (String) e.getActionCommand().trim();
+ String newname = e.getActionCommand().trim();
String msg = null;
if (isServicePreset(newname))
{
@@ -1400,9 +1436,10 @@ public class WsJobParameters extends JPanel implements ItemListener,
{
public void run()
{
- JOptionPane.showMessageDialog(ourframe,
- "Invalid name - preset already exists.",
- "Invalid name", JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showMessageDialog(ourframe, MessageManager
+ .getString("label.invalid_name_preset_exists"),
+ MessageManager.getString("label.invalid_name"),
+ JOptionPane.WARNING_MESSAGE);
}
});