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

Examples of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell


                .getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
    }

    @Test
    public void getCellForACellInAColumnGroup() throws Exception {
        ILayerCell cell = columnGroupLayer.getCellByPosition(0, 0);

        assertEquals(TEST_GROUP_NAME_1, cell.getDataValue());
        assertEquals(0, cell.getBounds().x);
        assertEquals(0, cell.getBounds().y);
        assertEquals(200, cell.getBounds().width);
        assertEquals(20, cell.getBounds().height);

        cell = columnGroupLayer.getCellByPosition(1, 0);
        assertEquals(TEST_GROUP_NAME_1, cell.getDataValue());
        assertEquals(0, cell.getBounds().x);
        assertEquals(0, cell.getBounds().y);
        assertEquals(200, cell.getBounds().width);
        assertEquals(20, cell.getBounds().height);
    }
View Full Code Here


    }

    @Test
    public void getCellForACellNotInAColumnGroup() throws Exception {
        ILayerCell cell = columnGroupLayer.getCellByPosition(5, 0);

        assertEquals(500, cell.getBounds().x);
        assertEquals(0, cell.getBounds().y);
        assertEquals(200, cell.getBounds().width);
        assertEquals(20, cell.getBounds().height);
    }
View Full Code Here

    }

    @Test
    public void testGetLastSelectedCellWithSingleSelection() {
        this.selectionLayer.selectCell(1, 1, false, false);
        ILayerCell cell = EditUtils.getLastSelectedCell(this.selectionLayer);
        assertNotNull(cell);
        assertEquals(1, cell.getColumnIndex());
        assertEquals(1, cell.getRowIndex());
    }
View Full Code Here

    @Test
    public void testGetLastSelectedCellWithMultiSelection() {
        this.selectionLayer.selectCell(1, 1, false, true);
        this.selectionLayer.selectCell(2, 2, false, true);
        this.selectionLayer.selectCell(3, 3, false, true);
        ILayerCell cell = EditUtils.getLastSelectedCell(this.selectionLayer);
        assertNotNull(cell);
        assertEquals(3, cell.getColumnIndex());
        assertEquals(3, cell.getRowIndex());
    }
View Full Code Here

        assertTrue(classNames.contains("ViewportLayerFixture"));
    }

    @Test
    public void getCellByPosition() throws Exception {
        ILayerCell cell = layerFixture.getCellByPosition(3, 2);
        assertIsCorner(cell.getLayer());
        assertEquals("[3, 2]", cell.getDataValue());
        assertEquals(new Rectangle(15, 10, 5, 5), cell.getBounds()); // pixel
                                                                     // values
        assertEquals(DisplayMode.NORMAL, cell.getDisplayMode());

        // Get a cell from the body
        cell = layerFixture.getCellByPosition(8, 8);
        assertTrue(cell.getLayer() instanceof CompositeLayer);
        assertEquals("[3, 1]", cell.getDataValue());
        assertEquals(new Rectangle(310, 75, 100, 70), cell.getBounds());
        assertEquals(DisplayMode.NORMAL, cell.getDisplayMode());
        assertEquals(8, cell.getOriginColumnPosition());
        assertEquals(8, cell.getOriginRowPosition());
    }
View Full Code Here

    @Override
    public ILayerCell getCellByPosition(int columnPosition, int rowPosition) {
        int underlyingColumnPosition = localToUnderlyingColumnPosition(columnPosition);
        int underlyingRowPosition = localToUnderlyingRowPosition(rowPosition);
        ILayerCell cell = underlyingLayer.getCellByPosition(
                underlyingColumnPosition, underlyingRowPosition);
        if (cell != null) {
            cell = new TranslatedLayerCell(cell, this,
                    underlyingToLocalColumnPosition(underlyingLayer,
                            cell.getOriginColumnPosition()),
                    underlyingToLocalRowPosition(underlyingLayer,
                            cell.getOriginRowPosition()),
                    underlyingToLocalColumnPosition(underlyingLayer,
                            cell.getColumnPosition()),
                    underlyingToLocalRowPosition(underlyingLayer,
                            cell.getRowPosition()));
        }
        return cell;
    }
View Full Code Here

    }

    @Test
    public void testGetLastSelectedCellWithSingleSelection() {
        this.selectionLayer.selectCell(1, 1, false, false);
        ILayerCell cell = EditUtils.getLastSelectedCell(this.selectionLayer);
        assertNotNull(cell);
        assertEquals(1, cell.getColumnIndex());
        assertEquals(1, cell.getRowIndex());
    }
View Full Code Here

    @Test
    public void testGetLastSelectedCellWithMultiSelection() {
        this.selectionLayer.selectCell(1, 1, false, true);
        this.selectionLayer.selectCell(2, 2, false, true);
        this.selectionLayer.selectCell(3, 3, false, true);
        ILayerCell cell = EditUtils.getLastSelectedCell(this.selectionLayer);
        assertNotNull(cell);
        assertEquals(3, cell.getColumnIndex());
        assertEquals(3, cell.getRowIndex());
    }
View Full Code Here

    // Cell features

    @Override
    public ILayerCell getCellByPosition(int columnPosition, int rowPosition) {
        ILayerCell cell = underlyingLayer.getCellByPosition(
                localToUnderlyingColumnPosition(columnPosition),
                localToUnderlyingRowPosition(rowPosition));
        if (cell == null) {
            return null;
        }
        return new TranslatedLayerCell(cell, this,
                underlyingToLocalColumnPosition(underlyingLayer,
                        cell.getOriginColumnPosition()),
                underlyingToLocalRowPosition(underlyingLayer,
                        cell.getOriginRowPosition()),
                underlyingToLocalColumnPosition(underlyingLayer,
                        cell.getColumnPosition()),
                underlyingToLocalRowPosition(underlyingLayer,
                        cell.getRowPosition()));
    }
View Full Code Here

        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE,
                cellStyle, DisplayMode.NORMAL,
                AlternatingRowConfigLabelAccumulator.ODD_ROW_CONFIG_TYPE);

        // Check for background color styling
        ILayerCell cell = natTable.getCellByPosition(2, 2);
        IStyle cellStyle = configRegistry.getConfigAttribute(
                CellConfigAttributes.CELL_STYLE, cell.getDisplayMode(), cell
                        .getConfigLabels().getLabels());
        Assert.assertEquals(backgroundColor, cellStyle
                .getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR));

        // set up painter
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell

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.