- HiddenCursorPosition oldpos = cursorPos.get();
- HiddenCursorPosition newpos = new HiddenCursorPosition(index,
- hiddencount);
- cursorPos.compareAndSet(oldpos, newpos);
- }
- }
-
- /**
- * Delete the region the cursor is currently at. Avoids having to reset the
- * cursor just because we deleted a region.
- *
- * Calls to updateForDeletedRegion should be made from within a writeLock in
- * the HiddenColumns class - since changes to the hiddenColumns collection
- * require a writeLock the lock should already exist.
- *
- * @param hiddenCols
- */
- protected void updateForDeletedRegion(List<int[]> hiddenCols)
- {
-
- if ((hiddenCols != null) && (!hiddenCols.isEmpty()))
- {
- // if there is a region to the right of the current region,
- // nothing changes; otherwise
- // we deleted the last region (index=hiddenCols.size()-1)
- // or the index was at the end of the alignment (index=hiddenCols.size())
- HiddenCursorPosition oldpos = cursorPos.get();
-
- int index = oldpos.getRegionIndex();
- if (index >= hiddenColumns.size() - 1)
- {
- // deleted last region, index is now end of alignment
- index = hiddenCols.size();
-
- HiddenCursorPosition newpos = new HiddenCursorPosition(index,
- oldpos.getHiddenSoFar());
- cursorPos.compareAndSet(oldpos, newpos);
- }