Search in sources :

Example 46 with CompositeLayer

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

the class TextPainter_Examples method createNatTable2.

private void createNatTable2(Composite parent, final ICellPainter painter) {
    IDataProvider bodyDataProvider = new ExampleTextBodyDataProvider();
    DataLayer dataLayer = new DataLayer(bodyDataProvider);
    dataLayer.setRowHeightByPosition(0, 32);
    SelectionLayer selectionLayer = new SelectionLayer(dataLayer);
    ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
    ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(new ExampleHeaderDataProvider()), viewportLayer, selectionLayer, false);
    columnHeaderLayer.addConfiguration(new DefaultColumnHeaderLayerConfiguration() {

        @Override
        protected void addColumnHeaderStyleConfig() {
            addConfiguration(new DefaultColumnHeaderStyleConfiguration() {

                {
                    this.cellPainter = new BeveledBorderDecorator(painter);
                }
            });
        }
    });
    CompositeLayer compositeLayer = new CompositeLayer(1, 2);
    compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 0, 0);
    compositeLayer.setChildLayer(GridRegion.BODY, viewportLayer, 0, 1);
    NatTable natTable = new NatTable(parent, compositeLayer, false);
    natTable.addConfiguration(new DefaultNatTableStyleConfiguration() {

        {
            this.vAlign = VerticalAlignmentEnum.TOP;
            this.hAlign = HorizontalAlignmentEnum.LEFT;
            this.cellPainter = new LineBorderDecorator(painter);
        }
    });
    natTable.configure();
    GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
}
Also used : ColumnHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer) IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) CompositeLayer(org.eclipse.nebula.widgets.nattable.layer.CompositeLayer) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) LineBorderDecorator(org.eclipse.nebula.widgets.nattable.painter.cell.decorator.LineBorderDecorator) BeveledBorderDecorator(org.eclipse.nebula.widgets.nattable.painter.cell.decorator.BeveledBorderDecorator) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) DefaultColumnHeaderLayerConfiguration(org.eclipse.nebula.widgets.nattable.layer.config.DefaultColumnHeaderLayerConfiguration) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) DefaultColumnHeaderStyleConfiguration(org.eclipse.nebula.widgets.nattable.layer.config.DefaultColumnHeaderStyleConfiguration)

Aggregations

CompositeLayer (org.eclipse.nebula.widgets.nattable.layer.CompositeLayer)46 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)42 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)41 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)34 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)32 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)29 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)26 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)25 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)25 HashMap (java.util.HashMap)20 GridLayout (org.eclipse.swt.layout.GridLayout)20 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)19 Composite (org.eclipse.swt.widgets.Composite)19 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)17 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)17 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)16 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)15 ExtendedReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ExtendedReflectiveColumnPropertyAccessor)14 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)14 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)14