Search in sources :

Example 1 with Person

use of org.eclipse.nebula.widgets.nattable.dataset.person.Person in project nebula.widgets.nattable by eclipse.

the class DataChangeLayerIdIndexTest method shouldUpdateChangeOnSortAndSaveWithTemp.

@Test
public void shouldUpdateChangeOnSortAndSaveWithTemp() {
    // enable temp data storage to test update on save
    this.dataChangeLayer = new DataChangeLayer(this.dataLayer, new IdIndexKeyHandler<>(this.dataProvider, new IRowIdAccessor<Person>() {

        @Override
        public Serializable getRowId(Person rowObject) {
            return rowObject.getId();
        }
    }), true);
    assertEquals("Simpson", this.dataLayer.getDataValue(1, 2));
    this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 2, "Zoolander"));
    assertEquals("Simpson", this.dataLayer.getDataValue(1, 2));
    assertEquals("Zoolander", this.dataChangeLayer.getDataValueByPosition(1, 2));
    // sort via firstname
    // NOTE: this is because we are storing the data temporary and therefore
    // sorting for lastname would not respect the shown data.
    this.dataLayer.setDataValueByPosition(0, 2, "Yosefine");
    Collections.sort(this.dataModel, new Comparator<Person>() {

        @Override
        public int compare(Person o1, Person o2) {
            return o1.getFirstName().compareTo(o2.getFirstName());
        }
    });
    // fire event to trigger update of cached row indexes
    this.dataLayer.fireLayerEvent(new RowStructuralRefreshEvent(this.dataLayer));
    // now the dirty state should be on the last row
    assertEquals("Simpson", this.dataLayer.getDataValue(1, 17));
    assertEquals("Zoolander", this.dataChangeLayer.getDataValueByPosition(1, 17));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY));
    assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 17).hasLabel(DataChangeLayer.DIRTY));
    assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1));
    assertFalse("Row 2 is dirty", this.dataChangeLayer.isRowDirty(2));
    assertTrue("Row 17 is not dirty", this.dataChangeLayer.isRowDirty(17));
    assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 17));
    assertFalse("changed columns are empty", this.dataChangeLayer.changedColumns.isEmpty());
    assertFalse("changed rows are empty", this.dataChangeLayer.changedRows.isEmpty());
    assertFalse("changes are empty", this.dataChangeLayer.dataChanges.isEmpty());
    // check if discard is applied correctly
    this.dataChangeLayer.doCommand(new SaveDataChangesCommand());
    assertEquals("Zoolander", this.dataLayer.getDataValue(1, 17));
    assertEquals("Zoolander", this.dataChangeLayer.getDataValueByPosition(1, 17));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 17).hasLabel(DataChangeLayer.DIRTY));
    assertFalse("Column 1 is dirty", this.dataChangeLayer.isColumnDirty(1));
    assertFalse("Row 2 is dirty", this.dataChangeLayer.isRowDirty(2));
    assertFalse("Row 17 is dirty", this.dataChangeLayer.isRowDirty(17));
    assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 17));
    assertTrue("changed columns are not empty", this.dataChangeLayer.changedColumns.isEmpty());
    assertTrue("changed rows are not empty", this.dataChangeLayer.changedRows.isEmpty());
    assertTrue("changes are not empty", this.dataChangeLayer.dataChanges.isEmpty());
}
Also used : Serializable(java.io.Serializable) RowStructuralRefreshEvent(org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent) SaveDataChangesCommand(org.eclipse.nebula.widgets.nattable.datachange.command.SaveDataChangesCommand) UpdateDataCommand(org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand) Person(org.eclipse.nebula.widgets.nattable.dataset.person.Person) Test(org.junit.Test)

Example 2 with Person

use of org.eclipse.nebula.widgets.nattable.dataset.person.Person in project nebula.widgets.nattable by eclipse.

the class DataChangeLayerIdIndexTest method setup.

@Before
public void setup() {
    this.dataModel = PersonService.getFixedPersons();
    this.dataProvider = new ListDataProvider<>(this.dataModel, new ReflectiveColumnPropertyAccessor<>(new String[] { "firstName", "lastName", "gender", "married", "birthday" }));
    this.dataLayer = new DataLayer(this.dataProvider);
    this.dataChangeLayer = new DataChangeLayer(this.dataLayer, new IdIndexKeyHandler<>(this.dataProvider, new IRowIdAccessor<Person>() {

        @Override
        public Serializable getRowId(Person rowObject) {
            return rowObject.getId();
        }
    }), false);
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) Serializable(java.io.Serializable) Person(org.eclipse.nebula.widgets.nattable.dataset.person.Person) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) Before(org.junit.Before)

