Search in sources :

Example 41 with LabelStack

use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.

the class GroupByDataLayerTest method testTwoLevelGroupSortSummary.

@Test
public void testTwoLevelGroupSortSummary() {
    addSortingCapability();
    addSummaryConfiguration();
    // increase the money amount for all flanders to show that the sort
    // order is related to the summary value and not the groupBy value
    double value = 600.0d;
    for (int i = 10; i < this.sortedList.size(); i++) {
        if ((i - 10) % 2 == 0) {
            value -= 100.0d;
        }
        this.sortedList.get(i).setMoney(value);
    }
    // groupBy lastname
    this.groupByModel.addGroupByColumnIndex(1);
    // groupBy firstname
    this.groupByModel.addGroupByColumnIndex(0);
    // 18 data rows + 2 GroupBy rows lastname + 8 data rows firstname
    assertEquals(28, this.dataLayer.getRowCount());
    // Flanders
    int row = 0;
    Object o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Flanders", ((GroupByObject) o).getValue());
    LabelStack labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(2800.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 1;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Maude", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(800.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 4;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Ned", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 7;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Rodd", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(600.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 10;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Todd", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(400.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    // Simpsons
    row = 13;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Simpson", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 14;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Bart", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(300.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 18;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Homer", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(300.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 22;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Lisa", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(200.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 25;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Marge", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(200.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    // sort ascending by money
    this.sortModel.sort(2, SortDirectionEnum.ASC, false);
    // Simpsons
    row = 0;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Simpson", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 1;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Lisa", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(200.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 4;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Marge", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(200.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 7;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Bart", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(300.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 11;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Homer", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(300.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    // Flanders
    row = 15;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Flanders", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(2800.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 16;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Todd", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(400.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 19;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Rodd", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(600.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 22;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Maude", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(800.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 25;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Ned", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    // sort descending by money
    this.sortModel.sort(2, SortDirectionEnum.DESC, false);
    // Flanders
    row = 0;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Flanders", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(2800.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 1;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Ned", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 4;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Maude", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(800.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 7;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Rodd", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(600.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 10;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Todd", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(400.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    // Simpsons
    row = 13;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Simpson", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(1000.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 14;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Homer", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(300.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 18;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Bart", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(300.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 22;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Marge", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(200.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
    row = 25;
    o = this.dataLayer.getTreeList().get(row);
    assertTrue("Object is not a GroupByObject", o instanceof GroupByObject);
    assertEquals("Lisa", ((GroupByObject) o).getValue());
    labelStack = this.dataLayer.getConfigLabelsByPosition(2, row);
    assertEquals(200.0d, this.dataLayer.getDataValueByPosition(2, row, labelStack, false));
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) GroupByObject(org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByObject) GroupByObject(org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByObject) Test(org.junit.Test)

Example 42 with LabelStack

use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.

the class GroupByDataLayerTest method testConfigLabelsWithGroupingAndSummary.

@Test
public void testConfigLabelsWithGroupingAndSummary() {
    // groupBy lastname
    this.groupByModel.addGroupByColumnIndex(1);
    // add summary configuration
    addSummaryConfiguration();
    for (int row = 0; row < this.dataLayer.getRowCount(); row++) {
        for (int column = 0; column < this.dataLayer.getColumnCount(); column++) {
            LabelStack stack = this.dataLayer.getConfigLabelsByPosition(column, row);
            assertTrue("column label not found", stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column));
            if (row == 0 || row == 9) {
                // row 0 is groupBy for flanders, row 9 groupBy for simpsons
                assertTrue("groupBy object label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT));
                assertTrue("groupBy column label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column));
                if (column == 2) {
                    assertTrue("groupBy summary label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY));
                    assertTrue("groupBy summary column label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column));
                    // respect the label order
                    assertEquals(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column, stack.getLabels().get(0));
                    assertEquals(GroupByDataLayer.GROUP_BY_SUMMARY, stack.getLabels().get(1));
                    assertEquals(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column, stack.getLabels().get(2));
                    assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.getLabels().get(3));
                    assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.getLabels().get(4));
                } else {
                    assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY));
                    assertFalse("groupBy summary column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column));
                    // respect the label order
                    assertEquals(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column, stack.getLabels().get(0));
                    assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.getLabels().get(1));
                    assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.getLabels().get(2));
                }
            } else {
                assertFalse("groupBy object label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT));
                assertFalse("groupBy column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column));
                assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY));
                assertFalse("groupBy summary column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column));
            }
        }
    }
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) Test(org.junit.Test)

Example 43 with LabelStack

use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.

the class GroupByDataLayerTest method testConfigLabelsWithGroupingAndSummaryWithConditional.

@Test
public void testConfigLabelsWithGroupingAndSummaryWithConditional() {
    // groupBy lastname
    this.groupByModel.addGroupByColumnIndex(1);
    // add summary configuration
    addSummaryConfiguration();
    // add conditional styling labels
    addConditionalStyling();
    for (int row = 0; row < this.dataLayer.getRowCount(); row++) {
        for (int column = 0; column < this.dataLayer.getColumnCount(); column++) {
            LabelStack stack = this.dataLayer.getConfigLabelsByPosition(column, row);
            assertTrue("column label not found", stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column));
            if (row == 0 || row == 9) {
                // row 0 is groupBy for flanders, row 9 groupBy for simpsons
                assertTrue("groupBy object label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT));
                assertTrue("groupBy column label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column));
                if (column == 2) {
                    assertTrue("groupBy summary label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY));
                    assertTrue("groupBy summary column label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column));
                    // should have conditional formatting
                    if (row == 9) {
                        // respect the label order
                        assertEquals(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column, stack.getLabels().get(0));
                        assertEquals(GroupByDataLayer.GROUP_BY_SUMMARY, stack.getLabels().get(1));
                        assertEquals(MY_LABEL, stack.getLabels().get(2));
                        assertEquals(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column, stack.getLabels().get(3));
                        assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.getLabels().get(4));
                        assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.getLabels().get(5));
                    } else {
                        // respect the label order
                        assertEquals(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column, stack.getLabels().get(0));
                        assertEquals(GroupByDataLayer.GROUP_BY_SUMMARY, stack.getLabels().get(1));
                        assertEquals(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column, stack.getLabels().get(2));
                        assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.getLabels().get(3));
                        assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.getLabels().get(4));
                    }
                } else {
                    assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY));
                    assertFalse("groupBy summary column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column));
                    // respect the label order
                    assertEquals(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column, stack.getLabels().get(0));
                    assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.getLabels().get(1));
                    assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.getLabels().get(2));
                }
            } else {
                assertFalse("groupBy object label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT));
                assertFalse("groupBy column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column));
                assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY));
                assertFalse("groupBy summary column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column));
            }
        }
    }
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) Test(org.junit.Test)

Example 44 with LabelStack

use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.

the class GroupByDataLayerTest method testConfigLabelsWithGrouping.

@Test
public void testConfigLabelsWithGrouping() {
    // groupBy lastname
    this.groupByModel.addGroupByColumnIndex(1);
    for (int row = 0; row < this.dataLayer.getRowCount(); row++) {
        for (int column = 0; column < this.dataLayer.getColumnCount(); column++) {
            LabelStack stack = this.dataLayer.getConfigLabelsByPosition(column, row);
            assertTrue("column label not found", stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column));
            if (row == 0 || row == 9) {
                // row 0 is groupBy for flanders, row 9 groupBy for simpsons
                // there should be groupBy labels but no groupBySummary
                // labels
                assertTrue("groupBy object label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT));
                assertTrue("groupBy column label not found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column));
                // respect the label order
                assertEquals(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column, stack.getLabels().get(0));
                assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.getLabels().get(1));
                assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.getLabels().get(2));
            } else {
                assertFalse("groupBy object label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT));
                assertFalse("groupBy column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column));
            }
            assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY));
            assertFalse("groupBy summary column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column));
        }
    }
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) Test(org.junit.Test)

Example 45 with LabelStack

use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.

the class MultiCellEditDialogRunner method shouldOpenDefaultDialogWithoutIncrementDecrementBox.

public void shouldOpenDefaultDialogWithoutIncrementDecrementBox() {
    CellFixture cell = new CellFixture();
    cell.setBounds(new Rectangle(100, 100, 100, 20));
    cell.setConfigLabels(new LabelStack("Cell_Edit"));
    cell.setDataValue("123");
    cell.setDisplayMode(DisplayMode.NORMAL);
    TextCellEditor cellEditor = new TextCellEditor();
    IDisplayConverter dataTypeConverter = new DisplayConverter() {

        @Override
        public Object canonicalToDisplayValue(Object canonicalValue) {
            return canonicalValue;
        }

        @Override
        public Object displayToCanonicalValue(Object displayValue) {
            return displayValue;
        }
    };
    final Character newValue = Character.valueOf('4');
    IDataValidator dataValidator = new DataValidator() {

        @Override
        public boolean validate(int columnIndex, int rowIndex, Object newValue) {
            Assert.assertEquals(newValue, newValue);
            return false;
        }
    };
    Shell shell = new Shell(Display.getDefault(), SWT.H_SCROLL | SWT.V_SCROLL | SWT.RESIZE);
    ConfigRegistry configRegistry = new ConfigRegistry();
    configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, dataTypeConverter);
    configRegistry.registerConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, dataValidator);
    final CellEditDialog dialog = new CellEditDialog(shell, newValue, cell, cellEditor, configRegistry);
    if (!this.interactive) {
        Display.getDefault().asyncExec(new Runnable() {

            @Override
            public void run() {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                } finally {
                    dialog.close();
                }
            }
        });
    }
    dialog.open();
}
Also used : CellFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.CellFixture) LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) IDataValidator(org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator) DisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter) IDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter) Rectangle(org.eclipse.swt.graphics.Rectangle) IDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter) ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) Shell(org.eclipse.swt.widgets.Shell) IDataValidator(org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator) DataValidator(org.eclipse.nebula.widgets.nattable.data.validate.DataValidator) TextCellEditor(org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor)

Aggregations

LabelStack (org.eclipse.nebula.widgets.nattable.layer.LabelStack)80 Test (org.junit.Test)30 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)14 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)13 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)11 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)10 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)10 HashMap (java.util.HashMap)9 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)9 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)9 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)9 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)9 GridLayout (org.eclipse.swt.layout.GridLayout)9 Composite (org.eclipse.swt.widgets.Composite)9 AbstractRegistryConfiguration (org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration)8 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)8 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)8 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)8 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)8