Search in sources :

Example 6 with DefaultValue

use of net.sf.jtreemap.swing.DefaultValue in project beakerx by twosigma.

the class TreeMapNodeSerializerTest method serializeTooltipOfTreeMapNode_resultJsonHasTooltip.

@Test
public void serializeTooltipOfTreeMapNode_resultJsonHasTooltip() throws IOException {
    // when
    TreeMapNode treeMapNode = new TreeMapNode("010", 1, new DefaultValue(1.5));
    treeMapNode.setUserObject(values);
    treeMapNodeSerializer.serialize(treeMapNode, jgen, new DefaultSerializerProvider.Impl());
    jgen.flush();
    // then
    JsonNode actualObj = mapper.readTree(sw.toString());
    Assertions.assertThat(actualObj.has("tooltip")).isTrue();
    Assertions.assertThat(actualObj.get("tooltip").asText()).isEqualTo("some tooltip");
}
Also used : DefaultValue(net.sf.jtreemap.swing.DefaultValue) DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) TreeMapNode(net.sf.jtreemap.swing.TreeMapNode) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test)

Example 7 with DefaultValue

use of net.sf.jtreemap.swing.DefaultValue in project beakerx by twosigma.

the class TreeMapNodeSerializerTest method serializeColorOfTreeMapNode_resultJsonHasColor.

@Test
public void serializeColorOfTreeMapNode_resultJsonHasColor() throws IOException {
    // when
    TreeMapNode treeMapNode = new TreeMapNode("010", 1, new DefaultValue(1.5));
    treeMapNode.setUserObject(values);
    treeMapNodeSerializer.serialize(treeMapNode, jgen, new DefaultSerializerProvider.Impl());
    jgen.flush();
    // then
    JsonNode actualObj = mapper.readTree(sw.toString());
    Assertions.assertThat(actualObj.has("color")).isTrue();
}
Also used : DefaultValue(net.sf.jtreemap.swing.DefaultValue) DefaultSerializerProvider(com.fasterxml.jackson.databind.ser.DefaultSerializerProvider) TreeMapNode(net.sf.jtreemap.swing.TreeMapNode) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test)

Example 8 with DefaultValue

use of net.sf.jtreemap.swing.DefaultValue in project beakerx by twosigma.

the class TreeMapSerializerTest method initTestStubData.

@Before
public void initTestStubData() throws IOException {
    KernelManager.register(new KernelTest());
    sw = new StringWriter();
    jgen = mapper.getJsonFactory().createJsonGenerator(sw);
    treeMap = new TreeMap(new TreeMapNode("label", 1, new DefaultValue(1.5)));
}
Also used : DefaultValue(net.sf.jtreemap.swing.DefaultValue) StringWriter(java.io.StringWriter) KernelTest(com.twosigma.beakerx.KernelTest) TreeMapNode(net.sf.jtreemap.swing.TreeMapNode) TreeMap(com.twosigma.beakerx.chart.treemap.TreeMap) Before(org.junit.Before)

Example 9 with DefaultValue

use of net.sf.jtreemap.swing.DefaultValue in project beakerx by twosigma.

the class TreeMapTest method createWidget.

@Override
public TreeMap createWidget() {
    TreeMapNode node = new TreeMapNode("0");
    TreeMapNode node01 = new TreeMapNode("01");
    node01.add(new TreeMapNode("011", 1, new DefaultValue(1)));
    node.add(node01);
    TreeMap treeMap = new TreeMap(node);
    treeMap.display();
    kernel.clearMessages();
    return treeMap;
}
Also used : DefaultValue(net.sf.jtreemap.swing.DefaultValue) TreeMapNode(net.sf.jtreemap.swing.TreeMapNode)

Example 10 with DefaultValue

use of net.sf.jtreemap.swing.DefaultValue in project beakerx by twosigma.

the class GradientColorProviderTest method initStubData.

@Before
public void initStubData() {
    KernelManager.register(new KernelTest());
    treeMap = new TreeMap();
    treeMap.setRoot(new TreeMapNode("020", 2, new DefaultValue(2)));
    node01 = new TreeMapNode("010", 1, new DefaultValue(1));
}
Also used : DefaultValue(net.sf.jtreemap.swing.DefaultValue) KernelTest(com.twosigma.beakerx.KernelTest) TreeMapNode(net.sf.jtreemap.swing.TreeMapNode) TreeMap(com.twosigma.beakerx.chart.treemap.TreeMap) Before(org.junit.Before)

Aggregations

DefaultValue (net.sf.jtreemap.swing.DefaultValue)10 TreeMapNode (net.sf.jtreemap.swing.TreeMapNode)10 JsonNode (com.fasterxml.jackson.databind.JsonNode)6 DefaultSerializerProvider (com.fasterxml.jackson.databind.ser.DefaultSerializerProvider)6 Test (org.junit.Test)6 Before (org.junit.Before)3 KernelTest (com.twosigma.beakerx.KernelTest)2 TreeMap (com.twosigma.beakerx.chart.treemap.TreeMap)2 StringWriter (java.io.StringWriter)1