JAL-779 and some redraw refinements
authorjprocter <Jim Procter>
Fri, 18 Feb 2011 17:24:29 +0000 (17:24 +0000)
committerjprocter <Jim Procter>
Fri, 18 Feb 2011 17:24:29 +0000 (17:24 +0000)
src/jalview/gui/AlignFrame.java

index f79afca..e9b0873 100755 (executable)
@@ -754,7 +754,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       progressBars.put(lId, progressPanel);
     }
     // update GUI
-    setMenusForViewport();
+    // setMenusForViewport();
     validate();
   }
 
@@ -3723,18 +3723,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       sortByTreeMenu.add(item);
     }
   }
+
   public boolean sortBy(AlignmentOrder alorder, String undoname)
   {
-    SequenceI[] oldOrder = viewport.getAlignment()
-    .getSequencesArray();
+    SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
     AlignmentSorter.sortBy(viewport.getAlignment(), alorder);
-    if (undoname!=null)
+    if (undoname != null)
     {
-      addHistoryItem(new OrderCommand(undoname, oldOrder, viewport.alignment));
+      addHistoryItem(new OrderCommand(undoname, oldOrder,
+              viewport.alignment));
     }
     alignPanel.paintAlignment(true);
     return true;
   }
+
   /**
    * Work out whether the whole set of sequences or just the selected set will
    * be submitted for multiple alignment.
@@ -4388,7 +4390,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       featuresFile = new FeaturesFile(file, type)
               .parse(viewport.alignment.getDataset(),
                       alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours,
-                      false,jalview.bin.Cache.getDefault("RELAXEDSEQIDMATCHING", false));
+                      false, jalview.bin.Cache.getDefault(
+                              "RELAXEDSEQIDMATCHING", false));
     } catch (Exception ex)
     {
       ex.printStackTrace();
@@ -5041,6 +5044,26 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       alignPanel.paintAlignment(true);
     }
   }
+
+  /**
+   * make the given alignmentPanel the currently selected tab
+   * 
+   * @param alignmentPanel
+   */
+  public void setDisplayedView(AlignmentPanel alignmentPanel)
+  {
+    if (!viewport.getSequenceSetId().equals(
+            alignmentPanel.av.getSequenceSetId()))
+    {
+      throw new Error(
+              "Implementation error: cannot show a view from another alignment in an AlignFrame.");
+    }
+    if (tabbedPane != null
+            & alignPanels.indexOf(alignmentPanel) != tabbedPane.getSelectedIndex())
+    {
+      tabbedPane.setSelectedIndex(alignPanels.indexOf(alignmentPanel));
+    }
+  }
 }
 
 class PrintThread extends Thread