Search in sources :

Example 1 with GroupedCellValue

use of org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue.GroupedCellValue in project kie-wb-common by kiegroup.

the class DynamicDataWithGroupingTest method testDataGrouping.

@Test
@SuppressWarnings("rawtypes")
public void testDataGrouping() {
    // [1][-][3] --> [1][x][3]
    // [1][2][3] --> [-][2][3]
    // [-][2][3] -->
    CellValue.GroupedCellValue gcv;
    CellValue<? extends Comparable<?>> cv = data.get(0).get(0);
    data.setMerged(true);
    data.applyModelGrouping(cv);
    assertEquals(data.size(), 2);
    cv = data.get(0).get(0);
    assertTrue(cv instanceof GroupedCellValue);
    gcv = (GroupedCellValue) cv;
    assertFalse(gcv.hasMultipleValues());
    assertEquals(cv.getValue(), "1");
    cv = data.get(0).get(1);
    assertTrue(cv instanceof GroupedCellValue);
    gcv = (GroupedCellValue) cv;
    assertTrue(gcv.hasMultipleValues());
    cv = data.get(0).get(2);
    assertTrue(cv instanceof GroupedCellValue);
    gcv = (GroupedCellValue) cv;
    assertFalse(gcv.hasMultipleValues());
    assertEquals(cv.getValue(), "3");
    cv = data.get(1).get(0);
    assertFalse(cv instanceof GroupedCellValue);
    assertEquals(cv.getValue(), "-");
    cv = data.get(1).get(1);
    assertFalse(cv instanceof GroupedCellValue);
    assertEquals(cv.getValue(), "2");
    cv = data.get(1).get(2);
    assertFalse(cv instanceof GroupedCellValue);
    assertEquals(cv.getValue(), "3");
}
Also used : GroupedCellValue(org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue.GroupedCellValue) CellValue(org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue) GroupedCellValue(org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue.GroupedCellValue) GroupedCellValue(org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue.GroupedCellValue) Test(org.junit.Test)

Example 2 with GroupedCellValue

use of org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue.GroupedCellValue in project kie-wb-common by kiegroup.

the class DynamicDataWithGroupingWithOtherwiseTest method testDataGrouping.

@Test
@SuppressWarnings("rawtypes")
public void testDataGrouping() {
    // [1][-][3] --> [1][x][x]
    // [1][2][*] --> [-][2][3]
    // [-][2][3] -->
    GroupedCellValue gcv;
    CellValue<? extends Comparable<?>> cv = data.get(0).get(0);
    data.setMerged(true);
    data.applyModelGrouping(cv);
    assertEquals(data.size(), 2);
    cv = data.get(0).get(0);
    assertTrue(cv instanceof GroupedCellValue);
    gcv = (GroupedCellValue) cv;
    assertFalse(gcv.hasMultipleValues());
    assertEquals(cv.getValue(), "1");
    cv = data.get(0).get(1);
    assertTrue(cv instanceof GroupedCellValue);
    gcv = (GroupedCellValue) cv;
    assertTrue(gcv.hasMultipleValues());
    cv = data.get(0).get(2);
    assertTrue(cv instanceof GroupedCellValue);
    gcv = (GroupedCellValue) cv;
    assertTrue(gcv.hasMultipleValues());
    assertEquals(cv.getValue(), "3");
    cv = data.get(1).get(0);
    assertFalse(cv instanceof GroupedCellValue);
    assertEquals(cv.getValue(), "-");
    cv = data.get(1).get(1);
    assertFalse(cv instanceof GroupedCellValue);
    assertEquals(cv.getValue(), "2");
    cv = data.get(1).get(2);
    assertFalse(cv instanceof GroupedCellValue);
    assertEquals(cv.getValue(), "3");
}
Also used : GroupedCellValue(org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue.GroupedCellValue) Test(org.junit.Test)

Example 3 with GroupedCellValue

