Search in sources :

Example 1 with TableDisplayCellHighlighter

use of com.twosigma.beakerx.table.highlight.TableDisplayCellHighlighter in project beakerx by twosigma.

the class TableDisplayTest method shouldSendCommMsgWhenAddHeatmapHighlighterForColumnChange.

@Test
public void shouldSendCommMsgWhenAddHeatmapHighlighterForColumnChange() throws Exception {
    // given;
    // when
    TableDisplayCellHighlighter heatmapHighlighter = TableDisplayCellHighlighter.getHeatmapHighlighter(COL_1, TableDisplayCellHighlighter.FULL_ROW);
    tableDisplay.addCellHighlighter(heatmapHighlighter);
    // then
    assertThat(tableDisplay.getCellHighlighters().get(0)).isEqualTo(heatmapHighlighter);
    LinkedHashMap model = getModelUpdate();
    assertThat(model.size()).isEqualTo(1);
    List actual = getValueAsList(model, CELL_HIGHLIGHTERS);
    Map column = (Map) actual.get(0);
    assertThat(column.get(HeatmapHighlighterSerializer.TYPE)).isEqualTo(HeatmapHighlighter.class.getSimpleName());
    assertThat(column.get(HeatmapHighlighterSerializer.STYLE)).isEqualTo(TableDisplayCellHighlighter.FULL_ROW.toString());
}
Also used : TableDisplayCellHighlighter(com.twosigma.beakerx.table.highlight.TableDisplayCellHighlighter) List(java.util.List) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) HeatmapHighlighter(com.twosigma.beakerx.table.highlight.HeatmapHighlighter) ThreeColorHeatmapHighlighter(com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 2 with TableDisplayCellHighlighter

use of com.twosigma.beakerx.table.highlight.TableDisplayCellHighlighter in project beakerx by twosigma.

the class TableDisplayTest method shouldSendCommMsgWhenRemoveAllCellHighlighters.

@Test
public void shouldSendCommMsgWhenRemoveAllCellHighlighters() throws Exception {
    // given;
    TableDisplayCellHighlighter uniqueEntriesHighlighter = TableDisplayCellHighlighter.getUniqueEntriesHighlighter(COL_1, TableDisplayCellHighlighter.FULL_ROW);
    TableDisplayCellHighlighter heatmapHighlighter = TableDisplayCellHighlighter.getHeatmapHighlighter(COL_1, 0, 8, Color.ORANGE, Color.PINK);
    ThreeColorHeatmapHighlighter colorHeatmapHighlighter = new ThreeColorHeatmapHighlighter(COL_1, TableDisplayCellHighlighter.SINGLE_COLUMN, 4, 6, 8, new Color(247, 106, 106), new Color(239, 218, 82), new Color(100, 189, 122));
    tableDisplay.addCellHighlighter(uniqueEntriesHighlighter);
    tableDisplay.addCellHighlighter(heatmapHighlighter);
    tableDisplay.addCellHighlighter(colorHeatmapHighlighter);
    kernel.clearMessages();
    // when
    tableDisplay.removeAllCellHighlighters();
    // then
    assertThat(tableDisplay.getCellHighlighters()).isEmpty();
    LinkedHashMap model = getModelUpdate();
    assertThat(model.size()).isEqualTo(1);
    List actual = getValueAsList(model, CELL_HIGHLIGHTERS);
    assertThat(actual).isEmpty();
}
Also used : ThreeColorHeatmapHighlighter(com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter) TableDisplayCellHighlighter(com.twosigma.beakerx.table.highlight.TableDisplayCellHighlighter) Color(com.twosigma.beakerx.chart.Color) List(java.util.List) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 3 with TableDisplayCellHighlighter

use of com.twosigma.beakerx.table.highlight.TableDisplayCellHighlighter in project beakerx by twosigma.

the class TableDisplayToJson method serializeCellHighlighters.

static Map<Object, Object> serializeCellHighlighters(List<TableDisplayCellHighlighter> list) {
    List result = new ArrayList();
    for (TableDisplayCellHighlighter item : list) {
        result.add(toJson(item));
    }
    Map<Object, Object> value = new LinkedHashMap<>();
    value.put(CELL_HIGHLIGHTERS, result);
    return value;
}
Also used : TableDisplayCellHighlighter(com.twosigma.beakerx.table.highlight.TableDisplayCellHighlighter) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap)

Example 4 with TableDisplayCellHighlighter

use of com.twosigma.beakerx.table.highlight.TableDisplayCellHighlighter in project beakerx by twosigma.

the class TableDisplayTest method shouldSendCommMsgWhenAddUniqueEntriesHighlighterForColumnChange.

@Test
public void shouldSendCommMsgWhenAddUniqueEntriesHighlighterForColumnChange() throws Exception {
    // given;
    TableDisplayCellHighlighter highlighter = TableDisplayCellHighlighter.getUniqueEntriesHighlighter(COL_1, TableDisplayCellHighlighter.FULL_ROW);
    // when
    tableDisplay.addCellHighlighter(highlighter);
    // then
    assertThat(tableDisplay.getCellHighlighters().get(0)).isEqualTo(highlighter);
    LinkedHashMap model = getModelUpdate();
    assertThat(model.size()).isEqualTo(1);
    List actual = getValueAsList(model, CELL_HIGHLIGHTERS);
    Map column = (Map) actual.get(0);
    assertThat(column.get(UniqueEntriesHighlighterSerializer.TYPE)).isEqualTo(UniqueEntriesHighlighter.class.getSimpleName());
    assertThat(column.get(UniqueEntriesHighlighterSerializer.STYLE)).isEqualTo(TableDisplayCellHighlighter.FULL_ROW.toString());
    assertThat(column.get(UniqueEntriesHighlighterSerializer.COL_NAME)).isEqualTo(COL_1);
}
Also used : TableDisplayCellHighlighter(com.twosigma.beakerx.table.highlight.TableDisplayCellHighlighter) UniqueEntriesHighlighter(com.twosigma.beakerx.table.highlight.UniqueEntriesHighlighter) List(java.util.List) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Aggregations

TableDisplayCellHighlighter (com.twosigma.beakerx.table.highlight.TableDisplayCellHighlighter)4 ArrayList (java.util.ArrayList)4 LinkedHashMap (java.util.LinkedHashMap)4 List (java.util.List)4 KernelTest (com.twosigma.beakerx.KernelTest)3 Test (org.junit.Test)3 ThreeColorHeatmapHighlighter (com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Color (com.twosigma.beakerx.chart.Color)1 HeatmapHighlighter (com.twosigma.beakerx.table.highlight.HeatmapHighlighter)1 UniqueEntriesHighlighter (com.twosigma.beakerx.table.highlight.UniqueEntriesHighlighter)1