Search in sources :

Example 1 with ColumnHideShowLayer

use of org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer 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 2 with ColumnHideShowLayer

use of org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer in project nebula.widgets.nattable by eclipse.

the class ShowColumnPositionsEventDiffTest method before.

@Before
public void before() {
    this.dataLayer = new DataLayerFixture(20, 20, 100, 40);
    this.hideShowLayer = new ColumnHideShowLayer(this.dataLayer);
    this.viewportLayer = new ViewportLayer(this.hideShowLayer);
    this.viewportLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 800, 400);
        }
    });
    this.viewportLayer.setOriginX(this.viewportLayer.getStartXOfColumnPosition(2));
    this.viewportLayer.setOriginY(this.viewportLayer.getStartYOfRowPosition(2));
    this.event = new ShowColumnPositionsEvent(this.dataLayer, Arrays.asList(new Integer[] { 2, 4, 7, 8, 9 }));
}
Also used : IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) Rectangle(org.eclipse.swt.graphics.Rectangle) ColumnHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) ShowColumnPositionsEvent(org.eclipse.nebula.widgets.nattable.hideshow.event.ShowColumnPositionsEvent) Before(org.junit.Before)

Example 3 with ColumnHideShowLayer

use of org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer 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 4 with ColumnHideShowLayer

use of org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer 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 5 with ColumnHideShowLayer

use of org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer in project nebula.widgets.nattable by eclipse.

the class HideSelectedColumnsTest method setUp.

@Before
public void setUp() {
    this.columnHideShowLayer = new ColumnHideShowLayer(new DataLayerFixture());
    this.selectionLayer = new SelectionLayer(this.columnHideShowLayer);
}
Also used : SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) ColumnHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer) Before(org.junit.Before)

Aggregations

ColumnHideShowLayer (org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer)31 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)23 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)22 ColumnReorderLayer (org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer)22 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)22 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)19 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)18 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 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)16 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)15 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)12 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)10