Search in sources :

Example 6 with TextCellEditor

use of org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor in project nebula.widgets.nattable by eclipse.

the class EditableGridExample method registerISINValidator.

private static void registerISINValidator(IConfigRegistry configRegistry) {
    TextCellEditor textCellEditor = new TextCellEditor();
    textCellEditor.setErrorDecorationEnabled(true);
    textCellEditor.setDecorationPositionOverride(SWT.LEFT | SWT.TOP);
    configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, textCellEditor, DisplayMode.NORMAL, SECURITY_ID_EDITOR);
    configRegistry.registerConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, getSecurtityIdValidator(), DisplayMode.EDIT, SECURITY_ID_CONFIG_LABEL);
}
Also used : TextCellEditor(org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor)

Example 7 with TextCellEditor

use of org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor in project nebula.widgets.nattable by eclipse.

the class EditorConfiguration method registerColumnFiveIntegerEditor.

private void registerColumnFiveIntegerEditor(IConfigRegistry configRegistry) {
    // register a TextCellEditor for column five that moves the selection
    // after commit
    configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new TextCellEditor(false, true), DisplayMode.NORMAL, EditorExample.COLUMN_FIVE_LABEL);
    // configure to open the adjacent editor after commit
    configRegistry.registerConfigAttribute(EditConfigAttributes.OPEN_ADJACENT_EDITOR, Boolean.TRUE, DisplayMode.EDIT, EditorExample.COLUMN_FIVE_LABEL);
    // configure to open always in dialog to show the tick update in normal
    // mode
    configRegistry.registerConfigAttribute(EditConfigAttributes.OPEN_IN_DIALOG, Boolean.TRUE, DisplayMode.EDIT, EditorExample.COLUMN_FIVE_LABEL);
    // don't forget to register the Integer converter!
    configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultIntegerDisplayConverter(), DisplayMode.NORMAL, EditorExample.COLUMN_FIVE_LABEL);
}
Also used : DefaultIntegerDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter) TextCellEditor(org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor) MultiLineTextCellEditor(org.eclipse.nebula.widgets.nattable.edit.editor.MultiLineTextCellEditor)

Example 8 with TextCellEditor

use of org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor in project nebula.widgets.nattable by eclipse.

the class EditorConfiguration method registerColumnSixDoubleEditor.

private void registerColumnSixDoubleEditor(IConfigRegistry configRegistry) {
    // register a TextCellEditor for column five that moves the selection
    // after commit
    configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new TextCellEditor(false, true), DisplayMode.NORMAL, EditorExample.COLUMN_SIX_LABEL);
    // configure to open the adjacent editor after commit
    configRegistry.registerConfigAttribute(EditConfigAttributes.OPEN_ADJACENT_EDITOR, Boolean.TRUE, DisplayMode.EDIT, EditorExample.COLUMN_SIX_LABEL);
    // configure to open always in dialog to show the tick update in normal
    // mode
    configRegistry.registerConfigAttribute(EditConfigAttributes.OPEN_IN_DIALOG, Boolean.TRUE, DisplayMode.EDIT, EditorExample.COLUMN_SIX_LABEL);
    // configure the tick update dialog to use the adjust mode
    configRegistry.registerConfigAttribute(TickUpdateConfigAttributes.USE_ADJUST_BY, Boolean.TRUE, DisplayMode.EDIT, EditorExample.COLUMN_SIX_LABEL);
    // don't forget to register the Double converter!
    configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDoubleDisplayConverter(), DisplayMode.NORMAL, EditorExample.COLUMN_SIX_LABEL);
}
Also used : TextCellEditor(org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor) MultiLineTextCellEditor(org.eclipse.nebula.widgets.nattable.edit.editor.MultiLineTextCellEditor) DefaultDoubleDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter)

Example 9 with TextCellEditor

use of org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor in project nebula.widgets.nattable by eclipse.

the class EditorConfiguration method registerColumnTwoTextEditor.

