+ removeProgressPanel(progressPanel);
+ }
+ else
+ {
+ progressBars.put(new Long(id), addProgressPanel(message));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.gui.IProgressIndicator#registerHandler(long,
+ * jalview.gui.IProgressIndicatorHandler)
+ */
+ public void registerHandler(final long id,
+ final IProgressIndicatorHandler handler)
+ {
+ if (progressBarHandlers == null || !progressBars.contains(new Long(id)))
+ {
+ throw new Error(
+ "call setProgressBar before registering the progress bar's handler.");
+ }
+ progressBarHandlers.put(new Long(id), handler);
+ final JPanel progressPanel = (JPanel) progressBars.get(new Long(id));
+ if (handler.canCancel())
+ {
+ JButton cancel = new JButton(MessageManager.getString("action.cancel"));
+ final IProgressIndicator us = this;
+ cancel.addActionListener(new ActionListener()
+ {
+
+ public void actionPerformed(ActionEvent e)
+ {
+ handler.cancelActivity(id);
+ us.setProgressBar(
+ "Cancelled "
+ + ((JLabel) progressPanel.getComponent(0))
+ .getText(), id);
+ }
+ });
+ progressPanel.add(cancel, BorderLayout.EAST);
+ }
+ }
+
+ /**
+ *
+ * @return true if any progress bars are still active
+ */
+ @Override
+ public boolean operationInProgress()
+ {
+ if (progressBars != null && progressBars.size() > 0)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * This will return the first AlignFrame viewing AlignViewport av. It will
+ * break if there are more than one AlignFrames viewing a particular av. This
+ *
+ * @param av
+ * @return alignFrame for av
+ */
+ public static AlignFrame getAlignFrameFor(AlignViewport av)
+ {
+ if (desktop != null)
+ {
+ AlignmentPanel[] aps = getAlignmentPanels(av.getSequenceSetId());
+ for (int panel = 0; aps != null && panel < aps.length; panel++)
+ {
+ if (aps[panel] != null && aps[panel].av == av)
+ {
+ return aps[panel].alignFrame;
+ }
+ }
+ }
+ return null;
+ }
+
+ public VamsasApplication getVamsasApplication()
+ {
+ return v_client;
+
+ }
+
+ /**
+ * flag set if jalview GUI is being operated programmatically
+ */
+ private boolean inBatchMode = false;
+
+ /**
+ * check if jalview GUI is being operated programmatically
+ *
+ * @return inBatchMode
+ */
+ public boolean isInBatchMode()
+ {
+ return inBatchMode;
+ }
+
+ /**
+ * set flag if jalview GUI is being operated programmatically
+ *
+ * @param inBatchMode
+ */
+ public void setInBatchMode(boolean inBatchMode)
+ {
+ this.inBatchMode = inBatchMode;
+ }
+
+ public void startServiceDiscovery()
+ {
+ startServiceDiscovery(false);
+ }
+
+ public void startServiceDiscovery(boolean blocking)
+ {
+ boolean alive = true;
+ Thread t0 = null, t1 = null, t2 = null;
+ // JAL-940 - JALVIEW 1 services are now being EOLed as of JABA 2.1 release
+ if (true)
+ {
+ // todo: changesupport handlers need to be transferred
+ if (discoverer == null)
+ {
+ discoverer = new jalview.ws.jws1.Discoverer();
+ // register PCS handler for desktop.
+ discoverer.addPropertyChangeListener(changeSupport);
+ }
+ // JAL-940 - disabled JWS1 service configuration - always start discoverer
+ // until we phase out completely
+ (t0 = new Thread(discoverer)).start();
+ }
+
+ // ENFIN services are EOLed as of Jalview 2.8.1 release
+ if (false)
+ {