Project

General

Profile

« Previous | Next » 

Revision d8af4f9e

Added by Patrick Plitzner over 8 years ago

Remove report configuration from ABCD import wizard

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportWizard.java
62 62
	    if(classificationChooserWizardPage.getClassification()!=null){
63 63
	        configurator.setClassificationUuid(classificationChooserWizardPage.getClassification().getUuid());
64 64
	    }
65
	    configurator.setReportUri(classificationChooserWizardPage.getReportUri());
66 65

  
67 66
	    if(CdmStore.getCurrentSessionManager().isRemoting()) {
68 67
	        //Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ClassificationChooserWizardPage.java
10 10

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

  
13
import java.io.File;
14
import java.net.URI;
15

  
16 13
import org.eclipse.jface.wizard.WizardPage;
17 14
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.events.SelectionAdapter;
19
import org.eclipse.swt.events.SelectionEvent;
20 15
import org.eclipse.swt.layout.GridData;
21 16
import org.eclipse.swt.layout.GridLayout;
22 17
import org.eclipse.swt.widgets.Button;
23 18
import org.eclipse.swt.widgets.Composite;
24 19
import org.eclipse.swt.widgets.Event;
25
import org.eclipse.swt.widgets.FileDialog;
26 20
import org.eclipse.swt.widgets.Label;
27 21
import org.eclipse.swt.widgets.Listener;
28 22
import org.eclipse.swt.widgets.Text;
29 23
import org.eclipse.wb.swt.ResourceManager;
30 24

  
31 25
import eu.etaxonomy.cdm.model.taxon.Classification;
32
import eu.etaxonomy.taxeditor.store.CdmStore;
33 26
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
34 27

  
35 28
/**
......
50 43

  
51 44
    private Button btnClear;
52 45

  
53
    //report
54
    private FileDialog fileDialogReport;
55
    private Text textFileReport;
56

  
57
	/**
58
	 * <p>Constructor for ImportFromFileDataSourceWizardPage.</p>
59
	 *
60
	 * @param title a {@link java.lang.String} object.
61
	 * @param description a {@link java.lang.String} object.
62
	 * @param extensions an array of {@link java.lang.String} objects.
63
	 */
64 46
	protected ClassificationChooserWizardPage(String title, String description) {
65 47
		super(PAGE_NAME);
66 48

  
......
70 52

  
71 53
	}
72 54

  
73
	/**
74
	 * <p>XML</p>
75
	 *
76
	 * @return a {@link eu.etaxonomy.taxeditor.io.wizard.ClassificationChooserWizardPage} object.
77
	 */
78 55
	protected static ClassificationChooserWizardPage createPage(){
79 56
		return new ClassificationChooserWizardPage("Configure import destinations", "Note: Selecting no classification will create a default one.");
80 57
	}
81 58

  
82 59

  
83 60

  
84
	/* (non-Javadoc)
85
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
86
	 */
87 61
	/** {@inheritDoc} */
88 62
	@Override
89 63
    public void createControl(Composite parent) {
......
106 80
		btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
107 81
		btnClear.addListener(SWT.Selection, this);
108 82

  
109
		if(!CdmStore.getCurrentSessionManager().isRemoting()) {
110
		    //report
111
		    Label labelReportFile = new Label(composite, SWT.NONE);
112
		    labelReportFile.setText("Report File");
113

  
114
		    fileDialogReport = new FileDialog(parent.getShell());
115

  
116
		    fileDialogReport.setFilterExtensions(new String[]{"*.*"});
117

  
118
		    textFileReport = new Text(composite, SWT.BORDER);
119
		    textFileReport.setEditable(false);
120
		    textFileReport.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
121

  
122

  
123
		    Button buttonReport = new Button(composite, SWT.PUSH);
124
		    buttonReport.setText("Browse...");
125

  
126
		    buttonReport.addSelectionListener(new SelectionAdapter(){
127

  
128
		        /* (non-Javadoc)
129
		         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
130
		         */
131
		        @Override
132
		        public void widgetSelected(SelectionEvent e) {
133
		            String path = fileDialogReport.open();
134
		            if(path!=null){
135
		                textFileReport.setText(path);
136
		                setPageComplete(true);
137
		            }
138
		        }
139

  
140
		    });
141
		}
142 83
		setControl(composite);
143 84
	}
144 85

  
145
	/* (non-Javadoc)
146
	 * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
147
	 */
148 86
	@Override
149 87
	public void handleEvent(Event event) {
150 88
	    if(event.widget==btnBrowseClassification){
......
166 104
        return classification;
167 105
    }
168 106

  
169
    public URI getReportUri(){
170
        if(textFileReport == null) {
171
            return null;
172
        }
173
        String text = textFileReport.getText();
174
        if(text==null || text.isEmpty()){
175
            return null;
176
        }
177
        return new File(text).toURI();
178
    }
179 107
}

Also available in: Unified diff