void () { if (documentOfPagesModel.getPagesAmount() == 0) return; int localScrollBarValue = myLocalInvisibleScrollBar.getValue(); int indexOfPage = 0; int topOfPage = 0; int bottomOfPage = 0; while (indexOfPage < documentOfPagesModel.getPagesAmount()) { topOfPage = bottomOfPage; bottomOfPage = offsetToY(getSymbolOffsetToStartOfPage(indexOfPage + 1)); if (localScrollBarValue < bottomOfPage) { targetVisiblePosition.set(documentOfPagesModel.getPageByIndex(indexOfPage).getPageNumber(), localScrollBarValue - topOfPage); return; } indexOfPage++; } if (indexOfPage >= 1 && localScrollBarValue == bottomOfPage) { targetVisiblePosition.set(documentOfPagesModel.getPageByIndex(indexOfPage - 1).getPageNumber(), localScrollBarValue - topOfPage); return; } LOG.warn("[Large File Editor Subsystem] EditorModel.reflectLocalScrollBarStateToTargetPosition():" + " can't reflect state." + " indexOfPage=" + indexOfPage + " localScrollBarValue=" + localScrollBarValue + " topOfPage=" + topOfPage + " bottomOfPage=" + bottomOfPage + " pagesInDocument.size()=" + documentOfPagesModel.getPagesAmount()); }