2017-03-19 12:54:35 -04:00
|
|
|
package terminal;
|
|
|
|
|
|
|
|
import com.googlecode.lanterna.TerminalSize;
|
|
|
|
import com.googlecode.lanterna.terminal.Terminal;
|
|
|
|
import com.googlecode.lanterna.terminal.virtual.VirtualTerminalListener;
|
|
|
|
|
|
|
|
public class FlushListener implements VirtualTerminalListener {
|
|
|
|
|
|
|
|
private int flushCount;
|
|
|
|
|
|
|
|
public FlushListener() {
|
|
|
|
this.flushCount = 0;
|
|
|
|
}
|
|
|
|
|
2017-03-24 11:53:33 -04:00
|
|
|
public synchronized int getFlushCount() {
|
2017-03-19 12:54:35 -04:00
|
|
|
return flushCount;
|
|
|
|
}
|
|
|
|
|
2017-03-24 11:53:33 -04:00
|
|
|
public synchronized void reduceFlushCount(int reduction) {
|
|
|
|
flushCount -= reduction;
|
2017-03-19 12:54:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResized(Terminal terminal, TerminalSize newSize) {}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public synchronized void onFlush() {
|
|
|
|
flushCount++;
|
|
|
|
notify();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onBell() {}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClose() {}
|
|
|
|
|
|
|
|
}
|