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

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


                IDataValidator.NEVER_VALID, DisplayMode.EDIT, TEST_LABEL);
        natTable.getConfigRegistry().registerConfigAttribute(
                EditConfigAttributes.DATA_VALIDATOR,
                IDataValidator.ALWAYS_VALID, DisplayMode.EDIT, TEST_LABEL_2);

        ILayerCell cell = natTable.getCellByPosition(1, 1);
        assertEquals("Col: 1, Row: 1", cell.getDataValue());

        // Column index 0 never valid
        natTable.doCommand(new EditCellCommand(natTable, natTable
                .getConfigRegistry(), cell));
        assertFalse(natTable.getActiveCellEditor().validateCanonicalValue(
                cell.getDataValue()));

        cell = natTable.getCellByPosition(2, 1);
        assertEquals("Col: 2, Row: 1", cell.getDataValue());

        // Column index 1 always valid
        natTable.doCommand(new EditCellCommand(natTable, natTable
                .getConfigRegistry(), cell));
        assertTrue(natTable.getActiveCellEditor().validateCanonicalValue(
                cell.getDataValue()));
    }
View Full Code Here


    public void navigationWithTab() throws Exception {
        natTable.enableEditingOnAllCells();
        natTable.doCommand(new SelectCellCommand(natTable, 1, 1, false, false));

        // Edit cell
        ILayerCell cell = natTable.getCellByPosition(1, 1);
        natTable.doCommand(new EditCellCommand(natTable, natTable
                .getConfigRegistry(), cell));

        // Press tab - 3 times
        Text textControl = ((Text) natTable.getActiveCellEditor()
View Full Code Here

        natTable.getConfigRegistry().registerConfigAttribute(
                EditConfigAttributes.DATA_VALIDATOR,
                getStartingWithCValidator(), DisplayMode.EDIT, TEST_LABEL);

        // Start editing 1,1
        ILayerCell cell = natTable.getCellByPosition(1, 1);
        assertEquals("Col: 1, Row: 1", cell.getDataValue());
        natTable.doCommand(new SelectCellCommand(natTable, 1, 1, false, false));

        // Column position 1 - originally valid
        natTable.doCommand(new EditCellCommand(natTable, natTable
                .getConfigRegistry(), cell));
        assertTrue(natTable.getActiveCellEditor().validateCanonicalValue(
                cell.getDataValue()));

        // Set an invalid value in cell - AA
        Text textControl = ((Text) natTable.getActiveCellEditor()
                .getEditorControl());
        textControl.setText("AA");
View Full Code Here

     */
    @Test
    public void testEditorRegisteredInActiveCellEditorRegistry() {
        natTable.enableEditingOnAllCells();

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

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

     */
    @Test
    public void testEditorRemovedWhenCommitted() {
        natTable.enableEditingOnAllCells();

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

        Text editor = (Text) natTable.getActiveCellEditor().getEditorControl();
        editor.setText("A");
View Full Code Here

     */
    @Test
    public void testEditorRemovedWhenClosed() {
        natTable.enableEditingOnAllCells();

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

        // close the editor
        ActiveCellEditorRegistry.getActiveCellEditor().close();
View Full Code Here

                    if ("<".equals(token)) {
                        // Span from left
                        dataValues[columnPosition][rowPosition] = dataValues[columnPosition - 1][rowPosition];

                        ILayerCell cell = cells[columnPosition - 1][rowPosition];
                        Rectangle boundsRect = bounds[columnPosition - 1][rowPosition];

                        if (columnPosition >= cell.getColumnPosition()
                                + cell.getColumnSpan()) {
                            boundsRect = new Rectangle(
                                    boundsRect.x,
                                    boundsRect.y,
                                    boundsRect.width
                                            + getColumnWidthByPosition(columnPosition),
                                    boundsRect.height);

                            final ILayerCell underlyingCell = cell;
                            cell = new TransformedLayerCell(cell) {
                                @Override
                                public int getColumnSpan() {
                                    return underlyingCell.getColumnSpan() + 1;
                                }
                            };
                        }

                        cells[columnPosition][rowPosition] = cell;
                        bounds[columnPosition][rowPosition] = boundsRect;

                        if (cellInfoFieldTokenizer.hasMoreTokens()) {
                            System.out
                                    .println("Extra tokens detected after parsing span for cell position "
                                            + columnPosition
                                            + ","
                                            + rowPosition + "; ignoring");
                        }
                        break;
                    } else if ("^".equals(token)) {
                        // Span from above
                        dataValues[columnPosition][rowPosition] = dataValues[columnPosition][rowPosition - 1];

                        ILayerCell cell = cells[columnPosition][rowPosition - 1];
                        Rectangle boundsRect = bounds[columnPosition][rowPosition - 1];

                        if (rowPosition >= cell.getRowPosition()
                                + cell.getRowSpan()) {
                            boundsRect = new Rectangle(
                                    boundsRect.x,
                                    boundsRect.y,
                                    boundsRect.width,
                                    boundsRect.height
                                            + getRowHeightByPosition(rowPosition));

                            final ILayerCell underlyingCell = cell;
                            cell = new TransformedLayerCell(cell) {
                                @Override
                                public int getRowSpan() {
                                    return underlyingCell.getRowSpan() + 1;
                                }
                            };
                        }

                        cells[columnPosition][rowPosition] = cell;
View Full Code Here

    public void shouldHaveAllCellsSelected() {
        for (int columnPosition = 0; columnPosition < selectionLayer
                .getColumnCount(); columnPosition++) {
            for (int rowPosition = 0; rowPosition < selectionLayer
                    .getRowCount(); rowPosition++) {
                ILayerCell cell = selectionLayer.getCellByPosition(
                        columnPosition, rowPosition);
                Assert.assertEquals(DisplayMode.SELECT, cell.getDisplayMode());
            }
        }
    }
View Full Code Here

            return true;
        if (obj == null)
            return false;
        if (!(obj instanceof ILayerCell))
            return false;
        ILayerCell other = (ILayerCell) obj;
        if (this.getColumnSpan() != other.getColumnSpan())
            return false;
        if (this.getOriginColumnPosition() != other.getOriginColumnPosition())
            return false;
        if (this.getOriginRowPosition() != other.getOriginRowPosition())
            return false;
        if (this.getRowSpan() != other.getRowSpan())
            return false;
        return true;
    }
View Full Code Here

                    progressBar.setSelection(rowPosition);
                }

                for (int columnPosition = 0; columnPosition < layer
                        .getColumnCount(); columnPosition++) {
                    ILayerCell cell = layer.getCellByPosition(columnPosition,
                            rowPosition);

                    IExportFormatter exportFormatter = configRegistry
                            .getConfigAttribute(
                                    ExportConfigAttributes.EXPORT_FORMATTER,
                                    cell.getDisplayMode(), cell
                                            .getConfigLabels().getLabels());
                    Object exportDisplayValue = exportFormatter
                            .formatForExport(cell, configRegistry);

                    exporter.exportCell(outputStream, exportDisplayValue, cell,
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.