]> gerrit.simantics Code Review - simantics/district.git/commitdiff
Disable editable style from columns other than "Enabled" 57/4557/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Mon, 12 Oct 2020 11:26:19 +0000 (14:26 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 14 Oct 2020 09:57:59 +0000 (09:57 +0000)
gitlab #101

Change-Id: I5142a8b615881f97cf2dea24aa86485cf4b43ef8
(cherry picked from commit dea2f95092ad8d682b356cdd39e8c1c4a0db9b2c)

org.simantics.district.network.ui/src/org/simantics/district/network/ui/techtype/table/TechTypeTable.java

index fa0a1acb4632957bd329bcc6f4e4d11ca9beedbb..a8db44c789200fb8015596916ade28ed8283e9fa 100644 (file)
@@ -8,7 +8,6 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
 import java.util.Set;
-import java.util.function.Consumer;
 import java.util.stream.Collectors;
 
 import org.eclipse.jface.layout.GridDataFactory;
@@ -17,8 +16,8 @@ import org.eclipse.nebula.widgets.nattable.NatTable;
 import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration;
 import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
 import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
+import org.eclipse.nebula.widgets.nattable.config.EditableRule;
 import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.config.IEditableRule;
 import org.eclipse.nebula.widgets.nattable.copy.command.CopyDataCommandHandler;
 import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
 import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
@@ -268,7 +267,12 @@ public class TechTypeTable extends Composite {
                                cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_RED);
                                
                                configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE,
-                                               IEditableRule.ALWAYS_EDITABLE);
+                                               new EditableRule() {
+                                                       @Override
+                                                       public boolean isEditable(int columnIndex, int rowIndex) {
+                                                               return columnIndex == 0;
+                                                       }
+                                               });
                                
                                configRegistry.registerConfigAttribute(
                                                CellConfigAttributes.CELL_STYLE,