jalview 2.5 release banner
[jalview.git] / src / jalview / gui / DasSourceBrowser.java
index afcecc0..4bd31bd 100755 (executable)
@@ -1,20 +1,19 @@
 /*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)\r
- * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)\r
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
  * \r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
+ * This file is part of Jalview.\r
  * \r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
+ * Jalview is free software: you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License \r
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
  * \r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ * Jalview is distributed in the hope that it will be useful, but \r
+ * WITHOUT ANY WARRANTY; without even the implied warranty \r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ * PURPOSE.  See the GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
  */\r
 package jalview.gui;\r
 \r
@@ -53,7 +52,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
 \r
     if (registry.indexOf("/registry/das1/sources/") > -1)\r
     {\r
-      jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL, DEFAULT_REGISTRY);\r
+      jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,\r
+              DEFAULT_REGISTRY);\r
       registry = DEFAULT_REGISTRY;\r
     }\r
     return registry;\r
@@ -284,18 +284,32 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
   public Vector getSelectedSources()\r
   {\r
     // wait around if we're still loading.\r
-    while (dasSources ==null) {\r
+    while (dasSources == null)\r
+    {\r
       if (!loadingDasSources)\r
       {\r
         new Thread(this).start();\r
-        try { Thread.sleep(5); } catch (Exception e) {};\r
+        try\r
+        {\r
+          Thread.sleep(5);\r
+        } catch (Exception e)\r
+        {\r
+        }\r
+        ;\r
         while (loadingDasSources)\r
         {\r
-          try { Thread.sleep(5); } catch (Exception e) {}; \r
-        };\r
+          try\r
+          {\r
+            Thread.sleep(5);\r
+          } catch (Exception e)\r
+          {\r
+          }\r
+          ;\r
+        }\r
+        ;\r
       }\r
     }\r
-      \r
+\r
     Vector selected = new Vector();\r
     for (int r = 0; r < selectedSources.size(); r++)\r
     {\r
@@ -395,13 +409,14 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
   public void amendLocal(boolean newSource)\r
   {\r
     String url = "http://localhost:8080/", nickname = "";\r
-    boolean seqsrc=false;\r
+    boolean seqsrc = false;\r
     if (!newSource)\r
     {\r
       int selectedRow = table.getSelectionModel().getMinSelectionIndex();\r
       nickname = table.getValueAt(selectedRow, 0).toString();\r
       url = ((DasSource) localSources.get(nickname)).getUrl();\r
-      seqsrc = ((DasSource)localSources.get(nickname)).hasCapability("sequence");\r
+      seqsrc = ((DasSource) localSources.get(nickname))\r
+              .hasCapability("sequence");\r
     }\r
 \r
     JTextField nametf = new JTextField(nickname, 40);\r
@@ -418,7 +433,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     pane12.add(seqs, BorderLayout.SOUTH);\r
     pane12.add(urltf, BorderLayout.EAST);\r
     panel.add(pane12, BorderLayout.SOUTH);\r
-    \r
+\r
     int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,\r
             panel, "Enter Nickname & URL of Local DAS Source",\r
             JOptionPane.OK_CANCEL_OPTION);\r
@@ -439,7 +454,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     local.setNickname(nametf.getText());\r
     if (seqs.isSelected())\r
     {\r
-      local.setCapabilities(new String[] {"features","sequence"});\r
+      local.setCapabilities(new String[]\r
+      { "features", "sequence" });\r
     }\r
     if (localSources == null)\r
     {\r
@@ -580,7 +596,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     {\r
       return;\r
     }\r
-    // note - we add all das sources to list so they can be filtered for the standard fetchDbRefs function\r
+    // note - we add all das sources to list so they can be filtered for the\r
+    // standard fetchDbRefs function\r
     int size = dasSources != null ? dasSources.length : 0;\r
     int lsize = localSources.size();\r
 \r
@@ -723,11 +740,11 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     {\r
       selectedSources.addElement(st.nextToken());\r
     }\r
-    \r
+\r
     Vector _localSources = jalview.bin.Cache.getLocalDasSources();\r
-    if (_localSources!=null)\r
+    if (_localSources != null)\r
     {\r
-      if (localSources==null)\r
+      if (localSources == null)\r
       {\r
         localSources = new Hashtable();\r
       }\r
@@ -747,6 +764,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
 \r
   /**\r
    * set the DAS source settings in the given jalview properties.\r
+   * \r
    * @param properties\r
    */\r
   public void saveProperties(Properties properties)\r
@@ -757,7 +775,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     }\r
     else\r
     {\r
-      properties.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL, registryURL.getText());\r
+      properties.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,\r
+              registryURL.getText());\r
     }\r
 \r
     StringBuffer sb = new StringBuffer();\r
@@ -769,7 +788,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       }\r
     }\r
 \r
-    properties.setProperty(jalview.bin.Cache.DAS_ACTIVE_SOURCE, sb.toString());\r
+    properties.setProperty(jalview.bin.Cache.DAS_ACTIVE_SOURCE, sb\r
+            .toString());\r
 \r
     if (localSources != null)\r
     {\r
@@ -778,12 +798,15 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       while (en.hasMoreElements())\r
       {\r
         String token = en.nextElement().toString();\r
-        sb.append(token + "|"\r
-                +(((DasSource) localSources.get(token)).hasCapability("sequence") ? "sequence:" : "")\r
+        sb.append(token\r
+                + "|"\r
+                + (((DasSource) localSources.get(token))\r
+                        .hasCapability("sequence") ? "sequence:" : "")\r
                 + ((DasSource) localSources.get(token)).getUrl() + "\t");\r
       }\r
 \r
-      properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE, sb.toString());\r
+      properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE, sb\r
+              .toString());\r
     }\r
 \r
   }\r
@@ -877,8 +900,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       }\r
     });\r
     thr.start();\r
-    while (loadingDasSources\r
-            || dasSources == null)\r
+    while (loadingDasSources || dasSources == null)\r
     {\r
       try\r
       {\r