}
});
}
private void setRange(LineInfo newTop, LineInfo newBottom) {
LineInfo oldTop;
LineInfo oldBottom;
if (topAnchor == null || bottomAnchor == null) {
oldTop = oldBottom = null;
topAnchor =
anchorManager.createAnchor(VIEWPORT_MODEL_ANCHOR_TYPE, newTop.line(), newTop.number(),
AnchorManager.IGNORE_COLUMN);
topAnchor.setRemovalStrategy(RemovalStrategy.SHIFT);
topAnchor.getShiftListenerRegistrar().add(anchorShiftedListener);
bottomAnchor =
anchorManager.createAnchor(VIEWPORT_MODEL_ANCHOR_TYPE, newBottom.line(),
newBottom.number(), AnchorManager.IGNORE_COLUMN);
bottomAnchor.setRemovalStrategy(RemovalStrategy.SHIFT);
bottomAnchor.getShiftListenerRegistrar().add(anchorShiftedListener);
} else {
oldTop = topAnchor.getLineInfo();
oldBottom = bottomAnchor.getLineInfo();
if (oldTop.equals(newTop) && oldBottom.equals(newBottom)) {
return;
}
anchorManager.moveAnchor(topAnchor, newTop.line(), newTop.number(),
AnchorManager.IGNORE_COLUMN);