Search in sources :

Example 6 with ConfigRegistry

use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.

the class AutoResizeColumnsTest method setUp.

@Before
public void setUp() {
    this.configRegistry = new ConfigRegistry();
    new DefaultNatTableStyleConfiguration().configureRegistry(this.configRegistry);
    this.img = new Image(Display.getDefault(), new Rectangle(0, 0, 200, 150));
    this.gcFactory = new GCFactory(this.img);
    // Use a common, foxed width font to avoid failing the test on a
    // different platform
    Font normalFont = GUIHelper.getFont(new FontData("Courier", 8, SWT.NORMAL));
    Style cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.FONT, normalFont);
    this.configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL);
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) GCFactory(org.eclipse.nebula.widgets.nattable.util.GCFactory) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) FontData(org.eclipse.swt.graphics.FontData) Rectangle(org.eclipse.swt.graphics.Rectangle) Style(org.eclipse.nebula.widgets.nattable.style.Style) Image(org.eclipse.swt.graphics.Image) Font(org.eclipse.swt.graphics.Font) Before(org.junit.Before)

Example 7 with ConfigRegistry

use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.

the class RowSearchStrategyTest method setUp.

@Before
public void setUp() {
    this.gridLayer = new GridLayerFixture();
    this.layer = this.gridLayer.getBodyLayer().getSelectionLayer();
    this.configRegistry = new ConfigRegistry();
    new DefaultNatTableStyleConfiguration().configureRegistry(this.configRegistry);
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) Before(org.junit.Before)

Example 8 with ConfigRegistry

use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.

the class SelectionSearchStrategyTest method setUp.

@Before
public void setUp() {
    this.bodyDataProvider = new IDataProvider() {

        @Override
        public int getColumnCount() {
            return GridLayerFixture.bodyDataProvider.getColumnCount();
        }

        @Override
        public int getRowCount() {
            return GridLayerFixture.bodyDataProvider.getRowCount();
        }

        @Override
        public Object getDataValue(int columnIndex, int rowIndex) {
            if (columnIndex == 0 || columnIndex == 9) {
                return CELL_VALUE;
            }
            return GridLayerFixture.bodyDataProvider.getDataValue(columnIndex, rowIndex);
        }

        @Override
        public void setDataValue(int columnIndex, int rowIndex, Object newValue) {
            throw new UnsupportedOperationException();
        }
    };
    this.gridLayer = new DefaultGridLayer(this.bodyDataProvider, GridLayerFixture.colHeaderDataProvider, GridLayerFixture.rowHeaderDataProvider, GridLayerFixture.cornerDataProvider);
    this.gridLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 1050, 250);
        }
    });
    this.gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
    this.selectionLayer = this.gridLayer.getBodyLayer().getSelectionLayer();
    this.configRegistry = new ConfigRegistry();
    new DefaultNatTableStyleConfiguration().configureRegistry(this.configRegistry);
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) Shell(org.eclipse.swt.widgets.Shell) IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) ClientAreaResizeCommand(org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) Rectangle(org.eclipse.swt.graphics.Rectangle) IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) Before(org.junit.Before)

Example 9 with ConfigRegistry

use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.

the class SummaryRowIntegrationTest method initLayerStackWithSummaryRow.

@Before
public void initLayerStackWithSummaryRow() {
    this.dataList = RowDataListFixture.getList().subList(0, 4);
    // Rows 0, 1, 2, 3; Summary row would be position 4
    assertEquals(4, this.dataList.size());
    this.dataProvider = new ListDataProvider<RowDataFixture>(this.dataList, new ReflectiveColumnPropertyAccessor<RowDataFixture>(RowDataListFixture.getPropertyNames()));
    IConfigRegistry configRegistry = new ConfigRegistry();
    this.dataLayer = new DataLayer(this.dataProvider);
    this.summaryRowLayer = new SummaryRowLayer(this.dataLayer, configRegistry);
    IUniqueIndexLayer columnReorderLayer = new ColumnReorderLayer(this.summaryRowLayer);
    IUniqueIndexLayer columnHideShowLayer = new ColumnHideShowLayer(columnReorderLayer);
    IUniqueIndexLayer selectionLayer = new SelectionLayer(columnHideShowLayer);
    this.layerStackWithSummary = new ViewportLayer(selectionLayer);
    // NatTableFixture initializes the client area
    this.natTable = new NatTableFixture(this.layerStackWithSummary, false);
    this.natTable.setConfigRegistry(configRegistry);
    this.natTable.addConfiguration(new TestSummaryRowConfiguration());
    this.natTable.configure();
}
Also used : NatTableFixture(org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture) ColumnReorderLayer(org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer) ColumnHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) IConfigRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) IConfigRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry) IUniqueIndexLayer(org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer) Before(org.junit.Before)

Example 10 with ConfigRegistry

use of org.eclipse.nebula.widgets.nattable.config.ConfigRegistry in project nebula.widgets.nattable by eclipse.

the class TickUpdateCommandHandlerTest method setup.

@Before
public void setup() {
    DataLayerFixture bodyDataLayer = new DataLayerFixture();
    this.selectionLayer = new SelectionLayer(bodyDataLayer);
    this.selectionLayer.setSelectedCell(1, 1);
    this.testConfigRegistry = new ConfigRegistry();
    this.testConfigRegistry.registerConfigAttribute(TickUpdateConfigAttributes.UPDATE_HANDLER, new TickUpdateHandlerFixture());
    this.testConfigRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE);
    registerCellStyleAccumulators(bodyDataLayer);
    this.commandHandler = new TickUpdateCommandHandler(this.selectionLayer);
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) TickUpdateHandlerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.TickUpdateHandlerFixture) Before(org.junit.Before)

Aggregations

ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)92 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)72 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)61 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)54 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)54 HashMap (java.util.HashMap)40 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)38 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)38 DefaultColumnHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLayer)34 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)34 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)33 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)33 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)33 GridLayout (org.eclipse.swt.layout.GridLayout)33 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)32 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)31 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)31 Composite (org.eclipse.swt.widgets.Composite)31 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)28 SelectionEvent (org.eclipse.swt.events.SelectionEvent)28