X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FColumnSelection.java;h=94e26422a5d29c857f706d1353959072db4424b6;hb=f5f5806de6923a8a62906c5a62c6276ba56ae0da;hp=26dba83bd36d44c00093efbe57d37d7959e00e31;hpb=ab2005eb4fd46c5d9f2df238f2cf20bcb35bf1f3;p=jalview.git diff --git a/src/jalview/gui/ColumnSelection.java b/src/jalview/gui/ColumnSelection.java index 26dba83..94e2642 100755 --- a/src/jalview/gui/ColumnSelection.java +++ b/src/jalview/gui/ColumnSelection.java @@ -171,6 +171,23 @@ public class ColumnSelection selected.setElementAt(new Integer(temp - change), i); } } + + if(hiddenColumns!=null) + { + for(int i=0; i start) + { + region[0] -= change; + region[1] -= change; + } + if(region[0]<0) + region[0] = 0; + if(region[1] <0) + region[1] = 0; + } + } } /** @@ -267,7 +284,7 @@ public class ColumnSelection * In otherwords, the next hidden column. * @param index int */ - public int getHiddenRegionBoundary(int alPos) + public int getHiddenBoundaryRight(int alPos) { if (hiddenColumns != null) { @@ -286,9 +303,35 @@ public class ColumnSelection return alPos; } + /** + * THis method returns the rightmost limit of a + * region of an alignment with hidden columns. + * In otherwords, the next hidden column. + * @param index int + */ + public int getHiddenBoundaryLeft(int alPos) + { + if (hiddenColumns != null) + { + int index = hiddenColumns.size()-1; + do + { + int[] region = (int[]) hiddenColumns.elementAt(index); + if(alPos > region[1]) + return region[1]; + index--; + } + while(index >-1); + } + + return alPos; + + } - public void hideColumns(int res, AlignViewport av) + + + public void hideColumns(int res) { if(hiddenColumns==null) hiddenColumns = new Vector(); @@ -318,13 +361,21 @@ public class ColumnSelection if(!added) hiddenColumns.addElement(new int[]{min, max}); - - av.setSelectionGroup(null); - av.hasHiddenColumns = true; } public void revealAllHiddenColumns(AlignViewport av) { + if(hiddenColumns!=null) + { + for (int i = 0; i < hiddenColumns.size(); i++) + { + int[] region = (int[]) hiddenColumns.elementAt(i); + for (int j = region[0]; j < region[1]; j++) + { + addElement(j); + } + } + } av.hasHiddenColumns = false; hiddenColumns = null; } @@ -336,6 +387,11 @@ public class ColumnSelection int [] region = (int[])hiddenColumns.elementAt(i); if( res == region[0]) { + for (int j = region[0]; j < region[1]; j++) + { + addElement(j); + } + hiddenColumns.remove(region); break; }