X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDasSourceBrowser.java;h=36e51647c1e4491ff79221cdfb717d48a89b5d29;hb=76b6b31c53b099a3034e0622ec78d4c2b455a309;hp=bdb3b572ff7d28c0c8b03342a68a95f38bca13f5;hpb=8f759d39bf8d95e5657eccda618b65ad31171fcf;p=jalview.git diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java index bdb3b57..36e5164 100755 --- a/src/jalview/gui/DasSourceBrowser.java +++ b/src/jalview/gui/DasSourceBrowser.java @@ -27,9 +27,9 @@ import javax.swing.*; import java.util.*; -import jalview.biojava.dasobert.dasregistry.DasCoordinateSystem; -import jalview.biojava.dasobert.dasregistry.DasSource; -import jalview.biojava.dasobert.dasregistry.Das1Source; +import org.biojava.dasobert.dasregistry.DasCoordinateSystem; +import org.biojava.dasobert.dasregistry.DasSource; +import org.biojava.dasobert.dasregistry.Das1Source; import java.awt.BorderLayout; public class DasSourceBrowser extends GDasSourceBrowser @@ -41,10 +41,13 @@ public class DasSourceBrowser extends GDasSourceBrowser Vector selectedSources; + String DEFAULT_REGISTRY = "http://das.sanger.ac.uk/registry/das1/sources/"; + + public DasSourceBrowser() { registryURL.setText(jalview.bin.Cache.getDefault("DAS_REGISTRY_URL", - "http://das.sanger.ac.uk/registry/das1/sources/") ); + DEFAULT_REGISTRY) ); setSelectedFromProperties(); @@ -61,10 +64,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()) { @@ -240,7 +239,6 @@ public class DasSourceBrowser extends GDasSourceBrowser public void run() { - addLocal.setVisible(false); refresh.setVisible(false); progressBar.setVisible(true); @@ -251,6 +249,7 @@ public class DasSourceBrowser extends GDasSourceBrowser appendLocalSources(); init(); + } public Vector getSelectedSources() @@ -549,23 +548,26 @@ public class DasSourceBrowser extends GDasSourceBrowser index++; } - dasSources = tmp; + dasSources = tmp; - refreshTableData(data); + refreshTableData(data); } public void valueChanged(ListSelectionEvent evt) { //Called when the MainTable selection changes - if (evt.getValueIsAdjusting()) + if (evt.getValueIsAdjusting() ) { return; } + displayFullDetails(null); // Filter the displayed data sources int dSize = dasSources.length; + + ArrayList names = new ArrayList(); ArrayList selected = new ArrayList(); DasSource ds; @@ -575,10 +577,25 @@ public class DasSourceBrowser extends GDasSourceBrowser //July 2006 - only 6 sources fo not serve features Object [] dummyFeatureList = new Object[]{"features"}; - // capabilities.get for (int i = 0; i < dSize; i++) { ds = dasSources[i]; + DasCoordinateSystem[] dcs = ds.getCoordinateSystem(); + + if (dcs.length == 0 && ds.getCapabilities().length == 0 + && filter1.getSelectedIndex() == 0 + && filter2.getSelectedIndex() == 0 + && filter3.getSelectedIndex() == 0) + { + //THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT + //HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT + //IS ADDED FROM THE REGISTRY + names.add(ds.getNickname()); + selected.add(new Boolean( + selectedSources.contains(ds.getNickname()))); + continue; + } + if (!selectedInList(dummyFeatureList, ds.getCapabilities()) || !selectedInList(filter3.getSelectedValues(), @@ -587,12 +604,9 @@ public class DasSourceBrowser extends GDasSourceBrowser continue; } - DasCoordinateSystem[] dcs = ds.getCoordinateSystem(); for (int j = 0; j < dcs.length; j++) { - if (selectedInList(dummyFeatureList,ds.getCapabilities()) - && - selectedInList(filter1.getSelectedValues(), + if ( selectedInList(filter1.getSelectedValues(), new String[] {dcs[j].getName()}) && selectedInList(filter2.getSelectedValues(), @@ -622,7 +636,7 @@ public class DasSourceBrowser extends GDasSourceBrowser { for (int i = 0; i < selection.length; i++) { - if (selection[i].equals("Any")) + if (selection[i].equals("Any") ) return true; for (int j = 0; j < items.length; j++) @@ -666,9 +680,17 @@ public class DasSourceBrowser extends GDasSourceBrowser } } + public void reset_actionPerformed(ActionEvent e) + { + registryURL.setText(DEFAULT_REGISTRY); + } + public void saveProperties(Properties properties) { - properties.setProperty("DAS_REGISTRY_URL", registryURL.getText()); + if (registryURL.getText() == null || registryURL.getText().length() < 1) + properties.remove("DAS_REGISTRY_URL"); + else + properties.setProperty("DAS_REGISTRY_URL", registryURL.getText()); StringBuffer sb = new StringBuffer(); for(int r=0; r