JAL-1942 small tidy (formatting, explict imports, typed list, spelling)
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 27 May 2016 08:51:36 +0000 (09:51 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 27 May 2016 08:51:36 +0000 (09:51 +0100)
src/jalview/gui/FeatureSettings.java
src/jalview/gui/PopupMenu.java
src/jalview/gui/StructureChooser.java
src/jalview/ws/DBRefFetcher.java
src/jalview/ws/DasSequenceFeatureFetcher.java

index f250583..09204d1 100644 (file)
@@ -1326,7 +1326,7 @@ public class FeatureSettings extends JPanel implements
    * 
    * @return vector of selected das source nicknames
    */
-  public Vector getSelectedSources()
+  public Vector<jalviewSourceI> getSelectedSources()
   {
     return dassourceBrowser.getSelectedSources();
   }
index 1e0772a..4b0ffad 100644 (file)
@@ -60,6 +60,7 @@ import jalview.util.GroupUrlLink;
 import jalview.util.GroupUrlLink.UrlStringTooLongException;
 import jalview.util.MessageManager;
 import jalview.util.UrlLink;
+import jalview.ws.DBRefFetcher;
 
 import java.awt.Color;
 import java.awt.event.ActionEvent;
@@ -2389,11 +2390,11 @@ public class PopupMenu extends JPopupMenu
       @Override
       public void run()
       {
-        boolean isNuclueotide = ap.alignFrame.getViewport().getAlignment()
+        boolean isNucleotide = ap.alignFrame.getViewport().getAlignment()
                 .isNucleotide();
 
-        new jalview.ws.DBRefFetcher(sequences, ap.alignFrame, null,
-                ap.alignFrame.featureSettings, isNuclueotide)
+        new DBRefFetcher(sequences, ap.alignFrame, null,
+                ap.alignFrame.featureSettings, isNucleotide)
                 .fetchDBRefs(false);
 
       }
index d924e73..ff856ab 100644 (file)
@@ -35,6 +35,7 @@ import jalview.fts.service.pdb.PDBFTSRestClient;
 import jalview.jbgui.GStructureChooser;
 import jalview.structure.StructureSelectionManager;
 import jalview.util.MessageManager;
+import jalview.ws.DBRefFetcher;
 import jalview.ws.sifts.SiftsSettings;
 
 import java.awt.event.ItemEvent;
@@ -860,31 +861,30 @@ public class StructureChooser extends GStructureChooser implements
         {
           ssm.setProgressBar(null);
           ssm.setProgressBar("Fetching Database refs..");
-          new jalview.ws.DBRefFetcher(sequences, null, null, null, false)
-                  .fetchDBRefs(true);
+          new DBRefFetcher(sequences).fetchDBRefs(true);
           break;
         }
       }
     }
