Search in sources :

Example 1 with TerminalSize

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);
}
Also used : TerminalSize(org.apache.hadoop.hbase.hbtop.terminal.TerminalSize) FieldInfo(org.apache.hadoop.hbase.hbtop.field.FieldInfo) Before(org.junit.Before)

Example 2 with TerminalSize

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;
}
Also used : TerminalSize(org.apache.hadoop.hbase.hbtop.terminal.TerminalSize) Nullable(edu.umd.cs.findbugs.annotations.Nullable)

Example 3 with TerminalSize

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();
}
Also used : TerminalSize(org.apache.hadoop.hbase.hbtop.terminal.TerminalSize)

Example 4 with TerminalSize

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;
}
Also used : TerminalSize(org.apache.hadoop.hbase.hbtop.terminal.TerminalSize) Nullable(edu.umd.cs.findbugs.annotations.Nullable)

Example 5 with 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;
}
Also used : TerminalSize(org.apache.hadoop.hbase.hbtop.terminal.TerminalSize) Nullable(edu.umd.cs.findbugs.annotations.Nullable)

Aggregations

TerminalSize (org.apache.hadoop.hbase.hbtop.terminal.TerminalSize)6 Nullable (edu.umd.cs.findbugs.annotations.Nullable)3 StringTokenizer (java.util.StringTokenizer)1 FieldInfo (org.apache.hadoop.hbase.hbtop.field.FieldInfo)1 Before (org.junit.Before)1