1 package org.simantics.district.network.ui.table;
3 import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration;
4 import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
5 import org.eclipse.nebula.widgets.nattable.config.IEditableRule;
6 import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
7 import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
9 public class EditingSupportConfiguration extends AbstractRegistryConfiguration {
11 private TableDataProvider bodyDataProvider;
13 public EditingSupportConfiguration(TableDataProvider bodyDataProvider) {
14 this.bodyDataProvider = bodyDataProvider;
18 public void configureRegistry(IConfigRegistry configRegistry) {
19 configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, new IEditableRule() {
21 public boolean isEditable(ILayerCell cell, IConfigRegistry configRegistry) {
22 return bodyDataProvider.isEditable(cell.getColumnIndex(), cell.getRowIndex());
26 public boolean isEditable(int columnIndex, int rowIndex) {
27 return bodyDataProvider.isEditable(columnIndex, rowIndex);