1
|
/**
|
2
|
* Copyright (C) 2014 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.newWizard;
|
10
|
|
11
|
import eu.etaxonomy.cdm.api.service.IVocabularyService;
|
12
|
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
|
13
|
import eu.etaxonomy.cdm.model.term.TermType;
|
14
|
import eu.etaxonomy.cdm.model.term.TermVocabulary;
|
15
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
16
|
|
17
|
/**
|
18
|
* @author pplitzner
|
19
|
* @date 11.03.2014
|
20
|
*
|
21
|
*/
|
22
|
public class NewFeatureVocabularyWizard extends AbstractNewEntityWizard<TermVocabulary> {
|
23
|
|
24
|
private VocabularyWizardPage vocabularyPage;
|
25
|
|
26
|
private TermType termType;
|
27
|
|
28
|
public NewFeatureVocabularyWizard(TermType termType) {
|
29
|
this.termType = termType;
|
30
|
}
|
31
|
|
32
|
@Override
|
33
|
public void addPages() {
|
34
|
vocabularyPage = new VocabularyWizardPage(formFactory, getConversationHolder(), getEntity());
|
35
|
addPage(vocabularyPage);
|
36
|
}
|
37
|
|
38
|
@Override
|
39
|
protected TermVocabulary createNewEntity() {
|
40
|
if(termType!=null){
|
41
|
return TermVocabulary.NewInstance(termType);
|
42
|
}
|
43
|
return TermVocabulary.NewInstance(TermType.Feature);
|
44
|
}
|
45
|
|
46
|
@Override
|
47
|
protected void saveEntity() {
|
48
|
CdmStore.getService(IVocabularyService.class).merge(getEntity(),true);
|
49
|
|
50
|
}
|
51
|
|
52
|
@Override
|
53
|
public void setEntity(TermVocabulary entity) {
|
54
|
super.setEntity(entity);
|
55
|
vocabularyPage.getDetailElement().setEntity(entity);
|
56
|
}
|
57
|
|
58
|
@Override
|
59
|
protected String getEntityName() {
|
60
|
return "Vocabulary";
|
61
|
}
|
62
|
}
|