ref #7849: show db preference for status and area vocabularies if no local prefs...
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / preference / wizard / AvailableDistributionStatusPage.java
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.model.metadata.PreferencePredicate;
22 import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
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 05.10.2018
31 *
32 */
33 public class AvailableDistributionStatusPage extends AbstractAdminTermSelectionWizardPage implements ICdmEntitySessionEnabled{
34
35
36
37 public AvailableDistributionStatusPage(String pageName, CdmPreference pref, boolean localPref) {
38 super(pageName, TermType.PresenceAbsenceTerm, pref);
39 this.localPref = localPref;
40 }
41
42 @Override
43 public void createControl(Composite parent) {
44 setTitle(Messages.AvailableDistributionStatusPage_PAGE_TITLE);
45 setDescription(Messages.AvailableDistributionStatusPage_PAGE_DESCRIPTION);
46 //if (!localPref){
47 createAllowOverrideButton(parent);
48 //}
49 super.createControl(parent);
50
51 }
52
53 @Override
54 protected String getCheckedValuesFromPreferences() {
55 String checkedValues = null;
56 if (localPref || pref == null){
57 checkedValues = PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(), true);
58 if (StringUtils.isBlank(checkedValues) && pref != null){
59 checkedValues = pref.getValue();
60 }
61 }else {
62 checkedValues = pref.getValue();
63 }
64 return checkedValues;
65 }
66
67 @Override
68 public ICdmEntitySession getCdmEntitySession() {
69 return null;
70 }
71
72 @Override
73 public <T extends CdmBase> Collection<T> getRootEntities() {
74 return null;
75 }
76
77 @Override
78 public Map<Object, List<String>> getPropertyPathsMap() {
79 return null;
80 }
81
82 @Override
83 protected List<TermVocabularyDto> getVocabulariesFromPreference(){
84 return null;
85 }
86
87 }