Example 3 with Person

use of org.eclipse.nebula.widgets.nattable.dataset.person.Person in project nebula.widgets.nattable by eclipse.

the class DataChangeLayerIdIndexTest method shouldUpdateOnMultiRowInsert.

@Test
public void shouldUpdateOnMultiRowInsert() {
    this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 1, "Lovejoy"));
    this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 3, "Lovejoy"));
    this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 5, "Lovejoy"));
    this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 7, "Lovejoy"));
    this.dataChangeLayer.doCommand(new UpdateDataCommand(this.dataChangeLayer, 1, 9, "Lovejoy"));
    assertEquals("Simpson", this.dataLayer.getDataValue(1, 0));
    assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 1));
    assertEquals("Simpson", this.dataLayer.getDataValue(1, 2));
    assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 3));
    assertEquals("Simpson", this.dataLayer.getDataValue(1, 4));
    assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 5));
    assertEquals("Simpson", this.dataLayer.getDataValue(1, 6));
    assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 7));
    assertEquals("Simpson", this.dataLayer.getDataValue(1, 8));
    assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 9));
    this.dataModel.add(9, new Person(44, "Nelson", "Muntz", Gender.MALE, false, new Date(), 100d));
    this.dataModel.add(7, new Person(43, "Nelson", "Muntz", Gender.MALE, false, new Date(), 100d));
    this.dataModel.add(5, new Person(42, "Nelson", "Muntz", Gender.MALE, false, new Date(), 100d));
    this.dataModel.add(3, new Person(41, "Nelson", "Muntz", Gender.MALE, false, new Date(), 100d));
    this.dataModel.add(1, new Person(40, "Nelson", "Muntz", Gender.MALE, false, new Date(), 100d));
    this.dataLayer.fireLayerEvent(new RowInsertEvent(this.dataLayer, new Range(1, 1), new Range(3, 3), new Range(5, 5), new Range(7, 7), new Range(9, 9)));
    assertEquals(23, this.dataModel.size());
    assertEquals("Simpson", this.dataLayer.getDataValue(1, 0));
    assertEquals("Muntz", this.dataLayer.getDataValue(1, 1));
    assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 2));
    assertEquals("Simpson", this.dataLayer.getDataValue(1, 3));
    assertEquals("Muntz", this.dataLayer.getDataValue(1, 4));
    assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 5));
    assertEquals("Simpson", this.dataLayer.getDataValue(1, 6));
    assertEquals("Muntz", this.dataLayer.getDataValue(1, 7));
    assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 8));
    assertEquals("Simpson", this.dataLayer.getDataValue(1, 9));
    assertEquals("Muntz", this.dataLayer.getDataValue(1, 10));
    assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 11));
    assertEquals("Simpson", this.dataLayer.getDataValue(1, 12));
    assertEquals("Muntz", this.dataLayer.getDataValue(1, 13));
    assertEquals("Lovejoy", this.dataLayer.getDataValue(1, 14));
    assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 0));
    assertEquals("Muntz", this.dataChangeLayer.getDataValueByPosition(1, 1));
    assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 2));
    assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 3));
    assertEquals("Muntz", this.dataChangeLayer.getDataValueByPosition(1, 4));
    assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 5));
    assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 6));
    assertEquals("Muntz", this.dataChangeLayer.getDataValueByPosition(1, 7));
    assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 8));
    assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 9));
    assertEquals("Muntz", this.dataChangeLayer.getDataValueByPosition(1, 10));
    assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 11));
    assertEquals("Simpson", this.dataChangeLayer.getDataValueByPosition(1, 12));
    assertEquals("Muntz", this.dataChangeLayer.getDataValueByPosition(1, 13));
    assertEquals("Lovejoy", this.dataChangeLayer.getDataValueByPosition(1, 14));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 0).hasLabel(DataChangeLayer.DIRTY));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 1).hasLabel(DataChangeLayer.DIRTY));
    assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 2).hasLabel(DataChangeLayer.DIRTY));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 3).hasLabel(DataChangeLayer.DIRTY));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 4).hasLabel(DataChangeLayer.DIRTY));
    assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 5).hasLabel(DataChangeLayer.DIRTY));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 6).hasLabel(DataChangeLayer.DIRTY));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 7).hasLabel(DataChangeLayer.DIRTY));
    assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 8).hasLabel(DataChangeLayer.DIRTY));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 9).hasLabel(DataChangeLayer.DIRTY));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 10).hasLabel(DataChangeLayer.DIRTY));
    assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 11).hasLabel(DataChangeLayer.DIRTY));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 12).hasLabel(DataChangeLayer.DIRTY));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 13).hasLabel(DataChangeLayer.DIRTY));
    assertTrue("Dirty label not set", this.dataChangeLayer.getConfigLabelsByPosition(1, 14).hasLabel(DataChangeLayer.DIRTY));
    assertFalse("Dirty label set", this.dataChangeLayer.getConfigLabelsByPosition(1, 15).hasLabel(DataChangeLayer.DIRTY));
    assertTrue("Column 1 is not dirty", this.dataChangeLayer.isColumnDirty(1));
    assertFalse("Row 0 is not dirty", this.dataChangeLayer.isRowDirty(0));
    assertFalse("Row 1 is not dirty", this.dataChangeLayer.isRowDirty(1));
    assertTrue("Row 2 is not dirty", this.dataChangeLayer.isRowDirty(2));
    assertFalse("Row 3 is not dirty", this.dataChangeLayer.isRowDirty(3));
    assertFalse("Row 4 is not dirty", this.dataChangeLayer.isRowDirty(4));
    assertTrue("Row 5 is not dirty", this.dataChangeLayer.isRowDirty(5));
    assertFalse("Row 6 is not dirty", this.dataChangeLayer.isRowDirty(6));
    assertFalse("Row 7 is not dirty", this.dataChangeLayer.isRowDirty(7));
    assertTrue("Row 8 is not dirty", this.dataChangeLayer.isRowDirty(8));
    assertFalse("Row 9 is not dirty", this.dataChangeLayer.isRowDirty(9));
    assertFalse("Row 10 is not dirty", this.dataChangeLayer.isRowDirty(10));
    assertTrue("Row 11 is not dirty", this.dataChangeLayer.isRowDirty(11));
    assertFalse("Row 12 is not dirty", this.dataChangeLayer.isRowDirty(12));
    assertFalse("Row 13 is not dirty", this.dataChangeLayer.isRowDirty(13));
    assertTrue("Row 14 is not dirty", this.dataChangeLayer.isRowDirty(14));
    assertFalse("Row 15 is not dirty", this.dataChangeLayer.isRowDirty(15));
    assertFalse("Row 16 is not dirty", this.dataChangeLayer.isRowDirty(16));
    assertFalse("Row 17 is not dirty", this.dataChangeLayer.isRowDirty(17));
    assertFalse("Row 18 is not dirty", this.dataChangeLayer.isRowDirty(18));
    assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 2));
    assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 5));
    assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 8));
    assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 11));
    assertTrue("Cell is not dirty", this.dataChangeLayer.isCellDirty(1, 14));
    assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(1, 4));
    assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(0, 2));
    assertFalse("Cell is dirty", this.dataChangeLayer.isCellDirty(2, 3));
    assertFalse("changed columns are empty", this.dataChangeLayer.changedColumns.isEmpty());
    assertFalse("changed rows are empty", this.dataChangeLayer.changedRows.isEmpty());
    assertFalse("changes are empty", this.dataChangeLayer.dataChanges.isEmpty());
}
Also used : RowInsertEvent(org.eclipse.nebula.widgets.nattable.layer.event.RowInsertEvent) UpdateDataCommand(org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand) Range(org.eclipse.nebula.widgets.nattable.coordinate.Range) Person(org.eclipse.nebula.widgets.nattable.dataset.person.Person) Date(java.util.Date) Test(org.junit.Test)

