X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fgui%2FDasSourceBrowser.java;h=807aa4b5cbc6b89b2ba36f526d66219dd6949085;hb=2acd9b68254936cb75c88eb20f94cfb38da9d203;hp=01aa532f3c78638230593bc6bca98f387b709bdc;hpb=d2735d899ea977b635ca89378daa9ae16c5f55b9;p=jalview.git
diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java
index 01aa532..807aa4b 100755
--- a/src/jalview/gui/DasSourceBrowser.java
+++ b/src/jalview/gui/DasSourceBrowser.java
@@ -1,6 +1,6 @@
/*
* Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,21 +18,20 @@
*/
package jalview.gui;
-import jalview.jbgui.*;
-import javax.swing.table.AbstractTableModel;
-import javax.swing.event.*;
-import jalview.util.TableSorter;
+import java.util.*;
+
+import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import java.util.*;
-import java.net.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
-import org.biojava.services.das.registry.DasCoordinateSystem;
-import org.biojava.services.das.registry.DasSource;
-import java.awt.BorderLayout;
+import org.biojava.dasobert.dasregistry.*;
+import jalview.jbgui.*;
+import jalview.util.*;
-public class DasSourceBrowser extends GDasSourceBrowser
- implements Runnable, ListSelectionListener
+public class DasSourceBrowser
+ extends GDasSourceBrowser implements Runnable, ListSelectionListener
{
static DasSource[] dasSources = null;
@@ -40,19 +39,39 @@ public class DasSourceBrowser extends GDasSourceBrowser
Vector selectedSources;
+ public static String DEFAULT_REGISTRY =
+ "http://www.dasregistry.org/das1/sources/";
+
+ /**
+ * true if thread is running and we are talking to DAS registry service
+ */
+ public boolean loadingDasSources = false;
+ protected static String getDasRegistryURL()
+ {
+ String registry = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",
+ DEFAULT_REGISTRY);
+
+ if (registry.indexOf("/registry/das1/sources/") > -1)
+ {
+ jalview.bin.Cache.setProperty("DAS_REGISTRY_URL", DEFAULT_REGISTRY);
+ registry = DEFAULT_REGISTRY;
+ }
+ return registry;
+ }
public DasSourceBrowser()
{
- registryURL.setText(jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",
- "http://servlet.sanger.ac.uk/dasregistry/services/das_registry") );
+ String registry = getDasRegistryURL();
+
+ registryURL.setText(registry);
setSelectedFromProperties();
displayFullDetails(null);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- capabilities.addListSelectionListener(this);
- coords1.addListSelectionListener(this);
- coords2.addListSelectionListener(this);
+ filter1.addListSelectionListener(this);
+ filter2.addListSelectionListener(this);
+ filter3.addListSelectionListener(this);
//Ask to be notified of selection changes.
ListSelectionModel rowSM = table.getSelectionModel();
@@ -60,10 +79,6 @@ public class DasSourceBrowser extends GDasSourceBrowser
{
public void valueChanged(ListSelectionEvent e)
{
- //Ignore extra messages.
- if (e.getValueIsAdjusting())
- return;
-
ListSelectionModel lsm = (ListSelectionModel) e.getSource();
if (!lsm.isSelectionEmpty())
{
@@ -74,24 +89,30 @@ public class DasSourceBrowser extends GDasSourceBrowser
});
table.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent evt)
+ {
+ if (evt.getClickCount() == 2
+ || SwingUtilities.isRightMouseButton(evt))
{
- public void mouseClicked(MouseEvent evt)
- {
- if(evt.getClickCount()==2
- || SwingUtilities.isRightMouseButton(evt))
- editRemoveLocalSource(evt);
- }
- });
+ editRemoveLocalSource(evt);
+ }
+ }
+ });
- if(dasSources==null)
+ if (dasSources != null)
{
- Thread worker = new Thread(this);
- worker.start();
+ init();
+ }
+ }
+
+ public void paintComponent(java.awt.Graphics g)
+ {
+ if (dasSources == null && !loadingDasSources)
+ {
+ Thread worker = new Thread(this);
+ worker.start();
}
- else
- {
- init();
- }
}
void init()
@@ -109,14 +130,14 @@ public class DasSourceBrowser extends GDasSourceBrowser
setCapabilities(dasSources);
javax.swing.SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- TableSorter sorter = (TableSorter)table.getModel();
- sorter.setSortingStatus(1, TableSorter.DESCENDING);
- sorter.setSortingStatus(1, TableSorter.NOT_SORTED);
- }
- });
+ {
+ public void run()
+ {
+ TableSorter sorter = (TableSorter) table.getModel();
+ sorter.setSortingStatus(1, TableSorter.DESCENDING);
+ sorter.setSortingStatus(1, TableSorter.NOT_SORTED);
+ }
+ });
progressBar.setIndeterminate(false);
progressBar.setVisible(false);
@@ -124,7 +145,6 @@ public class DasSourceBrowser extends GDasSourceBrowser
refresh.setVisible(true);
}
-
public void refreshTableData(Object[][] data)
{
TableSorter sorter = new TableSorter(new DASTableModel(data));
@@ -150,7 +170,9 @@ public class DasSourceBrowser extends GDasSourceBrowser
for (int i = 0; i < dSize; i++)
{
if (!dasSources[i].getNickname().equals(nickName))
+ {
continue;
+ }
DasSource ds = dasSources[i];
@@ -161,37 +183,41 @@ public class DasSourceBrowser extends GDasSourceBrowser
text.append("URL: " + dasSources[i].getUrl() +
"
");
- text.append("Admin Email: "+dasSources[i].getAdminemail()+"" +
- "
");
-
+ text.append(
+ "Admin Email: " + dasSources[i].getAdminemail() + "" +
+ "
");
- text.append("Registered at: " + dasSources[i].getRegisterDate() +
- "
");
+ text.append("Registered at: " +
+ dasSources[i].getRegisterDate() +
+ "
");
- text.append("Last successful test: " + dasSources[i].getLeaseDate() +
- "
");
+ text.append("Last successful test: " +
+ dasSources[i].getLeaseDate() +
+ "
");
text.append("Labels: ");
- for(int s=0; s");
-
-
text.append("Capabilities: ");
String[] scap = dasSources[i].getCapabilities();
for (int j = 0; j < scap.length; j++)
{
text.append(scap[j]);
if (j < scap.length - 1)
+ {
text.append(", ");
+ }
}
text.append("
");
@@ -202,9 +228,13 @@ public class DasSourceBrowser extends GDasSourceBrowser
text.append("(" + dcs[j].getUniqueId() + ") "
+ dcs[j].getCategory() + ", " + dcs[j].getName());
if (dcs[j].getNCBITaxId() != 0)
+ {
text.append(", " + dcs[j].getNCBITaxId());
+ }
if (dcs[j].getOrganismName().length() > 0)
+ {
text.append(", " + dcs[j].getOrganismName());
+ }
text.append("
");
}
@@ -212,7 +242,8 @@ public class DasSourceBrowser extends GDasSourceBrowser
text.append("Description: " +
dasSources[i].getDescription() + "
");
- if (dasSources[i].getHelperurl().length() > 0)
+ if (dasSources[i].getHelperurl() != null
+ && dasSources[i].getHelperurl().length() > 0)
{
text.append("