use of org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue.GroupedCellValue in project kie-wb-common by kiegroup.

the class DynamicDataTestsWithGrouping method testDataGrouping.

@Test
@SuppressWarnings("rawtypes")
public void testDataGrouping() {
    // [1][-][3] --> [1][x][3]
    // [1][2][3] --> [-][2][3]
    // [-][2][3] -->
    CellValue.GroupedCellValue gcv;
    CellValue<? extends Comparable<?>> cv = data.get(0).get(0);
    data.setMerged(true);
    data.applyModelGrouping(cv);
    assertEquals(data.size(), 2);
    cv = data.get(0).get(0);
    assertTrue(cv instanceof GroupedCellValue);
    gcv = (GroupedCellValue) cv;
    assertFalse(gcv.hasMultipleValues());
    assertEquals(cv.getValue(), "1");
    cv = data.get(0).get(1);
    assertTrue(cv instanceof GroupedCellValue);
    gcv = (GroupedCellValue) cv;
    assertTrue(gcv.hasMultipleValues());
    cv = data.get(0).get(2);
    assertTrue(cv instanceof GroupedCellValue);
    gcv = (GroupedCellValue) cv;
    assertFalse(gcv.hasMultipleValues());
    assertEquals(cv.getValue(), "3");
    cv = data.get(1).get(0);
    assertFalse(cv instanceof GroupedCellValue);
    assertEquals(cv.getValue(), "-");
    cv = data.get(1).get(1);
    assertFalse(cv instanceof GroupedCellValue);
    assertEquals(cv.getValue(), "2");
    cv = data.get(1).get(2);
    assertFalse(cv instanceof GroupedCellValue);
    assertEquals(cv.getValue(), "3");
}
Also used : GroupedCellValue(org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue.GroupedCellValue) CellValue(org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue) GroupedCellValue(org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue.GroupedCellValue) GroupedCellValue(org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue.GroupedCellValue) Test(org.junit.Test)

Example 4 with GroupedCellValue

use of org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue.GroupedCellValue in project kie-wb-common by kiegroup.

the class DynamicDataTestsWithGroupingWithOtherwise method testDataGrouping.

@Test
@SuppressWarnings("rawtypes")
public void testDataGrouping() {
    // [1][-][3] --> [1][x][x]
    // [1][2][*] --> [-][2][3]
    // [-][2][3] -->
    GroupedCellValue gcv;
    CellValue<? extends Comparable<?>> cv = data.get(0).get(0);
    data.setMerged(true);
    data.applyModelGrouping(cv);
    assertEquals(data.size(), 2);
    cv = data.get(0).get(0);
    assertTrue(cv instanceof GroupedCellValue);
    gcv = (GroupedCellValue) cv;
    assertFalse(gcv.hasMultipleValues());
    assertEquals(cv.getValue(), "1");
    cv = data.get(0).get(1);
    assertTrue(cv instanceof GroupedCellValue);
    gcv = (GroupedCellValue) cv;
    assertTrue(gcv.hasMultipleValues());
    cv = data.get(0).get(2);
    assertTrue(cv instanceof GroupedCellValue);
    gcv = (GroupedCellValue) cv;
    assertTrue(gcv.hasMultipleValues());
    assertEquals(cv.getValue(), "3");
    cv = data.get(1).get(0);
    assertFalse(cv instanceof GroupedCellValue);
    assertEquals(cv.getValue(), "-");
    cv = data.get(1).get(1);
    assertFalse(cv instanceof GroupedCellValue);
    assertEquals(cv.getValue(), "2");
    cv = data.get(1).get(2);
    assertFalse(cv instanceof GroupedCellValue);
    assertEquals(cv.getValue(), "3");
}
Also used : GroupedCellValue(org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue.GroupedCellValue) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 GroupedCellValue (org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue.GroupedCellValue)4 CellValue (org.kie.workbench.common.widgets.decoratedgrid.client.widget.CellValue)2