Example 4 with Person

use of org.eclipse.nebula.widgets.nattable.dataset.person.Person in project nebula.widgets.nattable by eclipse.

the class ConfigLabelProviderTest method testProvidedGridLabelsSortHeader.

@Test
public void testProvidedGridLabelsSortHeader() {
    SelectionLayer selectionLayer = new SelectionLayer(this.bodyDataLayer);
    GridLayer grid = new GridLayer(selectionLayer, new SortHeaderLayer<Person>(new ColumnHeaderLayer(this.columnHeaderDataLayer, this.bodyDataLayer, selectionLayer), new SortModelFixture()), this.rowHeaderDataLayer, this.cornerDataLayer);
    Collection<String> labels = grid.getProvidedLabels();
    assertEquals(19, labels.size());
    assertTrue(labels.contains(GridRegion.CORNER));
    assertTrue(labels.contains(GridRegion.COLUMN_HEADER));
    assertTrue(labels.contains(GridRegion.ROW_HEADER));
    assertTrue(labels.contains(GridRegion.BODY));
    assertTrue(labels.contains(AlternatingRowConfigLabelAccumulator.ODD_ROW_CONFIG_TYPE));
    assertTrue(labels.contains(AlternatingRowConfigLabelAccumulator.EVEN_ROW_CONFIG_TYPE));
    assertTrue(labels.contains(SelectionStyleLabels.SELECTION_ANCHOR_STYLE));
    assertTrue(labels.contains(SelectionStyleLabels.SELECTION_ANCHOR_GRID_LINE_STYLE));
    assertTrue(labels.contains(SelectionStyleLabels.COLUMN_FULLY_SELECTED_STYLE));
    assertTrue(labels.contains(SelectionStyleLabels.ROW_FULLY_SELECTED_STYLE));
    assertTrue(labels.contains(SelectionStyleLabels.FILL_HANDLE_CELL));
    assertTrue(labels.contains(SelectionStyleLabels.FILL_HANDLE_REGION));
    assertTrue(labels.contains(SelectionStyleLabels.COPY_BORDER_STYLE));
    assertTrue(labels.contains(DefaultSortConfiguration.SORT_CONFIG_TYPE));
    assertTrue(labels.contains(DefaultSortConfiguration.SORT_UP_CONFIG_TYPE));
    assertTrue(labels.contains(DefaultSortConfiguration.SORT_DOWN_CONFIG_TYPE));
    assertTrue(labels.contains(DefaultSortConfiguration.SORT_SEQ_CONFIG_TYPE + "0"));
    assertTrue(labels.contains(DefaultSortConfiguration.SORT_SEQ_CONFIG_TYPE + "1"));
    assertTrue(labels.contains(DefaultSortConfiguration.SORT_SEQ_CONFIG_TYPE + "2"));
}
Also used : SortModelFixture(org.eclipse.nebula.widgets.nattable.test.fixture.SortModelFixture) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) ColumnHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer) GridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer) Person(org.eclipse.nebula.widgets.nattable.dataset.person.Person) Test(org.junit.Test)

