use of org.apache.hadoop.hbase.hbtop.terminal.TerminalSize in project hbase by apache.
the class TestTopScreenPresenter method setup.
@Before
public void setup() {
when(topScreenView.getTerminalSize()).thenReturn(new TerminalSize(100, 100));
when(topScreenView.getPageSize()).thenReturn(100);
when(topScreenModel.getFieldInfos()).thenReturn(TEST_FIELD_INFOS);
when(topScreenModel.getFields()).thenReturn(TEST_FIELD_INFOS.stream().map(FieldInfo::getField).collect(Collectors.toList()));
when(topScreenModel.getRecords()).thenReturn(TEST_RECORDS);
when(topScreenModel.getSummary()).thenReturn(TEST_SUMMARY);
topScreenPresenter = new TopScreenPresenter(topScreenView, 3000, topScreenModel, null, Long.MAX_VALUE);
}
use of org.apache.hadoop.hbase.hbtop.terminal.TerminalSize in project hbase by apache.
the class TerminalImpl method doResizeIfNecessary.
@Nullable
@Override
public TerminalSize doResizeIfNecessary() {
TerminalSize currentTerminalSize = queryTerminalSize();
if (!currentTerminalSize.equals(cachedTerminalSize)) {
cachedTerminalSize = currentTerminalSize;
updateTerminalSize(cachedTerminalSize.getColumns(), cachedTerminalSize.getRows());
return cachedTerminalSize;
}
return null;
}
use of org.apache.hadoop.hbase.hbtop.terminal.TerminalSize in project hbase by apache.
the class TopScreenPresenter method refresh.
public long refresh(boolean force) {
if (!force) {
long delay = EnvironmentEdgeManager.currentTime() - lastRefreshTimestamp;
if (delay < refreshDelay.get()) {
return refreshDelay.get() - delay;
}
}
TerminalSize newTerminalSize = topScreenView.doResizeIfNecessary();
if (newTerminalSize != null) {
updateTerminalLengthAndPageSize(newTerminalSize, topScreenView.getPageSize());
topScreenView.clearTerminal();
}
topScreenModel.refreshMetricsData();
paging.updateRecordsSize(topScreenModel.getRecords().size());
adjustFieldLengthIfNeeded();
topScreenView.showTopScreen(topScreenModel.getSummary(), getDisplayedHeaders(), getDisplayedRecords(), getSelectedRecord());
topScreenView.refreshTerminal();
lastRefreshTimestamp = EnvironmentEdgeManager.currentTime();
iterations++;
return refreshDelay.get();
}
use of org.apache.hadoop.hbase.hbtop.terminal.TerminalSize in project hbase by apache.
the class TopScreenView method doResizeIfNecessary.
@Nullable
@Override
public TerminalSize doResizeIfNecessary() {
TerminalSize terminalSize = super.doResizeIfNecessary();
if (terminalSize == null) {
return null;
}
updatePageSize(terminalSize);
return terminalSize;
}
use of org.apache.hadoop.hbase.hbtop.terminal.TerminalSize in project hbase by apache.
the class TopScreenView method getTerminalSize.
@Nullable
@Override
public TerminalSize getTerminalSize() {
TerminalSize terminalSize = super.getTerminalSize();
if (terminalSize == null) {
return null;
}
updatePageSize(terminalSize);
return terminalSize;
}
Aggregations