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

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


            // render row header w/ columnspan = 2
            // as in this case we ask the row header layer for the cell position
            // and the row header layer asks his data provider for the column
            // count
            // which should always return 1, we ask for row position 0
            ILayerCell cell = rowHeaderLayer.getCellByPosition(0, rowPosition);
            if (cell != null) {
                cell = new TransformedLayerCell(cell) {
                    @Override
                    public ILayer getLayer() {
                        return RowGroupHeaderLayer.this;
View Full Code Here


        ILayer childLayer = this.childLayerLayout[layoutCoordinate.x][layoutCoordinate.y];
        int childColumnPosition = compositeColumnPosition - getColumnPositionOffset(layoutCoordinate.x);
        int childRowPosition = compositeRowPosition - getRowPositionOffset(layoutCoordinate.y);

        ILayerCell cell = childLayer.getCellByPosition(
                childColumnPosition, childRowPosition);

        if (cell != null) {
            cell = new TranslatedLayerCell(
                    cell,
                    this,
                    underlyingToLocalColumnPosition(childLayer, cell.getOriginColumnPosition()),
                    underlyingToLocalRowPosition(childLayer, cell.getOriginRowPosition()),
                    underlyingToLocalColumnPosition(childLayer, cell.getColumnPosition()),
                    underlyingToLocalRowPosition(childLayer, cell.getRowPosition()));
        }

        return cell;
    }
View Full Code Here

        // Cell features

        for (int columnPosition = 0; columnPosition < expectedColumnCount; columnPosition++) {
            for (int rowPosition = 0; rowPosition < expectedRowCount; rowPosition++) {
                ILayerCell expectedCellByPosition = expectedLayer
                        .getCellByPosition(columnPosition, rowPosition);
                ILayerCell actualCellByPosition = actualLayer
                        .getCellByPosition(columnPosition, rowPosition);
                Assert.assertEquals("Cell by position (" + columnPosition
                        + ", " + rowPosition + ")", expectedCellByPosition,
                        actualCellByPosition);
            }
View Full Code Here

                AlternatingRowConfigLabelAccumulator.EVEN_ROW_CONFIG_TYPE);
    }

    @Test
    public void shouldFallBackToSuperTypeAttributesForEvenCell() {
        ILayerCell cell = natTable.getCellByPosition(2, 2);

        // Test cell even attributes
        final IStyle cellInstanceStyle = configRegistry.getConfigAttribute(
                CellConfigAttributes.CELL_STYLE, cell.getDisplayMode(), cell
                        .getConfigLabels().getLabels());
        Assert.assertEquals(Display.getDefault()
                .getSystemColor(SWT.COLOR_BLACK), cellInstanceStyle
                .getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR));
        Assert.assertEquals(
                Display.getDefault().getSystemColor(SWT.COLOR_GRAY),
                cellInstanceStyle
                        .getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR));

        // Test super cell attributes
        StyleProxy cellProxy = new CellStyleProxy(configRegistry,
                cell.getDisplayMode(), cell.getConfigLabels().getLabels());
        final Font fontAttribute = cellProxy
                .getAttributeValue(CellStyleAttributes.FONT);
        Assert.assertEquals(FONT_DATA.getName(),
                fontAttribute.getFontData()[0].getName());
        Assert.assertEquals(FONT_DATA.getStyle(),
View Full Code Here

                fontAttribute.getFontData()[0].getStyle());
    }

    @Test
    public void shouldFallBackToSuperTypeAttributesForOddCell() {
        ILayerCell cell = natTable.getCellByPosition(2, 3);

        // Test cell odd attributes
        final IStyle cellInstanceStyle = configRegistry.getConfigAttribute(
                CellConfigAttributes.CELL_STYLE, cell.getDisplayMode(), cell
                        .getConfigLabels().getLabels());
        Assert.assertEquals(
                Display.getDefault().getSystemColor(SWT.COLOR_RED),
                cellInstanceStyle
                        .getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR));

        // Test super odd attributes
        StyleProxy cellProxy = new CellStyleProxy(configRegistry,
                cell.getDisplayMode(), cell.getConfigLabels().getLabels());
        final Color fontAttributeValue = cellProxy
                .getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR);
        Assert.assertEquals(defaultBackgroundColor, fontAttributeValue);
    }
View Full Code Here

                AlternatingRowConfigLabelAccumulator.ODD_ROW_CONFIG_TYPE);
    }

    private void verifyFontAttributes() {
        // Check cell font attributes
        ILayerCell cell = natTable.getCellByPosition(2, 2);
        final FontData expectedFontData = defaultFont.getFontData()[0];
        IStyle cellStyle = configRegistry.getConfigAttribute(
                CellConfigAttributes.CELL_STYLE, cell.getDisplayMode(), cell
                        .getConfigLabels().getLabels());
        final FontData actualFontData = cellStyle.getAttributeValue(
                CellStyleAttributes.FONT).getFontData()[0];
        Assert.assertEquals(actualFontData.getName(),
                expectedFontData.getName());
View Full Code Here

        // Get row header cell corresponding to the selected body cell
        RowHeaderLayer rowHeaderLayer = (RowHeaderLayer) gridLayer
                .getChildLayerByLayoutCoordinate(0, 1);
        // The column position is 0 because it takes into account the offset of
        // the row header
        ILayerCell cell = rowHeaderLayer.getCellByPosition(0, 1);

        // Assert the cell is in selected state
        Assert.assertEquals(DisplayMode.SELECT, cell.getDisplayMode());
    }
View Full Code Here

        ActiveCellEditorRegistry.unregisterActiveCellEditor();
    }

    @Test
    public void testNotEditableByDefault() {
        ILayerCell cell = natTable.getCellByPosition(4, 4);
        natTable.doCommand(new EditCellCommand(natTable, natTable
                .getConfigRegistry(), cell));

        assertNull(natTable.getActiveCellEditor());
        assertNull(ActiveCellEditorRegistry.getActiveCellEditor());
View Full Code Here

    @Test
    public void testEditorActivatedDuringInlineCellEdit() {
        natTable.enableEditingOnAllCells();

        ILayerCell cell = natTable.getCellByPosition(4, 4);
        natTable.doCommand(new EditCellCommand(natTable, natTable
                .getConfigRegistry(), cell));

        ICellEditor cellEditor = natTable.getActiveCellEditor();
        assertNotNull(cellEditor);
View Full Code Here

    @Test
    public void testEditorResize() {
        natTable.enableEditingOnAllCells();

        ILayerCell cell = natTable.getCellByPosition(4, 4);
        natTable.doCommand(new EditCellCommand(natTable, natTable
                .getConfigRegistry(), cell));
        assertEquals(new Rectangle(340, 80, 99, 19), natTable
                .getActiveCellEditor().getEditorControl().getBounds());
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.