Search in sources :

Example 1 with DataLayer

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

the class BlinkLayerTest method setUp.

@Before
public void setUp() {
    this.display = Display.getDefault();
    this.dataList = new LinkedList<BlinkingRowDataFixture>();
    IColumnPropertyAccessor<BlinkingRowDataFixture> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<BlinkingRowDataFixture>(RowDataListFixture.getPropertyNames());
    this.listDataProvider = new ListDataProvider<BlinkingRowDataFixture>(this.dataList, columnPropertyAccessor);
    this.propertyChangeListener = getPropertyChangeListener();
    this.dataLayer = new DataLayer(this.listDataProvider);
    this.layerUnderTest = new BlinkLayer<BlinkingRowDataFixture>(this.dataLayer, this.listDataProvider, new IRowIdAccessor<BlinkingRowDataFixture>() {

        @Override
        public Serializable getRowId(BlinkingRowDataFixture rowObject) {
            return rowObject.getSecurity_id();
        }
    }, columnPropertyAccessor, this.configRegistry);
    this.layerUnderTest.blinkingEnabled = true;
    registerBlinkConfigTypes();
    load10Rows();
}
Also used : BlinkingRowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.BlinkingRowDataFixture) IRowIdAccessor(org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) Before(org.junit.Before)

Example 2 with DataLayer

use of org.eclipse.nebula.widgets.nattable.layer.DataLayer 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 DataLayer

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

the class ColumnChooserUtilsTest method getVisibleColumnEntries.

@Test
public void getVisibleColumnEntries() throws Exception {
    DefaultGridLayer gridLayer = new DefaultGridLayer(RowDataListFixture.getList(), RowDataListFixture.getPropertyNames(), RowDataListFixture.getPropertyToLabelMap());
    ColumnHideShowLayer columnHideShowLayer = gridLayer.getBodyLayer().getColumnHideShowLayer();
    ColumnHeaderLayer columnHeaderLayer = gridLayer.getColumnHeaderLayer();
    DataLayer columnHeaderDataLayer = (DataLayer) gridLayer.getColumnHeaderDataLayer();
    List<ColumnEntry> visibleEntries = ColumnChooserUtils.getVisibleColumnsEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer);
    // All columns shown
    assertEquals(RowDataListFixture.getPropertyNames().length, visibleEntries.size());
    // Hide a few columns
    gridLayer.getBodyLayer().getColumnHideShowLayer().hideColumnPositions(Arrays.asList(1, 2, 3));
    visibleEntries = ColumnChooserUtils.getVisibleColumnsEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer);
    assertEquals(RowDataListFixture.getPropertyNames().length - 3, visibleEntries.size());
    // Check the hidden entries
    List<ColumnEntry> hiddenEntries = ColumnChooserUtils.getHiddenColumnEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer);
    assertEquals(3, hiddenEntries.size());
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) ColumnHeaderLayerFixture.getDataLayer(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHeaderLayerFixture.getDataLayer) ColumnHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer) ColumnHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer) ColumnEntry(org.eclipse.nebula.widgets.nattable.columnChooser.ColumnEntry) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) Test(org.junit.Test)

Example 4 with DataLayer

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

the class CompositeFreezeLayerHideShowTest method setup.

@Before
public void setup() {
    this.dataLayer = new DataLayer(this.testDataProvider);
    this.reorderLayer = new ColumnReorderLayer(this.dataLayer);
    this.rowHideShowLayer = new RowHideShowLayer(this.reorderLayer);
    this.columnHideShowLayer = new ColumnHideShowLayer(this.rowHideShowLayer);
    this.selectionLayer = new SelectionLayer(this.columnHideShowLayer);
    this.viewportLayer = new ViewportLayer(this.selectionLayer);
    this.freezeLayer = new FreezeLayer(this.selectionLayer);
    this.compositeFreezeLayer = new CompositeFreezeLayer(this.freezeLayer, this.viewportLayer, this.selectionLayer);
    this.compositeFreezeLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 600, 150);
        }
    });
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) Rectangle(org.eclipse.swt.graphics.Rectangle) ColumnReorderLayer(org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer) ColumnHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) RowHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer) Before(org.junit.Before)

Example 5 with DataLayer

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

the class FreezeHandlerTest method setUp.

@Before
public void setUp() {
    final DataLayer bodyDataLayer = new DataLayer(new DummyBodyDataProvider(10, 10));
    final DefaultBodyLayerStack bodyLayer = new DefaultBodyLayerStack(bodyDataLayer);
    this.selectionLayer = bodyLayer.getSelectionLayer();
    this.freezeLayer = new FreezeLayer(this.selectionLayer);
    this.compositeFreezeLayer = new CompositeFreezeLayer(this.freezeLayer, bodyLayer.getViewportLayer(), bodyLayer.getSelectionLayer());
    this.viewportLayer = bodyLayer.getViewportLayer();
    this.commandHandler = new FreezeCommandHandler(this.freezeLayer, this.viewportLayer, this.selectionLayer);
    this.compositeFreezeLayer.registerCommandHandler(this.commandHandler);
    this.compositeFreezeLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 600, 400);
        }
    });
    // Shoot this command so that the viewport can be initialized
    this.compositeFreezeLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.H_SCROLL | SWT.V_SCROLL)));
}
Also used : DummyBodyDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) Shell(org.eclipse.swt.widgets.Shell) IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) ClientAreaResizeCommand(org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand) CompositeFreezeLayer(org.eclipse.nebula.widgets.nattable.freeze.CompositeFreezeLayer) FreezeLayer(org.eclipse.nebula.widgets.nattable.freeze.FreezeLayer) Rectangle(org.eclipse.swt.graphics.Rectangle) CompositeFreezeLayer(org.eclipse.nebula.widgets.nattable.freeze.CompositeFreezeLayer) DefaultBodyLayerStack(org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack) Before(org.junit.Before)

Aggregations

DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)227 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)150 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)99 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)96 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)93 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)91 HashMap (java.util.HashMap)83 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)82 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)78 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)77 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)77 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)76 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)75 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)75 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)74 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)74 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)70 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)64 Test (org.junit.Test)62 GridLayout (org.eclipse.swt.layout.GridLayout)56