/*
* 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 <http://www.gnu.org/licenses/>.
* The Jalview Authors are detailed in the 'AUTHORS' file.
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;
/**
* 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;
/**
* Creates a new AlignFrame object with specific width and height.
- *
+ *
* @param al
* @param width
* @param height
/**
* Creates a new AlignFrame object with specific width, height and
* sequenceSetId
- *
+ *
* @param al
* @param width
* @param height
/**
* Creates a new AlignFrame object with specific width, height and
* sequenceSetId
- *
+ *
* @param al
* @param width
* @param height
/**
* new alignment window with hidden columns
- *
+ *
* @param al
* AlignmentI
* @param hiddenColumns
/**
* Create alignment frame for al with hiddenColumns, a specific width and
* height, and specific sequenceId
- *
+ *
* @param al
* @param hiddenColumns
* @param width
/**
* Create alignment frame for al with hiddenColumns, a specific width and
* height, and specific sequenceId
- *
+ *
* @param al
* @param hiddenColumns
* @param width
/**
* Make a new AlignFrame from existing alignmentPanels
- *
+ *
* @param ap
* AlignmentPanel
* @param av
/**
* Change the filename and format for the alignment, and enable the 'reload'
* button functionality.
- *
+ *
* @param file
* valid filename
* @param format
}
/**
- *
+ *
* @param fileName
* @param file from SwingJS; may contain bytes -- for reload
* @param protocol from SwingJS; may be RELATIVE_URL
/**
* JavaScript will have this, maybe others. More dependable than a file name
* and maintains a reference to the actual bytes loaded.
- *
+ *
* @param file
*/
buildWebServicesMenu();
}
+ @Override
+ public void servicesChanged(WebServiceDiscoverer discoverer,
+ Collection<? extends WebServiceI> 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))
{
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);
/**
* Need to call this method when tabs are selected for multiple views, or when
* loading from Jalview2XML.java
- *
+ *
* @param av
* AlignViewport
*/
/**
* Set the enabled state of the 'Run Groovy' option in the Calculate menu
- *
+ *
* @param b
*/
/*
* (non-Javadoc)
- *
+ *
* @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long)
*/
{
progressBar.setProgressBar(message, id);
}
-
+
@Override
public void removeProgressBar(long id)
{
}
/**
- *
+ *
* @return true if any progress bars are still active
*/
}
/*
- * get default parameters, and (if requested) show
+ * get default parameters, and (if requested) show
* dialog to allow modification
*/
ParamDatastoreI store = HMMERParamStore.forSearch(viewport);
{
/*
- * get default parameters, and (if requested) show
+ * get default parameters, and (if requested) show
* dialog to allow modification
*/
/**
* 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()
/**
* Checks if the alignment contains the required number of sequences.
- *
+ *
* @param required
* @return
*/
* 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
*/
* 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
*/
* 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
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* 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
*/
/**
* 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
*/
/**
* 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
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* 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
*/
/**
* Close the specified panel and close up tabs appropriately.
- *
+ *
* @param panelToClose
*/
}
/**
- *
+ *
* @return alignment objects for all views
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param up
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
* @throws InterruptedException
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
* @throws InterruptedException
/**
* Paste contents of Jalview clipboard
- *
+ *
* @param newAlignment
* true to paste to a new alignment, otherwise add to this.
* @throws InterruptedException
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* 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
* 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
*/
/**
* 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
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/*
* (non-Javadoc)
- *
+ *
* @see jalview.jbgui.GAlignFrame#followHighlight_actionPerformed()
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* called by key handler and the hide all/show all menu items
- *
+ *
* @param toggleSeqs
* @param toggleCols
*/
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#hideAllButSelection_actionPerformed(java.awt.
* event.ActionEvent)
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#hideAllSelection_actionPerformed(java.awt.event
* .ActionEvent)
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showAllhidden_actionPerformed(java.awt.event.
* ActionEvent)
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* Set or clear 'Show Sequence Features'
- *
+ *
* @param evt
* DOCUMENT ME!
*/
/**
* 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
*/
{
alignPanel.updateScrollBarsFromRanges();
}
-
+
});
}
else
/**
* Java only
- *
+ *
* @j2sIgnore
*/
{
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
* 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
*/
/**
* Action on user selecting a colour from the colour menu
- *
+ *
* @param name
* the name (not the menu item label!) of the colour scheme
*/
/**
* Actions on setting or changing the alignment colour scheme
- *
+ *
* @param cs
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* Constructs a tree panel and adds it to the desktop
- *
+ *
* @param type
* tree type (NJ or AV)
* @param modelName
/**
* DOCUMENT ME!
- *
+ *
* @param title
* DOCUMENT ME!
* @param order
/**
* Add a new sort by annotation score menu item
- *
+ *
* @param sort
* the menu to add the option to
* @param scoreLabel
* 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
}
/**
- * 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()
List<TreePanel> treePanels = getTreePanels();
sortByTreeMenu.setEnabled(!treePanels.isEmpty());
}
-
+
/**
* Maintain the Order by->Displayed Tree menu. Creates a new menu item for a
* TreePanel with an appropriate <code>jalview.analysis.AlignmentSorter</code>
/**
* Work out whether the whole set of sequences or just the selected set will
* be submitted for multiple alignment.
- *
+ *
*/
public jalview.datamodel.AlignmentView gatherSequencesForAlignment()
/*
* 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); }
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* Add a treeviewer for the tree extracted from a Newick file object to the
* current alignment view
- *
+ *
* @param nf
* the tree
* @param title
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);
/**
* 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
}
}
+ 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
*/
/*
* 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
* 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
*/
/**
* 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
/**
* Set the file format
- *
+ *
* @param format
*/
/**
* Try to load a features file onto the alignment.
- *
+ *
* @param file
* contents or path to retrieve file or a File object
* @param sourceType
* <li>a features file</li>
* <li>else try to interpret as an alignment file</li>
* </ul>
- *
+ *
* @param file
* either a filename or a URL string.
* @throws InterruptedException
/**
* Change the display state for the given feature groups -- Added by BH from
* JalviewLite
- *
+ *
* @param groups
* list of group strings
* @param state
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showDbRefs_actionPerformed(java.awt.event.ActionEvent
* )
/*
* (non-Javadoc)
- *
+ *
* @seejalview.jbgui.GAlignFrame#showNpFeats_actionPerformed(java.awt.event.
* ActionEvent)
*/
/**
* find the viewport amongst the tabs in this alignment frame and close that
* tab
- *
+ *
* @param av
*/
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showUnconservedMenuItem_actionPerformed(java.
* awt.event.ActionEvent)
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showGroupConsensus_actionPerformed(java.awt.event
* .ActionEvent)
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showGroupConservation_actionPerformed(java.awt
* .event.ActionEvent)
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt
* .event.ActionEvent)
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt
* .event.ActionEvent)
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#makeGrpsFromSelection_actionPerformed(java.awt
* .event.ActionEvent)
/**
* make the given alignmentPanel the currently selected tab
- *
+ *
* @param alignmentPanel
*/
/**
* Action on selection of menu options to Show or Hide annotations.
- *
+ *
* @param visible
* @param forSequences
* update sequence-related annotations
}
/**
- *
+ *
* @return alignment panels in this alignment frame
*/
/**
* Set visibility of dna/protein complement view (available when shown in a
* split frame).
- *
+ *
* @param show
*/
/**
* Hides columns containing (or not containing) a specified feature, provided
* that would not leave all columns hidden
- *
+ *
* @param featureType
* @param columnsContaining
* @return
/**
* BH 2019 from JalviewLite
- *
+ *
* get sequence feature groups that are hidden or shown
- *
+ *
* @param visible
* true is visible
* @return list
}
/**
- *
+ *
* @return list of feature groups on the view
*/
}
}
}
+
}
/*
* 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 <http://www.gnu.org/licenses/>.
* The Jalview Authors are detailed in the 'AUTHORS' file.
/**
* Jalview Desktop
- *
- *
+ *
+ *
* @author $author$
* @version $Revision: 1.155 $
*/
* 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()
if (!Platform.isJS())
/**
* Java only
- *
+ *
* @j2sIgnore
*/
{
/**
* Answers true if user preferences to enable experimental features is True
* (on), else false
- *
+ *
* @return
*/
public boolean showExperimental()
/**
* 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
// /**
// * 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
// /**
// * 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
/**
* 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
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
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
}
// 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;
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.
} else {
frame.setMinimumSize(
new Dimension(DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT));
-
+
}
}
}
/*
- * 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());
/**
* 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)
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
/**
* Shows a dialog for input of a URL at which to retrieve alignment data
- *
+ *
* @param viewport
*/
@Override
else
/**
* Java only
- *
+ *
* @j2sIgnore
*/
{
/**
* 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
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
* 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()
else
/**
* Java only
- *
+ *
* @j2sIgnore
*/
{
/*
* (non-Javadoc)
- *
+ *
* @seejalview.jbgui.GDesktop#garbageCollect_actionPerformed(java.awt.event.
* ActionEvent)
*/
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GDesktop#showMemusage_actionPerformed(java.awt.event.ActionEvent
* )
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GDesktop#showConsole_actionPerformed(java.awt.event.ActionEvent
* )
/**
* control whether the java console is visible or not
- *
+ *
* @param selected
*/
void showConsole(boolean selected)
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
}
/**
- *
+ *
* @param alignmentId
* - if null, all sets are returned
* @return all AlignmentPanels concerning the alignmentId sequence set
/**
* get all the viewports on an alignment.
- *
+ *
* @param sequenceSetId
* unique alignment id (may be null - all viewports returned in that
* case)
/**
* Explode the views in the given frame into separate AlignFrame
- *
+ *
* @param af
*/
public static void explodeViews(AlignFrame af)
* 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)
/**
* 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)
* 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
/**
* Accessor method to quickly get all the AlignmentFrames loaded.
- *
+ *
* @return an array of AlignFrame, or null if none found
*/
public static AlignFrame[] getAlignFrames()
/**
* Returns an array of any AppJmol frames in the Desktop (or null if none).
- *
+ *
* @return
*/
public GStructureViewer[] getJmols()
/*
* 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();
/**
* Enable or disable 'Run Groovy script' in AlignFrame calculate menus
- *
+ *
* @param enabled
* true if Groovy console is open
*/
/*
* (non-Javadoc)
- *
+ *
* @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long)
*/
@Override
progressBars.put(Long.valueOf(id), addProgressPanel(message));
}
}
-
+
@Override
public void removeProgressBar(long id)
{
/*
* (non-Javadoc)
- *
+ *
* @see jalview.gui.IProgressIndicator#registerHandler(long,
* jalview.gui.IProgressIndicatorHandler)
*/
}
/**
- *
+ *
* @return true if any progress bars are still active
*/
@Override
* 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
*/
/**
* check if jalview GUI is being operated programmatically
- *
+ *
* @return inBatchMode
*/
public boolean isInBatchMode()
/**
* set flag if jalview GUI is being operated programmatically
- *
+ *
* @param inBatchMode
*/
public void setInBatchMode(boolean inBatchMode)
// 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
}
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)
{
/**
* called to check if the service discovery process completed successfully.
- *
+ *
* @param evt
*/
protected void JalviewServicesChanged(PropertyChangeEvent evt)
/*
* 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("<html><table width=\"450\"><tr><td>" + ermsg +
* "<br/>It may be that you have invalid JABA URLs in your web service preferences,"
* " Tools->Preferences dialog box to change them.</td></tr></table></html>"
* ), true, true, "Web Service Configuration Problem", 450,
* 400);
- *
+ *
* jd.waitForInput();
*/
JvOptionPane.showConfirmDialog(desktopPane,
* 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)
/**
* Like showUrl but allows progress handler to be specified
- *
+ *
* @param url
* @param progress
* (null) or object implementing IProgressIndicator
/**
* static hyperlink handler proxy method for use by Jalview's internal windows
- *
+ *
* @param e
*/
public static void hyperlinkUpdate(HyperlinkEvent e)
/**
* add another dialog thread to the queue
- *
+ *
* @param prompter
*/
public void addDialogThread(final Runnable prompter)
* 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
- *
+ *
* <pre>
* Jalview_snapshot_nnnnn.eps where nnnnn is the current timestamp in milliseconds
* </pre>
* 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)
* 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
*/
* 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)
/**
* 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
* 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
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;
setPreferredSize(new Dimension(500, 450));
}
- WSDiscovererI discoverer;
+ WebServiceDiscoverer discoverer;
private final ArrayList<String> urls = new ArrayList<>();
{
String input = (String) JvOptionPane
.showInternalInputDialog(
- this,
+ this,
MessageManager.getString("label.url:"),
UIManager.getString("OptionPane.inputDialogTitle", MessageManager.getLocale()),
JOptionPane.QUESTION_MESSAGE,
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);
}
};
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);
}
}
};
urls.remove(i);
statuses.remove(i);
urlTableModel.fireTableRowsDeleted(i, i);
- discoverer.setServiceUrls(urls);
+ discoverer.setUrls(urls);
}
};
if (i > 0)
{
moveTableRow(i, i - 1);
- discoverer.setServiceUrls(urls);
+ discoverer.setUrls(urls);
}
};
if (i >= 0 && i < urls.size() - 1)
{
moveTableRow(i, i + 1);
- discoverer.setServiceUrls(urls);
+ discoverer.setUrls(urls);
}
};
};
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();
};
{
// 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));
}
}
}
}
executor.schedule(() -> pollJobs(worker), 1, TimeUnit.SECONDS);
});
- executor.schedule(() -> pollJobs(worker), 1, TimeUnit.SECONDS);
}
private void pollJobs(WebServiceWorkerI worker)
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;
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
wsInfo.removeProgressBar(progbarId);
}
- private void displayResults(Map<Long, AlignmentI> alignments)
+ private class OutputWrapper
+ {
+ AlignmentI aln;
+
+ List<AlignmentOrder> alorders;
+
+ HiddenColumns hidden;
+
+ OutputWrapper(AlignmentI aln, List<AlignmentOrder> alorders,
+ HiddenColumns hidden)
+ {
+ this.aln = aln;
+ this.alorders = alorders;
+ this.hidden = hidden;
+ }
+ }
+
+ private OutputWrapper prepareOutput(Map<Long, AlignmentI> alignments)
{
List<AlignmentOrder> alorders = new ArrayList<>();
SequenceI[][] results = new SequenceI[jobs.size()][];
{
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());
// 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;
aln.setDataset(dataset);
propagateDatasetMappings(aln);
-
- displayNewFrame(aln, alorders, hidden);
+ return new OutputWrapper(aln, alorders, hidden);
+ // displayNewFrame(aln, alorders, hidden);
}
/*
* 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<List<Integer>> sortOrders(List<?> alorders)
protected int typeFlags = 0;
- protected static final EnumMap<Job.Status, WsJob.JobState> stateMap = new EnumMap<>(
+ protected static final EnumMap<Job.Status, WSJobStatus> 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<WsJob.JobState> 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;
@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