5bae5b085852f91a9be8ea8a669ec657edb563f3
2 * This file is part of lanterna (http://code.google.com/p/lanterna/).
4 * lanterna is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 * Copyright (C) 2010-2015 Martin
19 package com
.googlecode
.lanterna
.terminal
.swing
;
22 * This interface can be used to control the backlog scrolling of a SwingTerminal. It's used as a callback by the
23 * {@code SwingTerminal} when it needs to fetch the scroll position and also used whenever the backlog changes to that
24 * some view class, like a scrollbar for example, can update its view accordingly.
27 public interface TerminalScrollController
{
29 * Called by the SwingTerminal when the terminal has changed or more lines are entered into the terminal
30 * @param totalSize Total number of lines in the backlog currently
31 * @param screenSize Number of lines covered by the terminal window at its current size
33 void updateModel(int totalSize
, int screenSize
);
36 * Called by the SwingTerminal to know the 'offset' into the backlog. Returning 0 here will always draw the latest
37 * lines; if you return 5, it will draw from five lines into the backlog and skip the 5 most recent lines.
38 * @return According to this scroll controller, how far back into the backlog are we?
40 int getScrollingOffset();
42 final class Null
implements TerminalScrollController
{
44 public void updateModel(int totalSize
, int screenSize
) {
48 public int getScrollingOffset() {