]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.imports.ui/src/org/simantics/district/imports/ui/CSVImportWizardPage.java
Make optional to calculate elevation for edge during CSV import
[simantics/district.git] / org.simantics.district.imports.ui / src / org / simantics / district / imports / ui / CSVImportWizardPage.java
index e5cb3a6afba8f8ed2df8cab2e53214124f80a759..b7e46475dcec4f00c2b4069476de5084364b8b4e 100644 (file)
@@ -12,7 +12,6 @@ import org.eclipse.jface.dialogs.IPageChangeProvider;
 import org.eclipse.jface.dialogs.IPageChangedListener;
 import org.eclipse.jface.dialogs.PageChangedEvent;
 import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
 import org.eclipse.jface.layout.TableColumnLayout;
 import org.eclipse.jface.viewers.ColumnWeightData;
 import org.eclipse.jface.wizard.IWizardContainer;
@@ -79,6 +78,7 @@ public class CSVImportWizardPage extends WizardPage {
     private DynamicComboFieldEditor nominalPressureLossSelector;
     private DynamicComboFieldEditor valvePositionSelector;
     private DynamicComboFieldEditor addressSelector;
+    private DynamicComboFieldEditor lengthSelector;
 
     // For edge import
     private DynamicComboFieldEditor startXCoordSelector;
@@ -654,6 +654,8 @@ public class CSVImportWizardPage extends WizardPage {
                 validatePageComplete();
             }
         });
+        
+
     }
 
     private void createEdgeIndexMappingField(Group parent) {
@@ -846,6 +848,20 @@ public class CSVImportWizardPage extends WizardPage {
                 validatePageComplete();
             }
         });
+        lengthSelector = new DynamicComboFieldEditor("lengthValue", "lengthSelector", parent);
+        lengthSelector.addComboListener(new SelectionListener() {
+
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                widgetDefaultSelected(e);
+            }
+
+            @Override
+            public void widgetDefaultSelected(SelectionEvent e) {
+                model.setLengthIndex(Integer.parseInt(lengthSelector.getValue()));
+                validatePageComplete();
+            }
+        });
     }
 
     private void updateCombos() {
@@ -886,6 +902,7 @@ public class CSVImportWizardPage extends WizardPage {
         kReturnSelector.updateCombo(namesAndValues);
         kSupplySelector.updateCombo(namesAndValues);
         tGroundSelector.updateCombo(namesAndValues);
+        lengthSelector.updateCombo(namesAndValues);
     }
 
     private void updateVertexCombos(String[][] namesAndValues) {
@@ -910,7 +927,7 @@ public class CSVImportWizardPage extends WizardPage {
         velocitySelector.updateCombo(namesAndValues);              
         flowAreaSelector.updateCombo(namesAndValues);              
         nominalPressureLossSelector.updateCombo(namesAndValues);   
-        addressSelector.updateCombo(namesAndValues);   
+        addressSelector.updateCombo(namesAndValues);
     }