Select revealed seqs
authoramwaterhouse <Andrew Waterhouse>
Tue, 15 Aug 2006 10:34:11 +0000 (10:34 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 15 Aug 2006 10:34:11 +0000 (10:34 +0000)
src/jalview/appletgui/AlignViewport.java
src/jalview/datamodel/HiddenSequences.java
src/jalview/gui/AlignViewport.java

index 99d0794..7c46cd9 100755 (executable)
@@ -775,9 +775,23 @@ public class AlignViewport
 \r
   public void showSequence(int index)\r
   {\r
-    alignment.getHiddenSequences().showSequence(index);\r
+    Vector tmp = alignment.getHiddenSequences().showSequence(index);\r
+    if (tmp.size() > 0)\r
+    {\r
+      if (selectionGroup == null)\r
+      {\r
+        selectionGroup = new SequenceGroup();\r
+        selectionGroup.setEndRes(alignment.getWidth() - 1);\r
+      }\r
 \r
-    if(alignment.getHiddenSequences().getSize()<1)\r
+      for (int t = 0; t < tmp.size(); t++)\r
+      {\r
+        selectionGroup.addSequence(\r
+            (SequenceI) tmp.elementAt(t), false\r
+            );\r
+      }\r
+    }\r
+    if (alignment.getHiddenSequences().getSize() < 1)\r
       hasHiddenRows = false;\r
   }\r
 \r
@@ -798,9 +812,20 @@ public class AlignViewport
   {\r
     if(alignment.getHiddenSequences().getSize()>0)\r
     {\r
-      alignment.getHiddenSequences().showAll();\r
+      if(selectionGroup==null)\r
+      {\r
+        selectionGroup = new SequenceGroup();\r
+        selectionGroup.setEndRes(alignment.getWidth()-1);\r
+      }\r
+      Vector tmp = alignment.getHiddenSequences().showAll();\r
+      for(int t=0; t<tmp.size(); t++)\r
+      {\r
+        selectionGroup.addSequence(\r
+            (SequenceI)tmp.elementAt(t), false\r
+            );\r
+      }\r
       hasHiddenRows = false;\r
-    }\r
+      }\r
   }\r
 \r
   public int adjustForHiddenSeqs(int alignmentIndex)\r
index 36c6498..9a7afd2 100755 (executable)
@@ -62,14 +62,21 @@ public class HiddenSequences
     alignment.deleteSequence(sequence);\r
   }\r
 \r
-  public void showAll()\r
+  public Vector showAll()\r
   {\r
+   Vector revealedSeqs = new Vector();\r
    for(int i=0; i<alignment.getHeight()+hiddenSequences.size(); i++)\r
-     showSequence(i);\r
+    {\r
+      Vector tmp = showSequence(i);\r
+      for(int t=0; t<tmp.size(); t++)\r
+        revealedSeqs.addElement(tmp.elementAt(t));\r
+    }\r
+    return revealedSeqs;\r
   }\r
 \r
-  public void showSequence(int alignmentIndex)\r
+  public Vector showSequence(int alignmentIndex)\r
   {\r
+    Vector revealedSeqs = new Vector();\r
     SequenceI repSequence = alignment.getSequenceAt(alignmentIndex);\r
     if(repSequence!=null\r
        && repSequence.getHiddenSequences()==null\r
@@ -88,8 +95,10 @@ public class HiddenSequences
       SequenceI seq =  (SequenceI)hiddenSequences.remove(new Integer(\r
           index));\r
 \r
+\r
       if(seq!=null)\r
       {\r
+        revealedSeqs.addElement(seq);\r
         alignment.getSequences().insertElementAt(seq, alignmentIndex);\r
         if(repSequence!=null)\r
         {\r
@@ -97,6 +106,8 @@ public class HiddenSequences
         }\r
       }\r
     }\r
+\r
+    return revealedSeqs;\r
   }\r
 \r
   public Hashtable getHiddenSequences()\r
index 2dd5fda..bca3589 100755 (executable)
@@ -1133,8 +1133,22 @@ public class AlignViewport
 \r
     public void showSequence(int index)\r
     {\r
-      alignment.getHiddenSequences().showSequence(index);\r
+      Vector tmp = alignment.getHiddenSequences().showSequence(index);\r
+      if(tmp.size()>0)\r
+      {\r
+        if(selectionGroup==null)\r
+        {\r
+          selectionGroup = new SequenceGroup();\r
+          selectionGroup.setEndRes(alignment.getWidth()-1);\r
+        }\r
 \r
+        for (int t = 0; t < tmp.size(); t++)\r
+        {\r
+          selectionGroup.addSequence(\r
+              (SequenceI) tmp.elementAt(t), false\r
+              );\r
+        }\r
+      }\r
       if(alignment.getHiddenSequences().getSize()<1)\r
         hasHiddenRows = false;\r
     }\r
@@ -1156,7 +1170,18 @@ public class AlignViewport
     {\r
       if(alignment.getHiddenSequences().getSize()>0)\r
       {\r
-        alignment.getHiddenSequences().showAll();\r
+        if(selectionGroup==null)\r
+        {\r
+          selectionGroup = new SequenceGroup();\r
+          selectionGroup.setEndRes(alignment.getWidth()-1);\r
+        }\r
+        Vector tmp = alignment.getHiddenSequences().showAll();\r
+        for(int t=0; t<tmp.size(); t++)\r
+        {\r
+          selectionGroup.addSequence(\r
+              (SequenceI)tmp.elementAt(t), false\r
+              );\r
+        }\r
         hasHiddenRows = false;\r
       }\r
     }\r