Package org.eclipse.nebula.widgets.nattable.grid.layer

Examples of org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer


    public void comboBoxShouldCommitWhenAValueIsSelectedByClickingOnIt()
            throws Exception {
        if (SWTUtils.isRunningOnUnix()) {
            return;
        }
        DefaultGridLayer layerStack = new DefaultGridLayer(
                RowDataListFixture.getList(),
                RowDataListFixture.getPropertyNames(),
                RowDataListFixture.getPropertyToLabelMap());
        natTable = new NatTableFixture(layerStack, 1200, 300, false);

        // Enable editing
        natTable.enableEditingOnAllCells();

        // Calculate pixel value to click on
        int columnIndex = RowDataListFixture
                .getColumnIndexOfProperty(RowDataListFixture.PRICING_TYPE_PROP_NAME);
        int columnPosition = columnIndex + ROW_HEADER_COLUMN_COUNT;
        int rowPosition = 0 + COLUMN_HEADER_ROW_COUNT;
        int startX = natTable.getStartXOfColumnPosition(columnPosition);
        int startY = natTable.getStartYOfRowPosition(1);

        // Register combo box for the publish flag column
        DataLayer bodyDataLayer = (DataLayer) layerStack.getBodyDataLayer();
        natTable.registerLabelOnColumn(bodyDataLayer, columnIndex, TEST_LABEL);
        registerComboBox(
                natTable.getConfigRegistry(),
                new ComboBoxPainter(),
                new ComboBoxCellEditor(Arrays.asList(new PricingTypeBean("MN"),
View Full Code Here


    private ILayer layer;
    private ConfigRegistry configRegistry;

    @Before
    public void setUp() {
        DefaultGridLayer gridLayer = new GridLayerFixture();
        layer = gridLayer.getBodyLayer().getSelectionLayer();

        configRegistry = new ConfigRegistry();
        new DefaultNatTableStyleConfiguration()
                .configureRegistry(configRegistry);
    }
View Full Code Here

                throw new UnsupportedOperationException();
            }

        };

        gridLayer = new DefaultGridLayer(bodyDataProvider,
                GridLayerFixture.colHeaderDataProvider,
                GridLayerFixture.rowHeaderDataProvider,
                GridLayerFixture.cornerDataProvider);
        gridLayer.setClientAreaProvider(new IClientAreaProvider() {
View Full Code Here

     * resized.
     */
    @Test
    public void shouldAutoResizeCorrectlyIfMultipleColumnsAreSelected()
            throws Exception {
        GridLayer gridLayer = new DefaultGridLayer(
                RowDataListFixture.getList(),
                RowDataListFixture.getPropertyNames(),
                RowDataListFixture.getPropertyToLabelMap());
        setClientAreaProvider(gridLayer);

        // Resize grid column 1, 2
        gridLayer.doCommand(new ColumnResizeCommand(gridLayer, 1, 10));
        gridLayer.doCommand(new ColumnResizeCommand(gridLayer, 2, 10));
        assertEquals(10, gridLayer.getColumnWidthByPosition(1));
        assertEquals(10, gridLayer.getColumnWidthByPosition(2));

        // Fully select columns 1, 2
        SelectionLayer selectionLayer = ((DefaultBodyLayerStack) gridLayer
                .getBodyLayer()).getSelectionLayer();
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 0, 0,
                false, false));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 1, 0,
                true, false));
        assertEquals(2, selectionLayer.getFullySelectedColumnPositions().length);

        // Resize grid column 5
        gridLayer.doCommand(new ColumnResizeCommand(gridLayer, 5, 10));
        assertEquals(10, gridLayer.getColumnWidthByPosition(5));

        // Auto resize column 5
        InitializeAutoResizeColumnsCommand command = new InitializeAutoResizeColumnsCommand(
                gridLayer, 5, configRegistry, gcFactory);
        gridLayer.doCommand(command);

        // Columns 1 and 2 should not be resized
        assertEquals(10, gridLayer.getColumnWidthByPosition(1));
        assertEquals(10, gridLayer.getColumnWidthByPosition(2));
        assertTrue(gridLayer.getColumnWidthByPosition(5) > 10);
    }
View Full Code Here

    private ILayer layer;
    private ConfigRegistry configRegistry;

    @Before
    public void setUp() {
        DefaultGridLayer gridLayer = new GridLayerFixture();
        layer = gridLayer.getBodyLayer().getSelectionLayer();
        configRegistry = new ConfigRegistry();
        configRegistry.registerConfigAttribute(
                CellConfigAttributes.DISPLAY_CONVERTER,
                new DefaultDisplayConverter());
    }
View Full Code Here

    private DefaultGridLayer gridLayer;
    private ConfigRegistry configRegistry;

    @Before
    public void setUp() {
        gridLayer = new DefaultGridLayer(getBodyDataProvider(),
                GridLayerFixture.colHeaderDataProvider);
        gridLayer.setClientAreaProvider(new IClientAreaProvider() {

            public Rectangle getClientArea() {
                return new Rectangle(0, 0, 1050, 250);
View Full Code Here

        configRegistry.registerConfigAttribute(
                CellConfigAttributes.DISPLAY_CONVERTER,
                PricingTypeBean.getDisplayConverter());

        NatTableFixture natTableFixture = new NatTableFixture(
                new DefaultGridLayer(RowDataListFixture.getList(),
                        RowDataListFixture.getPropertyNames(),
                        RowDataListFixture.getPropertyToLabelMap()), false);
        natTableFixture.setConfigRegistry(configRegistry);
        natTableFixture.configure();
View Full Code Here

        bodyDataLayer = new BaseDataLayerFixture();
        columnHeaderDataLayer = new BaseDataLayerFixture();
        rowHeaderDataLayer = new BaseDataLayerFixture();
        cornerDataLayer = new BaseDataLayerFixture();

        gridLayerUnderTest = new DefaultGridLayer(bodyDataLayer,
                columnHeaderDataLayer, rowHeaderDataLayer, cornerDataLayer);
    }
View Full Code Here

    /**
     * @see ViewportLayerFixture#DEFAULT_CLIENT_AREA
     */
    @Test
    public void initBodyLayer() throws Exception {
        DefaultGridLayer gridLayer = new GridLayerFixture();

        ViewportLayer viewport = gridLayer.getBodyLayer().getViewportLayer();
        viewport.setClientAreaProvider(new IClientAreaProvider() {
            public Rectangle getClientArea() {
                return new Rectangle(0, 0, 160, 80);
            }
        });

        // Client area gets init when this command is fired
        gridLayer.doCommand(new InitializeClientAreaCommandFixture());

        Assert.assertEquals(160, viewport.getClientAreaWidth());
        Assert.assertEquals(80, viewport.getClientAreaHeight());

        Assert.assertEquals(160, viewport.getWidth());
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.