From 499fbdac5e7260dcfd51456e0b7eb1dd7ff613b5 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 16 Apr 2018 10:18:09 +0100 Subject: [PATCH] JAL-2937 use preferences for presets, simplify some constructors --- resources/lang/Messages.properties | 9 +- resources/lang/Messages_es.properties | 1 - src/jalview/gui/OptsAndParamsPage.java | 7 +- src/jalview/gui/Preferences.java | 60 +++++++------ src/jalview/gui/WsJobParameters.java | 62 ++++++-------- src/jalview/hmmer/HMMERParamStore.java | 57 +++++++++---- src/jalview/jbgui/GPreferences.java | 103 ++++++++++++----------- src/jalview/ws/jws2/Jws2Client.java | 2 +- src/jalview/ws/params/simple/BooleanOption.java | 11 +-- 9 files changed, 173 insertions(+), 139 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index bcd0bbd..b3afc6a 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -964,7 +964,6 @@ 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.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.implementation_error_vamsas_operation_not_init = Impementation error! Vamsas Operations when client not initialised and connected @@ -1378,8 +1377,10 @@ label.hmmbuild = hmmbuild label.hmmbuild_group = Build HMM from Selected Group label.group_hmmbuild = Build HMM from Group label.hmmsearch = hmmsearch +label.installation = Installation label.hmmer_location = HMMER Binaries Installation Location label.cygwin_location = Cygwin Binaries Installation Location (Windows) +label.information_annotation = Information Annotation warn.null_hmm = Please ensure the alignment contains a hidden Markov model label.ignore_below_background_frequency = Ignore Below Background Frequency label.information_description = Information content, measured in bits @@ -1411,10 +1412,10 @@ label.dom_e_value = Domain E-value Cutoff label.dom_score = Domain Score Threshold label.number_of_results_desc = The maximum number of results that hmmsearch will return label.auto_align_seqs_desc = If true, all fetched sequences will be aligned to the hidden Markov model with which the search was performed -label.use_accessions_desc = If true, the accession number of each sequence is returned, rather than that sequences name -label.seq_e_value_desc = The E-value cutoff for returned sequences +label.use_accessions_desc = If true, the accession number of each sequence is returned, rather than that sequence's name +label.seq_e_value_desc = The E-value cutoff for returned sequences (hmmsearch -E) label.seq_score_desc = The score threshold for returned sequences -label.dom_e_value_desc = The E-value cutoff for returned domains +label.dom_e_value_desc = The E-value cutoff for returned domains (hmmsearch -domE) label.dom_score_desc = The score threshold for returned domains label.not_enough_sequences = There are not enough sequences to run {0} label.add_database = Add Database diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index e42d6b8..ee7e4fe 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -887,7 +887,6 @@ 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.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.implementation_error_vamsas_operation_not_init = ¡Error de implementación! Operaciones VAMSAS cuando el cliente no estaba inicializado ni conectado diff --git a/src/jalview/gui/OptsAndParamsPage.java b/src/jalview/gui/OptsAndParamsPage.java index 1505df8..482f122 100644 --- a/src/jalview/gui/OptsAndParamsPage.java +++ b/src/jalview/gui/OptsAndParamsPage.java @@ -26,6 +26,7 @@ import jalview.ws.params.OptionI; import jalview.ws.params.ParameterI; import jalview.ws.params.ValueConstrainI; import jalview.ws.params.ValueConstrainI.ValueType; +import jalview.ws.params.simple.BooleanOption; import jalview.ws.params.simple.LogarithmicParameter; import java.awt.BorderLayout; @@ -958,11 +959,9 @@ public class OptsAndParamsPage } else { - throw new Error(MessageManager.formatMessage( - "error.invalid_value_for_option", new String[] - { string, option.getName() })); + throw new Error(String.format("Invalid value '%s' for option '%s'", + string, option.getName())); } - } if (option.isRequired() && !cb.enabled.isSelected()) { diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 9f9d6f8..296c4bf 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -86,6 +86,12 @@ import ext.edu.ucsf.rbvi.strucviz2.StructureManager; */ public class Preferences extends GPreferences { + public static final String HMMSEARCH_SEQCOUNT = "HMMSEARCH_SEQCOUNT"; + + public static final String HMMINFO_GLOBAL_BACKGROUND = "HMMINFO_GLOBAL_BACKGROUND"; + + public static final String HMMALIGN_TRIM_TERMINI = "HMMALIGN_TRIM_TERMINI"; + public static final String ENABLE_SPLIT_FRAME = "ENABLE_SPLIT_FRAME"; public static final String SCALE_PROTEIN_TO_CDNA = "SCALE_PROTEIN_TO_CDNA"; @@ -222,8 +228,8 @@ public class Preferences extends GPreferences /* * Set HMMER tab defaults */ - hmmrTrimTermini.setSelected(Cache.getDefault("TRIM_TERMINI", false)); - if (Cache.getDefault("USE_UNIPROT", false)) + hmmrTrimTermini.setSelected(Cache.getDefault(HMMALIGN_TRIM_TERMINI, false)); + if (Cache.getDefault(HMMINFO_GLOBAL_BACKGROUND, false)) { hmmerBackgroundUniprot.setSelected(true); } @@ -232,7 +238,7 @@ public class Preferences extends GPreferences hmmerBackgroundAlignment.setSelected(true); } hmmerSequenceCount - .setText(Cache.getProperty("SEQUENCES_TO_KEEP")); + .setText(Cache.getProperty(HMMSEARCH_SEQCOUNT)); hmmerPath.setText(Cache.getProperty(HMMER_PATH)); hmmerPath.addActionListener(new ActionListener() { @@ -250,23 +256,26 @@ public class Preferences extends GPreferences validateHmmerPath(); } }); - cygwinPath.setText(Cache.getProperty(CYGWIN_PATH)); - cygwinPath.addActionListener(new ActionListener() + if (cygwinPath != null) { - @Override - public void actionPerformed(ActionEvent e) + cygwinPath.setText(Cache.getProperty(CYGWIN_PATH)); + cygwinPath.addActionListener(new ActionListener() { - validateCygwinPath(); - } - }); - cygwinPath.addFocusListener(new FocusAdapter() - { - @Override - public void focusLost(FocusEvent e) + @Override + public void actionPerformed(ActionEvent e) + { + validateCygwinPath(); + } + }); + cygwinPath.addFocusListener(new FocusAdapter() { - validateCygwinPath(); - } - }); + @Override + public void focusLost(FocusEvent e) + { + validateCygwinPath(); + } + }); + } /* * Set Visual tab defaults @@ -727,14 +736,17 @@ public class Preferences extends GPreferences /* * Save HMMER settings */ - Cache.applicationProperties.setProperty("TRIM_TERMINI", + Cache.applicationProperties.setProperty(HMMALIGN_TRIM_TERMINI, Boolean.toString(hmmrTrimTermini.isSelected())); - Cache.applicationProperties.setProperty("USE_UNIPROT", + Cache.applicationProperties.setProperty(HMMINFO_GLOBAL_BACKGROUND, Boolean.toString(hmmerBackgroundUniprot.isSelected())); - Cache.applicationProperties.setProperty("SEQUENCES_TO_KEEP", + Cache.applicationProperties.setProperty(HMMSEARCH_SEQCOUNT, hmmerSequenceCount.getText()); Cache.setOrRemove(HMMER_PATH, hmmerPath.getText()); - Cache.setOrRemove(CYGWIN_PATH, cygwinPath.getText()); + if (cygwinPath != null) + { + Cache.setOrRemove(CYGWIN_PATH, cygwinPath.getText()); + } AlignFrame[] frames = Desktop.getAlignFrames(); if (frames != null && frames.length > 0) { @@ -744,8 +756,8 @@ public class Preferences extends GPreferences } } - hmmrTrimTermini.setSelected(Cache.getDefault("TRIM_TERMINI", false)); - if (Cache.getDefault("USE_UNIPROT", false)) + hmmrTrimTermini.setSelected(Cache.getDefault(HMMALIGN_TRIM_TERMINI, false)); + if (Cache.getDefault(HMMINFO_GLOBAL_BACKGROUND, false)) { hmmerBackgroundUniprot.setSelected(true); } @@ -754,7 +766,7 @@ public class Preferences extends GPreferences hmmerBackgroundAlignment.setSelected(true); } hmmerSequenceCount - .setText(Cache.getProperty("SEQUENCES_TO_KEEP")); + .setText(Cache.getProperty(HMMSEARCH_SEQCOUNT)); hmmerPath.setText(Cache.getProperty(HMMER_PATH)); /* diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java index af52d43..bf97b6a 100644 --- a/src/jalview/gui/WsJobParameters.java +++ b/src/jalview/gui/WsJobParameters.java @@ -95,6 +95,10 @@ import net.miginfocom.swing.MigLayout; public class WsJobParameters extends JPanel implements ItemListener, ActionListener, DocumentListener, OptsParametersContainerI { + private static final int PREFERRED_WIDTH = 540; + + private static final int DEFAULT_HEIGHT = 640; + URL linkImageURL = getClass().getResource("/images/link.gif"); private static final String SVC_DEF = "Defaults"; // this is the null @@ -158,8 +162,7 @@ public class WsJobParameters extends JPanel implements ItemListener, this(service, null); } - public WsJobParameters(JFrame parent, ParamDatastoreI store, - WsParamSetI preset, + public WsJobParameters(ParamDatastoreI store, WsParamSetI preset, List args) { super(); @@ -175,45 +178,41 @@ public class WsJobParameters extends JPanel implements ItemListener, public WsJobParameters(Jws2Instance service, WsParamSetI preset) { - this(null, service, preset, null); + this(service, preset, null); } /** * - * @param desktop - * - if null, create new JFrame outside of desktop * @param service * @param preset */ - public WsJobParameters(JFrame parent, Jws2Instance service, + public WsJobParameters(Jws2Instance service, WsParamSetI preset, List jobArgset) { - this(parent, null, service, preset, jobArgset); + this(null, service, preset, jobArgset); } /** * - * @param parent * @param paramStorei * @param service * @param preset * @param jobArgset */ - public WsJobParameters(JFrame parent, ParamDatastoreI paramStorei, - Jws2Instance service, WsParamSetI preset, - List jobArgset) + public WsJobParameters(ParamDatastoreI paramStorei, Jws2Instance service, + WsParamSetI preset, List jobArgset) { super(); jbInit(); this.paramStore = paramStorei; - if (paramStore == null) + if (paramStore == null && service != null) { paramStore = service.getParamStore(); } this.service = service; // argSetModified(false); // populate parameter table - initForService(service, preset, jobArgset); + initForService(preset, jobArgset); // display in new JFrame attached to parent. validate(); } @@ -423,8 +422,8 @@ public class WsJobParameters extends JPanel implements ItemListener, paramList.setBorder( new TitledBorder(MessageManager.getString("label.parameters"))); paramList.setOpaque(true); - JPanel bjo = new JPanel(new BorderLayout()), - bjp = new JPanel(new BorderLayout()); + JPanel bjo = new JPanel(new BorderLayout()); + JPanel bjp = new JPanel(new BorderLayout()); bjo.add(jobOptions, BorderLayout.CENTER); bjp.add(paramList, BorderLayout.CENTER); bjp.setOpaque(true); @@ -454,9 +453,9 @@ public class WsJobParameters extends JPanel implements ItemListener, 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 + final int windowHeight = Desktop.instance == null ? DEFAULT_HEIGHT : Desktop.instance.getHeight(); - setPreferredSize(new Dimension(540, windowHeight)); + // setPreferredSize(new Dimension(PREFERRED_WIDTH, windowHeight)); add(dialogpanel, BorderLayout.SOUTH); validate(); } @@ -545,8 +544,7 @@ public class WsJobParameters extends JPanel implements ItemListener, */ boolean settingDialog = false; - void initForService(Jws2Instance service, WsParamSetI jabap, - List jabajobArgset) + void initForService(WsParamSetI jabap, List jabajobArgset) { WsParamSetI p = null; List jobArgset = null; @@ -619,7 +617,6 @@ public class WsJobParameters extends JPanel implements ItemListener, settingDialog = false; } - @SuppressWarnings("unchecked") private void updateTable(WsParamSetI p, List jobArgset) { boolean setDefaultParams = false; @@ -867,22 +864,19 @@ public class WsJobParameters extends JPanel implements ItemListener, FlowLayout fl = new FlowLayout(FlowLayout.LEFT); int sep = fl.getVgap(); boolean fh = true; - int os = 0, - s = jobOptions.getBorder().getBorderInsets(jobOptions).bottom - + jobOptions.getBorder().getBorderInsets(jobOptions).top - + 2 * sep; - /** - * final height for viewport - */ - int finalh = s; + int s = jobOptions.getBorder().getBorderInsets(jobOptions).bottom + + jobOptions.getBorder().getBorderInsets(jobOptions).top + + 2 * sep; + int panewidth = paramPane.getViewport().getSize().width - 120 - jobOptions.getBorder().getBorderInsets(jobOptions).left + jobOptions.getBorder().getBorderInsets(jobOptions).right; - int w = 2 * fl.getHgap() - + (MAX_OPTWIDTH > OptsAndParamsPage.PARAM_WIDTH ? MAX_OPTWIDTH - : OptsAndParamsPage.PARAM_WIDTH); - int hgap = fl.getHgap(), cw = hgap; + // int w = 2 * fl.getHgap() + // + (MAX_OPTWIDTH > OptsAndParamsPage.PARAM_WIDTH ? MAX_OPTWIDTH + // : OptsAndParamsPage.PARAM_WIDTH); + int hgap = fl.getHgap(); + int cw = hgap; if (opanp.getOptSet().size() > 0) { @@ -907,7 +901,7 @@ public class WsJobParameters extends JPanel implements ItemListener, } if (fh) { - finalh += pbox.getSize().height + fl.getVgap(); + // finalh += pbox.getSize().height + fl.getVgap(); fh = false; } } @@ -945,7 +939,7 @@ public class WsJobParameters extends JPanel implements ItemListener, } if (fh) { - finalh += pbox.getSize().height + fl.getVgap(); + // finalh += pbox.getSize().height + fl.getVgap(); fh = false; } diff --git a/src/jalview/hmmer/HMMERParamStore.java b/src/jalview/hmmer/HMMERParamStore.java index c668481..d12475a 100644 --- a/src/jalview/hmmer/HMMERParamStore.java +++ b/src/jalview/hmmer/HMMERParamStore.java @@ -3,6 +3,7 @@ package jalview.hmmer; import jalview.bin.Cache; import jalview.gui.Preferences; import jalview.util.MessageManager; +import jalview.viewmodel.AlignmentViewport; import jalview.ws.params.ArgumentI; import jalview.ws.params.ParamDatastoreI; import jalview.ws.params.WsParamSetI; @@ -26,28 +27,31 @@ public final class HMMERParamStore implements ParamDatastoreI private static final String HMMSEARCH = "hmmsearch"; - String name; + private String name; - List presets = new ArrayList<>(); + private List presets = new ArrayList<>(); - private HMMERParamStore(String nam) + private AlignmentViewport viewport; + + private HMMERParamStore(String nam, AlignmentViewport av) { + this.viewport = av; this.name = nam; } - public static HMMERParamStore forBuild() + public static HMMERParamStore forBuild(AlignmentViewport viewport) { - return new HMMERParamStore(HMMBUILD); + return new HMMERParamStore(HMMBUILD, viewport); } - public static HMMERParamStore forAlign() + public static HMMERParamStore forAlign(AlignmentViewport viewport) { - return new HMMERParamStore(HMMALIGN); + return new HMMERParamStore(HMMALIGN, viewport); } - public static HMMERParamStore forSearch() + public static HMMERParamStore forSearch(AlignmentViewport viewport) { - return new HMMERParamStore(HMMSEARCH); + return new HMMERParamStore(HMMSEARCH, viewport); } @Override @@ -83,6 +87,12 @@ public final class HMMERParamStore implements ParamDatastoreI return args; } + /** + * Answers default parameters for hmmsearch, taking into account any + * configured as user preferences + * + * @param args + */ private void getHMMSearchParams(List args) { args.add(new IntegerParameter( @@ -142,7 +152,7 @@ public final class HMMERParamStore implements ParamDatastoreI 0d, 0d, 10000d)); */ args.add(new LogarithmicParameter( - MessageManager.getString("label.dom_e_value_desc"), + MessageManager.getString("label.dom_e_value"), MessageManager.getString("label.dom_e_value_desc"), false, -3d, -37.92977945, 1d, 10d)); /* @@ -154,23 +164,40 @@ public final class HMMERParamStore implements ParamDatastoreI */ } + /** + * Answers default parameters for hmmalign, taking into account any configured + * as user preferences + * + * @param args + */ private void getHMMAlignParams(List args) { + boolean def = Cache.getDefault(Preferences.HMMALIGN_TRIM_TERMINI, + false); args.add(new BooleanOption( MessageManager.getString("label.trim_termini"), MessageManager.getString("label.trim_termini_desc"), - false, false, true, null)); + false, false, def, null)); } + /** + * Answers default parameters for hmmbuild, taking into account any configured + * as user preferences + * + * @param args + */ private void getHMMBuildParams(List args) { args.add(new StringParameter(MessageManager.getString("label.hmm_name"), MessageManager.getString("label.hmm_name_desc"), true, "")); // todo only enable Use Reference Annotation if RF is present - args.add(new BooleanOption( - MessageManager.getString("label.use_reference"), - MessageManager.getString("label.use_reference_desc"), true, - true, true, null)); + if (viewport.hasReferenceAnnotation()) + { + args.add(new BooleanOption( + MessageManager.getString("label.use_reference"), + MessageManager.getString("label.use_reference_desc"), true, + true, true, null)); + } Collection options = new ArrayList<>(); options.add(MessageManager.getString("label.alignment")); diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 6ff335e..d74cf73 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -48,6 +48,7 @@ import java.awt.event.MouseEvent; import javax.swing.AbstractButton; import javax.swing.AbstractCellEditor; import javax.swing.BorderFactory; +import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.DefaultListCellRenderer; import javax.swing.JButton; @@ -72,6 +73,8 @@ import javax.swing.event.ChangeListener; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; +import net.miginfocom.swing.MigLayout; + /** * Base class for the Preferences panel. * @@ -273,19 +276,19 @@ public class GPreferences extends JPanel /* * hmmer tab and components */ - protected JPanel hmmerTab = new JPanel(); + protected JPanel hmmerTab; - protected JCheckBox hmmrTrimTermini = new JCheckBox(); + protected JCheckBox hmmrTrimTermini; - protected AbstractButton hmmerBackgroundUniprot = new JCheckBox(); + protected AbstractButton hmmerBackgroundUniprot; - protected AbstractButton hmmerBackgroundAlignment = new JCheckBox(); + protected AbstractButton hmmerBackgroundAlignment; - protected JTextField hmmerSequenceCount = new JTextField(); + protected JTextField hmmerSequenceCount; - protected JTextField hmmerPath = new JTextField(); + protected JTextField hmmerPath; - protected JTextField cygwinPath = new JTextField(); + protected JTextField cygwinPath; /* * DAS Settings tab @@ -426,20 +429,23 @@ public class GPreferences extends JPanel */ private JPanel initHMMERTab() { - hmmerTab.setLayout(null); - final int lineSpacing = 20; + hmmerTab = new JPanel(); + hmmerTab.setLayout(new BoxLayout(hmmerTab, BoxLayout.Y_AXIS)); + hmmerTab.setLayout(new MigLayout("flowy")); /* * path to hmmer binaries folder */ + JPanel installationPanel = new JPanel(new MigLayout("flowy")); + // new FlowLayout(FlowLayout.LEFT)); + JvSwingUtils.createTitledBorder(installationPanel, + MessageManager.getString("label.installation"), true); + hmmerTab.add(installationPanel); JLabel hmmerLocation = new JLabel( MessageManager.getString("label.hmmer_location")); hmmerLocation.setFont(LABEL_FONT); - int xPos = 22; - int yPos = 10; - hmmerLocation.setBounds(new Rectangle(xPos, yPos, 250, 23)); - yPos += lineSpacing; - hmmerPath.setBounds(new Rectangle(xPos, yPos, 300, 23)); + final int pathFieldLength = 40; + hmmerPath = new JTextField(pathFieldLength); hmmerPath.addMouseListener(new MouseAdapter() { @Override @@ -456,8 +462,8 @@ public class GPreferences extends JPanel } } }); - hmmerTab.add(hmmerLocation); - hmmerTab.add(hmmerPath); + installationPanel.add(hmmerLocation); + installationPanel.add(hmmerPath); /* * path to Cygwin binaries folder (for Windows) @@ -467,10 +473,7 @@ public class GPreferences extends JPanel JLabel cygwinLocation = new JLabel( MessageManager.getString("label.cygwin_location")); cygwinLocation.setFont(LABEL_FONT); - yPos += lineSpacing * 2; - cygwinLocation.setBounds(new Rectangle(xPos, yPos, 250, 23)); - yPos += lineSpacing; - cygwinPath.setBounds(new Rectangle(xPos, yPos, 300, 23)); + cygwinPath = new JTextField(pathFieldLength); cygwinPath.addMouseListener(new MouseAdapter() { @Override @@ -487,60 +490,62 @@ public class GPreferences extends JPanel } } }); - hmmerTab.add(cygwinLocation); - hmmerTab.add(cygwinPath); + installationPanel.add(cygwinLocation); + installationPanel.add(cygwinPath); } /* * preferences for hmmalign */ - yPos += lineSpacing * 2; - JPanel alignOptions = new JPanel(new FlowLayout(FlowLayout.LEFT)); - JvSwingUtils.createTitledBorder(alignOptions, + JPanel alignOptionsPanel = new JPanel(new MigLayout()); + // new FlowLayout(FlowLayout.LEFT)); + JvSwingUtils.createTitledBorder(alignOptionsPanel, MessageManager.getString("label.hmmalign_label"), true); - yPos += lineSpacing; + hmmerTab.add(alignOptionsPanel); + hmmrTrimTermini = new JCheckBox(); hmmrTrimTermini.setFont(LABEL_FONT); hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini")); - alignOptions.add(hmmrTrimTermini); - hmmerTab.add(alignOptions); - alignOptions.setBounds(new Rectangle(xPos, yPos, 300, 43)); + alignOptionsPanel.add(hmmrTrimTermini); /* * preferences for hmmsearch */ - yPos += lineSpacing * 3; - JPanel searchOptions = new JPanel(new FlowLayout(FlowLayout.LEFT)); + JPanel searchOptions = new JPanel(new MigLayout()); + // FlowLayout(FlowLayout.LEFT)); JvSwingUtils.createTitledBorder(searchOptions, MessageManager.getString("label.hmmsearch_label"), true); - searchOptions.setBounds(new Rectangle(xPos, yPos, 300, 43)); + hmmerTab.add(searchOptions); JLabel sequencesToKeep = new JLabel( MessageManager.getString("label.no_of_sequences")); sequencesToKeep.setFont(LABEL_FONT); - // hmmerSequenceCount.setBounds(new Rectangle(xPos + 250, yPos, 60, 23)); searchOptions.add(sequencesToKeep); + hmmerSequenceCount = new JTextField(5); searchOptions.add(hmmerSequenceCount); - hmmerTab.add(searchOptions); - - ButtonGroup backgroundFreqSource = new ButtonGroup(); - backgroundFreqSource.add(hmmerBackgroundUniprot); - backgroundFreqSource.add(hmmerBackgroundAlignment); - backgroundFreqSource.setSelected(hmmerBackgroundUniprot.getModel(), true); /* * preferences for Information Content annotation */ - yPos += lineSpacing * 3; - hmmerBackgroundUniprot.setText(MessageManager.getString("label.freq_uniprot")); + // JPanel dummy = new JPanel(new FlowLayout(FlowLayout.LEFT)); + JPanel annotationOptions = new JPanel(new MigLayout("left")); + JvSwingUtils.createTitledBorder(annotationOptions, + MessageManager.getString("label.information_annotation"), true); + // dummy.add(annotationOptions); + hmmerTab.add(annotationOptions); + ButtonGroup backgroundOptions = new ButtonGroup(); + hmmerBackgroundUniprot = new JRadioButton( + MessageManager.getString("label.freq_uniprot")); hmmerBackgroundUniprot.setFont(LABEL_FONT); - hmmerBackgroundUniprot.setBounds(new Rectangle(xPos, yPos, 255, 23)); - - yPos += lineSpacing; - hmmerBackgroundAlignment.setText(MessageManager.getString("label.freq_alignment")); + hmmerBackgroundAlignment = new JRadioButton( + MessageManager.getString("label.freq_alignment")); hmmerBackgroundAlignment.setFont(LABEL_FONT); - hmmerBackgroundAlignment.setBounds(new Rectangle(xPos, yPos, 300, 23)); - - hmmerTab.add(hmmerBackgroundUniprot); - hmmerTab.add(hmmerBackgroundAlignment); + backgroundOptions.add(hmmerBackgroundUniprot); + backgroundOptions.add(hmmerBackgroundAlignment); + backgroundOptions.setSelected(hmmerBackgroundUniprot.getModel(), true); + // disable buttons for now as annotation only uses Uniprot background + hmmerBackgroundAlignment.setEnabled(false); + hmmerBackgroundUniprot.setEnabled(false); + annotationOptions.add(hmmerBackgroundUniprot, "wrap"); + annotationOptions.add(hmmerBackgroundAlignment); return hmmerTab; } diff --git a/src/jalview/ws/jws2/Jws2Client.java b/src/jalview/ws/jws2/Jws2Client.java index 0f1a25e..60e25b0 100644 --- a/src/jalview/ws/jws2/Jws2Client.java +++ b/src/jalview/ws/jws2/Jws2Client.java @@ -108,7 +108,7 @@ public abstract class Jws2Client extends jalview.ws.WSClient } WsJobParameters jobParams = (preset == null && paramset != null && paramset.size() > 0) - ? new WsJobParameters(null, sh, null, paramset) + ? new WsJobParameters(sh, null, paramset) : new WsJobParameters(sh, preset); if (adjustingExisting) { diff --git a/src/jalview/ws/params/simple/BooleanOption.java b/src/jalview/ws/params/simple/BooleanOption.java index f80ff77..05abc3a 100644 --- a/src/jalview/ws/params/simple/BooleanOption.java +++ b/src/jalview/ws/params/simple/BooleanOption.java @@ -20,21 +20,18 @@ */ package jalview.ws.params.simple; -import jalview.ws.params.OptionI; - import java.net.URL; import java.util.Arrays; -public class BooleanOption extends Option implements OptionI +public class BooleanOption extends Option { public BooleanOption(String name, String descr, boolean required, boolean defVal, boolean val, URL link) { - - super(name, descr, required, (defVal ? name : ""), (val ? name : ""), - Arrays.asList(new String[] - { name }), link); + super(name, descr, required, (defVal ? name : null), + (val ? name : null), + Arrays.asList(name), link); } } -- 1.7.10.2