import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.BitSet;
import java.util.Collection;
import java.util.Collections;
import java.util.Hashtable;
protected void hideInsertions_actionPerformed(ActionEvent actionEvent)
{
- if (sequence != null)
+ HiddenColumns hidden = ap.av.getAlignment().getHiddenColumns();
+ if (hidden == null)
{
- /* ColumnSelection cs = ap.av.getColumnSelection();
- if (cs == null)
- {
- cs = new ColumnSelection();
- }
- cs.hideInsertionsFor(sequence);
- ap.av.setColumnSelection(cs);*/
-
- HiddenColumns hidden = ap.av.getAlignment().getHiddenColumns();
- if (hidden == null)
+ hidden = new HiddenColumns();
+ }
+ if (ap.av.getSelectionGroup() != null)
+ {
+ BitSet inserts = new BitSet();
+ inserts.set(0, ap.av.getAlignment().getWidth());
+ ;
+ for (SequenceI sq : ap.av.getSelectionGroup().getSequences())
{
- hidden = new HiddenColumns();
+ inserts.and(sq.getInsertionsAsBits());
}
+ int firstSet = 0, lastSet = 0;
+ do
+ {
+ if (inserts.get(firstSet))
+ {
+ lastSet = inserts.nextClearBit(firstSet) - 1;
+ hidden.hideColumns(firstSet, lastSet);
+ firstSet = lastSet + 1;
+ }
+ else
+ {
+ firstSet = inserts.nextSetBit(firstSet);
+ }
+ } while (firstSet > -1);
+
+ }
+ else
+ if (sequence != null)
+ {
hidden.hideInsertionsFor(sequence);
ap.av.getAlignment().setHiddenColumns(hidden);
}