X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FDasSourceBrowser.java;h=91711dcd727cd1c21ebd117a195a83d4ff53f921;hb=3b1dd2adcb9dfcd941566e27a02e6611caf75b23;hp=fc2b387d609d12ff8b5f6f83bd523b3b00dda751;hpb=174230b4233d9ce80f94527768d2cd2f76da11ab;p=jalview.git
diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java
index fc2b387..91711dc 100755
--- a/src/jalview/gui/DasSourceBrowser.java
+++ b/src/jalview/gui/DasSourceBrowser.java
@@ -1,39 +1,37 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
package jalview.gui;
-import jalview.jbgui.*;
-import javax.swing.table.AbstractTableModel;
-import javax.swing.event.*;
-import jalview.util.TableSorter;
-import java.awt.event.*;
-import javax.swing.*;
import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
-import org.biojava.dasobert.dasregistry.DasCoordinateSystem;
-import org.biojava.dasobert.dasregistry.DasSource;
-import org.biojava.dasobert.dasregistry.Das1Source;
-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;
@@ -41,15 +39,30 @@ public class DasSourceBrowser extends GDasSourceBrowser
Vector selectedSources;
- String DEFAULT_REGISTRY = "http://das.sanger.ac.uk/registry/das1/sources/";
-
- boolean loadingDasSources = false;
+ 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",
- DEFAULT_REGISTRY) );
+ String registry = getDasRegistryURL();
+
+ registryURL.setText(registry);
setSelectedFromProperties();
@@ -76,18 +89,20 @@ 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)
{
- init();
+ init();
}
}
@@ -115,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);
@@ -130,7 +145,6 @@ public class DasSourceBrowser extends GDasSourceBrowser
refresh.setVisible(true);
}
-
public void refreshTableData(Object[][] data)
{
TableSorter sorter = new TableSorter(new DASTableModel(data));
@@ -156,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];
@@ -167,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("
");
@@ -208,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("
");
}
@@ -218,8 +242,7 @@ public class DasSourceBrowser extends GDasSourceBrowser
text.append("Description: " +
dasSources[i].getDescription() + "
");
-
- if (dasSources[i].getHelperurl()!=null
+ if (dasSources[i].getHelperurl() != null
&& dasSources[i].getHelperurl().length() > 0)
{
text.append("