1
|
/**
|
2
|
* Copyright (C) 2018 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.preference.wizard;
|
10
|
|
11
|
import java.util.Collection;
|
12
|
import java.util.List;
|
13
|
import java.util.Map;
|
14
|
|
15
|
import org.apache.commons.lang.StringUtils;
|
16
|
import org.eclipse.swt.widgets.Composite;
|
17
|
|
18
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
19
|
import eu.etaxonomy.cdm.model.common.TermType;
|
20
|
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
|
21
|
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
|
22
|
import eu.etaxonomy.taxeditor.editor.definedterm.RootElementsOnlyTreeContentProvider;
|
23
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
24
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
25
|
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
|
26
|
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
|
27
|
|
28
|
/**
|
29
|
* @author k.luther
|
30
|
* @since 04.06.2018
|
31
|
*
|
32
|
*/
|
33
|
public class AvailableAreaVocabulariesPage extends AbstractAdminTermSelectionWizardPage implements ICdmEntitySessionEnabled{
|
34
|
|
35
|
String featureTitle;
|
36
|
|
37
|
|
38
|
public AvailableAreaVocabulariesPage(String pageName, boolean localPref, CdmPreference pref, String featureTitle) {
|
39
|
super(pageName, TermType.NamedArea, pref );
|
40
|
this.localPref = localPref;
|
41
|
this.featureTitle = featureTitle;
|
42
|
|
43
|
}
|
44
|
|
45
|
@Override
|
46
|
public void createControl(Composite parent) {
|
47
|
|
48
|
setTitle(String.format(Messages.AvailableAreaVocabulariesPage_PAGE_TITLE, featureTitle));
|
49
|
setDescription(String.format(Messages.AvailableAreaVocabulariesPage_PAGE_DESCRIPTION, featureTitle));
|
50
|
createAllowOverrideButton(parent);
|
51
|
|
52
|
super.createControl(parent);
|
53
|
|
54
|
treeComposite.getViewer().setContentProvider(new RootElementsOnlyTreeContentProvider());
|
55
|
treeComposite.setAllowTopLevelSelection(true);
|
56
|
}
|
57
|
|
58
|
|
59
|
|
60
|
@Override
|
61
|
protected String getCheckedValuesFromPreferences() {
|
62
|
String vocString = null;
|
63
|
if (localPref){
|
64
|
vocString = PreferencesUtil.getPreferredVocabulariesForDistributionEditor(localPref);
|
65
|
if (StringUtils.isBlank(vocString) && pref != null){
|
66
|
vocString = pref.getValue();
|
67
|
}
|
68
|
}else if (pref != null){
|
69
|
vocString = pref.getValue();
|
70
|
}
|
71
|
return vocString;
|
72
|
}
|
73
|
|
74
|
protected CdmPreference getPreferences() {
|
75
|
return pref;
|
76
|
}
|
77
|
|
78
|
@Override
|
79
|
public ICdmEntitySession getCdmEntitySession() {
|
80
|
return null;
|
81
|
}
|
82
|
|
83
|
@Override
|
84
|
public <T extends CdmBase> Collection<T> getRootEntities() {
|
85
|
return null;
|
86
|
}
|
87
|
|
88
|
@Override
|
89
|
public Map<Object, List<String>> getPropertyPathsMap() {
|
90
|
return null;
|
91
|
}
|
92
|
|
93
|
/**
|
94
|
* {@inheritDoc}
|
95
|
*/
|
96
|
@Override
|
97
|
protected List<TermVocabularyDto> getVocabulariesFromPreference() {
|
98
|
// TODO Auto-generated method stub
|
99
|
return null;
|
100
|
}
|
101
|
|
102
|
|
103
|
|
104
|
}
|