X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDasSourceBrowser.java;h=09c8a3e9ae4b015a8ae6a8271bfdad7cad7fd8e6;hb=32c4c7d4e5db964461c541ee2252510aa3e9e563;hp=f57967c6900c78c5f58300383ef517a98c21b510;hpb=42ed2d813b3b8e7c9c80d79e1c8e1ded61ec6dd9;p=jalview.git diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java index f57967c..09c8a3e 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.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.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,35 @@ 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; + public DasSourceBrowser() { - registryURL.setText(jalview.bin.Cache.getDefault("DAS_REGISTRY_URL", - "http://servlet.sanger.ac.uk/dasregistry/services/das_registry") ); + 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; + } + + 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 +75,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 +85,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 +126,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 +141,6 @@ public class DasSourceBrowser extends GDasSourceBrowser refresh.setVisible(true); } - public void refreshTableData(Object[][] data) { TableSorter sorter = new TableSorter(new DASTableModel(data)); @@ -150,7 +166,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 +179,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 +224,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 +238,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("