JAL-3269 JAL-3370 JalviewJS interface upgrade
[jalview.git] / src / jalview / gui / AlignFrame.java
index bc08c4f..386c39b 100644 (file)
@@ -28,10 +28,12 @@ import jalview.analysis.GeneticCodeI;
 import jalview.analysis.ParseProperties;
 import jalview.analysis.SequenceIdMatcher;
 import jalview.api.AlignExportSettingsI;
+import jalview.api.AlignFrameI;
 import jalview.api.AlignViewControllerGuiI;
 import jalview.api.AlignViewControllerI;
 import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
+//from JalviewLite imports import jalview.api.FeatureRenderer;
 import jalview.api.FeatureSettingsControllerI;
 import jalview.api.SplitContainerI;
 import jalview.api.ViewStyleI;
@@ -162,7 +164,8 @@ import ext.vamsas.ServiceHandle;
  * @version $Revision$
  */
 @SuppressWarnings("serial")
-public class AlignFrame extends GAlignFrame implements DropTargetListener,
+public class AlignFrame extends GAlignFrame
+        implements AlignFrameI, DropTargetListener,
         IProgressIndicator, AlignViewControllerGuiI, ColourChangeListener
 {
 
@@ -407,7 +410,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       wrapMenuItem_actionPerformed(null);
     }
 
-    if (jalview.bin.Cache.getDefault("SHOW_OVERVIEW", false))
+    if (jalview.bin.Cache.getDefault(Preferences.SHOW_OVERVIEW, false))
     {
       this.overviewMenuItem_actionPerformed(null);
     }
@@ -4461,7 +4464,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   {
     // BH 2018
     return avc.parseFeaturesFile(file, sourceType,
-            Cache.getDefault("RELAXEDSEQIDMATCHING", false));
+            Cache.getDefault(Preferences.RELAXEDSEQIDMATCHING, false));
 
   }
 
@@ -4604,7 +4607,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
             if (filesmatched.size() > 0)
             {
               boolean autoAssociate = Cache
-                      .getDefault("AUTOASSOCIATE_PDBANDSEQS", false);
+                      .getDefault(Preferences.AUTOASSOCIATE_PDBANDSEQS, false);
               if (!autoAssociate)
               {
                 String msg = MessageManager.formatMessage(
@@ -5787,6 +5790,67 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   }
 
+  /**
+   * BH 2019 from JalviewLite
+   * 
+   * get sequence feature groups that are hidden or shown
+   * 
+   * @param visible
+   *          true is visible
+   * @return list
+   */
+  public String[] getFeatureGroupsOfState(boolean visible)
+  {
+    jalview.api.FeatureRenderer fr = null;
+    if (alignPanel != null
+            && (fr = alignPanel
+                    .getFeatureRenderer()) != null)
+    {
+      List<String> gps = fr.getGroups(visible);
+      String[] _gps = gps.toArray(new String[gps.size()]);
+      return _gps;
+    }
+    return null;
+  }
+
+  public void scrollTo(int row, int column)
+  {
+    alignPanel.getSeqPanel().scrollTo(row, column);
+  }
+
+  public void scrollToRow(int row)
+  {
+    alignPanel.getSeqPanel().scrollToRow(row);
+  }
+
+  public void scrollToColumn(int column)
+  {
+    alignPanel.getSeqPanel().scrollToColumn(column);
+  }
+
+  /**
+   * 
+   * @return list of feature groups on the view
+   */
+  public String[] getFeatureGroups()
+  {
+    jalview.api.FeatureRenderer fr = null;
+    if (alignPanel != null
+            && (fr = alignPanel.getFeatureRenderer()) != null)
+    {
+      List<String> gps = fr.getFeatureGroups();
+      String[] _gps = gps.toArray(new String[gps.size()]);
+      return _gps;
+    }
+    return null;
+  }
+
+  public void select(SequenceGroup sel, ColumnSelection csel,
+          HiddenColumns hidden)
+  {
+    alignPanel.getSeqPanel().selection(sel, csel, hidden, null);
+  }
+
 }
 
 class PrintThread extends Thread