Example 5 with Person

use of org.eclipse.nebula.widgets.nattable.dataset.person.Person in project nebula.widgets.nattable by eclipse.

the class _5113_RowGroupingExample method createExampleControl.

@Override
public Control createExampleControl(Composite parent) {
    // Body
    // property names of the Person class
    String[] propertyNames = { "firstName", "lastName", "gender", "married", "birthday" };
    // mapping from property to label, needed for column header labels
    Map<String, String> propertyToLabelMap = new HashMap<>();
    propertyToLabelMap.put("firstName", "Firstname");
    propertyToLabelMap.put("lastName", "Lastname");
    propertyToLabelMap.put("gender", "Gender");
    propertyToLabelMap.put("married", "Married");
    propertyToLabelMap.put("birthday", "Birthday");
    // build the body layer stack
    // Usually you would create a new layer stack by extending
    // AbstractIndexLayerTransform and setting the ViewportLayer as
    // underlying layer. But in this case using the ViewportLayer directly
    // as body layer is also working.
    IRowDataProvider<Person> bodyDataProvider = new DefaultBodyDataProvider<>(getStaticPersonList(), propertyNames);
    DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
    ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(bodyDataLayer);
    ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(columnReorderLayer);
    RowHideShowLayer rowHideShowLayer = new RowHideShowLayer(columnHideShowLayer);
    RowGroupModel<Person> rowGroupModel = new RowGroupModel<>();
    rowGroupModel.setDataProvider(bodyDataProvider);
    RowGroupExpandCollapseLayer<Person> rowExpandCollapseLayer = new RowGroupExpandCollapseLayer<>(rowHideShowLayer, rowGroupModel);
    SelectionLayer selectionLayer = new SelectionLayer(rowExpandCollapseLayer);
    ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
    // Column header
    DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
    DefaultColumnHeaderDataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(defaultColumnHeaderDataProvider);
    ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
    // Row header
    DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyDataProvider);
    DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
    RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer, false);
    rowHeaderLayer.addConfiguration(new RowHeaderConfiguration());
    RowGroupHeaderLayer<Person> rowGroupHeaderLayer = new RowGroupHeaderLayer<>(rowHeaderLayer, selectionLayer, rowGroupModel);
    rowGroupHeaderLayer.setColumnWidth(20);
    // Create a group of rows for the model.
    RowGroup<Person> rowGroup = new RowGroup<>(rowGroupModel, "Simpson", false);
    rowGroup.addMemberRow(bodyDataProvider.getRowObject(0));
    rowGroup.addStaticMemberRow(bodyDataProvider.getRowObject(1));
    rowGroup.addMemberRow(bodyDataProvider.getRowObject(2));
    rowGroup.addMemberRow(bodyDataProvider.getRowObject(3));
    rowGroup.addMemberRow(bodyDataProvider.getRowObject(4));
    rowGroupModel.addRowGroup(rowGroup);
    rowGroup = new RowGroup<>(rowGroupModel, "Flanders", false);
    rowGroup.addMemberRow(bodyDataProvider.getRowObject(5));
    rowGroup.addStaticMemberRow(bodyDataProvider.getRowObject(6));
    rowGroup.addMemberRow(bodyDataProvider.getRowObject(7));
    rowGroup.addMemberRow(bodyDataProvider.getRowObject(8));
    rowGroupModel.addRowGroup(rowGroup);
    rowGroup = new RowGroup<>(rowGroupModel, "Lovejoy", true);
    rowGroup.addMemberRow(bodyDataProvider.getRowObject(9));
    rowGroup.addStaticMemberRow(bodyDataProvider.getRowObject(10));
    rowGroup.addMemberRow(bodyDataProvider.getRowObject(11));
    rowGroupModel.addRowGroup(rowGroup);
    // Corner
    final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(defaultColumnHeaderDataProvider, rowHeaderDataProvider);
    DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
    ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowGroupHeaderLayer, columnHeaderLayer);
    // Grid
    GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer, rowGroupHeaderLayer, cornerLayer);
    NatTable natTable = new NatTable(parent, gridLayer, false);
    natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
    natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
    natTable.configure();
    natTable.setTheme(new ModernNatTableThemeConfiguration());
    return natTable;
}
Also used : HashMap(java.util.HashMap) ColumnHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer) RowGroup(org.eclipse.nebula.widgets.nattable.group.model.RowGroup) HeaderMenuConfiguration(org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration) ColumnHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer) DefaultCornerDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider) RowGroupExpandCollapseLayer(org.eclipse.nebula.widgets.nattable.group.RowGroupExpandCollapseLayer) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) DefaultBodyDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) DefaultRowHeaderDataLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer) DefaultColumnHeaderDataLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer) RowGroupModel(org.eclipse.nebula.widgets.nattable.group.model.RowGroupModel) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) DefaultRowHeaderDataLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) ModernNatTableThemeConfiguration(org.eclipse.nebula.widgets.nattable.style.theme.ModernNatTableThemeConfiguration) ILayer(org.eclipse.nebula.widgets.nattable.layer.ILayer) ColumnReorderLayer(org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer) DefaultColumnHeaderDataLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer) DefaultRowHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider) RowHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer) CornerLayer(org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) GridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer) DefaultColumnHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider) RowGroupHeaderLayer(org.eclipse.nebula.widgets.nattable.group.RowGroupHeaderLayer) Person(org.eclipse.nebula.widgets.nattable.dataset.person.Person) RowHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer)

Aggregations

Person (org.eclipse.nebula.widgets.nattable.dataset.person.Person)55 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)31 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)29 HashMap (java.util.HashMap)25 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)25 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)25 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)25 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)23 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)23 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)22 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)21 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)21 ReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor)19 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)19 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)19 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)19 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)18 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)18 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)17 GridLayout (org.eclipse.swt.layout.GridLayout)16