From: Ben Soares Date: Thu, 16 Sep 2021 11:07:52 +0000 (+0100) Subject: JAL-3739 (combined) commits from feature/JAL-3739_useFormFieldText X-Git-Tag: Release_2_11_2_0~34^2~13 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6a44ba8cd68f29329876560cfe24403fe3e7a565;p=jalview.git JAL-3739 (combined) commits from feature/JAL-3739_useFormFieldText --- diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index ece1dab..ada04d6 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -931,7 +931,7 @@ label.groovy_support_failed = Jalview Groovy Support Failed label.couldnt_create_groovy_shell = Couldn't create the groovy Shell. Check the error log for the details of what went wrong. error.unsupported_version_calcIdparam = Unsupported Version for calcIdparam {0} error.implementation_error_cant_reorder_tree = Implementation Error: Can't reorder this tree. Not DefaultMutableTreeNode. -error.invalid_value_for_option = Invalid value {0} for option {1} +error.invalid_value_for_option = Invalid value ''{0}'' for option ''{1}'' error.implementation_error_cannot_import_vamsas_doc = Implementation Error - cannot import existing vamsas document into an existing session, Yet! label.vamsas_doc_couldnt_be_opened_as_new_session = VAMSAS Document could not be opened as a new session - please choose another error.setstatus_called_non_existent_job_pane = setStatus called for non-existent job pane {0} @@ -955,7 +955,6 @@ error.implementation_error_minlen_must_be_greater_zero = Implementation error: m error.implementation_error_msawbjob_called = Implementation error - StartJob(MsaWSJob) called on a WSJobInstance {0} error.implementation_error_cannot_attach_ws_menu_entry = IMPLEMENTATION ERROR: cannot attach WS Menu Entry without service handle reference! error.parameter_migration_not_implemented_yet = Parameter migration not implemented yet -error.implementation_error_cannot_set_jaba_option = Implementation error: cannot set Jaba Option to a value outside its allowed value range! error.implementation_error_valuetype_doesnt_support_jabaws_type = IMPLEMENTATION ERROR: jalview.ws.params.ValueConstrainI.ValueType does not support the JABAWS type : {0} error.cannot_create_jabaws_param_set = Cannot create a JabaWSParamSet from non-JabaWS parameters error.cannot_set_arguments_to_jabaws_param_set = Cannot set arguments to a JabaWSParamSet that are not JabaWS arguments diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index d61a546..cb3aba9 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -856,7 +856,7 @@ label.groovy_support_failed = El soporte Groovy de Jalview ha fallado label.couldnt_create_groovy_shell = No es posible crear el shell de Groovy. Compruebe el fichero de log para conocer los detalles. error.unsupported_version_calcIdparam = Versión no soportada de {0} error.implementation_error_cant_reorder_tree = Error de implementación: no es posible reordenar este árbol. No DefaultMutableTreeNode. -error.invalid_value_for_option = Valor no válido de {0} para la opción {1} +error.invalid_value_for_option = Valor no válido de ''{0}'' para la opción ''{1}'' error.implementation_error_cannot_import_vamsas_doc = Error de implementación - todavía no es posible importar el documento VAMSAS existente en una sesión existente. label.vamsas_doc_couldnt_be_opened_as_new_session = El documento VAMSAS no ha podido abrirse como una nueva sesión. Por favor, escoja otra. error.setstatus_called_non_existent_job_pane = se lllamado a setStatus para el panel de trabajo {0} no existente @@ -880,7 +880,6 @@ error.implementation_error_minlen_must_be_greater_zero = Error de implementaci error.implementation_error_msawbjob_called = Error de implementación - StartJob(MsaWSJob) invocado en un WSJobInstance {0} error.implementation_error_cannot_attach_ws_menu_entry = Error de implementación: ¡no es posible adjunto una WS Menu Entry sin una referencia a un manejador del servicio! error.parameter_migration_not_implemented_yet = La migración de parámetros no se ha implementado todavía -error.implementation_error_cannot_set_jaba_option = Error de implementación: no es posible establecer el valor de Jaba Option a un valor fuera de su rango permitido error.implementation_error_valuetype_doesnt_support_jabaws_type = Error de implementación: jalview.ws.params.ValueConstrainI.ValueType no soporta el tipo JABAWS: {0} error.cannot_create_jabaws_param_set = No es posible crear un JabaWSParamSet con parámetros no JabaWS error.cannot_set_arguments_to_jabaws_param_set = No es posible establecer argumentos en JabaWSParamSet que no sean argumentos JabaWS diff --git a/src/jalview/gui/OptsAndParamsPage.java b/src/jalview/gui/OptsAndParamsPage.java index 0f4d0e7..ba575ae 100644 --- a/src/jalview/gui/OptsAndParamsPage.java +++ b/src/jalview/gui/OptsAndParamsPage.java @@ -20,13 +20,6 @@ */ package jalview.gui; -import jalview.util.MessageManager; -import jalview.ws.params.ArgumentI; -import jalview.ws.params.OptionI; -import jalview.ws.params.ParameterI; -import jalview.ws.params.ValueConstrainI; -import jalview.ws.params.ValueConstrainI.ValueType; - import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; @@ -35,6 +28,8 @@ import java.awt.GridLayout; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; @@ -59,6 +54,12 @@ import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import jalview.util.MessageManager; +import jalview.ws.params.ArgumentI; +import jalview.ws.params.OptionI; +import jalview.ws.params.ParameterI; +import jalview.ws.params.ValueConstrainI; +import jalview.ws.params.ValueConstrainI.ValueType; import net.miginfocom.swing.MigLayout; /** @@ -621,6 +622,15 @@ public class OptsAndParamsPage { } }); + valueField.addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent e) + { + actionPerformed(null); + } + + }); valueField.setPreferredSize(new Dimension(60, 25)); slider = makeSlider(parm.getValidValue()); slider.addChangeListener(this); diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java index 976e551..7a139e2 100644 --- a/src/jalview/gui/WsJobParameters.java +++ b/src/jalview/gui/WsJobParameters.java @@ -20,19 +20,6 @@ */ package jalview.gui; -import jalview.gui.OptsAndParamsPage.OptionBox; -import jalview.gui.OptsAndParamsPage.ParamBox; -import jalview.util.MessageManager; -import jalview.ws.jws2.JabaParamStore; -import jalview.ws.jws2.JabaPreset; -import jalview.ws.jws2.Jws2Discoverer; -import jalview.ws.jws2.jabaws2.Jws2Instance; -import jalview.ws.params.ArgumentI; -import jalview.ws.params.OptionI; -import jalview.ws.params.ParamDatastoreI; -import jalview.ws.params.ParameterI; -import jalview.ws.params.WsParamSetI; - import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; @@ -75,6 +62,19 @@ import compbio.metadata.Parameter; import compbio.metadata.Preset; import compbio.metadata.PresetManager; import compbio.metadata.RunnerConfig; +import jalview.bin.Cache; +import jalview.gui.OptsAndParamsPage.OptionBox; +import jalview.gui.OptsAndParamsPage.ParamBox; +import jalview.util.MessageManager; +import jalview.ws.jws2.JabaParamStore; +import jalview.ws.jws2.JabaPreset; +import jalview.ws.jws2.Jws2Discoverer; +import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.params.ArgumentI; +import jalview.ws.params.OptionI; +import jalview.ws.params.ParamDatastoreI; +import jalview.ws.params.ParameterI; +import jalview.ws.params.WsParamSetI; import net.miginfocom.swing.MigLayout; /** @@ -1339,8 +1339,11 @@ public class WsJobParameters extends JPanel implements ItemListener, if (e.getSource() == setName && e.getStateChange() == e.SELECTED) { final String setname = (String) setName.getSelectedItem(); - System.out.println("Item state changed for " + setname - + " (handling ? " + !settingDialog + ")"); + if (Cache.log.isDebugEnabled()) + { + Cache.log.debug("Item state changed for " + setname + + " (handling ? " + !settingDialog + ")"); + } if (settingDialog) { // ignore event diff --git a/src/jalview/ws/jws2/Jws2Client.java b/src/jalview/ws/jws2/Jws2Client.java index 0f1a25e..71ba1b9 100644 --- a/src/jalview/ws/jws2/Jws2Client.java +++ b/src/jalview/ws/jws2/Jws2Client.java @@ -20,6 +20,17 @@ */ package jalview.ws.jws2; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.List; + +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.event.MenuEvent; +import javax.swing.event.MenuListener; + +import compbio.metadata.Argument; import jalview.api.AlignCalcWorkerI; import jalview.bin.Cache; import jalview.gui.AlignFrame; @@ -34,18 +45,6 @@ import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.params.WsParamSetI; import jalview.ws.uimodel.AlignAnalysisUIText; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.List; - -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.event.MenuEvent; -import javax.swing.event.MenuListener; - -import compbio.metadata.Argument; - /** * provides metadata for a jabaws2 service instance - resolves names, etc. * @@ -122,9 +121,10 @@ public abstract class Jws2Client extends jalview.ws.WSClient WsParamSetI prset = jobParams.getPreset(); if (prset == null) { - paramset = jobParams.isServiceDefaults() ? null - : JabaParamStore - .getJabafromJwsArgs(jobParams.getJobParams()); + paramset = + /* JAL-3739 always take values from input form */ + /* jobParams.isServiceDefaults() ? null : */ + JabaParamStore.getJabafromJwsArgs(jobParams.getJobParams()); this.preset = null; } else diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java index 23c6949..e33b4bd 100644 --- a/src/jalview/ws/jws2/MsaWSClient.java +++ b/src/jalview/ws/jws2/MsaWSClient.java @@ -20,16 +20,6 @@ */ package jalview.ws.jws2; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.AlignmentView; -import jalview.gui.AlignFrame; -import jalview.gui.Desktop; -import jalview.gui.JvOptionPane; -import jalview.gui.JvSwingUtils; -import jalview.util.MessageManager; -import jalview.ws.jws2.jabaws2.Jws2Instance; -import jalview.ws.params.WsParamSetI; - import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -42,6 +32,15 @@ import javax.swing.ToolTipManager; import compbio.data.msa.MsaWS; import compbio.metadata.Argument; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.AlignmentView; +import jalview.gui.AlignFrame; +import jalview.gui.Desktop; +import jalview.gui.JvOptionPane; +import jalview.gui.JvSwingUtils; +import jalview.util.MessageManager; +import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.params.WsParamSetI; /** * DOCUMENT ME! @@ -214,9 +213,9 @@ public class MsaWSClient extends Jws2Client @Override public void attachWSMenuEntry(JMenu rmsawsmenu, - final Jws2Instance service, final AlignFrame alignFrame) + final Jws2Instance service, final AlignFrame af) { - if (registerAAConWSInstance(rmsawsmenu, service, alignFrame)) + if (registerAAConWSInstance(rmsawsmenu, service, af)) { // Alignment dependent analysis calculation WS gui return; @@ -264,14 +263,14 @@ public class MsaWSClient extends Jws2Client @Override public void actionPerformed(ActionEvent e) { - AlignmentView msa = alignFrame.gatherSequencesForAlignment(); + AlignmentView msa = af.gatherSequencesForAlignment(); if (msa != null) { - new MsaWSClient(service, alignFrame.getTitle(), msa, withGaps, + new MsaWSClient(service, af.getTitle(), msa, withGaps, true, - alignFrame.getViewport().getAlignment().getDataset(), - alignFrame); + af.getViewport().getAlignment().getDataset(), + af); } } @@ -291,13 +290,10 @@ public class MsaWSClient extends Jws2Client @Override public void actionPerformed(ActionEvent e) { - AlignmentView msa = alignFrame.gatherSequencesForAlignment(); + AlignmentView msa = af.gatherSequencesForAlignment(); if (msa != null) { - new MsaWSClient(service, null, null, true, - alignFrame.getTitle(), msa, withGaps, true, - alignFrame.getViewport().getAlignment().getDataset(), - alignFrame); + startJob(service, af, withGaps, msa); } } @@ -312,9 +308,9 @@ public class MsaWSClient extends Jws2Client final int showToolTipFor = ToolTipManager.sharedInstance() .getDismissDelay(); - for (final WsParamSetI preset : presets) + for (final WsParamSetI preSet : presets) { - final JMenuItem methodR = new JMenuItem(preset.getName()); + final JMenuItem methodR = new JMenuItem(preSet.getName()); final int QUICK_TOOLTIP = 1500; // JAL-1582 shorten tooltip display time in these menu items as // they can obscure other options @@ -336,27 +332,27 @@ public class MsaWSClient extends Jws2Client }); String tooltip = JvSwingUtils.wrapTooltip(true, "" - + (preset.isModifiable() + + (preSet.isModifiable() ? MessageManager.getString("label.user_preset") : MessageManager .getString("label.service_preset")) - + "
" + preset.getDescription()); + + "
" + preSet.getDescription()); methodR.setToolTipText(tooltip); methodR.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - AlignmentView msa = alignFrame + AlignmentView msa = af .gatherSequencesForAlignment(); if (msa != null) { - MsaWSClient msac = new MsaWSClient(service, preset, - alignFrame.getTitle(), msa, false, true, - alignFrame.getViewport().getAlignment() + MsaWSClient msac = new MsaWSClient(service, preSet, + af.getTitle(), msa, false, true, + af.getViewport().getAlignment() .getDataset(), - alignFrame); + af); } } @@ -378,4 +374,20 @@ public class MsaWSClient extends Jws2Client } } while (!finished); } + + protected void startJob(final Jws2Instance service, final AlignFrame af, + final boolean withGaps, AlignmentView msa) + { + try { + new MsaWSClient(service, null, null, true, + af.getTitle(), msa, withGaps, true, + af.getViewport().getAlignment().getDataset(), + af); + } catch (Exception e) { + JvOptionPane.showMessageDialog(alignFrame, e.getMessage(), + MessageManager.getString("label.state_job_error"), + JvOptionPane.WARNING_MESSAGE); + + } + } } diff --git a/src/jalview/ws/jws2/dm/JabaOption.java b/src/jalview/ws/jws2/dm/JabaOption.java index cbfbd3b..5a3fb35 100644 --- a/src/jalview/ws/jws2/dm/JabaOption.java +++ b/src/jalview/ws/jws2/dm/JabaOption.java @@ -20,15 +20,14 @@ */ package jalview.ws.jws2.dm; -import jalview.util.MessageManager; -import jalview.ws.jws2.ParameterUtils; -import jalview.ws.params.OptionI; - import java.net.MalformedURLException; import java.net.URL; import java.util.List; import compbio.metadata.Option; +import jalview.util.MessageManager; +import jalview.ws.jws2.ParameterUtils; +import jalview.ws.params.OptionI; public class JabaOption implements jalview.ws.params.OptionI { @@ -94,9 +93,9 @@ public class JabaOption implements jalview.ws.params.OptionI opt.setDefaultValue(selectedItem); } catch (Exception e) { - e.printStackTrace(); - throw new Error(MessageManager.getString( - "error.implementation_error_cannot_set_jaba_option")); + throw new IllegalArgumentException(MessageManager + .formatMessage("error.invalid_value_for_option", new String[] + { selectedItem, opt.getName() })); } }