Examples of ICellEditor


Examples of org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor

            // - which editor to use for that cell
            final List<String> configLabels = cell.getConfigLabels()
                    .getLabels();

            // check which editor to use
            final ICellEditor cellEditor = configRegistry.getConfigAttribute(
                    EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT,
                    configLabels);

            if (cellEditor.openInline(configRegistry, configLabels)) {
                // edit inline
                ICellEditHandler editHandler = new InlineEditHandler(layer,
                        columnPosition, rowPosition);

                Rectangle editorBounds = layer.getLayerPainter()
                        .adjustCellBounds(
                                columnPosition,
                                rowPosition,
                                new Rectangle(cellBounds.x, cellBounds.y,
                                        cellBounds.width, cellBounds.height));

                cellEditor.activateCell(parent, initialCanonicalValue,
                        EditModeEnum.INLINE, editHandler, cell, configRegistry);

                final Control editorControl = cellEditor.getEditorControl();

                editorBounds = cellEditor.calculateControlBounds(editorBounds);

                if (editorControl != null && !editorControl.isDisposed()) {
                    editorControl.setBounds(editorBounds);
                    // We need to add the control listeners after setting the
                    // bounds to it
                    // because of the strange behaviour on Mac OS where a
                    // control loses focus
                    // if its bounds are set
                    cellEditor.addEditorControlListeners();
                    layer.fireLayerEvent(new CellEditorCreatedEvent(cellEditor));
                }
            } else {
                List<ILayerCell> cells = new ArrayList<ILayerCell>();
                cells.add(cell);
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor

            // Note: this works because previous to calling this method it is
            // checked
            // if all cells have the same editor configured. Otherwise this
            // method
            // will have serious issues further on.
            ICellEditor cellEditor = configRegistry.getConfigAttribute(
                    EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, cells
                            .iterator().next().getConfigLabels().getLabels());

            if (cells.size() == 1
                    || (cells.size() > 1 && supportMultiEdit(cells, cellEditor,
                            configRegistry))) {

                if (cellEditor.openMultiEditDialog()) {
                    // as the EditSelectionCommandHandler already ensured that
                    // all cells have the same
                    // configuration, we can simply use any cell for multi cell
                    // edit handling
                    ICellEditDialog dialog = CellEditDialogFactory
                            .createCellEditDialog(
                                    parent != null ? parent.getShell() : null,
                                    initialCanonicalValue, cells.iterator()
                                            .next(), cellEditor, configRegistry);

                    int returnValue = dialog.open();

                    if (returnValue == Window.OK) {
                        for (ILayerCell selectedCell : cells) {
                            Object editorValue = dialog.getCommittedValue();
                            if (!(dialog.getEditType() == EditTypeEnum.SET)) {
                                editorValue = dialog.calculateValue(
                                        selectedCell.getDataValue(),
                                        editorValue);
                            }
                            ILayer layer = selectedCell.getLayer();

                            layer.doCommand(new UpdateDataCommand(layer,
                                    selectedCell.getColumnPosition(),
                                    selectedCell.getRowPosition(), editorValue));
                        }
                    }
                } else {
                    // if the editor is configured to do not open a multi edit
                    // dialog for
                    // multi editing, we simply activate all editors for cells
                    // that are
                    // selected for multi editing
                    // this only works for editors that have no interactive
                    // control for
                    // editing, like for example the CheckBoxCellEditor that
                    // directly
                    // changes the value and closes right away.
                    for (ILayerCell cell : cells) {
                        ICellEditHandler editHandler = new InlineEditHandler(
                                cell.getLayer(), cell.getColumnPosition(),
                                cell.getRowPosition());

                        cellEditor.activateCell(parent, initialCanonicalValue,
                                EditModeEnum.INLINE, editHandler, cell,
                                configRegistry);
                    }
                }
            }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor

     */
    public static boolean activateLastSelectedCellEditor(SelectionLayer selectionLayer, IConfigRegistry configRegistry, boolean byTraversal) {
        ILayerCell lastSelectedCell = EditUtils.getLastSelectedCell(selectionLayer);
        if (lastSelectedCell != null) {
            final List<String> lastSelectedCellLabelsArray = lastSelectedCell.getConfigLabels().getLabels();
            ICellEditor editor = configRegistry.getConfigAttribute(
                    EditConfigAttributes.CELL_EDITOR,
                    DisplayMode.EDIT,
                    lastSelectedCellLabelsArray);
            if (editor != null) {
                return (!byTraversal || editor.activateOnTraversal(configRegistry, lastSelectedCellLabelsArray));
            }
        }
        return false;
    }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor

     *         {@link ICellEditor} configured, <code>false</code> if at least
     *         one cell has another {@link ICellEditor} configured.
     */
    public static boolean isEditorSame(Collection<ILayerCell> selectedCells, IConfigRegistry configRegistry) {
        if (selectedCells != null) {
            ICellEditor lastSelectedCellEditor = null;
            for (ILayerCell selectedCell : selectedCells) {
                LabelStack labelStack = selectedCell.getConfigLabels();
                ICellEditor cellEditor = configRegistry.getConfigAttribute(
                        EditConfigAttributes.CELL_EDITOR,
                        DisplayMode.EDIT,
                        labelStack.getLabels());

                // The first time we get here we need to remember the editor so
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor

     *         <code>true</code> if there is no active open editor or it could
     *         be closed after committing the value.
     */
    @Deprecated
    public static boolean commitAndCloseActiveEditor() {
        ICellEditor activeCellEditor = ActiveCellEditorRegistry.getActiveCellEditor();
        if (activeCellEditor != null) {
            return activeCellEditor.commit(MoveDirectionEnum.NONE, true);
        }
        return true;
    }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor

            // Bug 407598: only perform a check if the click in the body region
            // was performed on a cell
            // cell == null can happen if the viewport is quite large and
            // contains not enough cells to fill it.
            if (cell != null) {
                ICellEditor cellEditor = natTable.getConfigRegistry()
                        .getConfigAttribute(EditConfigAttributes.CELL_EDITOR,
                                DisplayMode.EDIT,
                                cell.getConfigLabels().getLabels());
                if (this.cellEditorClass.isInstance(cellEditor)) {
                    return true;
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor

                // Bug 407598: only perform a check if the click in the body
                // region was performed on a cell
                // cell == null can happen if the viewport is quite large and
                // contains not enough cells to fill it.
                if (cell != null) {
                    ICellEditor cellEditor = natTable.getConfigRegistry()
                            .getConfigAttribute(
                                    EditConfigAttributes.CELL_EDITOR,
                                    DisplayMode.EDIT,
                                    cell.getConfigLabels().getLabels());

                    if (cellEditor != null
                            && cellEditor.activateAtAnyPosition()) {
                        // if there is a cell editor configured for the cell
                        // that was clicked on, the match is found
                        return true;
                    }
                }
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor

            // register a combo box cell editor for the gender column in the
            // filter row
            // the label is set automatically to the value of
            // FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + column
            // position
            ICellEditor comboBoxCellEditor = new ComboBoxCellEditor(
                    Arrays.asList(Gender.FEMALE, Gender.MALE));
            configRegistry.registerConfigAttribute(
                    EditConfigAttributes.CELL_EDITOR, comboBoxCellEditor,
                    DisplayMode.NORMAL,
                    FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor

        // draw the filter icon to indicate the cell as a filter cell
        if (this.filterImage != null) {
            return this.filterImage;
        }

        ICellEditor cellEditor = configRegistry.getConfigAttribute(
                EditConfigAttributes.CELL_EDITOR, cell.getDisplayMode(), cell
                        .getConfigLabels().getLabels());

        // If a combo box is specified as the editor, draw the combo box arrow
        if (ObjectUtils.isNotNull(cellEditor)
View Full Code Here

Examples of org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor

            // register a combo box cell editor for the gender column in the
            // filter row
            // the label is set automatically to the value of
            // FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + column
            // position
            ICellEditor comboBoxCellEditor = new ComboBoxCellEditor(
                    Arrays.asList(Gender.FEMALE, Gender.MALE));
            configRegistry.registerConfigAttribute(
                    EditConfigAttributes.CELL_EDITOR, comboBoxCellEditor,
                    DisplayMode.NORMAL,
                    FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.