From 408115ff6848403c54eb08a516c990aec455e4cc Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 9 Aug 2006 15:56:05 +0000 Subject: [PATCH] Fix for local sources with no capabilities --- src/jalview/gui/DasSourceBrowser.java | 40 +++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java index e8109c7..6388e07 100755 --- a/src/jalview/gui/DasSourceBrowser.java +++ b/src/jalview/gui/DasSourceBrowser.java @@ -41,6 +41,7 @@ public class DasSourceBrowser extends GDasSourceBrowser Vector selectedSources; + public DasSourceBrowser() { registryURL.setText(jalview.bin.Cache.getDefault("DAS_REGISTRY_URL", @@ -61,10 +62,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 +237,6 @@ public class DasSourceBrowser extends GDasSourceBrowser public void run() { - addLocal.setVisible(false); refresh.setVisible(false); progressBar.setVisible(true); @@ -251,6 +247,7 @@ public class DasSourceBrowser extends GDasSourceBrowser appendLocalSources(); init(); + } public Vector getSelectedSources() @@ -549,23 +546,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 +575,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 +602,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 +634,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++) -- 1.7.10.2