Project

General

Profile

« Previous | Next » 

Revision 10b4eb6d

Added by Katja Luther over 6 years ago

adapt export configurator for taxonnode filter (at first only for cdm light)

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CdmLightExportWizard.java
15 15

  
16 16
import org.eclipse.core.runtime.jobs.Job;
17 17
import org.eclipse.jface.viewers.IStructuredSelection;
18
import org.eclipse.jface.viewers.TreeSelection;
18 19
import org.eclipse.swt.SWT;
19 20
import org.eclipse.swt.widgets.Combo;
20 21
import org.eclipse.swt.widgets.Listener;
21 22
import org.eclipse.ui.IWorkbench;
22 23
import org.eclipse.ui.progress.IProgressConstants;
23 24

  
25
import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
24 26
import eu.etaxonomy.cdm.io.cdmLight.CdmLightExportConfigurator;
25 27
import eu.etaxonomy.cdm.model.taxon.Classification;
28
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
26 29
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
27 30
import eu.etaxonomy.taxeditor.store.CdmStore;
28 31

  
......
43 46

  
44 47
        @Override
45 48
        public void init(IWorkbench workbench, IStructuredSelection selection) {
46
            configurator = new CdmLightExportConfigurator(null);
49
        	configurator = new CdmLightExportConfigurator(null);
50
    		if (selection instanceof TreeSelection && !selection.isEmpty()){
51
    			TaxonNode node = (TaxonNode)selection.getFirstElement();
52
    			configurator.setTaxonNodeFilter(TaxonNodeFilter.NewTaxonNodeInstance(node.getUuid()));
53
    			
54
    		}
55
        	
56
            
47 57
        }
48 58

  
49 59

  
......
71 81
                    for(Classification c:listClassifications){
72 82
                        if(c.getTitleCache().equalsIgnoreCase(combo.getItem(selectionIndex))){
73 83
                            set.add(c.getUuid());
84
                            if (!page.getCheckUseSelectedTaxonNode()){
85
                            	configurator.setTaxonNodeFilter(TaxonNodeFilter.NewClassificationInstance(c.getUuid()));
86
                            }
74 87
                        }
75 88
                    }
76
                    configurator.setClassificationUuids(set);
89
                    
77 90

  
78 91
                }
79 92
            }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExportToFileDestinationWizardPage.java
9 9

  
10 10
package eu.etaxonomy.taxeditor.io.wizard;
11 11

  
12
import java.awt.Checkbox;
12 13
import java.text.SimpleDateFormat;
13 14
import java.util.Calendar;
14 15
import java.util.Collections;
......
16 17
import java.util.List;
17 18
import java.util.UUID;
18 19

  
20
import org.apache.commons.lang.StringUtils;
19 21
import org.eclipse.jface.wizard.WizardPage;
20 22
import org.eclipse.swt.SWT;
21 23
import org.eclipse.swt.events.SelectionAdapter;
......
28 30
import org.eclipse.swt.widgets.Composite;
29 31
import org.eclipse.swt.widgets.Control;
30 32
import org.eclipse.swt.widgets.DirectoryDialog;
33
import org.eclipse.swt.widgets.Event;
31 34
import org.eclipse.swt.widgets.Label;
32 35
import org.eclipse.swt.widgets.Listener;
33 36
import org.eclipse.swt.widgets.Text;
......
109 112
    private List<Classification> classifications;
110 113

  
111 114
    private Classification selectedClassification;
115
    private Label classificationLabel;
112 116
    
113 117
    private ExportConfiguratorBase configurator;
118
    private Button checkUseSelectedtaxonNode;
114 119

  
115 120
	/**
116 121
	 * @param pageName
......
304 309
		if(csvExport || csvPrintExport || outputModelExport|| csvNameExport){
305 310
//		    Label comboBoxLabel = new Label(composite, SWT.NONE);
306 311
//		    comboBoxLabel.setText("Classification");
307

  
308
		    createClassificationSelectionCombo(composite);
309
		    classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
310
		                true, false, 2, 1));
312
			
313
			if (outputModelExport && !((CdmLightExportConfigurator)configurator).getTaxonNodeFilter().getTaxonNodesFilter().isEmpty()){
314
				  checkUseSelectedtaxonNode= new Button(composite, SWT.CHECK);
315
				  checkUseSelectedtaxonNode.setText("Use selected Taxon Node (or whole Classification)");
316
				  checkUseSelectedtaxonNode.addListener(SWT.Selection, new Listener() {
317
		               @Override
318
		            public void handleEvent(Event e) {
319
		                   Button b = (Button) e.widget;
320
		                   GridData data = (GridData)  classificationSelectionCombo.getLayoutData();
321
		                   data.exclude = b.getSelection();
322
		                   classificationSelectionCombo.setVisible(!data.exclude);
323
		                   classificationLabel.setVisible(!data.exclude);
324
		                  
325
		               }
326
		        });
327
			}
328
			
329
			createClassificationSelectionCombo(composite);
330
			classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
331
			                true, false, 2, 1));
332
			
311 333
		}
312 334
		
313 335

  
......
421 443
	private void createClassificationSelectionCombo(Composite parent){
422 444
//		classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null);
423 445

  
424
//		Composite classificationSelection = new Composite(parent, SWT.NULL);
425
//		classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
446
		Composite classificationSelection = new Composite(parent, SWT.NULL);
447
		classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
426 448

  
427
//		GridLayout layout = new GridLayout();
428
//		classificationSelection.setLayout(layout);
449
		GridLayout layout = new GridLayout();
450
		classificationSelection.setLayout(layout);
429 451

  
430
		Label label = new Label(parent, SWT.NULL);
452
		classificationLabel = new Label(classificationSelection, SWT.NULL);
431 453
		// TODO not working is not really true but leave it here to remind everyone that this is under construction
432
		label.setText("Select Classification");
454
		classificationLabel.setText("Select Classification");
433 455
		
434
		classificationSelectionCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
456
		classificationSelectionCombo = new Combo(classificationSelection, SWT.BORDER | SWT.READ_ONLY);
435 457
		classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 2,1));
436 458

  
437 459
		for(Classification tree : classifications){
......
469 491

  
470 492
		return selectedClassification.getUuid();
471 493
	}
494

  
495
	public boolean getCheckUseSelectedTaxonNode() {
496
		return checkUseSelectedtaxonNode.getSelection();
497
	}
498

  
499
	
472 500
	
473 501
	
474 502

  

Also available in: Unified diff