use of org.eclipse.nebula.widgets.nattable.extension.builder.model.IEditor 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;
}
}
}
}
Aggregations