Project

General

Profile

Download (6.74 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2020 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.io.e4.out.cdmlight;
10

    
11
import java.util.List;
12

    
13
import org.eclipse.jface.wizard.WizardPage;
14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.layout.GridData;
16
import org.eclipse.swt.layout.GridLayout;
17
import org.eclipse.swt.widgets.Combo;
18
import org.eclipse.swt.widgets.Composite;
19
import org.eclipse.swt.widgets.Label;
20
import org.eclipse.swt.widgets.Text;
21

    
22
import eu.etaxonomy.cdm.io.cdmLight.CdmLightExportConfigurator;
23
import eu.etaxonomy.cdm.model.common.Language;
24
import eu.etaxonomy.taxeditor.store.CdmStore;
25

    
26
/**
27
 * @author k.luther
28
 * @since Aug 5, 2020
29
 */
30
public class MetaDataConfigurationWizardPage extends WizardPage {
31

    
32
    CdmLightExportConfigurator configurator;
33

    
34
    private Text text_title;
35
    private Text text_description;
36
    private Text text_creator;
37
    private Text text_contributor;
38
    private Combo combo_language;
39
    private Text text_dataset_landingPage;
40
    private Text uri_datasetDownloadLink;
41
    private Text base_url;
42
    private Text text_recommendedCitation;
43
    private Text text_location;
44
    private Text text_keyWords;
45
    private Text text_licence;
46

    
47
    /**
48
     * @param pageName
49
     */
50
    protected MetaDataConfigurationWizardPage(String pageName, CdmLightExportConfigurator config) {
51
        super(pageName);
52
        configurator = config;
53

    
54
    }
55

    
56
    public CdmLightExportConfigurator getConfigurator() {
57
        return configurator;
58
    }
59

    
60
    public void setConfigurator(CdmLightExportConfigurator configurator) {
61
        this.configurator = configurator;
62
    }
63

    
64
    @Override
65
    public void createControl(Composite parent) {
66
        Composite composite = new Composite(parent, SWT.NULL);
67
        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
68

    
69
        GridLayout gridLayout = new GridLayout();
70
        gridLayout.numColumns = 2;
71
        composite.setLayout(gridLayout);
72
        Label label_title = new Label(composite, SWT.NULL);
73
        label_title.setText("Title");
74
        text_title = new Text(composite, SWT.BORDER);
75
        text_title.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
76
                false));
77

    
78
        Label label_description = new Label(composite, SWT.NULL);
79
        label_description.setText("Description");
80
        text_description = new Text(composite, SWT.BORDER);
81
        text_description.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
82
                false));
83

    
84
        Label label_creator = new Label(composite, SWT.NULL);
85
        label_creator.setText("Creator");
86
        text_creator = new Text(composite, SWT.BORDER);
87
        text_creator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
88
                false));
89

    
90
        Label label_contributor = new Label(composite, SWT.NULL);
91
        label_contributor.setText("Contributor");
92
        text_contributor = new Text(composite, SWT.BORDER);
93
        text_contributor.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
94
                false));
95

    
96
        Label label_language = new Label(composite, SWT.NULL);
97
        label_language.setText("Language");
98
        combo_language = new Combo(composite, SWT.BORDER);
99

    
100
        List<Language> preferredLanguages = CdmStore.getTermManager().getPreferredTerms(Language.class);
101
        int currentSelectionIndex = 0;
102
        Language defaultLang = CdmStore.getDefaultLanguage();
103
        for(int i = 0; i < preferredLanguages.size(); i++){
104
            Language language = preferredLanguages.get(i);
105
            combo_language.add(language.getLabel(), i);
106
            combo_language.setData(language.getLabel(), language);
107
           if (language.equals(defaultLang)){
108
               currentSelectionIndex = i;
109
           }
110
        }
111

    
112
        combo_language.select(currentSelectionIndex);
113

    
114

    
115

    
116
        Label label_landingPage = new Label(composite, SWT.NULL);
117
        label_landingPage.setText("Dataset landing page");
118
        text_dataset_landingPage= new Text(composite, SWT.BORDER);
119
        text_dataset_landingPage.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
120
                false));
121

    
122
        Label label_datasetDownloadLink = new Label(composite, SWT.NULL);
123
        label_datasetDownloadLink.setText("Dataset download link");
124
        uri_datasetDownloadLink= new Text(composite, SWT.BORDER);
125
        uri_datasetDownloadLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
126
                false));
127

    
128
        Label label_base_url = new Label(composite, SWT.NULL);
129
        label_base_url.setText("Base URL");
130
        base_url= new Text(composite, SWT.BORDER);
131
        base_url.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
132
                false));
133

    
134
        Label label_recommendedCitation = new Label(composite, SWT.NULL);
135
        label_recommendedCitation.setText("Recommended citation");
136
        text_recommendedCitation= new Text(composite, SWT.BORDER);
137
        text_recommendedCitation.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
138
                false));
139

    
140
        Label label_location = new Label(composite, SWT.NULL);
141
        label_location.setText("Location");
142
        text_location= new Text(composite, SWT.BORDER);
143
        text_location.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
144
                false));
145

    
146
        Label label_keyWords = new Label(composite, SWT.NULL);
147
        label_keyWords.setText("Keywords");
148
        text_keyWords= new Text(composite, SWT.BORDER);
149
        text_keyWords.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
150
                false));
151

    
152
        Label label_licence = new Label(composite, SWT.NULL);
153
        label_licence.setText("Licence");
154
        text_licence= new Text(composite, SWT.BORDER);
155
        text_licence.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
156
                false));
157

    
158

    
159
        setControl(composite);
160
    }
161

    
162

    
163
    public void fillConfig() {
164

    
165
        configurator.setTitle(text_title.getText());
166

    
167
        configurator.setDescription(text_description.getText());
168

    
169
        configurator.setCreator(text_creator.getText());
170

    
171
        configurator.setContributor(text_contributor.getText());
172

    
173
        configurator.setLanguage((Language)combo_language.getData(combo_language.getText()));
174

    
175
        configurator.setDataSet_landing_page(text_dataset_landingPage.getText());
176

    
177
        configurator.setDataset_download_link(uri_datasetDownloadLink.getText());
178

    
179
        configurator.setBase_url(base_url.getText());
180

    
181
        configurator.setRecommended_citation(text_recommendedCitation.getText());
182

    
183
        configurator.setLocation(text_location.getText());
184

    
185
        configurator.setKeywords(text_keyWords.getText());
186

    
187
        configurator.setLicence(text_licence.getText());
188
    }
189

    
190

    
191

    
192
}
(2-2/3)