X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDasSourceBrowser.java;h=fc2b387d609d12ff8b5f6f83bd523b3b00dda751;hb=9f08afb8654d8e19fddfd3c6de0e8702804ea97d;hp=e8109c7a052163eefca5436f0d8125c99dba1f96;hpb=911f617591056102f9983264f52377ccad1a2f50;p=jalview.git diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java index e8109c7..fc2b387 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) 2006 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 @@ -41,10 +41,15 @@ public class DasSourceBrowser extends GDasSourceBrowser Vector selectedSources; + String DEFAULT_REGISTRY = "http://das.sanger.ac.uk/registry/das1/sources/"; + + boolean loadingDasSources = false; + + public DasSourceBrowser() { registryURL.setText(jalview.bin.Cache.getDefault("DAS_REGISTRY_URL", - "http://das.sanger.ac.uk/registry/das1/sources/") ); + DEFAULT_REGISTRY) ); setSelectedFromProperties(); @@ -61,10 +66,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()) { @@ -84,15 +85,19 @@ public class DasSourceBrowser extends GDasSourceBrowser } }); - if(dasSources==null) + if(dasSources!=null) { - Thread worker = new Thread(this); - worker.start(); - } - else - { init(); - } + } + } + + public void paintComponent(java.awt.Graphics g) + { + if (dasSources == null && !loadingDasSources) + { + Thread worker = new Thread(this); + worker.start(); + } } void init() @@ -240,6 +245,7 @@ public class DasSourceBrowser extends GDasSourceBrowser public void run() { + loadingDasSources = true; addLocal.setVisible(false); refresh.setVisible(false); @@ -251,6 +257,9 @@ public class DasSourceBrowser extends GDasSourceBrowser appendLocalSources(); init(); + + loadingDasSources = false; + } public Vector getSelectedSources() @@ -549,23 +558,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 +587,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 +614,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 +646,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,6 +690,11 @@ public class DasSourceBrowser extends GDasSourceBrowser } } + public void reset_actionPerformed(ActionEvent e) + { + registryURL.setText(DEFAULT_REGISTRY); + } + public void saveProperties(Properties properties) { if (registryURL.getText() == null || registryURL.getText().length() < 1)