private void registerColumnTwoTextEditor(IConfigRegistry configRegistry) {
    // register a TextCellEditor for column two that commits on key up/down
    // moves the selection after commit by enter
    configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new TextCellEditor(true, true), DisplayMode.NORMAL, EditorExample.COLUMN_TWO_LABEL);
    // configure to open the adjacent editor after commit
    configRegistry.registerConfigAttribute(EditConfigAttributes.OPEN_ADJACENT_EDITOR, Boolean.TRUE, DisplayMode.EDIT, EditorExample.COLUMN_TWO_LABEL);
    // configure a custom message for the multi edit dialog
    Map<String, Object> editDialogSettings = new HashMap<>();
    editDialogSettings.put(ICellEditDialog.DIALOG_MESSAGE, "Please specify the lastname in here:");
    configRegistry.registerConfigAttribute(EditConfigAttributes.EDIT_DIALOG_SETTINGS, editDialogSettings, DisplayMode.EDIT, EditorExample.COLUMN_TWO_LABEL);
}
Also used : HashMap(java.util.HashMap) TextCellEditor(org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor) MultiLineTextCellEditor(org.eclipse.nebula.widgets.nattable.edit.editor.MultiLineTextCellEditor)

Example 10 with TextCellEditor

use of org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor in project nebula.widgets.nattable by eclipse.

the class NatTableBuilder method configureEditing.

protected void configureEditing() {
    for (int colIndex = 0; colIndex < columns.length; colIndex++) {
        TableColumn column = columns[colIndex];
        if (column.isEditable) {
            IEditor editor = column.editor;
            // Column label has been registered already
            String columnLabel = BODY_COLUMN_LABEL_PREFIX + colIndex;
            configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, editor.getEditableRule(), DisplayMode.EDIT, columnLabel);
            configRegistry.registerConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, editor.getValidator(), DisplayMode.EDIT, columnLabel);
            switch(editor.getType()) {
                case CHECKBOX:
                    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new CheckBoxPainter(), DisplayMode.NORMAL, columnLabel);
                    configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultBooleanDisplayConverter(), DisplayMode.NORMAL, columnLabel);
                    configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, editor.getCellEditor(), DisplayMode.NORMAL, columnLabel);
                    break;
                case COMBO:
                    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new ComboBoxPainter(), DisplayMode.NORMAL, columnLabel);
                    configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, editor.getCellEditor(), DisplayMode.NORMAL, columnLabel);
                    configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, editor.getCellEditor(), DisplayMode.EDIT, columnLabel);
                    break;
                case TEXT:
                    configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new TextCellEditor());
                    break;
                default:
                    break;
            }
        }
    }
}
Also used : IEditor(org.eclipse.nebula.widgets.nattable.extension.builder.model.IEditor) DefaultBooleanDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.DefaultBooleanDisplayConverter) CheckBoxPainter(org.eclipse.nebula.widgets.nattable.painter.cell.CheckBoxPainter) ComboBoxPainter(org.eclipse.nebula.widgets.nattable.painter.cell.ComboBoxPainter) TextCellEditor(org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor) TableColumn(org.eclipse.nebula.widgets.nattable.extension.builder.model.TableColumn)

Aggregations

TextCellEditor (org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor)17 Test (org.junit.Test)6 ICellEditor (org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor)5 DefaultBooleanDisplayConverter (org.eclipse.nebula.widgets.nattable.data.convert.DefaultBooleanDisplayConverter)4 DefaultDataValidator (org.eclipse.nebula.widgets.nattable.data.validate.DefaultDataValidator)4 HashMap (java.util.HashMap)3 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)3 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)3 DefaultDoubleDisplayConverter (org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter)3 DefaultIntegerDisplayConverter (org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter)3 DisplayConverter (org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter)3 DefaultEditBindings (org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditBindings)3 MultiLineTextCellEditor (org.eclipse.nebula.widgets.nattable.edit.editor.MultiLineTextCellEditor)3 DateFormat (java.text.DateFormat)2 SimpleDateFormat (java.text.SimpleDateFormat)2 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)2 VisualRefreshCommand (org.eclipse.nebula.widgets.nattable.command.VisualRefreshCommand)2 AbstractRegistryConfiguration (org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration)2 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)2 ExtendedReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ExtendedReflectiveColumnPropertyAccessor)2