Search in sources :

Example 1 with SelectionLayer

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

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

use of org.eclipse.nebula.widgets.nattable.selection.SelectionLayer in project nebula.widgets.nattable by eclipse.

the class ConfigLabelProviderTest method testSelectionLabels.

@Test
public void testSelectionLabels() {
    SelectionLayer selectionLayer = new SelectionLayer(this.bodyDataLayer);
    Collection<String> labels = selectionLayer.getProvidedLabels();
    assertEquals(7, labels.size());
    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));
}
Also used : SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) Test(org.junit.Test)

Example 4 with SelectionLayer

use of org.eclipse.nebula.widgets.nattable.selection.SelectionLayer in project nebula.widgets.nattable by eclipse.

the class ConfigLabelProviderTest method testSummaryRowLabels.

@Test
public void testSummaryRowLabels() {
    SummaryRowLayer summaryRowLayer = new SummaryRowLayer(this.bodyDataLayer, new ConfigRegistry(), false);
    SelectionLayer selectionLayer = new SelectionLayer(summaryRowLayer);
    Collection<String> labels = selectionLayer.getProvidedLabels();
    assertEquals(13, labels.size());
    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(SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL));
    assertTrue(labels.contains(SummaryRowLayer.DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX + "0"));
    assertTrue(labels.contains(SummaryRowLayer.DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX + "1"));
    assertTrue(labels.contains(SummaryRowLayer.DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX + "2"));
    assertTrue(labels.contains(SummaryRowLayer.DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX + "3"));
    assertTrue(labels.contains(SummaryRowLayer.DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX + "4"));
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) SummaryRowLayer(org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowLayer) Test(org.junit.Test)

Example 5 with SelectionLayer

use of org.eclipse.nebula.widgets.nattable.selection.SelectionLayer 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)

Aggregations

SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)107 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)75 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)73 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)71 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)63 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)58 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)54 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)47 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)46 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)44 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)43 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)43 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)42 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)41 HashMap (java.util.HashMap)38 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)37 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)34 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)27 CompositeLayer (org.eclipse.nebula.widgets.nattable.layer.CompositeLayer)25 ColumnReorderLayer (org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer)25