commit cb53bcb33c9538a28eab5354dbab66c4451f9a05
Author: Katja Luther <k.luther@bgbm.org>
Date:   Mon Jul 11 13:58:13 2016 +0200

    add selection of classification to csvPrintExport

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvNameExportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvNameExportWizard.java
index bd6ac4a48..3e13950c0 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvNameExportWizard.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvNameExportWizard.java
@@ -66,7 +66,7 @@ public class CsvNameExportWizard extends AbstractExportWizard<CsvNameExportConfi
 	            + page.getExportFileName();
 
 	    final Combo combo = page.getCombo();
-
+	    configurator.setClassificationUUID(page.getSelectedClassificationUUID());
 	    if(CdmStore.getCurrentSessionManager().isRemoting()) {
 	        // create job
 	        Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvPrintExportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvPrintExportWizard.java
index 61905f31f..870082e6d 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvPrintExportWizard.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvPrintExportWizard.java
@@ -60,27 +60,10 @@ public class CsvPrintExportWizard extends CsvNameExportWizard{
 				+ page.getExportFileName();
 
 		final Combo combo = page.getCombo();
-		final List<Classification> listClassifications = CdmStore.getCurrentApplicationConfiguration().getClassificationService().listClassifications(null, null, null, null);
-		if(combo != null){
-		    int selectionIndex = combo.getSelectionIndex();
-		    HashSet<UUID> set = new HashSet<UUID>();
-		    if(selectionIndex == -1){
-		        for(Classification c:listClassifications){
-		            set.add(c.getUuid());
-		        }
-		    }else{
-		        for(Classification c:listClassifications){
-		            if(c.getTitleCache().equalsIgnoreCase(combo.getItem(selectionIndex))){
-		                set.add(c.getUuid());
-		            }
-		        }
-
-		        configurator.setHasHeaderLines(true);
-
-		    }
-		} else{
-			configurator.setClassificationUUID(listClassifications.get(0).getUuid());
-		}
+
+	   
+	    configurator.setClassificationUUID(page.getSelectedClassificationUUID());
+		
 
 		if(CdmStore.getCurrentSessionManager().isRemoting()) {
 		    // create job
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExportToFileDestinationWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExportToFileDestinationWizardPage.java
index a35e64490..e5c389f66 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExportToFileDestinationWizardPage.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExportToFileDestinationWizardPage.java
@@ -12,21 +12,27 @@ package eu.etaxonomy.taxeditor.io.wizard;
 
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
+import java.util.UUID;
 
 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.events.SelectionListener;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.DirectoryDialog;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 
+import eu.etaxonomy.cdm.api.service.IClassificationService;
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
 import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSourceException;
@@ -41,7 +47,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @created 15.06.2009
  * @version 1.0
  */
-public class ExportToFileDestinationWizardPage extends WizardPage {
+public class ExportToFileDestinationWizardPage extends WizardPage implements SelectionListener {
 
 	/** Constant <code>DATE_FORMAT_NOW="yyyyMMddHHmm"</code> */
 	public static final String DATE_FORMAT_NOW = "yyyyMMddHHmm";
@@ -85,7 +91,11 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
 
 	private final String extension;
 
-    private Combo comboBox;
+    private Combo classificationSelectionCombo;
+    
+    private List<Classification> classifications;
+    
+    private Classification selectedClassification;
 
 	/**
 	 * @param pageName
@@ -225,13 +235,26 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
 		GridLayout gridLayout = new GridLayout();
 		gridLayout.numColumns = 3;
 		composite.setLayout(gridLayout);
+		if(classifications == null){
+			classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, null);
+			Collections.sort(classifications, new Comparator<Classification>() {
+
+                @Override
+                public int compare(Classification o1, Classification o2) {
+                    return o1.getTitleCache().compareTo(o2.getTitleCache());
+                }
+            });
+			
+			selectedClassification = classifications.iterator().next();
+		}
 
 
-		if(csvExport){
+		if(csvExport || csvPrintExport){
 		    Label comboBoxLabel = new Label(composite, SWT.NONE);
 		    comboBoxLabel.setText("Classification");
-		    Combo comboBox = addComboBox(composite);
-		    comboBox.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
+		   
+		    createClassificationSelectionCombo(composite);
+		    classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
 		                true, false, 2, 1));
 		}
 		
@@ -326,22 +349,55 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
 		return text_folder.getText();
 	}
 
-	private Combo addComboBox(Composite composite){
+	private Control createClassificationSelectionCombo(Composite parent){
+//		classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null);
 
-	    comboBox = new Combo(composite, SWT.DROP_DOWN);
-	    comboBox.setText("Choose Classification");
+		Composite classificationSelection = new Composite(parent, SWT.NULL);
+		classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
 
-	    final List<Classification> listClassifications = CdmStore.getCurrentApplicationConfiguration().getClassificationService().listClassifications(null, null, null, null);
+		GridLayout layout = new GridLayout();
+		classificationSelection.setLayout(layout);
 
-	    for(Classification c : listClassifications){
-	        comboBox.add(c.getTitleCache());
-	    }
+		Label label = new Label(classificationSelection, SWT.NULL);
+		// TODO not working is not really true but leave it here to remind everyone that this is under construction
+		label.setText("Select Classification");
+		classificationSelectionCombo = new Combo(classificationSelection, SWT.BORDER | SWT.READ_ONLY);
+		classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
+
+		for(Classification tree : classifications){
+			classificationSelectionCombo.add(tree.getName().getText(), classifications.indexOf(tree));
+
+		}
 
-	    return comboBox;
+		classificationSelectionCombo.select(classifications.indexOf(selectedClassification));
+
+		// TODO remember last selection
+		classificationSelectionCombo.addSelectionListener(this);
+
+
+
+		return classificationSelection;
 	}
 
 	public Combo getCombo(){
-	    return comboBox;
+	    return classificationSelectionCombo;
+	}
+
+	@Override
+	public void widgetSelected(SelectionEvent e) {
+		selectedClassification = classifications.get(classificationSelectionCombo.getSelectionIndex());
+		
+	}
+
+	@Override
+	public void widgetDefaultSelected(SelectionEvent e) {
+		//not needed here
+		
+	}
+
+	public UUID getSelectedClassificationUUID() {
+		
+		return selectedClassification.getUuid();
 	}
 
 }
