Search in sources :

Example 1 with ColumnReorderLayer

use of org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer in project nebula.widgets.nattable by eclipse.

the class HierarchicalTreeLayerTest method setup.

@Before
public void setup() {
    // de-normalize the object graph without parent structure objects
    this.data = HierarchicalHelper.deNormalize(CarService.getInput(), false, CarService.PROPERTY_NAMES_COMPACT);
    HierarchicalReflectiveColumnPropertyAccessor columnPropertyAccessor = new HierarchicalReflectiveColumnPropertyAccessor(CarService.PROPERTY_NAMES_COMPACT);
    this.bodyDataProvider = new ListDataProvider<>(this.data, columnPropertyAccessor);
    HierarchicalSpanningDataProvider spanningDataProvider = new HierarchicalSpanningDataProvider(this.bodyDataProvider, CarService.PROPERTY_NAMES_COMPACT);
    this.bodyDataLayer = new SpanningDataLayer(spanningDataProvider);
    // simply apply labels for every column by index
    this.bodyDataLayer.setConfigLabelAccumulator(new ColumnLabelAccumulator());
    this.columnReorderLayer = new ColumnReorderLayer(this.bodyDataLayer);
    this.selectionLayer = new SelectionLayer(this.columnReorderLayer);
    this.treeLayer = new HierarchicalTreeLayer(this.selectionLayer, this.data, CarService.PROPERTY_NAMES_COMPACT);
    this.layerListener = new LayerListenerFixture();
    this.treeLayer.addLayerListener(this.layerListener);
}
Also used : SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) ColumnReorderLayer(org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture) ColumnLabelAccumulator(org.eclipse.nebula.widgets.nattable.layer.cell.ColumnLabelAccumulator) SpanningDataLayer(org.eclipse.nebula.widgets.nattable.layer.SpanningDataLayer) Before(org.junit.Before)

Example 2 with ColumnReorderLayer

use of org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer 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 3 with ColumnReorderLayer

use of org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer in project nebula.widgets.nattable by eclipse.

the class FreezeLayerTest method setup.

@Before
public void setup() {
    this.reorderLayer = new ColumnReorderLayer(new BaseDataLayerFixture(10, 10));
    this.hideShowLayer = new ColumnHideShowLayer(this.reorderLayer);
    this.freezeLayer = new FreezeLayer(this.hideShowLayer);
    this.freezeLayer.setTopLeftPosition(1, 0);
    this.freezeLayer.setBottomRightPosition(3, 3);
}
Also used : BaseDataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture) FreezeLayer(org.eclipse.nebula.widgets.nattable.freeze.FreezeLayer) ColumnReorderLayer(org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer) ColumnHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer) Before(org.junit.Before)

Example 4 with ColumnReorderLayer

use of org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer in project nebula.widgets.nattable by eclipse.

the class ColumnGroupReorderLayerTest method setUp.

@Before
public void setUp() {
    this.modelFixture = new ColumnGroupModelFixture();
    this.reorderLayer = new ColumnReorderLayer(new BaseDataLayerFixture(24, 20));
    this.layer = new ColumnGroupReorderLayer(this.reorderLayer, this.modelFixture);
}
Also used : BaseDataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture) ColumnGroupModelFixture(org.eclipse.nebula.widgets.nattable.test.fixture.group.ColumnGroupModelFixture) ColumnReorderLayer(org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer) Before(org.junit.Before)

Example 5 with ColumnReorderLayer

use of org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer in project nebula.widgets.nattable by eclipse.

the class MultiColumnResizeCommandTest method getColumnWidthWhenTheColumnPositionsHaveBeenConverted.

@Test
public void getColumnWidthWhenTheColumnPositionsHaveBeenConverted() {
    DataLayerFixture dataLayer = new DataLayerFixture();
    // Indexes re-ordered: 4 1 0 2 3
    ColumnReorderLayer reorderLayerFixture = new ColumnReorderLayerFixture(dataLayer);
    MultiColumnResizeCommand resizeCommand = new MultiColumnResizeCommand(reorderLayerFixture, new int[] { 1, 2 }, new int[] { 100, 150 });
    reorderLayerFixture.doCommand(resizeCommand);
    // As the Commands goes down the stack - positions might get converted
    // to entirely different values.
    assertEquals(-1, resizeCommand.getCommonColumnWidth());
    assertEquals(-1, resizeCommand.getColumnWidth(5));
    assertEquals(-1, resizeCommand.getColumnWidth(12));
    assertEquals(100, resizeCommand.getColumnWidth(1));
    assertEquals(150, resizeCommand.getColumnWidth(0));
}
Also used : DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) ColumnReorderLayer(org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer) ColumnReorderLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnReorderLayerFixture) Test(org.junit.Test)

Aggregations

ColumnReorderLayer (org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer)36 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)25 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)25 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)24 ColumnHideShowLayer (org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer)22 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)21 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)21 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)18 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)18 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)18 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)18 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)18 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)18 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)16 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)14 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)14 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)14 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)14 HashMap (java.util.HashMap)13 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)11