*/
void init()
{
-// setBackground(Color.white); // BH 2019
-
+ // setBackground(Color.white); // BH 2019
+
if (!Jalview.isHeadlessMode())
{
progressBar = new ProgressBar(this.statusPanel, this.statusBar);
javax.swing.event.InternalFrameEvent evt)
{
// System.out.println("deregistering discoverer listener");
- Desktop.getInstance().removeJalviewPropertyChangeListener("services",
- thisListener);
+ Desktop.getInstance().removeJalviewPropertyChangeListener(
+ "services", thisListener);
closeMenuItem_actionPerformed(true);
}
});
String shortName = title;
if (shortName.indexOf(File.separatorChar) > -1)
{
- shortName = shortName.substring(
- shortName.lastIndexOf(File.separatorChar) + 1);
+ shortName = shortName
+ .substring(shortName.lastIndexOf(File.separatorChar) + 1);
}
- lastSaveSuccessful = new Jalview2XML().saveAlignment(this, file, shortName);
-
+ lastSaveSuccessful = new Jalview2XML().saveAlignment(this, file,
+ shortName);
+
statusBar.setText(MessageManager.formatMessage(
"label.successfully_saved_to_file_in_format", new Object[]
{ fileName, format }));
-
+
return;
}
BackupFiles backupfiles = doBackup ? new BackupFiles(file) : null;
try
{
- String tempFilePath = doBackup ? backupfiles.getTempFilePath() : file;
- PrintWriter out = new PrintWriter(
- new FileWriter(tempFilePath));
+ String tempFilePath = doBackup ? backupfiles.getTempFilePath()
+ : file;
+ PrintWriter out = new PrintWriter(new FileWriter(tempFilePath));
out.print(output);
out.close();
AlignFrame.this.setTitle(file);
statusBar.setText(MessageManager.formatMessage(
- "label.successfully_saved_to_file_in_format", new Object[]
- { fileName, format.getName() }));
+ "label.successfully_saved_to_file_in_format",
+ new Object[]
+ { fileName, format.getName() }));
lastSaveSuccessful = true;
} catch (Exception ex)
{
final JalviewFileChooser chooser = new JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
- String tooltip = MessageManager.getString("label.load_jalview_annotations");
+ String tooltip = MessageManager
+ .getString("label.load_jalview_annotations");
chooser.setDialogTitle(tooltip);
chooser.setToolTipText(tooltip);
chooser.setResponseHandler(0, new Runnable()
try
{
- jalview.gui.Desktop.internalCopy = true;
+ Desktop.getInstance().internalCopy = true;
// Its really worth setting the clipboard contents
// to empty before setting the large StringSelection!!
Toolkit.getDefaultToolkit().getSystemClipboard()
hiddenCutoff, hiddenOffset);
}
- Desktop.jalviewClipboard = new Object[] { seqs,
+ Desktop.getInstance().jalviewClipboard = new Object[] { seqs,
viewport.getAlignment().getDataset(), hiddenColumns };
setStatus(MessageManager.formatMessage(
"label.copied_sequences_to_clipboard", new Object[]
void paste(boolean newAlignment)
{
boolean externalPaste = true;
+ Desktop d = Desktop.getInstance();
try
{
Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
boolean annotationAdded = false;
AlignmentI alignment = null;
- if (Desktop.jalviewClipboard != null)
+ if (d.jalviewClipboard != null)
{
// The clipboard was filled from within Jalview, we must use the
// sequences
// And dataset from the copied alignment
- SequenceI[] newseq = (SequenceI[]) Desktop.jalviewClipboard[0];
+ SequenceI[] newseq = (SequenceI[]) d.jalviewClipboard[0];
// be doubly sure that we create *new* sequence objects.
sequences = new SequenceI[newseq.length];
for (int i = 0; i < newseq.length; i++)
if (newAlignment)
{
- if (Desktop.jalviewClipboard != null)
+ if (d.jalviewClipboard != null)
{
// dataset is inherited
- alignment.setDataset((Alignment) Desktop.jalviewClipboard[1]);
+ alignment.setDataset((Alignment) d.jalviewClipboard[1]);
}
else
{
alignment = viewport.getAlignment();
alwidth = alignment.getWidth() + 1;
// decide if we need to import sequences from an existing dataset
- boolean importDs = Desktop.jalviewClipboard != null
- && Desktop.jalviewClipboard[1] != alignment.getDataset();
+ boolean importDs = d.jalviewClipboard != null
+ && d.jalviewClipboard[1] != alignment.getDataset();
// importDs==true instructs us to copy over new dataset sequences from
// an existing alignment
Vector<SequenceI> newDs = (importDs) ? new Vector<>() : null; // used to
DEFAULT_HEIGHT);
String newtitle = new String("Copied sequences");
- if (Desktop.jalviewClipboard != null
- && Desktop.jalviewClipboard[2] != null)
+ if (d.jalviewClipboard != null && d.jalviewClipboard[2] != null)
{
- HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2];
+ HiddenColumns hc = (HiddenColumns) d.jalviewClipboard[2];
af.viewport.setHiddenColumns(hc);
}
AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH,
DEFAULT_HEIGHT);
String newtitle = new String("Flanking alignment");
-
- if (Desktop.jalviewClipboard != null
- && Desktop.jalviewClipboard[2] != null)
+ Desktop d = Desktop.getInstance();
+ if (d.jalviewClipboard != null && d.jalviewClipboard[2] != null)
{
- HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2];
+ HiddenColumns hc = (HiddenColumns) d.jalviewClipboard[2];
af.viewport.setHiddenColumns(hc);
}
return;
}
- Runnable okAction = new Runnable()
- {
- @Override
- public void run()
- {
- SequenceI[] cut = sg.getSequences()
- .toArray(new SequenceI[sg.getSize()]);
-
- addHistoryItem(new EditCommand(
- MessageManager.getString("label.cut_sequences"), Action.CUT,
- cut, sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
- viewport.getAlignment()));
-
- viewport.setSelectionGroup(null);
- viewport.sendSelection();
- viewport.getAlignment().deleteGroup(sg);
-
- viewport.firePropertyChange("alignment", null,
- viewport.getAlignment().getSequences());
- if (viewport.getAlignment().getHeight() < 1)
- {
- try
- {
- AlignFrame.this.setClosed(true);
- } catch (Exception ex)
- {
- }
- }
- }};
+ Runnable okAction = new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ SequenceI[] cut = sg.getSequences()
+ .toArray(new SequenceI[sg.getSize()]);
+
+ addHistoryItem(new EditCommand(
+ MessageManager.getString("label.cut_sequences"), Action.CUT,
+ cut, sg.getStartRes(),
+ sg.getEndRes() - sg.getStartRes() + 1,
+ viewport.getAlignment()));
+
+ viewport.setSelectionGroup(null);
+ viewport.sendSelection();
+ viewport.getAlignment().deleteGroup(sg);
+
+ viewport.firePropertyChange("alignment", null,
+ viewport.getAlignment().getSequences());
+ if (viewport.getAlignment().getHeight() < 1)
+ {
+ try
+ {
+ AlignFrame.this.setClosed(true);
+ } catch (Exception ex)
+ {
+ }
+ }
+ }
+ };
/*
* If the cut affects all sequences, prompt for confirmation
*/
- boolean wholeHeight = sg.getSize() == viewport.getAlignment().getHeight();
+ boolean wholeHeight = sg.getSize() == viewport.getAlignment()
+ .getHeight();
boolean wholeWidth = (((sg.getEndRes() - sg.getStartRes())
+ 1) == viewport.getAlignment().getWidth()) ? true : false;
- if (wholeHeight && wholeWidth)
- {
- JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.getDesktopPane());
- dialog.setResponseHandler(0, okAction); // 0 = OK_OPTION
- Object[] options = new Object[] { MessageManager.getString("action.ok"),
- MessageManager.getString("action.cancel") };
- dialog.showDialog(MessageManager.getString("warn.delete_all"),
- MessageManager.getString("label.delete_all"),
- JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null,
- options, options[0]);
- } else
- {
- okAction.run();
- }
+ if (wholeHeight && wholeWidth)
+ {
+ JvOptionPane dialog = JvOptionPane
+ .newOptionDialog(Desktop.getDesktopPane());
+ dialog.setResponseHandler(0, okAction); // 0 = OK_OPTION
+ Object[] options = new Object[] {
+ MessageManager.getString("action.ok"),
+ MessageManager.getString("action.cancel") };
+ dialog.showDialog(MessageManager.getString("warn.delete_all"),
+ MessageManager.getString("label.delete_all"),
+ JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null,
+ options, options[0]);
+ }
+ else
+ {
+ okAction.run();
+ }
}
/**
column, viewport.getAlignment());
}
- setStatus(MessageManager
- .formatMessage("label.removed_columns", new String[]
+ setStatus(MessageManager.formatMessage("label.removed_columns",
+ new String[]
{ Integer.valueOf(trimRegion.getSize()).toString() }));
addHistoryItem(trimRegion);
addHistoryItem(removeGapCols);
- setStatus(MessageManager
- .formatMessage("label.removed_empty_columns", new Object[]
+ setStatus(MessageManager.formatMessage("label.removed_empty_columns",
+ new Object[]
{ Integer.valueOf(removeGapCols.getSize()).toString() }));
// This is to maintain viewport position on first residue
if (viewport.getViewName() == null)
{
- viewport.setViewName(MessageManager
- .getString("label.view_name_original"));
+ viewport.setViewName(
+ MessageManager.getString("label.view_name_original"));
}
/*
JLabel textLabel = new JLabel();
textLabel.setText(content);
textLabel.setBackground(Color.WHITE);
-
+
pane = new JPanel(new BorderLayout());
((JPanel) pane).setOpaque(true);
pane.setBackground(Color.WHITE);
}
JInternalFrame frame = new JInternalFrame();
-
-
// BH 2019.07.26 we allow for an embedded
// undecorated overview with defined size
* otherwise set the chosen colour scheme (or null for 'None')
*/
ColourSchemeI cs = ColourSchemes.getInstance().getColourScheme(name,
- viewport,
- viewport.getAlignment(), viewport.getHiddenRepSequences());
+ viewport, viewport.getAlignment(),
+ viewport.getHiddenRepSequences());
changeColour(cs);
}
Enumeration<String> labels = scoreSorts.keys();
while (labels.hasMoreElements())
{
- addSortByAnnotScoreMenuItem(sortByAnnotScore,
- labels.nextElement());
+ addSortByAnnotScoreMenuItem(sortByAnnotScore, labels.nextElement());
}
sortByAnnotScore.setVisible(scoreSorts.size() > 0);
scoreSorts.clear();
chooser.setToolTipText(
MessageManager.getString("label.load_tree_file"));
- chooser.setResponseHandler(0,new Runnable()
+ chooser.setResponseHandler(0, new Runnable()
{
@Override
public void run()
viewport.setCurrentTree(showNewickTree(fin, filePath).getTree());
} catch (Exception ex)
{
- JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), ex.getMessage(),
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
+ ex.getMessage(),
MessageManager
.getString("label.problem_reading_tree_file"),
JvOptionPane.WARNING_MESSAGE);
final JMenu dismenu = new JMenu("Protein Disorder");
// JAL-940 - only show secondary structure prediction services from
// the legacy server
+ Hashtable<String, Vector<ServiceHandle>> ds = Discoverer
+ .getServices();
+
if (// Cache.getDefault("SHOW_JWS1_SERVICES", true)
// &&
- Discoverer.services != null && (Discoverer.services.size() > 0))
+ ds != null && (ds.size() > 0))
{
// TODO: refactor to allow list of AbstractName/Handler bindings to
// be
// No MSAWS used any more:
// Vector msaws = null; // (Vector)
// Discoverer.services.get("MsaWS");
- Vector<ServiceHandle> secstrpr = Discoverer.services
- .get("SecStrPred");
+ Vector<ServiceHandle> secstrpr = ds.get("SecStrPred");
if (secstrpr != null)
{
// Add any secondary structure prediction services
for (int i = 0, j = secstrpr.size(); i < j; i++)
{
- final ext.vamsas.ServiceHandle sh = secstrpr
- .get(i);
+ final ext.vamsas.ServiceHandle sh = secstrpr.get(i);
jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer
.getServiceClient(sh);
int p = secstrmenu.getItemCount();
final String errorTitle = MessageManager
.getString("label.implementation_error")
+ MessageManager.getString("label.translation_failed");
- JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg, errorTitle,
- JvOptionPane.ERROR_MESSAGE);
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg,
+ errorTitle, JvOptionPane.ERROR_MESSAGE);
return;
}
if (al == null || al.getHeight() == 0)
"label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation");
final String errorTitle = MessageManager
.getString("label.translation_failed");
- JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg, errorTitle,
- JvOptionPane.WARNING_MESSAGE);
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg,
+ errorTitle, JvOptionPane.WARNING_MESSAGE);
}
else
{
evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
Transferable t = evt.getTransferable();
- final AlignFrame thisaf = this;
final List<Object> files = new ArrayList<>();
List<DataSourceType> protocols = new ArrayList<>();
try
{
Desktop.transferFromDropTarget(files, protocols, evt, t);
+ if (files.size() > 0)
+ {
+ new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ loadDroppedFiles(files, protocols, evt, t);
+ }
+ }).start();
+ }
} catch (Exception e)
{
e.printStackTrace();
}
- if (files != null)
+ }
+
+ protected void loadDroppedFiles(List<Object> files,
+ List<DataSourceType> protocols, DropTargetDropEvent evt,
+ Transferable t)
+ {
+ try
{
- new Thread(new Runnable()
+ // check to see if any of these files have names matching sequences
+ // in
+ // the alignment
+ SequenceIdMatcher idm = new SequenceIdMatcher(
+ viewport.getAlignment().getSequencesArray());
+ /**
+ * Object[] { String,SequenceI}
+ */
+ ArrayList<Object[]> filesmatched = new ArrayList<>();
+ ArrayList<Object> filesnotmatched = new ArrayList<>();
+ for (int i = 0; i < files.size(); i++)
{
- @Override
- public void run()
+ // BH 2018
+ Object file = files.get(i);
+ String fileName = file.toString();
+ String pdbfn = "";
+ DataSourceType protocol = (file instanceof File
+ ? DataSourceType.FILE
+ : FormatAdapter.checkProtocol(fileName));
+ if (protocol == DataSourceType.FILE)
{
- try
+ File fl;
+ if (file instanceof File)
+ {
+ fl = (File) file;
+ Platform.cacheFileData(fl);
+ }
+ else
{
- // check to see if any of these files have names matching sequences
- // in
- // the alignment
- SequenceIdMatcher idm = new SequenceIdMatcher(
- viewport.getAlignment().getSequencesArray());
- /**
- * Object[] { String,SequenceI}
- */
- ArrayList<Object[]> filesmatched = new ArrayList<>();
- ArrayList<Object> filesnotmatched = new ArrayList<>();
- for (int i = 0; i < files.size(); i++)
+ fl = new File(fileName);
+ }
+ pdbfn = fl.getName();
+ }
+ else if (protocol == DataSourceType.URL)
+ {
+ URL url = new URL(fileName);
+ pdbfn = url.getFile();
+ }
+ if (pdbfn.length() > 0)
+ {
+ // attempt to find a match in the alignment
+ SequenceI[] mtch = idm.findAllIdMatches(pdbfn);
+ int l = 0, c = pdbfn.indexOf(".");
+ while (mtch == null && c != -1)
+ {
+ do
{
- // BH 2018
- Object file = files.get(i);
- String fileName = file.toString();
- String pdbfn = "";
- DataSourceType protocol = (file instanceof File
- ? DataSourceType.FILE
- : FormatAdapter.checkProtocol(fileName));
- if (protocol == DataSourceType.FILE)
- {
- File fl;
- if (file instanceof File) {
- fl = (File) file;
- Platform.cacheFileData(fl);
- } else {
- fl = new File(fileName);
- }
- pdbfn = fl.getName();
- }
- else if (protocol == DataSourceType.URL)
- {
- URL url = new URL(fileName);
- pdbfn = url.getFile();
- }
- if (pdbfn.length() > 0)
- {
- // attempt to find a match in the alignment
- SequenceI[] mtch = idm.findAllIdMatches(pdbfn);
- int l = 0, c = pdbfn.indexOf(".");
- while (mtch == null && c != -1)
- {
- do
- {
- l = c;
- } while ((c = pdbfn.indexOf(".", l)) > l);
- if (l > -1)
- {
- pdbfn = pdbfn.substring(0, l);
- }
- mtch = idm.findAllIdMatches(pdbfn);
- }
- if (mtch != null)
- {
- FileFormatI type;
- try
- {
- type = new IdentifyFile().identify(file, protocol);
- } catch (Exception ex)
- {
- type = null;
- }
- if (type != null && type.isStructureFile())
- {
- filesmatched.add(new Object[] { file, protocol, mtch });
- continue;
- }
- }
- // File wasn't named like one of the sequences or wasn't a PDB
- // file.
- filesnotmatched.add(file);
- }
+ l = c;
+ } while ((c = pdbfn.indexOf(".", l)) > l);
+ if (l > -1)
+ {
+ pdbfn = pdbfn.substring(0, l);
}
- int assocfiles = 0;
- if (filesmatched.size() > 0)
+ mtch = idm.findAllIdMatches(pdbfn);
+ }
+ if (mtch != null)
+ {
+ FileFormatI type;
+ try
{
- boolean autoAssociate = Cache
- .getDefault("AUTOASSOCIATE_PDBANDSEQS", false);
- if (!autoAssociate)
- {
- String msg = MessageManager.formatMessage(
- "label.automatically_associate_structure_files_with_sequences_same_name",
- new Object[]
- { Integer.valueOf(filesmatched.size())
- .toString() });
- String ttl = MessageManager.getString(
- "label.automatically_associate_structure_files_by_name");
- int choice = JvOptionPane.showConfirmDialog(thisaf, msg,
- ttl, JvOptionPane.YES_NO_OPTION);
- autoAssociate = choice == JvOptionPane.YES_OPTION;
- }
- if (autoAssociate)
- {
- for (Object[] fm : filesmatched)
- {
- // try and associate
- // TODO: may want to set a standard ID naming formalism for
- // associating PDB files which have no IDs.
- for (SequenceI toassoc : (SequenceI[]) fm[2])
- {
- PDBEntry pe = new AssociatePdbFileWithSeq()
- .associatePdbWithSeq(fm[0].toString(),
- (DataSourceType) fm[1], toassoc, false,
- Desktop.getInstance());
- if (pe != null)
- {
- System.err.println("Associated file : "
- + (fm[0].toString()) + " with "
- + toassoc.getDisplayId(true));
- assocfiles++;
- }
- }
- // TODO: do we need to update overview ? only if features are
- // shown I guess
- alignPanel.paintAlignment(true, false);
- }
- }
- else
- {
- /*
- * add declined structures as sequences
- */
- for (Object[] o : filesmatched)
- {
- filesnotmatched.add(o[0]);
- }
- }
+ type = new IdentifyFile().identify(file, protocol);
+ } catch (Exception ex)
+ {
+ type = null;
}
- if (filesnotmatched.size() > 0)
+ if (type != null && type.isStructureFile())
{
- if (assocfiles > 0 && (Cache.getDefault(
- "AUTOASSOCIATE_PDBANDSEQS_IGNOREOTHERS", false)
- || JvOptionPane.showConfirmDialog(thisaf,
- "<html>" + MessageManager.formatMessage(
- "label.ignore_unmatched_dropped_files_info",
- new Object[]
- { Integer.valueOf(
- filesnotmatched.size())
- .toString() })
- + "</html>",
- MessageManager.getString(
- "label.ignore_unmatched_dropped_files"),
- JvOptionPane.YES_NO_OPTION) == JvOptionPane.YES_OPTION))
- {
- return;
- }
- for (Object fn : filesnotmatched)
+ filesmatched.add(new Object[] { file, protocol, mtch });
+ continue;
+ }
+ }
+ // File wasn't named like one of the sequences or wasn't a PDB
+ // file.
+ filesnotmatched.add(file);
+ }
+ }
+ int assocfiles = 0;
+ if (filesmatched.size() > 0)
+ {
+ boolean autoAssociate = Cache.getDefault("AUTOASSOCIATE_PDBANDSEQS",
+ false);
+ if (!autoAssociate)
+ {
+ String msg = MessageManager.formatMessage(
+ "label.automatically_associate_structure_files_with_sequences_same_name",
+ new Object[]
+ { Integer.valueOf(filesmatched.size()).toString() });
+ String ttl = MessageManager.getString(
+ "label.automatically_associate_structure_files_by_name");
+ int choice = JvOptionPane.showConfirmDialog(this, msg, ttl,
+ JvOptionPane.YES_NO_OPTION);
+ autoAssociate = choice == JvOptionPane.YES_OPTION;
+ }
+ if (autoAssociate)
+ {
+ for (Object[] fm : filesmatched)
+ {
+ // try and associate
+ // TODO: may want to set a standard ID naming formalism for
+ // associating PDB files which have no IDs.
+ for (SequenceI toassoc : (SequenceI[]) fm[2])
+ {
+ PDBEntry pe = new AssociatePdbFileWithSeq()
+ .associatePdbWithSeq(fm[0].toString(),
+ (DataSourceType) fm[1], toassoc, false,
+ Desktop.getInstance());
+ if (pe != null)
{
- loadJalviewDataFile(fn, null, null, null);
+ System.err.println("Associated file : " + (fm[0].toString())
+ + " with " + toassoc.getDisplayId(true));
+ assocfiles++;
}
-
}
- } catch (Exception ex)
+ // TODO: do we need to update overview ? only if features are
+ // shown I guess
+ alignPanel.paintAlignment(true, false);
+ }
+ }
+ else
+ {
+ /*
+ * add declined structures as sequences
+ */
+ for (Object[] o : filesmatched)
{
- ex.printStackTrace();
+ filesnotmatched.add(o[0]);
}
}
- }).start();
+ }
+ if (filesnotmatched.size() > 0)
+ {
+ if (assocfiles > 0 && (Cache
+ .getDefault("AUTOASSOCIATE_PDBANDSEQS_IGNOREOTHERS", false)
+ || JvOptionPane.showConfirmDialog(this,
+ "<html>" + MessageManager.formatMessage(
+ "label.ignore_unmatched_dropped_files_info",
+ new Object[]
+ { Integer.valueOf(filesnotmatched.size())
+ .toString() })
+ + "</html>",
+ MessageManager.getString(
+ "label.ignore_unmatched_dropped_files"),
+ JvOptionPane.YES_NO_OPTION) == JvOptionPane.YES_OPTION))
+ {
+ return;
+ }
+ for (Object fn : filesnotmatched)
+ {
+ loadJalviewDataFile(fn, null, null, null);
+ }
+
+ }
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
}
}
}
}
-
/**
* Method invoked by the ChangeListener on the tabbed pane, in other words
* when a different tabbed pane is selected by the user or programmatically.
}
private Rectangle lastFeatureSettingsBounds = null;
+
@Override
public void setFeatureSettingsGeometry(Rectangle bounds)
{
{
jalview.api.FeatureRenderer fr = null;
if (alignPanel != null
- && (fr = alignPanel
- .getFeatureRenderer()) != null)
+ && (fr = alignPanel.getFeatureRenderer()) != null)
{
List<String> gps = fr.getGroups(visible);
String[] _gps = gps.toArray(new String[gps.size()]);
alignPanel.getSeqPanel().selection(sel, csel, hidden, null);
}
-
}
class PrintThread extends Thread
*/
package jalview.ws.jws1;
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
+import jalview.gui.AlignmentPanel;
import jalview.gui.JvOptionPane;
import jalview.util.MessageManager;
import java.net.URL;
import java.util.Hashtable;
+import java.util.List;
import java.util.StringTokenizer;
import java.util.Vector;
import ext.vamsas.ServiceHandle;
import ext.vamsas.ServiceHandles;
-public class Discoverer implements Runnable
+public class Discoverer implements Runnable, ApplicationSingletonI
{
+
+ public static Discoverer getInstance()
+ {
+ return (Discoverer) ApplicationSingletonProvider.getInstance(Discoverer.class);
+ }
+
+ private Discoverer()
+ {
+ // use getInstance()
+ }
+
ext.vamsas.IRegistry registry; // the root registry service.
private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(
return server;
}
- static private java.net.URL RootServiceURL = null;
+ private java.net.URL RootServiceURL = null;
- static public Vector<URL> ServiceURLList = null;
+ private Vector<URL> ServiceURLList = null;
- static private boolean reallyDiscoverServices = true;
+ public Vector<URL> getServiceURLList() {
+ return ServiceURLList;
+ }
+
+ private boolean reallyDiscoverServices = true;
- public static java.util.Hashtable<String, Vector<ServiceHandle>> services = null;
+ private java.util.Hashtable<String, Vector<ServiceHandle>> services = null;
// stored by
// abstractServiceType
// string
- public static java.util.Vector<ServiceHandle> serviceList = null;
+ public java.util.Vector<ServiceHandle> serviceList = null;
- static private Vector<URL> getDiscoveryURLS()
+ private Vector<URL> getDiscoveryURLS()
{
Vector<URL> urls = new Vector<>();
String RootServiceURLs = jalview.bin.Cache.getDefault("DISCOVERY_URLS",
*/
static public void doDiscovery()
{
+ getInstance().discovery();
+ }
+
+ private void discovery()
+ {
jalview.bin.Cache.log
.debug("(Re)-Initialising the discovery URL list.");
try
{
+ Discoverer d = getInstance();
reallyDiscoverServices = jalview.bin.Cache
.getDefault("DISCOVERY_START", false);
if (reallyDiscoverServices)
* Hashtable
* @return boolean
*/
- static private boolean buildServiceLists(ServiceHandle[] sh,
+ private boolean buildServiceLists(ServiceHandle[] sh,
Vector<ServiceHandle> cat,
Hashtable<String, Vector<ServiceHandle>> sscat)
{
/**
* binding service abstract name to handler class
*/
- private static Hashtable<String, WS1Client> serviceClientBindings;
+ private Hashtable<String, WS1Client> serviceClientBindings;
public static WS1Client getServiceClient(ServiceHandle sh)
{
+ return getInstance().getClient(sh);
+ }
+
+ /**
+ * notes on discovery service 1. need to allow multiple discovery source urls.
+ * 2. user interface to add/control list of urls in preferences notes on
+ * wsclient discovery 1. need a classpath property with list of additional
+ * plugin directories 2. optional config to cite specific bindings between
+ * class name and Abstract service name. 3. precedence for automatic discovery
+ * by using getAbstractName for WSClient - user added plugins override default
+ * plugins ? notes on wsclient gui code for gui attachment now moved to
+ * wsclient implementation. Needs more abstraction but approach seems to work.
+ * is it possible to 'generalise' the data retrieval calls further ? current
+ * methods are very specific (gatherForMSA or gatherForSeqOrMsaSecStrPred),
+ * new methods for conservation (group or alignment), treecalc (aligned
+ * profile), seqannot (sequences selected from dataset, annotation back to
+ * dataset).
+ *
+ */
+
+ private WS1Client getClient(ServiceHandle sh)
+ {
if (serviceClientBindings == null)
{
// get a list from Config or create below
}
return instance;
}
- /**
- * notes on discovery service 1. need to allow multiple discovery source urls.
- * 2. user interface to add/control list of urls in preferences notes on
- * wsclient discovery 1. need a classpath property with list of additional
- * plugin directories 2. optional config to cite specific bindings between
- * class name and Abstract service name. 3. precedence for automatic discovery
- * by using getAbstractName for WSClient - user added plugins override default
- * plugins ? notes on wsclient gui code for gui attachment now moved to
- * wsclient implementation. Needs more abstraction but approach seems to work.
- * is it possible to 'generalise' the data retrieval calls further ? current
- * methods are very specific (gatherForMSA or gatherForSeqOrMsaSecStrPred),
- * new methods for conservation (group or alignment), treecalc (aligned
- * profile), seqannot (sequences selected from dataset, annotation back to
- * dataset).
- *
- */
+
+ public static Hashtable<String, Vector<ServiceHandle>> getServices()
+ {
+ return getInstance().services;
+ }
}