- added file chooser for report file
authorPatric Plitzner <p.plitzner@bgbm.org>
Fri, 23 Jan 2015 09:51:29 +0000 (09:51 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Fri, 23 Jan 2015 09:51:29 +0000 (09:51 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ClassificationChooserWizardPage.java

index 275c39d3d7164c6759db1be286d543471b6ab26f..36ec38a4e446ec9559bb9d3468b1bc1e1fb76aa3 100644 (file)
@@ -65,6 +65,7 @@ public class AbcdImportWizard extends AbstractImportWizard<Abcd206ImportConfigur
                if(classificationChooserWizardPage.getClassification()!=null){
                    configurator.setClassificationUuid(classificationChooserWizardPage.getClassification().getUuid());
                }
                if(classificationChooserWizardPage.getClassification()!=null){
                    configurator.setClassificationUuid(classificationChooserWizardPage.getClassification().getUuid());
                }
+               configurator.setReportUri(classificationChooserWizardPage.getReportUri());
 
                CdmStore.getImportManager().run(configurator);
                return true;
 
                CdmStore.getImportManager().run(configurator);
                return true;
index 716481ae99e61bef28a2185bbea0774b2eb2c1cc..7538fddcef98edfa646ed18e275c88d6e0517aa0 100644 (file)
 
 package eu.etaxonomy.taxeditor.io.wizard;
 
 
 package eu.etaxonomy.taxeditor.io.wizard;
 
+import java.io.File;
+import java.net.URI;
+
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Text;
@@ -36,12 +42,17 @@ public class ClassificationChooserWizardPage extends WizardPage implements Liste
 
        public static final String PAGE_NAME = "ClassificationChooserWizardPage";
 
 
        public static final String PAGE_NAME = "ClassificationChooserWizardPage";
 
+       //classification
     private Text textClassification;
     private Classification classification;
     private Button btnBrowseClassification;
 
     private Button btnClear;
 
     private Text textClassification;
     private Classification classification;
     private Button btnBrowseClassification;
 
     private Button btnClear;
 
+    //report
+    private FileDialog fileDialogReport;
+    private Text textFileReport;
+
        /**
         * <p>Constructor for ImportFromFileDataSourceWizardPage.</p>
         *
        /**
         * <p>Constructor for ImportFromFileDataSourceWizardPage.</p>
         *
@@ -64,7 +75,7 @@ public class ClassificationChooserWizardPage extends WizardPage implements Liste
         * @return a {@link eu.etaxonomy.taxeditor.io.wizard.ClassificationChooserWizardPage} object.
         */
        protected static ClassificationChooserWizardPage createPage(){
         * @return a {@link eu.etaxonomy.taxeditor.io.wizard.ClassificationChooserWizardPage} object.
         */
        protected static ClassificationChooserWizardPage createPage(){
-               return new ClassificationChooserWizardPage("Choose Classification", "Note: Selecting no classification will create a default one.");
+               return new ClassificationChooserWizardPage("Configure import destinations", "Note: Selecting no classification will create a default one.");
        }
 
 
        }
 
 
@@ -81,6 +92,7 @@ public class ClassificationChooserWizardPage extends WizardPage implements Liste
                gridLayout.numColumns = 4;
                composite.setLayout(gridLayout);
 
                gridLayout.numColumns = 4;
                composite.setLayout(gridLayout);
 
+               //classification
                Label label = new Label(composite, SWT.NONE);
                label.setText("Classification");
                textClassification = new Text(composite, SWT.NONE);
                Label label = new Label(composite, SWT.NONE);
                label.setText("Classification");
                textClassification = new Text(composite, SWT.NONE);
@@ -93,6 +105,38 @@ public class ClassificationChooserWizardPage extends WizardPage implements Liste
                btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
                btnClear.addListener(SWT.Selection, this);
 
                btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
                btnClear.addListener(SWT.Selection, this);
 
+               //report
+               Label labelReportFile = new Label(composite, SWT.NONE);
+        labelReportFile.setText("Report File");
+
+        fileDialogReport = new FileDialog(parent.getShell());
+
+        fileDialogReport.setFilterExtensions(new String[]{"*.*"});
+
+        textFileReport = new Text(composite, SWT.BORDER);
+        textFileReport.setEditable(false);
+        textFileReport.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+
+        Button buttonReport = new Button(composite, SWT.PUSH);
+        buttonReport.setText("Browse...");
+
+        buttonReport.addSelectionListener(new SelectionAdapter(){
+
+            /* (non-Javadoc)
+             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+             */
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                String path = fileDialogReport.open();
+                if(path!=null){
+                    textFileReport.setText(path);
+                    setPageComplete(true);
+                }
+            }
+
+        });
+
                setControl(composite);
        }
 
                setControl(composite);
        }
 
@@ -113,11 +157,14 @@ public class ClassificationChooserWizardPage extends WizardPage implements Liste
            }
        }
 
            }
        }
 
-
     /**
      * @return the classification
      */
     public Classification getClassification() {
         return classification;
     }
     /**
      * @return the classification
      */
     public Classification getClassification() {
         return classification;
     }
+
+    public URI getReportUri(){
+        return new File(textFileReport.getText()).toURI();
+    }
 }
 }