Search in sources :

Example 1 with LineBorderDecorator

use of org.eclipse.nebula.widgets.nattable.painter.cell.decorator.LineBorderDecorator in project nebula.widgets.nattable by eclipse.

the class TextPainter_Examples method createNatTable3.

@SuppressWarnings("unused")
private void createNatTable3(Composite parent, final ICellPainter painter) {
    IDataProvider bodyDataProvider = new ExampleHeaderDataProvider();
    DataLayer dataLayer = new DataLayer(bodyDataProvider);
    SelectionLayer selectionLayer = new SelectionLayer(dataLayer);
    ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
    ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(new DummyColumnHeaderDataProvider(bodyDataProvider)), viewportLayer, selectionLayer);
    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);
            this.font = GUIHelper.getFont(new FontData("Arial", 20, SWT.NORMAL));
        }
    });
    natTable.configure();
    GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
}
Also used : ColumnHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer) ILayer(org.eclipse.nebula.widgets.nattable.layer.ILayer) FontData(org.eclipse.swt.graphics.FontData) IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) CompositeLayer(org.eclipse.nebula.widgets.nattable.layer.CompositeLayer) DummyColumnHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DummyColumnHeaderDataProvider) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) LineBorderDecorator(org.eclipse.nebula.widgets.nattable.painter.cell.decorator.LineBorderDecorator) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) NatTable(org.eclipse.nebula.widgets.nattable.NatTable)

Example 2 with LineBorderDecorator

use of org.eclipse.nebula.widgets.nattable.painter.cell.decorator.LineBorderDecorator in project nebula.widgets.nattable by eclipse.

the class TextPainter_Examples method createNatTable.

private void createNatTable(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);
    ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(new DummyColumnHeaderDataProvider(bodyDataProvider)), viewportLayer, selectionLayer);
    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 : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) LineBorderDecorator(org.eclipse.nebula.widgets.nattable.painter.cell.decorator.LineBorderDecorator) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) ColumnHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer) ILayer(org.eclipse.nebula.widgets.nattable.layer.ILayer) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) NatTable(org.eclipse.nebula.widgets.nattable.NatTable) IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) CompositeLayer(org.eclipse.nebula.widgets.nattable.layer.CompositeLayer) DummyColumnHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DummyColumnHeaderDataProvider)

Example 3 with LineBorderDecorator

use of org.eclipse.nebula.widgets.nattable.painter.cell.decorator.LineBorderDecorator in project nebula.widgets.nattable by eclipse.

the class TextPainter_Examples method createVerticalNatTable.

@SuppressWarnings("unused")
private void createVerticalNatTable(Composite parent, final ICellPainter painter) {
    IDataProvider bodyDataProvider = new ExampleHeaderDataProvider();
    SelectionLayer selectionLayer = new SelectionLayer(new DataLayer(bodyDataProvider, 20, 100));
    ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
    ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(new DummyColumnHeaderDataProvider(bodyDataProvider), 20, 100), viewportLayer, selectionLayer);
    columnHeaderLayer.addConfiguration(new DefaultColumnHeaderLayerConfiguration() {

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

                {
                    this.cellPainter = new BeveledBorderDecorator(new VerticalTextPainter());
                }
            });
        }
    });
    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.MIDDLE;
            this.hAlign = HorizontalAlignmentEnum.LEFT;
            this.cellPainter = new LineBorderDecorator(painter);
            this.font = GUIHelper.getFont(new FontData("Arial", 20, SWT.NORMAL));
        }
    });
    natTable.configure();
    GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
}
Also used : ColumnHeaderLayer(org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer) FontData(org.eclipse.swt.graphics.FontData) IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) CompositeLayer(org.eclipse.nebula.widgets.nattable.layer.CompositeLayer) DummyColumnHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DummyColumnHeaderDataProvider) 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) VerticalTextPainter(org.eclipse.nebula.widgets.nattable.painter.cell.VerticalTextPainter)

Example 4 with LineBorderDecorator

use of org.eclipse.nebula.widgets.nattable.painter.cell.decorator.LineBorderDecorator 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

NatTable (org.eclipse.nebula.widgets.nattable.NatTable)4 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)4 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)4 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)4 CompositeLayer (org.eclipse.nebula.widgets.nattable.layer.CompositeLayer)4 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)4 LineBorderDecorator (org.eclipse.nebula.widgets.nattable.painter.cell.decorator.LineBorderDecorator)4 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)4 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)4 DummyColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DummyColumnHeaderDataProvider)3 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)2 DefaultColumnHeaderLayerConfiguration (org.eclipse.nebula.widgets.nattable.layer.config.DefaultColumnHeaderLayerConfiguration)2 DefaultColumnHeaderStyleConfiguration (org.eclipse.nebula.widgets.nattable.layer.config.DefaultColumnHeaderStyleConfiguration)2 BeveledBorderDecorator (org.eclipse.nebula.widgets.nattable.painter.cell.decorator.BeveledBorderDecorator)2 FontData (org.eclipse.swt.graphics.FontData)2 VerticalTextPainter (org.eclipse.nebula.widgets.nattable.painter.cell.VerticalTextPainter)1