Search in sources :

Example 61 with ColumnHeaderLayer

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

the class RenameColumnHelperTest method setup.

@Before
public void setup() {
    ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayerFixture();
    this.properties = new Properties();
    this.helper = new RenameColumnHelper(columnHeaderLayer);
}
Also used : RenameColumnHelper(org.eclipse.nebula.widgets.nattable.columnRename.RenameColumnHelper) ColumnHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer) ColumnHeaderLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHeaderLayerFixture) Properties(java.util.Properties) Before(org.junit.Before)

Example 62 with ColumnHeaderLayer

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

the class ConfigLabelProviderTest method testProvidedGridLabelsFilterHeader.

@Test
public void testProvidedGridLabelsFilterHeader() {
    SelectionLayer selectionLayer = new SelectionLayer(this.bodyDataLayer);
    GridLayer grid = new GridLayer(selectionLayer, new FilterRowHeaderComposite<Person>(new IFilterStrategy<Person>() {

        @Override
        public void applyFilter(Map<Integer, Object> filterIndexToObjectMap) {
        }
    }, new SortHeaderLayer<Person>(new ColumnHeaderLayer(this.columnHeaderDataLayer, this.bodyDataLayer, selectionLayer), new SortModelFixture()), this.columnHeaderDataLayer.getDataProvider(), new ConfigRegistry()), this.rowHeaderDataLayer, this.cornerDataLayer);
    Collection<String> labels = grid.getProvidedLabels();
    assertEquals(26, 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"));
    assertTrue(labels.contains("columnHeader"));
    assertTrue(labels.contains(GridRegion.FILTER_ROW));
    assertTrue(labels.contains(FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + "0"));
    assertTrue(labels.contains(FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + "1"));
    assertTrue(labels.contains(FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + "2"));
    assertTrue(labels.contains(FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + "3"));
    assertTrue(labels.contains(FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + "4"));
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) 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) IFilterStrategy(org.eclipse.nebula.widgets.nattable.filterrow.IFilterStrategy) SortHeaderLayer(org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer) GridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer) Person(org.eclipse.nebula.widgets.nattable.dataset.person.Person) Map(java.util.Map) Test(org.junit.Test)

Example 63 with ColumnHeaderLayer

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

the class ConfigLabelProviderTest method testProvidedGridLabelsColumnGroupHeader.

@Test
public void testProvidedGridLabelsColumnGroupHeader() {
    SelectionLayer selectionLayer = new SelectionLayer(this.bodyDataLayer);
    GridLayer grid = new GridLayer(selectionLayer, new ColumnGroupHeaderLayer(new ColumnHeaderLayer(this.columnHeaderDataLayer, this.bodyDataLayer, selectionLayer), selectionLayer, new ColumnGroupModel()), this.rowHeaderDataLayer, this.cornerDataLayer);
    Collection<String> labels = grid.getProvidedLabels();
    assertEquals(16, labels.size());
    assertTrue(labels.contains(GridRegion.CORNER));
    assertTrue(labels.contains(GridRegion.COLUMN_HEADER));
    assertTrue(labels.contains(GridRegion.COLUMN_GROUP_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(DefaultColumnGroupHeaderLayerConfiguration.GROUP_COLLAPSED_CONFIG_TYPE));
    assertTrue(labels.contains(DefaultColumnGroupHeaderLayerConfiguration.GROUP_EXPANDED_CONFIG_TYPE));
}
Also used : ColumnGroupHeaderLayer(org.eclipse.nebula.widgets.nattable.group.ColumnGroupHeaderLayer) 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) ColumnGroupModel(org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel) Test(org.junit.Test)

Example 64 with ColumnHeaderLayer

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

the class RowStructuralChangeEventIntegrationTest method setUp.

@Before
public void setUp() {
    this.contents = new ArrayList<String>(Arrays.asList("one", "two", "three", "four", "five"));
    IDataProvider bodyDataProvider = new ListDataProvider<String>(this.contents, new IColumnAccessor<String>() {

        @Override
        public Object getDataValue(String rowObject, int columnIndex) {
            return rowObject;
        }

        @Override
        public void setDataValue(String rowObject, int columnIndex, Object newValue) {
        // ignore
        }

        @Override
        public int getColumnCount() {
            return 1;
        }
    });
    this.underlyingLayer = new DataLayer(bodyDataProvider);
    this.rowReorderLayer = new RowReorderLayer(this.underlyingLayer);
    this.rowHideShowLayer = new RowHideShowLayer(this.rowReorderLayer);
    this.selectionLayer = new SelectionLayer(this.rowHideShowLayer);
    this.viewportLayer = new ViewportLayer(this.selectionLayer);
    IDataProvider colDataProvider = new DummyColumnHeaderDataProvider(bodyDataProvider);
    ColumnHeaderLayer colHeader = new ColumnHeaderLayer(new DataLayer(colDataProvider), this.viewportLayer, this.selectionLayer);
    IDataProvider rowDataProvider = new DefaultRowHeaderDataProvider(bodyDataProvider);
    RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(new DataLayer(rowDataProvider), this.viewportLayer, this.selectionLayer);
    CornerLayer cornerLayer = new CornerLayer(new DataLayer(new DefaultCornerDataProvider(colDataProvider, rowDataProvider)), rowHeaderLayer, colHeader);
    GridLayer grid = new GridLayer(this.viewportLayer, colHeader, rowHeaderLayer, cornerLayer);
    this.natTable = new NatTable(new Shell(), grid);
    this.natTable.setSize(600, 600);
}
Also used : ListDataProvider(org.eclipse.nebula.widgets.nattable.data.ListDataProvider) ColumnHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer) DefaultRowHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider) DefaultCornerDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider) IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) RowReorderLayer(org.eclipse.nebula.widgets.nattable.reorder.RowReorderLayer) DummyColumnHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DummyColumnHeaderDataProvider) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) RowHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer) Shell(org.eclipse.swt.widgets.Shell) CornerLayer(org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) GridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer) RowHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer) Before(org.junit.Before)

Example 65 with ColumnHeaderLayer

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

the class ColumnHeaderLayerSelectionTest method shouldReturnAdditionalLabels.

@Test
public void shouldReturnAdditionalLabels() {
    ColumnHeaderLayer columnHeaderLayer = (ColumnHeaderLayer) this.gridLayer.getChildLayerByLayoutCoordinate(1, 0);
    columnHeaderLayer.setConfigLabelAccumulator(new IConfigLabelProvider() {

        @Override
        public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
            if (columnPosition == 2) {
                configLabels.addLabel("test");
            }
        }

        @Override
        public Collection<String> getProvidedLabels() {
            Set<String> result = new HashSet<String>();
            result.add("test");
            return result;
        }
    });
    LabelStack labelStack = this.gridLayer.getConfigLabelsByPosition(3, 0);
    assertEquals(2, labelStack.getLabels().size());
    assertTrue(labelStack.hasLabel("test"));
    assertTrue(labelStack.hasLabel(GridRegion.COLUMN_HEADER));
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) Set(java.util.Set) HashSet(java.util.HashSet) IConfigLabelProvider(org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelProvider) ColumnHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer) Collection(java.util.Collection) Test(org.junit.Test)

Aggregations

ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)101 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)93 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)88 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)82 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)77 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)73 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)73 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)73 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)73 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)72 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)66 HashMap (java.util.HashMap)63 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)63 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)62 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)61 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)58 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)53 GridLayout (org.eclipse.swt.layout.GridLayout)34 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)33 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)32