From a37132f229f72190ca1141a08dd716d303387685 Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Mon, 27 Sep 2021 16:03:21 +0200 Subject: [PATCH] JAL-3878 Wire web services logic to UI elements. --- src/jalview/gui/AlignFrame.java | 312 +++++++++++--------- src/jalview/gui/Desktop.java | 154 +++++----- src/jalview/gui/SlivkaPreferences.java | 31 +- src/jalview/ws2/WebServiceExecutor.java | 1 - src/jalview/ws2/operations/AlignmentOperation.java | 37 ++- src/jalview/ws2/slivka/SlivkaWebService.java | 33 +-- 6 files changed, 313 insertions(+), 255 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 6f3a7e3..9781f16 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1,19 +1,19 @@ /* * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) * Copyright (C) $$Year-Rel$$ 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 + * 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. - * - * 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 + * + * 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 . * The Jalview Authors are detailed in the 'AUTHORS' file. @@ -115,7 +115,11 @@ import jalview.ws.params.ArgumentI; import jalview.ws.params.ParamDatastoreI; import jalview.ws.params.WsParamSetI; import jalview.ws.seqfetcher.DbSourceProxy; -import jalview.ws.slivkaws.SlivkaWSDiscoverer; +import jalview.ws2.WebServiceDiscoverer; +import jalview.ws2.WebServiceI; +import jalview.ws2.operations.Operation; +import jalview.ws2.slivka.SlivkaWSDiscoverer; + import java.io.IOException; import java.util.HashSet; import java.util.Set; @@ -183,14 +187,15 @@ import ext.vamsas.ServiceHandle; /** * DOCUMENT ME! - * + * * @author $author$ * @version $Revision$ */ @SuppressWarnings("serial") public class AlignFrame extends GAlignFrame implements DropTargetListener, IProgressIndicator, - AlignViewControllerGuiI, ColourChangeListener, ServiceChangeListener + AlignViewControllerGuiI, ColourChangeListener, ServiceChangeListener, + WebServiceDiscoverer.ServiceChangeListener { public static int frameCount; @@ -231,7 +236,7 @@ public class AlignFrame extends GAlignFrame /** * Creates a new AlignFrame object with specific width and height. - * + * * @param al * @param width * @param height @@ -244,7 +249,7 @@ public class AlignFrame extends GAlignFrame /** * Creates a new AlignFrame object with specific width, height and * sequenceSetId - * + * * @param al * @param width * @param height @@ -259,7 +264,7 @@ public class AlignFrame extends GAlignFrame /** * Creates a new AlignFrame object with specific width, height and * sequenceSetId - * + * * @param al * @param width * @param height @@ -274,7 +279,7 @@ public class AlignFrame extends GAlignFrame /** * new alignment window with hidden columns - * + * * @param al * AlignmentI * @param hiddenColumns @@ -293,7 +298,7 @@ public class AlignFrame extends GAlignFrame /** * Create alignment frame for al with hiddenColumns, a specific width and * height, and specific sequenceId - * + * * @param al * @param hiddenColumns * @param width @@ -310,7 +315,7 @@ public class AlignFrame extends GAlignFrame /** * Create alignment frame for al with hiddenColumns, a specific width and * height, and specific sequenceId - * + * * @param al * @param hiddenColumns * @param width @@ -364,7 +369,7 @@ public class AlignFrame extends GAlignFrame /** * Make a new AlignFrame from existing alignmentPanels - * + * * @param ap * AlignmentPanel * @param av @@ -570,7 +575,7 @@ public class AlignFrame extends GAlignFrame /** * Change the filename and format for the alignment, and enable the 'reload' * button functionality. - * + * * @param file * valid filename * @param format @@ -586,7 +591,7 @@ public class AlignFrame extends GAlignFrame } /** - * + * * @param fileName * @param file from SwingJS; may contain bytes -- for reload * @param protocol from SwingJS; may be RELATIVE_URL @@ -604,7 +609,7 @@ public class AlignFrame extends GAlignFrame /** * JavaScript will have this, maybe others. More dependable than a file name * and maintains a reference to the actual bytes loaded. - * + * * @param file */ @@ -909,13 +914,20 @@ public class AlignFrame extends GAlignFrame buildWebServicesMenu(); } + @Override + public void servicesChanged(WebServiceDiscoverer discoverer, + Collection services) + { + buildWebServicesMenu(); + } + /* Set up intrinsic listeners for dynamically generated GUI bits. */ private void addServiceListeners() { if (Cache.getDefault("SHOW_SLIVKA_SERVICES", true)) { - WSDiscovererI discoverer = SlivkaWSDiscoverer.getInstance(); - discoverer.addServiceChangeListener(this); + WebServiceDiscoverer discoverer = SlivkaWSDiscoverer.getInstance(); + discoverer.addServiceChangeListener((disc, srvcs) -> buildWebServicesMenu()); } if (Cache.getDefault("SHOW_JWS2_SERVICES", true)) { @@ -927,12 +939,12 @@ public class AlignFrame extends GAlignFrame buildWebServicesMenu(); }; Desktop.getInstance().addJalviewPropertyChangeListener("services",legacyListener); - + addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameClosed(InternalFrameEvent e) { System.out.println("deregistering discoverer listener"); - SlivkaWSDiscoverer.getInstance().removeServiceChangeListener(AlignFrame.this); +// SlivkaWSDiscoverer.getInstance().removeServiceChangeListener(AlignFrame.this); Jws2Discoverer.getInstance().removeServiceChangeListener(AlignFrame.this); Desktop.getInstance().removeJalviewPropertyChangeListener("services", legacyListener); closeMenuItem_actionPerformed(true); @@ -980,7 +992,7 @@ public class AlignFrame extends GAlignFrame /** * Need to call this method when tabs are selected for multiple views, or when * loading from Jalview2XML.java - * + * * @param av * AlignViewport */ @@ -1037,7 +1049,7 @@ public class AlignFrame extends GAlignFrame /** * Set the enabled state of the 'Run Groovy' option in the Calculate menu - * + * * @param b */ @@ -1050,7 +1062,7 @@ public class AlignFrame extends GAlignFrame /* * (non-Javadoc) - * + * * @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long) */ @@ -1059,7 +1071,7 @@ public class AlignFrame extends GAlignFrame { progressBar.setProgressBar(message, id); } - + @Override public void removeProgressBar(long id) { @@ -1074,7 +1086,7 @@ public class AlignFrame extends GAlignFrame } /** - * + * * @return true if any progress bars are still active */ @@ -1197,7 +1209,7 @@ public class AlignFrame extends GAlignFrame } /* - * get default parameters, and (if requested) show + * get default parameters, and (if requested) show * dialog to allow modification */ ParamDatastoreI store = HMMERParamStore.forSearch(viewport); @@ -1228,7 +1240,7 @@ public class AlignFrame extends GAlignFrame { /* - * get default parameters, and (if requested) show + * get default parameters, and (if requested) show * dialog to allow modification */ @@ -1258,7 +1270,7 @@ public class AlignFrame extends GAlignFrame /** * Checks if the alignment has at least one hidden Markov model, if not shows * a dialog advising to run hmmbuild or load an HMM profile - * + * * @return */ private boolean checkForHMM() @@ -1303,7 +1315,7 @@ public class AlignFrame extends GAlignFrame /** * Checks if the alignment contains the required number of sequences. - * + * * @param required * @return */ @@ -1356,7 +1368,7 @@ public class AlignFrame extends GAlignFrame * Opens a file chooser, optionally restricted to selecting folders * (directories) only. Answers the path to the selected file or folder, or * null if none is chosen. - * + * * @param * @return */ @@ -1579,7 +1591,7 @@ public class AlignFrame extends GAlignFrame * alignment has hidden regions, or the format is one capable of including * non-sequence data (features, annotations, groups), then the user may be * prompted to specify what to include in the output. - * + * * @param file * @param format */ @@ -1692,7 +1704,7 @@ public class AlignFrame extends GAlignFrame * Outputs the alignment to textbox in the requested format, if necessary * first prompting the user for whether to include hidden regions or * non-sequence data - * + * * @param fileFormatName */ @@ -1751,7 +1763,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -1780,7 +1792,7 @@ public class AlignFrame extends GAlignFrame /** * Creates a PNG image of the alignment and writes it to the given file. If * the file is null, the user is prompted to choose a file. - * + * * @param f */ @@ -1793,7 +1805,7 @@ public class AlignFrame extends GAlignFrame /** * Creates an EPS image of the alignment and writes it to the given file. If * the file is null, the user is prompted to choose a file. - * + * * @param f */ @@ -1806,7 +1818,7 @@ public class AlignFrame extends GAlignFrame /** * Creates an SVG image of the alignment and writes it to the given file. If * the file is null, the user is prompted to choose a file. - * + * * @param f */ @@ -1825,7 +1837,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -1879,7 +1891,7 @@ public class AlignFrame extends GAlignFrame /** * Close the current view or all views in the alignment frame. If the frame * only contains one view then the alignment will be removed from memory. - * + * * @param closeAllTabs */ @@ -1934,7 +1946,7 @@ public class AlignFrame extends GAlignFrame /** * Close the specified panel and close up tabs appropriately. - * + * * @param panelToClose */ @@ -2012,7 +2024,7 @@ public class AlignFrame extends GAlignFrame } /** - * + * * @return alignment objects for all views */ @@ -2037,7 +2049,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -2076,7 +2088,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -2159,7 +2171,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param up * DOCUMENT ME! */ @@ -2284,7 +2296,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -2350,7 +2362,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! * @throws InterruptedException @@ -2366,7 +2378,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! * @throws InterruptedException @@ -2382,7 +2394,7 @@ public class AlignFrame extends GAlignFrame /** * Paste contents of Jalview clipboard - * + * * @param newAlignment * true to paste to a new alignment, otherwise add to this. * @throws InterruptedException @@ -2856,7 +2868,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -2890,7 +2902,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -2903,7 +2915,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -2916,7 +2928,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -2956,7 +2968,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -2969,7 +2981,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3042,7 +3054,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3093,7 +3105,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3131,7 +3143,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3146,7 +3158,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3169,7 +3181,7 @@ public class AlignFrame extends GAlignFrame /** * Creates and shows a new view of the current alignment. - * + * * @param viewTitle * title of newly created view; if null, one will be generated * @param copyAnnotation @@ -3245,7 +3257,7 @@ public class AlignFrame extends GAlignFrame * Make a new name for the view, ensuring it is unique within the current * sequenceSetId. (This used to be essential for Jalview Project archives, but * these now use viewId. Unique view names are still desirable for usability.) - * + * * @param viewTitle * @return */ @@ -3280,7 +3292,7 @@ public class AlignFrame extends GAlignFrame /** * Returns a list of distinct view names found in the given list of * components. View names are held on the viewport of an AlignmentPanel. - * + * * @param comps * @return */ @@ -3324,7 +3336,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3337,7 +3349,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3368,7 +3380,7 @@ public class AlignFrame extends GAlignFrame /* * (non-Javadoc) - * + * * @see jalview.jbgui.GAlignFrame#followHighlight_actionPerformed() */ @@ -3389,7 +3401,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3403,7 +3415,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3440,7 +3452,7 @@ public class AlignFrame extends GAlignFrame /** * called by key handler and the hide all/show all menu items - * + * * @param toggleSeqs * @param toggleCols */ @@ -3507,7 +3519,7 @@ public class AlignFrame extends GAlignFrame /* * (non-Javadoc) - * + * * @see * jalview.jbgui.GAlignFrame#hideAllButSelection_actionPerformed(java.awt. * event.ActionEvent) @@ -3522,7 +3534,7 @@ public class AlignFrame extends GAlignFrame /* * (non-Javadoc) - * + * * @see * jalview.jbgui.GAlignFrame#hideAllSelection_actionPerformed(java.awt.event * .ActionEvent) @@ -3542,7 +3554,7 @@ public class AlignFrame extends GAlignFrame /* * (non-Javadoc) - * + * * @see * jalview.jbgui.GAlignFrame#showAllhidden_actionPerformed(java.awt.event. * ActionEvent) @@ -3575,7 +3587,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3590,7 +3602,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3605,7 +3617,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3620,7 +3632,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3634,7 +3646,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3648,7 +3660,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3694,7 +3706,7 @@ public class AlignFrame extends GAlignFrame /** * Set or clear 'Show Sequence Features' - * + * * @param evt * DOCUMENT ME! */ @@ -3709,10 +3721,10 @@ public class AlignFrame extends GAlignFrame /** * Action on toggle of the 'Show annotations' menu item. This shows or hides * the annotations panel as a whole. - * + * * The options to show/hide all annotations should be enabled when the panel * is shown, and disabled when the panel is hidden. - * + * * @param e */ @@ -3731,7 +3743,7 @@ public class AlignFrame extends GAlignFrame { alignPanel.updateScrollBarsFromRanges(); } - + }); } @@ -3769,7 +3781,7 @@ public class AlignFrame extends GAlignFrame else /** * Java only - * + * * @j2sIgnore */ { @@ -3790,7 +3802,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -3885,7 +3897,7 @@ public class AlignFrame extends GAlignFrame * Action on the user checking or unchecking the option to apply the selected * colour scheme to all groups. If unchecked, groups may have their own * independent colour schemes. - * + * * @param selected */ @@ -3897,7 +3909,7 @@ public class AlignFrame extends GAlignFrame /** * Action on user selecting a colour from the colour menu - * + * * @param name * the name (not the menu item label!) of the colour scheme */ @@ -3926,7 +3938,7 @@ public class AlignFrame extends GAlignFrame /** * Actions on setting or changing the alignment colour scheme - * + * * @param cs */ @@ -4015,7 +4027,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -4033,7 +4045,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -4050,7 +4062,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -4067,7 +4079,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -4107,7 +4119,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -4120,7 +4132,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -4175,7 +4187,7 @@ public class AlignFrame extends GAlignFrame /** * Constructs a tree panel and adds it to the desktop - * + * * @param type * tree type (NJ or AV) * @param modelName @@ -4239,7 +4251,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param title * DOCUMENT ME! * @param order @@ -4275,7 +4287,7 @@ public class AlignFrame extends GAlignFrame /** * Add a new sort by annotation score menu item - * + * * @param sort * the menu to add the option to * @param scoreLabel @@ -4314,7 +4326,7 @@ public class AlignFrame extends GAlignFrame * search the alignment and rebuild the sort by annotation score submenu the * last alignment annotation vector hash is stored to minimize cost of * rebuilding in subsequence calls. - * + * */ @Override @@ -4356,9 +4368,9 @@ public class AlignFrame extends GAlignFrame } /** - * Enable (or, if desired, make visible) the By Tree + * Enable (or, if desired, make visible) the By Tree * submenu only if it has at least one element (or will have). - * + * */ @Override protected void enableSortMenuOptions() @@ -4366,7 +4378,7 @@ public class AlignFrame extends GAlignFrame List treePanels = getTreePanels(); sortByTreeMenu.setEnabled(!treePanels.isEmpty()); } - + /** * Maintain the Order by->Displayed Tree menu. Creates a new menu item for a * TreePanel with an appropriate jalview.analysis.AlignmentSorter @@ -4432,7 +4444,7 @@ public class AlignFrame extends GAlignFrame /** * Work out whether the whole set of sequences or just the selected set will * be submitted for multiple alignment. - * + * */ public jalview.datamodel.AlignmentView gatherSequencesForAlignment() @@ -4448,7 +4460,7 @@ public class AlignFrame extends GAlignFrame /* * SequenceGroup seqs = viewport.getSelectionGroup(); int sz; msa = new * SequenceI[sz = seqs.getSize(false)]; - * + * * for (int i = 0; i < sz; i++) { msa[i] = (SequenceI) * seqs.getSequenceAt(i); } */ @@ -4510,7 +4522,7 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -4577,7 +4589,7 @@ public class AlignFrame extends GAlignFrame /** * Add a treeviewer for the tree extracted from a Newick file object to the * current alignment view - * + * * @param nf * the tree * @param title @@ -4665,12 +4677,12 @@ public class AlignFrame extends GAlignFrame private void buildLegacyWebServicesMenu(JMenu menu) { JMenu secstrmenu = new JMenu("Secondary Structure Prediction"); - if (Discoverer.getServices() != null && Discoverer.getServices().size() > 0) + if (Discoverer.getServices() != null && Discoverer.getServices().size() > 0) { var secstrpred = Discoverer.getServices().get("SecStrPred"); - if (secstrpred != null) + if (secstrpred != null) { - for (ext.vamsas.ServiceHandle sh : secstrpred) + for (ext.vamsas.ServiceHandle sh : secstrpred) { var menuProvider = Discoverer.getServiceClient(sh); menuProvider.attachWSMenuEntry(secstrmenu, this); @@ -4683,7 +4695,7 @@ public class AlignFrame extends GAlignFrame /** * Constructs the web services menu for the given discoverer under the * specified menu. This method must be called on the EDT - * + * * @param discoverer * the discoverer used to build the menu * @param menu @@ -4711,9 +4723,36 @@ public class AlignFrame extends GAlignFrame } } + private void buildWebServicesMenu(WebServiceDiscoverer discoverer, JMenu menu) + { + if (discoverer.hasServices()) + { + for (WebServiceI service : discoverer.getServices()) + { + for (Operation op : service.getOperations()) + { + JMenu atpoint = JvSwingUtils.findOrCreateMenu(menu, op.getTypeName()); + op.getMenuBuilder().buildMenu(atpoint, this); + } + } + } + if (discoverer.isRunning()) + { + JMenuItem item = new JMenuItem("Service discovery in progress."); + item.setEnabled(false); + menu.add(item); + } + else if (!discoverer.hasServices()) + { + JMenuItem item = new JMenuItem("No services available."); + item.setEnabled(false); + menu.add(item); + } + } + /** * construct any groupURL type service menu entries. - * + * * @param webService */ @@ -4724,12 +4763,12 @@ public class AlignFrame extends GAlignFrame /* * JMenuItem testAlView = new JMenuItem("Test AlignmentView"); final * AlignFrame af = this; testAlView.addActionListener(new ActionListener() { - * + * * public void actionPerformed(ActionEvent e) { * jalview.datamodel.AlignmentView * .testSelectionViews(af.viewport.getAlignment(), * af.viewport.getColumnSelection(), af.viewport.selectionGroup); } - * + * * }); webService.add(testAlView); */ // TODO: refactor to RestClient discoverer and merge menu entries for @@ -4751,7 +4790,7 @@ public class AlignFrame extends GAlignFrame * Cross-References menu (formerly called Show Products), with database * sources for which cross-references are found (protein sources for a * nucleotide alignment and vice versa) - * + * * @return true if Show Cross-references menu should be enabled */ @@ -4807,7 +4846,7 @@ public class AlignFrame extends GAlignFrame /** * Finds and displays cross-references for the selected sequences (protein * products for nucleotide sequences, dna coding sequences for peptides). - * + * * @param sel * the sequences to show cross-references for * @param dna @@ -4882,7 +4921,7 @@ public class AlignFrame extends GAlignFrame /** * Set the file format - * + * * @param format */ @@ -4893,7 +4932,7 @@ public class AlignFrame extends GAlignFrame /** * Try to load a features file onto the alignment. - * + * * @param file * contents or path to retrieve file or a File object * @param sourceType @@ -5146,7 +5185,7 @@ public class AlignFrame extends GAlignFrame *
  • a features file
  • *
  • else try to interpret as an alignment file
  • * - * + * * @param file * either a filename or a URL string. * @throws InterruptedException @@ -5311,7 +5350,7 @@ public class AlignFrame extends GAlignFrame /** * Change the display state for the given feature groups -- Added by BH from * JalviewLite - * + * * @param groups * list of group strings * @param state @@ -5456,7 +5495,7 @@ public class AlignFrame extends GAlignFrame /* * (non-Javadoc) - * + * * @see * jalview.jbgui.GAlignFrame#showDbRefs_actionPerformed(java.awt.event.ActionEvent * ) @@ -5470,7 +5509,7 @@ public class AlignFrame extends GAlignFrame /* * (non-Javadoc) - * + * * @seejalview.jbgui.GAlignFrame#showNpFeats_actionPerformed(java.awt.event. * ActionEvent) */ @@ -5484,7 +5523,7 @@ public class AlignFrame extends GAlignFrame /** * find the viewport amongst the tabs in this alignment frame and close that * tab - * + * * @param av */ @@ -5858,7 +5897,7 @@ public class AlignFrame extends GAlignFrame /* * (non-Javadoc) - * + * * @see * jalview.jbgui.GAlignFrame#showUnconservedMenuItem_actionPerformed(java. * awt.event.ActionEvent) @@ -5873,7 +5912,7 @@ public class AlignFrame extends GAlignFrame /* * (non-Javadoc) - * + * * @see * jalview.jbgui.GAlignFrame#showGroupConsensus_actionPerformed(java.awt.event * .ActionEvent) @@ -5889,7 +5928,7 @@ public class AlignFrame extends GAlignFrame /* * (non-Javadoc) - * + * * @see * jalview.jbgui.GAlignFrame#showGroupConservation_actionPerformed(java.awt * .event.ActionEvent) @@ -5904,7 +5943,7 @@ public class AlignFrame extends GAlignFrame /* * (non-Javadoc) - * + * * @see * jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt * .event.ActionEvent) @@ -5919,7 +5958,7 @@ public class AlignFrame extends GAlignFrame /* * (non-Javadoc) - * + * * @see * jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt * .event.ActionEvent) @@ -5949,7 +5988,7 @@ public class AlignFrame extends GAlignFrame /* * (non-Javadoc) - * + * * @see * jalview.jbgui.GAlignFrame#makeGrpsFromSelection_actionPerformed(java.awt * .event.ActionEvent) @@ -6003,7 +6042,7 @@ public class AlignFrame extends GAlignFrame /** * make the given alignmentPanel the currently selected tab - * + * * @param alignmentPanel */ @@ -6024,7 +6063,7 @@ public class AlignFrame extends GAlignFrame /** * Action on selection of menu options to Show or Hide annotations. - * + * * @param visible * @param forSequences * update sequence-related annotations @@ -6076,7 +6115,7 @@ public class AlignFrame extends GAlignFrame } /** - * + * * @return alignment panels in this alignment frame */ @@ -6139,7 +6178,7 @@ public class AlignFrame extends GAlignFrame /** * Set visibility of dna/protein complement view (available when shown in a * split frame). - * + * * @param show */ @@ -6212,7 +6251,7 @@ public class AlignFrame extends GAlignFrame /** * Hides columns containing (or not containing) a specified feature, provided * that would not leave all columns hidden - * + * * @param featureType * @param columnsContaining * @return @@ -6351,9 +6390,9 @@ public class AlignFrame extends GAlignFrame /** * BH 2019 from JalviewLite - * + * * get sequence feature groups that are hidden or shown - * + * * @param visible * true is visible * @return list @@ -6373,7 +6412,7 @@ public class AlignFrame extends GAlignFrame } /** - * + * * @return list of feature groups on the view */ @@ -6438,5 +6477,6 @@ public class AlignFrame extends GAlignFrame } } } + } diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 88c94f6..0c3b553 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -1,19 +1,19 @@ /* * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) * Copyright (C) $$Year-Rel$$ 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 + * 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. - * - * 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 + * + * 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 . * The Jalview Authors are detailed in the 'AUTHORS' file. @@ -132,8 +132,8 @@ import jalview.ws.utils.UrlDownloadClient; /** * Jalview Desktop - * - * + * + * * @author $author$ * @version $Revision: 1.155 $ */ @@ -226,7 +226,7 @@ public class Desktop extends GDesktop * Answers an 'application scope' singleton instance of this class. Separate * SwingJS 'applets' running in the same browser page will each have a * distinct instance of Desktop. - * + * * @return */ public static Desktop getInstance() @@ -477,7 +477,7 @@ public class Desktop extends GDesktop if (!Platform.isJS()) /** * Java only - * + * * @j2sIgnore */ { @@ -579,7 +579,7 @@ public class Desktop extends GDesktop /** * Answers true if user preferences to enable experimental features is True * (on), else false - * + * * @return */ public boolean showExperimental() @@ -681,7 +681,7 @@ public class Desktop extends GDesktop /** * recover the last known dimensions for a jalview window - * + * * @param windowName * - empty string is desktop, all other windows have unique prefix * @return null or last known dimensions scaled to current geometry (if last @@ -781,7 +781,7 @@ public class Desktop extends GDesktop // /** // * Add an internal frame to the Jalview desktop that is allowed to be resized, // * has a minimum size of 300px and might or might not be visible -// * +// * // * @param frame // * Frame to show // * @param title @@ -807,7 +807,7 @@ public class Desktop extends GDesktop // /** // * Add an internal frame to the Jalview desktop that is visible, has a minimum // * size of 300px, and may or may not be resizable -// * +// * // * @param frame // * Frame to show // * @param title @@ -832,7 +832,7 @@ public class Desktop extends GDesktop /** * Adds and opens the given frame to the desktop that is visible, allowed to * resize, and has a 300px minimum width. - * + * * @param frame * Frame to show * @param title @@ -846,15 +846,15 @@ public class Desktop extends GDesktop final JInternalFrame frame, String title, int w, int h) { // 58 classes - - addInternalFrame(frame, title, Desktop.FRAME_MAKE_VISIBLE, w, h, + + addInternalFrame(frame, title, Desktop.FRAME_MAKE_VISIBLE, w, h, FRAME_ALLOW_RESIZE, FRAME_SET_MIN_SIZE_300); } /** * Add an internal frame to the Jalview desktop that may optionally be * visible, resizable, and allowed to be any size - * + * * @param frame * Frame to show * @param title @@ -876,7 +876,7 @@ public class Desktop extends GDesktop int w, int h, boolean resizable, boolean ignoreMinSize) { // 15 classes call this method directly. - + // TODO: allow callers to determine X and Y position of frame (eg. via // bounds object). // TODO: consider fixing method to update entries in the window submenu with @@ -893,7 +893,7 @@ public class Desktop extends GDesktop } // These can now by put into a single int flag, if desired: - + public final static boolean FRAME_MAKE_VISIBLE = true; public final static boolean FRAME_NOT_VISIBLE = false; @@ -905,19 +905,19 @@ public class Desktop extends GDesktop public final static boolean FRAME_ALLOW_ANY_SIZE = true; public final static boolean FRAME_SET_MIN_SIZE_300 = false; - + private void addFrame(JInternalFrame frame, boolean makeVisible, boolean resizable, boolean ignoreMinSize) { openFrameCount++; - + boolean isEmbedded = (Platform.getEmbeddedAttribute(frame, "id") != null); boolean hasEmbeddedSize = (Platform.getDimIfEmbedded(frame, -1, -1) != null); // Web page embedding allows us to ignore minimum size ignoreMinSize |= hasEmbeddedSize; - + if (!ignoreMinSize) { // Set default dimension for Alignment Frame window. @@ -931,7 +931,7 @@ public class Desktop extends GDesktop } else { frame.setMinimumSize( new Dimension(DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT)); - + } } @@ -948,7 +948,7 @@ public class Desktop extends GDesktop } /* - * add an entry for the new frame in the Window menu + * add an entry for the new frame in the Window menu * (and remove it when the frame is closed) */ final JMenuItem menuItem = new JMenuItem(frame.getTitle()); @@ -1033,7 +1033,7 @@ public class Desktop extends GDesktop /** * Add key bindings to a JInternalFrame so that Ctrl-W and Cmd-W will close * the window - * + * * @param frame */ private static void setKeyBindings(JInternalFrame frame) @@ -1098,7 +1098,7 @@ public class Desktop extends GDesktop /** * DOCUMENT ME! - * + * * @param evt * DOCUMENT ME! */ @@ -1163,7 +1163,7 @@ public class Desktop extends GDesktop /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -1216,7 +1216,7 @@ public class Desktop extends GDesktop /** * Shows a dialog for input of a URL at which to retrieve alignment data - * + * * @param viewport */ @Override @@ -1244,7 +1244,7 @@ public class Desktop extends GDesktop else /** * Java only - * + * * @j2sIgnore */ { @@ -1336,7 +1336,7 @@ public class Desktop extends GDesktop /** * Opens the CutAndPaste window for the user to paste an alignment in to - * + * * @param viewPanel * - if not null, the pasted alignment is added to the current * alignment; if null, to a new alignment window @@ -1404,7 +1404,7 @@ public class Desktop extends GDesktop /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -1425,7 +1425,7 @@ public class Desktop extends GDesktop * Returns the html text for the About screen, including any available version * number, build details, author details and citation reference, but without * the enclosing {@code html} tags - * + * * @return */ public String getAboutMessage() @@ -1489,7 +1489,7 @@ public class Desktop extends GDesktop else /** * Java only - * + * * @j2sIgnore */ { @@ -1549,7 +1549,7 @@ public class Desktop extends GDesktop /* * (non-Javadoc) - * + * * @seejalview.jbgui.GDesktop#garbageCollect_actionPerformed(java.awt.event. * ActionEvent) */ @@ -1564,7 +1564,7 @@ public class Desktop extends GDesktop /* * (non-Javadoc) - * + * * @see * jalview.jbgui.GDesktop#showMemusage_actionPerformed(java.awt.event.ActionEvent * ) @@ -1577,7 +1577,7 @@ public class Desktop extends GDesktop /* * (non-Javadoc) - * + * * @see * jalview.jbgui.GDesktop#showConsole_actionPerformed(java.awt.event.ActionEvent * ) @@ -1592,7 +1592,7 @@ public class Desktop extends GDesktop /** * control whether the java console is visible or not - * + * * @param selected */ void showConsole(boolean selected) @@ -1687,7 +1687,7 @@ public class Desktop extends GDesktop /** * DOCUMENT ME! - * + * * @param e * DOCUMENT ME! */ @@ -1951,7 +1951,7 @@ public class Desktop extends GDesktop } /** - * + * * @param alignmentId * - if null, all sets are returned * @return all AlignmentPanels concerning the alignmentId sequence set @@ -1991,7 +1991,7 @@ public class Desktop extends GDesktop /** * get all the viewports on an alignment. - * + * * @param sequenceSetId * unique alignment id (may be null - all viewports returned in that * case) @@ -2036,7 +2036,7 @@ public class Desktop extends GDesktop /** * Explode the views in the given frame into separate AlignFrame - * + * * @param af */ public static void explodeViews(AlignFrame af) @@ -2104,7 +2104,7 @@ public class Desktop extends GDesktop * identifier back in to this frame as additional views, and close the * expanded views. Note the expanded frames may themselves have multiple * views. We take the lot. - * + * * @param source */ public void gatherViews(AlignFrame source) @@ -2169,7 +2169,7 @@ public class Desktop extends GDesktop /** * Checks the given url to see if it gives a response indicating that the user * should be informed of a new questionnaire. - * + * * @param url */ public void checkForQuestionnaire(String url) @@ -2262,7 +2262,7 @@ public class Desktop extends GDesktop * Proxy class for JDesktopPane which optionally displays the current memory * usage and highlights the desktop area with a red bar if free memory runs * low. - * + * * @author AMW */ public class MyDesktopPane extends JDesktopPane implements Runnable @@ -2357,7 +2357,7 @@ public class Desktop extends GDesktop /** * Accessor method to quickly get all the AlignmentFrames loaded. - * + * * @return an array of AlignFrame, or null if none found */ public static AlignFrame[] getAlignFrames() @@ -2407,7 +2407,7 @@ public class Desktop extends GDesktop /** * Returns an array of any AppJmol frames in the Desktop (or null if none). - * + * * @return */ public GStructureViewer[] getJmols() @@ -2470,7 +2470,7 @@ public class Desktop extends GDesktop /* * We allow only one console at a time, so that AlignFrame menu option * 'Calculate | Run Groovy script' is unambiguous. - * Disable 'Groovy Console', and enable 'Run script', when the console is + * Disable 'Groovy Console', and enable 'Run script', when the console is * opened, and the reverse when it is closed */ Window window = (Window) groovyConsole.getFrame(); @@ -2523,7 +2523,7 @@ public class Desktop extends GDesktop /** * Enable or disable 'Run Groovy script' in AlignFrame calculate menus - * + * * @param enabled * true if Groovy console is open */ @@ -2554,7 +2554,7 @@ public class Desktop extends GDesktop /* * (non-Javadoc) - * + * * @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long) */ @Override @@ -2582,7 +2582,7 @@ public class Desktop extends GDesktop progressBars.put(Long.valueOf(id), addProgressPanel(message)); } } - + @Override public void removeProgressBar(long id) { @@ -2592,7 +2592,7 @@ public class Desktop extends GDesktop /* * (non-Javadoc) - * + * * @see jalview.gui.IProgressIndicator#registerHandler(long, * jalview.gui.IProgressIndicatorHandler) */ @@ -2631,7 +2631,7 @@ public class Desktop extends GDesktop } /** - * + * * @return true if any progress bars are still active */ @Override @@ -2648,7 +2648,7 @@ public class Desktop extends GDesktop * This will return the first AlignFrame holding the given viewport instance. * It will break if there are more than one AlignFrames viewing a particular * av. - * + * * @param viewport * @return alignFrame for viewport */ @@ -2683,7 +2683,7 @@ public class Desktop extends GDesktop /** * check if jalview GUI is being operated programmatically - * + * * @return inBatchMode */ public boolean isInBatchMode() @@ -2693,7 +2693,7 @@ public class Desktop extends GDesktop /** * set flag if jalview GUI is being operated programmatically - * + * * @param inBatchMode */ public void setInBatchMode(boolean inBatchMode) @@ -2713,7 +2713,7 @@ public class Desktop extends GDesktop // JAL-940 - JALVIEW 1 services are now being EOLed as of JABA 2.1 release System.out.println("loading services"); - + /** @j2sIgnore */ { // todo: changesupport handlers need to be transferred @@ -2736,7 +2736,7 @@ public class Desktop extends GDesktop } if (Cache.getDefault("SHOW_SLIVKA_SERVICES", true)) { - tasks.add(jalview.ws.slivkaws.SlivkaWSDiscoverer.getInstance().startDiscoverer()); + tasks.add(jalview.ws2.slivka.SlivkaWSDiscoverer.getInstance().startDiscoverer()); } if (blocking) { @@ -2755,7 +2755,7 @@ public class Desktop extends GDesktop /** * called to check if the service discovery process completed successfully. - * + * * @param evt */ protected void JalviewServicesChanged(PropertyChangeEvent evt) @@ -2781,16 +2781,16 @@ public class Desktop extends GDesktop /* * JalviewDialog jd =new JalviewDialog() { - * + * * @Override protected void cancelPressed() { // TODO * Auto-generated method stub - * + * * }@Override protected void okPressed() { // TODO * Auto-generated method stub - * + * * }@Override protected void raiseClosed() { // TODO * Auto-generated method stub - * + * * } }; jd.initDialogFrame(new * JLabel("
    " + ermsg + * "
    It may be that you have invalid JABA URLs in your web service preferences," @@ -2800,7 +2800,7 @@ public class Desktop extends GDesktop * " Tools->Preferences dialog box to change them.
    " * ), true, true, "Web Service Configuration Problem", 450, * 400); - * + * * jd.waitForInput(); */ JvOptionPane.showConfirmDialog(desktopPane, @@ -2835,7 +2835,7 @@ public class Desktop extends GDesktop * start a thread to open a URL in the configured browser. Pops up a warning * dialog to the user if there is an exception when calling out to the browser * to open the URL. - * + * * @param url */ public static void showUrl(final String url) @@ -2845,7 +2845,7 @@ public class Desktop extends GDesktop /** * Like showUrl but allows progress handler to be specified - * + * * @param url * @param progress * (null) or object implementing IProgressIndicator @@ -2898,7 +2898,7 @@ public class Desktop extends GDesktop /** * static hyperlink handler proxy method for use by Jalview's internal windows - * + * * @param e */ public static void hyperlinkUpdate(HyperlinkEvent e) @@ -2949,7 +2949,7 @@ public class Desktop extends GDesktop /** * add another dialog thread to the queue - * + * * @param prompter */ public void addDialogThread(final Runnable prompter) @@ -2995,7 +2995,7 @@ public class Desktop extends GDesktop * Outputs an image of the desktop to file in EPS format, after prompting the * user for choice of Text or Lineart character rendering (unless a preference * has been set). The file name is generated as - * + * *
        * Jalview_snapshot_nnnnn.eps where nnnnn is the current timestamp in milliseconds
        * 
    @@ -3032,7 +3032,7 @@ public class Desktop extends GDesktop * and location last time the view was expanded (if any). However it does not * remember the split pane divider location - this is set to match the * 'exploding' frame. - * + * * @param sf */ public void explodeViews(SplitFrame sf) @@ -3060,7 +3060,7 @@ public class Desktop extends GDesktop * AlignmentPanel objects, including their AlignmentViewports, so the * cdna/protein relationships between the viewports is carried over to the * new split frames. - * + * * explodedGeometry holds the (x, y) position of the previously exploded * SplitFrame, and the (width, height) of the AlignFrame component */ @@ -3110,7 +3110,7 @@ public class Desktop extends GDesktop * Gather expanded split frames, sharing the same pairs of sequence set ids, * back into the given SplitFrame as additional views. Note that the gathered * frames may themselves have multiple views. - * + * * @param source */ public void gatherViews(GSplitFrame source) @@ -3182,9 +3182,9 @@ public class Desktop extends GDesktop /** * handles the payload of a drag and drop event. - * + * * TODO refactor to desktop utilities class - * + * * @param files * - Data source strings extracted from the drop event * @param protocols @@ -3419,7 +3419,7 @@ public class Desktop extends GDesktop * for either Jmol or Chimera) which are currently open. This may optionally * be restricted to viewers of a specified class, or viewers linked to a * specified alignment panel. - * + * * @param apanel * if not null, only return viewers linked to this panel * @param structureViewerClass diff --git a/src/jalview/gui/SlivkaPreferences.java b/src/jalview/gui/SlivkaPreferences.java index 6c365b9..ddca49f 100644 --- a/src/jalview/gui/SlivkaPreferences.java +++ b/src/jalview/gui/SlivkaPreferences.java @@ -3,7 +3,8 @@ package jalview.gui; import jalview.bin.Cache; import jalview.util.MessageManager; import jalview.ws.WSDiscovererI; -import jalview.ws.slivkaws.SlivkaWSDiscoverer; +import jalview.ws2.slivka.SlivkaWSDiscoverer; +import jalview.ws2.WebServiceDiscoverer; import java.awt.BorderLayout; import java.awt.Color; @@ -42,7 +43,7 @@ public class SlivkaPreferences extends JPanel setPreferredSize(new Dimension(500, 450)); } - WSDiscovererI discoverer; + WebServiceDiscoverer discoverer; private final ArrayList urls = new ArrayList<>(); @@ -141,7 +142,7 @@ public class SlivkaPreferences extends JPanel { String input = (String) JvOptionPane .showInternalInputDialog( - this, + this, MessageManager.getString("label.url:"), UIManager.getString("OptionPane.inputDialogTitle", MessageManager.getLocale()), JOptionPane.QUESTION_MESSAGE, @@ -173,9 +174,9 @@ public class SlivkaPreferences extends JPanel if (input != null) { urls.add(input); - statuses.add(discoverer.getServerStatusFor(input)); + statuses.add(discoverer.getStatusForUrl(input)); urlTableModel.fireTableRowsInserted(urls.size(), urls.size()); - discoverer.setServiceUrls(urls); + discoverer.setUrls(urls); } }; @@ -187,9 +188,9 @@ public class SlivkaPreferences extends JPanel if (input != null) { urls.set(i, input); - statuses.set(i, discoverer.getServerStatusFor(input)); + statuses.set(i, discoverer.getStatusForUrl(input)); urlTableModel.fireTableRowsUpdated(i, i); - discoverer.setServiceUrls(urls); + discoverer.setUrls(urls); } } }; @@ -201,7 +202,7 @@ public class SlivkaPreferences extends JPanel urls.remove(i); statuses.remove(i); urlTableModel.fireTableRowsDeleted(i, i); - discoverer.setServiceUrls(urls); + discoverer.setUrls(urls); } }; @@ -210,7 +211,7 @@ public class SlivkaPreferences extends JPanel if (i > 0) { moveTableRow(i, i - 1); - discoverer.setServiceUrls(urls); + discoverer.setUrls(urls); } }; @@ -219,7 +220,7 @@ public class SlivkaPreferences extends JPanel if (i >= 0 && i < urls.size() - 1) { moveTableRow(i, i + 1); - discoverer.setServiceUrls(urls); + discoverer.setUrls(urls); } }; @@ -324,13 +325,13 @@ public class SlivkaPreferences extends JPanel }; private ActionListener resetServicesAction = (ActionEvent e) -> { - discoverer.setServiceUrls(null); + discoverer.setUrls(null); urls.clear(); statuses.clear(); - urls.addAll(discoverer.getServiceUrls()); + urls.addAll(discoverer.getUrls()); for (String url : urls) { - statuses.add(discoverer.getServerStatusFor(url)); + statuses.add(discoverer.getStatusForUrl(url)); } urlTableModel.fireTableDataChanged(); }; @@ -359,10 +360,10 @@ public class SlivkaPreferences extends JPanel { // Initial URLs loading discoverer = SlivkaWSDiscoverer.getInstance(); - urls.addAll(discoverer.getServiceUrls()); + urls.addAll(discoverer.getUrls()); for (String url : urls) { - statuses.add(discoverer.getServerStatusFor(url)); + statuses.add(discoverer.getStatusForUrl(url)); } } } diff --git a/src/jalview/ws2/WebServiceExecutor.java b/src/jalview/ws2/WebServiceExecutor.java index 9306020..4b41464 100644 --- a/src/jalview/ws2/WebServiceExecutor.java +++ b/src/jalview/ws2/WebServiceExecutor.java @@ -31,7 +31,6 @@ public class WebServiceExecutor } executor.schedule(() -> pollJobs(worker), 1, TimeUnit.SECONDS); }); - executor.schedule(() -> pollJobs(worker), 1, TimeUnit.SECONDS); } private void pollJobs(WebServiceWorkerI worker) diff --git a/src/jalview/ws2/operations/AlignmentOperation.java b/src/jalview/ws2/operations/AlignmentOperation.java index 6a1baf2..d71e839 100644 --- a/src/jalview/ws2/operations/AlignmentOperation.java +++ b/src/jalview/ws2/operations/AlignmentOperation.java @@ -33,6 +33,7 @@ import jalview.datamodel.SequenceI; import jalview.datamodel.Sequence; import jalview.gui.AlignFrame; import jalview.gui.AlignViewport; +import jalview.gui.Desktop; import jalview.gui.JvSwingUtils; import jalview.gui.WebserviceInfo; import jalview.gui.WsJobParameters; @@ -518,8 +519,9 @@ public class AlignmentOperation implements Operation updateWSInfoGlobalStatus(); if (results.size() > 0) { - wsInfo.showResultsNewFrame - .addActionListener(evt -> displayResults(results)); + OutputWrapper out = prepareOutput(results); + wsInfo.showResultsNewFrame.addActionListener(evt -> displayNewFrame( + new Alignment(out.aln), out.alorders, out.hidden)); wsInfo.setResultsReady(); } else @@ -529,7 +531,24 @@ public class AlignmentOperation implements Operation wsInfo.removeProgressBar(progbarId); } - private void displayResults(Map alignments) + private class OutputWrapper + { + AlignmentI aln; + + List alorders; + + HiddenColumns hidden; + + OutputWrapper(AlignmentI aln, List alorders, + HiddenColumns hidden) + { + this.aln = aln; + this.alorders = alorders; + this.hidden = hidden; + } + } + + private OutputWrapper prepareOutput(Map alignments) { List alorders = new ArrayList<>(); SequenceI[][] results = new SequenceI[jobs.size()][]; @@ -538,8 +557,8 @@ public class AlignmentOperation implements Operation { WSJob job = jobs.get(i); AlignmentI aln = alignments.get(job.getUid()); - if (aln != null) - { // equivalent of job.hasResults() + if (aln != null) // equivalent of job.hasResults() + { /* Get the alignment including any empty sequences in the original * order with original ids. */ JobInput input = inputs.get(job.getUid()); @@ -571,6 +590,7 @@ public class AlignmentOperation implements Operation // temporary workaround for deuniquify @SuppressWarnings({ "rawtypes", "unchecked" }) Hashtable names = new Hashtable(input.sequenceNames); + // FIXME first call to deuniquify alters original alignment SeqsetUtils.deuniquify(names, result); alorders.add(msaOrder); results[i] = result; @@ -597,8 +617,8 @@ public class AlignmentOperation implements Operation aln.setDataset(dataset); propagateDatasetMappings(aln); - - displayNewFrame(aln, alorders, hidden); + return new OutputWrapper(aln, alorders, hidden); + // displayNewFrame(aln, alorders, hidden); } /* @@ -654,6 +674,9 @@ public class AlignmentOperation implements Operation * If alignment was requested from one half of a SplitFrame, show in a * SplitFrame with the other pane similarly aligned. */ + + Desktop.addInternalFrame(frame, alnTitle, AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); } private List> sortOrders(List alorders) diff --git a/src/jalview/ws2/slivka/SlivkaWebService.java b/src/jalview/ws2/slivka/SlivkaWebService.java index c2ac7b3..3f0f5b0 100644 --- a/src/jalview/ws2/slivka/SlivkaWebService.java +++ b/src/jalview/ws2/slivka/SlivkaWebService.java @@ -47,27 +47,22 @@ public class SlivkaWebService implements WebServiceI protected int typeFlags = 0; - protected static final EnumMap stateMap = new EnumMap<>( + protected static final EnumMap statusMap = new EnumMap<>( Job.Status.class); { - stateMap.put(Job.Status.PENDING, WsJob.JobState.QUEUED); - stateMap.put(Job.Status.REJECTED, WsJob.JobState.INVALID); - stateMap.put(Job.Status.ACCEPTED, WsJob.JobState.QUEUED); - stateMap.put(Job.Status.QUEUED, WsJob.JobState.QUEUED); - stateMap.put(Job.Status.RUNNING, WsJob.JobState.RUNNING); - stateMap.put(Job.Status.COMPLETED, WsJob.JobState.FINISHED); - stateMap.put(Job.Status.INTERRUPTED, WsJob.JobState.CANCELLED); - stateMap.put(Job.Status.DELETED, WsJob.JobState.CANCELLED); - stateMap.put(Job.Status.FAILED, WsJob.JobState.FAILED); - stateMap.put(Job.Status.ERROR, WsJob.JobState.SERVERERROR); - stateMap.put(Job.Status.UNKNOWN, WsJob.JobState.UNKNOWN); + statusMap.put(Job.Status.PENDING, WSJobStatus.SUBMITTED); + statusMap.put(Job.Status.REJECTED, WSJobStatus.INVALID); + statusMap.put(Job.Status.ACCEPTED, WSJobStatus.QUEUED); + statusMap.put(Job.Status.QUEUED, WSJobStatus.QUEUED); + statusMap.put(Job.Status.RUNNING, WSJobStatus.RUNNING); + statusMap.put(Job.Status.COMPLETED, WSJobStatus.FINISHED); + statusMap.put(Job.Status.INTERRUPTED, WSJobStatus.CANCELLED); + statusMap.put(Job.Status.DELETED, WSJobStatus.CANCELLED); + statusMap.put(Job.Status.FAILED, WSJobStatus.FAILED); + statusMap.put(Job.Status.ERROR, WSJobStatus.SERVER_ERROR); + statusMap.put(Job.Status.UNKNOWN, WSJobStatus.UNKNOWN); } - protected final Set failedStates = new HashSet<>( - Arrays.asList(WsJob.JobState.INVALID, WsJob.JobState.BROKEN, - WsJob.JobState.FAILED, WsJob.JobState.SERVERERROR, - WsJob.JobState.CANCELLED)); - public SlivkaWebService(SlivkaClient client, SlivkaService service) { this.client = client; @@ -192,8 +187,8 @@ public class SlivkaWebService implements WebServiceI @Override public void updateProgress(WSJob job) throws IOException { - // TODO Auto-generated method stub - + var slivkaJob = client.getJob(job.getJobId()); + job.setStatus(statusMap.get(slivkaJob.getStatus())); } @Override -- 1.7.10.2