Search in sources :

Example 11 with Field

use of org.apache.hadoop.hbase.hbtop.field.Field in project hbase by apache.

the class FieldScreenPresenter method showField.

private void showField(int pos) {
    Field field = fields.get(pos);
    fieldScreenView.showField(pos, field, fieldDisplayMap.get(field), pos == currentPosition, headerMaxLength, descriptionMaxLength, moveMode);
}
Also used : Field(org.apache.hadoop.hbase.hbtop.field.Field)

Example 12 with Field

use of org.apache.hadoop.hbase.hbtop.field.Field in project hbase by apache.

the class FieldScreenPresenter method switchFieldDisplay.

public void switchFieldDisplay() {
    if (!moveMode) {
        Field field = fields.get(currentPosition);
        fieldDisplayMap.put(field, !fieldDisplayMap.get(field));
        showField(currentPosition);
        fieldScreenView.refreshTerminal();
    }
}
Also used : Field(org.apache.hadoop.hbase.hbtop.field.Field)

Example 13 with Field

use of org.apache.hadoop.hbase.hbtop.field.Field in project hbase by apache.

the class FieldScreenPresenter method arrowUp.

public void arrowUp() {
    if (currentPosition > 0) {
        currentPosition -= 1;
        if (moveMode) {
            Field tmp = fields.remove(currentPosition);
            fields.add(currentPosition + 1, tmp);
        }
        showField(currentPosition);
        showField(currentPosition + 1);
        fieldScreenView.refreshTerminal();
    }
}
Also used : Field(org.apache.hadoop.hbase.hbtop.field.Field)

Example 14 with Field

use of org.apache.hadoop.hbase.hbtop.field.Field in project hbase by apache.

the class TestFieldScreenPresenter method setup.

@Before
public void setup() {
    Field sortField = Mode.REGION.getDefaultSortField();
    fields = Mode.REGION.getFieldInfos().stream().map(FieldInfo::getField).collect(Collectors.toList());
    fieldDisplayMap = Mode.REGION.getFieldInfos().stream().collect(() -> new EnumMap<>(Field.class), (r, fi) -> r.put(fi.getField(), fi.isDisplayByDefault()), (r1, r2) -> {
    });
    fieldScreenPresenter = new FieldScreenPresenter(fieldScreenView, sortField, fields, fieldDisplayMap, resultListener, topScreenView);
    for (int i = 0; i < fields.size(); i++) {
        Field field = fields.get(i);
        if (field == sortField) {
            sortFieldPosition = i;
            break;
        }
    }
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) Mock(org.mockito.Mock) RunWith(org.junit.runner.RunWith) ArgumentMatchers.anyBoolean(org.mockito.ArgumentMatchers.anyBoolean) TopScreenView(org.apache.hadoop.hbase.hbtop.screen.top.TopScreenView) FieldInfo(org.apache.hadoop.hbase.hbtop.field.FieldInfo) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) ClassRule(org.junit.ClassRule) ArgumentMatchers.anyInt(org.mockito.ArgumentMatchers.anyInt) Before(org.junit.Before) InOrder(org.mockito.InOrder) EnumMap(java.util.EnumMap) HBaseClassTestRule(org.apache.hadoop.hbase.HBaseClassTestRule) Test(org.junit.Test) Category(org.junit.experimental.categories.Category) Collectors(java.util.stream.Collectors) Mockito.verify(org.mockito.Mockito.verify) List(java.util.List) MockitoJUnitRunner(org.mockito.runners.MockitoJUnitRunner) Field(org.apache.hadoop.hbase.hbtop.field.Field) Mode(org.apache.hadoop.hbase.hbtop.mode.Mode) Mockito.inOrder(org.mockito.Mockito.inOrder) SmallTests(org.apache.hadoop.hbase.testclassification.SmallTests) Field(org.apache.hadoop.hbase.hbtop.field.Field) EnumMap(java.util.EnumMap) FieldInfo(org.apache.hadoop.hbase.hbtop.field.FieldInfo) Before(org.junit.Before)

Aggregations

Field (org.apache.hadoop.hbase.hbtop.field.Field)14 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 FieldInfo (org.apache.hadoop.hbase.hbtop.field.FieldInfo)4 InterfaceAudience (org.apache.yetus.audience.InterfaceAudience)3 Arrays (java.util.Arrays)2 Collections (java.util.Collections)2 Map (java.util.Map)2 ClusterMetrics (org.apache.hadoop.hbase.ClusterMetrics)2 ServerMetrics (org.apache.hadoop.hbase.ServerMetrics)2 Record (org.apache.hadoop.hbase.hbtop.Record)2 RecordFilter (org.apache.hadoop.hbase.hbtop.RecordFilter)2 FieldValue (org.apache.hadoop.hbase.hbtop.field.FieldValue)2 Mode (org.apache.hadoop.hbase.hbtop.mode.Mode)2 Test (org.junit.Test)2 EnumMap (java.util.EnumMap)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Objects (java.util.Objects)1