-        if (pdbEntriesToView.length > 1)
-        {
-          ArrayList<SequenceI[]> seqsMap = new ArrayList<SequenceI[]>();
-          for (SequenceI seq : sequences)
-          {
-            seqsMap.add(new SequenceI[] { seq });
-          }
-          SequenceI[][] collatedSeqs = seqsMap.toArray(new SequenceI[0][0]);
+    if (pdbEntriesToView.length > 1)
+    {
+      ArrayList<SequenceI[]> seqsMap = new ArrayList<SequenceI[]>();
+      for (SequenceI seq : sequences)
+      {
+        seqsMap.add(new SequenceI[] { seq });
+      }
+      SequenceI[][] collatedSeqs = seqsMap.toArray(new SequenceI[0][0]);
       ssm.setProgressBar(null);
       ssm.setProgressBar("Fetching PDB Structures for selected entries..");
-          sViewer.viewStructures(pdbEntriesToView, collatedSeqs, alignPanel);
-        }
-        else
-        {
+      sViewer.viewStructures(pdbEntriesToView, collatedSeqs, alignPanel);
+    }
+    else
+    {
       ssm.setProgressBar(null);
       ssm.setProgressBar("Fetching PDB Structure for "
               + pdbEntriesToView[0].getId());
-          sViewer.viewStructures(pdbEntriesToView[0], sequences, alignPanel);
-        }
+      sViewer.viewStructures(pdbEntriesToView[0], sequences, alignPanel);
+    }
   }
 
   /**
index 40c88c1..3ba0e34 100644 (file)
@@ -141,7 +141,7 @@ public class DBRefFetcher implements Runnable
       String[] defdb = null, otherdb = sfetcher
               .getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);
       List<DbSourceProxy> selsources = new ArrayList<DbSourceProxy>();
-      Vector dasselsrc = (featureSettings != null) ? featureSettings
+      Vector<jalviewSourceI> dasselsrc = (featureSettings != null) ? featureSettings
               .getSelectedSources() : new jalview.gui.DasSourceBrowser()
               .getSelectedSources();
       Enumeration<jalviewSourceI> en = dasselsrc.elements();
@@ -190,6 +190,16 @@ public class DBRefFetcher implements Runnable
   }
 
   /**
+   * Constructor with only sequences provided
+   * 
+   * @param sequences
+   */
+  public DBRefFetcher(SequenceI[] sequences)
+  {
+    this(sequences, null, null, null, false);
+  }
+
+  /**
    * Add a listener to be notified when sequence fetching is complete
    * 
    * @param l
index d7ba24d..5f9b2d9 100644 (file)
@@ -22,11 +22,13 @@ package jalview.ws;
 
 import jalview.bin.Cache;
 import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
 import jalview.gui.AlignFrame;
 import jalview.gui.Desktop;
 import jalview.gui.FeatureSettings;
+import jalview.util.DBRefUtils;
 import jalview.util.MessageManager;
 import jalview.util.UrlLink;
 import jalview.ws.dbsources.das.api.DasSourceRegistryI;
@@ -186,8 +188,7 @@ public class DasSequenceFeatureFetcher
       {
         for (int j = 0; j < dbref.length; j++)
         {
-          if (dbref[j].getSource().equals(
-                  jalview.datamodel.DBRefSource.UNIPROT))
+          if (dbref[j].getSource().equals(DBRefSource.UNIPROT))
           {
             refCount++;
             break;
@@ -252,10 +253,10 @@ public class DasSequenceFeatureFetcher
     public void run()
     {
       running = true;
-      boolean isNuclueotide = af.getViewport().getAlignment()
+      boolean isNucleotide = af.getViewport().getAlignment()
               .isNucleotide();
-      new jalview.ws.DBRefFetcher(sequences, af, null, af.featureSettings,
-              isNuclueotide).fetchDBRefs(true);
+      new DBRefFetcher(sequences, af, null, af.featureSettings,
+              isNucleotide).fetchDBRefs(true);
 
       startFetching();
       setGuiFetchComplete();
@@ -286,7 +287,7 @@ public class DasSequenceFeatureFetcher
       {
         jalviewSourceI[] sources = sourceRegistry.getSources().toArray(
                 new jalviewSourceI[0]);
-        String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",
+        String active = Cache.getDefault("DAS_ACTIVE_SOURCE",
                 "uniprot");
         StringTokenizer st = new StringTokenizer(active, "\t");
         selectedSources = new Vector();
@@ -643,10 +644,10 @@ public class DasSequenceFeatureFetcher
     {
       return null;
     }
-    DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(
+    DBRefEntry[] uprefs = DBRefUtils.selectRefs(
             seq.getDBRefs(), new String[] {
             // jalview.datamodel.DBRefSource.PDB,
-            jalview.datamodel.DBRefSource.UNIPROT,
+            DBRefSource.UNIPROT,
             // jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord
             // sys sources
             });
@@ -665,7 +666,7 @@ public class DasSequenceFeatureFetcher
 
         for (COORDINATES csys : dasSource.getVersion().getCOORDINATES())
         {
-          if (jalview.util.DBRefUtils.isDasCoordinateSystem(
+          if (DBRefUtils.isDasCoordinateSystem(
                   csys.getAuthority(), uprefs[j]))
           {
             debug("Launched fetcher for coordinate system "