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());
}
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();
}
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;
}
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);
}
Aggregations