Project

General

Profile

Revision dd2e9b75

IDdd2e9b758ce6b222a712bfd71521fd30d4d70f7c
Parent ff8dd44d
Child 9445fcdc

Added by Katja Luther about 1 year ago

ref #7849: default values in local preferences

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/ChecklistEditorGeneralAdminPreference.java
29 29
public class ChecklistEditorGeneralAdminPreference extends ChecklistEditorGeneralPreference implements IE4AdminPreferencePage {
30 30

  
31 31
    Composite parent;
32
    CdmPreference areaVocPref = null;
33
    CdmPreference statusPref = null;
32

  
34 33

  
35 34
    @Override
36 35
    protected Control createContents(Composite parent) {
......
151 150
        setValid(false);
152 151
    }
153 152

  
154
    @Override
155
    protected void performDefaults() {
156
        isEditorActivated = (Boolean)PreferencePredicate.DistributionEditorActivated.getDefaultValue();
157
        activateCheckButton.setSelection(isEditorActivated);
158

  
159
        displayArea = ((TermDisplayEnum)PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue()).getKey();
160
        TermDisplayEnum areaDisplay;
161
        try{
162
            if (displayArea != null){
163
                areaDisplay  = TermDisplayEnum.byKey(displayArea);
164
            }else{
165
                areaDisplay = TermDisplayEnum.Title;
166
            }
167
        }catch(IllegalArgumentException e){
168
            areaDisplay = TermDisplayEnum.Title;
169
        }
170
        int index = 0;
171
        for (String itemLabel : areaDisplaySelectionCombo.getItems()){
172
            if (itemLabel.equalsIgnoreCase(areaDisplay.getLabel())){
173
                areaDisplaySelectionCombo.select(index);
174
                break;
175
            }
176
            index++;
177
        }
178

  
179
        displayStatus = ((TermDisplayEnum)PreferencePredicate.DisplayOfStatus.getDefaultValue()).getKey();
180
        TermDisplayEnum statusDisplay;
181
        try{
182
            if (displayStatus != null){
183
                statusDisplay  = TermDisplayEnum.byKey(displayStatus);
184
            }else{
185
                statusDisplay = TermDisplayEnum.Title;
186
            }
187
        }catch(IllegalArgumentException e){
188
            statusDisplay = TermDisplayEnum.Title;
189
        }
190
        index = 0;
191
        for (String itemLabel : statusDisplaySelectionCombo.getItems()){
192
            if (itemLabel.equalsIgnoreCase(statusDisplay.getLabel())){
193
                statusDisplaySelectionCombo.select(index);
194
                break;
195
            }
196
            index++;
197
        }
198

  
199

  
200

  
201
        orderAreas = ((TermOrder)PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue()).getKey();
202
        index = 0;
203
        if (PreferencesUtil.getStringValue(PreferencePredicate.DistributionEditorActivated.getKey()) != null){
204
            TermOrder areaOrder;
205
            try{
206
                if (orderAreas != null){
207
                    areaOrder  = TermOrder.valueOf(orderAreas);
208
                }else{
209
                    areaOrder = TermOrder.IdInVoc;
210
                }
211
            }catch(IllegalArgumentException e){
212
                areaOrder = TermOrder.IdInVoc;
213
            }
214
            for (String itemLabel : areaOrderSelectionCombo.getItems()){
215
                if (itemLabel.equalsIgnoreCase(areaOrder.getLabel())){
216
                    areaOrderSelectionCombo.select(index);
217
                    break;
218
                }
219
                index++;
220
            }
221
        }
222

  
223

  
224
        isShowRank = Boolean.valueOf(PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue().toString());
225
        activateRankButton.setSelection(isShowRank);
226 153

  
227
        ownDescriptionForDistributionEditor = Boolean.valueOf(PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue().toString());
228

  
229
        allowOverrideActivated = true;
230
        allowOverrideActivatedButton.setSelection(allowOverrideActivated);
231
        allowOverrideAreaDisplay = true;
232
        allowOverrideAreaDisplayButton.setSelection(allowOverrideAreaDisplay);
233
        allowOverrideStatusDisplay = true;
234
        allowOverrideStatusDisplayButton.setSelection(allowOverrideStatusDisplay);
235
        allowOverrideOrderAreas = true;
236
        allowOverrideOrderAreasButton.setSelection(allowOverrideOrderAreas);
237
        allowOverrideRank = true;
238
        allowOverrideRankButton.setSelection(allowOverrideRank);
239
        allowOverrideOwnDescriptionForDistributionEditor = true;
240
        createContents(parent);
241

  
242
        this.statusPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, null);
243
        this.areaVocPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, null);
244
        super.performDefaults();
245
    }
246 154

  
247 155
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NameDetailsViewAdminConfiguration.java
90 90

  
91 91
    }
92 92

  
93
    @Override
94
    protected void performDefaults() {
95
        nameDetailsConfig = new NameDetailsConfigurator(false);
96
        isShowAppendedPhrase = nameDetailsConfig.isAppendedPhraseActivated();
97
        isShowEpithets = nameDetailsConfig.isAtomisedEpithetsActivated();
98
        isShowAuthorship = nameDetailsConfig.isAuthorshipSectionActivated();
99
        isShowAuthorCache = nameDetailsConfig.isAuthorCacheActivated();
100
        isShowLSID = nameDetailsConfig.isLSIDActivated();
101
        isShowNameApprobiation = nameDetailsConfig.isNameApprobiationActivated();
102
        isShowNameCache = nameDetailsConfig.isNameCacheActivated();
103
        isShowNameRelationship = nameDetailsConfig.isNameRelationsSectionActivated();
104
        isShowNomenclaturalCode = nameDetailsConfig.isNomenclaturalCodeActived();
105
        isShowNomenclaturalStatus = nameDetailsConfig.isNomenclaturalStatusSectionActivated();
106
        isShowNomenclaturalRef = nameDetailsConfig.isNomenclaturalReferenceSectionActivated();
107
        isShowProtologue = nameDetailsConfig.isProtologueActivated();
108
        isShowRank = nameDetailsConfig.isRankActivated();
109
        isShowTaxon = nameDetailsConfig.isTaxonSectionActivated();
110
        isSecDetailsActivated = nameDetailsConfig.isSecDetailsActivated();
111
        isSecEnabled = nameDetailsConfig.isSecEnabled();
112
        isShowTypeDesignation = nameDetailsConfig.isTypeDesignationSectionActivated();
113
        isShowHybrid = nameDetailsConfig.isHybridActivated();
114
        this.setButtonSelections();
115
        super.performDefaults();
116
    }
93

  
117 94

  
118 95

  
119 96
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/PublishFlagPreference.java
73 73
        publishBehaviour = PublishEnum.valueOf(pref.getValue());
74 74
    }
75 75

  
76
    @Override
77
    protected void performDefaults() {
78
        publishBehaviour = (PublishEnum)PreferencePredicate.DefaultBehaviourForPublishFlag.getDefaultValue();
79
        allowOverride = true;
80
        int index = 0;
81
        for (String itemLabel : publishFlagBehaviour.getItems()){
82
            if (itemLabel.equalsIgnoreCase(publishBehaviour.getLabel())){
83
                publishFlagBehaviour.select(index);
84
                break;
85
            }
86
            index++;
87
        }
88 76

  
89
        super.performDefaults();
90
    }
91 77

  
92 78

  
93 79

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/SpecimenAdminPreferences.java
134 134
        return true;
135 135
    }
136 136

  
137
    @Override
138
    protected void performDefaults() {
139
        isShowSpecimenRelatedIssues = (Boolean)PreferencePredicate.ShowSpecimen.getDefaultValue();
140
        showSpecimenButton.setSelection(isShowSpecimenRelatedIssues);
141

  
142
        allowOverrideShowSpecimenRelatedIssues = true;
143
        allowOverrideIsShowSpecimenRelatedIssuesButton.setSelection(allowOverrideShowSpecimenRelatedIssues);
144

  
145
        isShowCollectingAreaInGeneralSection = (Boolean)PreferencePredicate.ShowCollectingAreasInGeneralSection.getDefaultValue();
146
        showCollectingAreaInGeneralSectionButton.setSelection(isShowCollectingAreaInGeneralSection);
147

  
148
        allowOverrideShowCollectingAreaInGeneralSection = true;
149
        allowOverrideShowCollectingAreaButton.setSelection(allowOverrideShowCollectingAreaInGeneralSection);
150

  
151
        isDeterminationOnlyForFieldUnits = (Boolean) PreferencePredicate.DeterminationOnlyForFieldUnits.getDefaultValue();
152
        determinationOnlyForFieldUnitsButton.setSelection(isDeterminationOnlyForFieldUnits);
153

  
154
        allowOverrideDeterminationOnlyForFieldUnits = true;
155
        allowOverridesDeterminationOnlyForFieldUnitsButton.setSelection(allowOverrideDeterminationOnlyForFieldUnits);
156

  
157
        isShowTaxonAssociation = (Boolean) PreferencePredicate.ShowTaxonAssociations.getDefaultValue();
158
        showTaxonAssociationButton.setSelection(isShowTaxonAssociation);
159

  
160
        allowOverrideShowTaxonAssociation = true;
161
        allowOverrideIsShowTaxonAssociationButton.setSelection(allowOverrideShowTaxonAssociation);
162

  
163
        isShowLifeForm = (Boolean) PreferencePredicate.ShowLifeForm.getDefaultValue();
164
        showLifeFormButton.setSelection(isShowLifeForm);
165

  
166
        allowOverrideShowLifeForm = true;
167
        allowOverrideShowLifeFormButton.setSelection(allowOverrideShowLifeForm);
168

  
169
        super.performDefaults();
170
    }
171

  
172 137
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java
26 26
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
27 27
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
28 28
import eu.etaxonomy.cdm.model.metadata.TermDisplayEnum;
29
import eu.etaxonomy.cdm.model.metadata.TermOrder;
29 30
import eu.etaxonomy.taxeditor.l10n.Messages;
30 31
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
31 32
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
......
81 82
    protected Button activateRankButton;
82 83
    protected Button allowOverrideRankButton;
83 84

  
85
    protected CdmPreference areaVocPref = null;
86
    protected CdmPreference statusPref = null;
87

  
84 88
    @Override
85 89
    protected Control createContents(Composite parent) {
86 90
        getValues();
......
500 504
            PreferencesUtil.setOwnDescriptionForChecklistEditor(ownDescriptionForDistributionEditor);
501 505
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey()), overrideOwnDescriptionForDistributionEditor);
502 506

  
503

  
507
            if (statusPref != null){
508
                PreferencesUtil.setStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(), statusPref.getValue());
509
                PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.AvailableDistributionStatus.getKey()), true);
510
            }
511
            if (areaVocPref != null){
512
                PreferencesUtil.setStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey(), areaVocPref.getValue());
513
                PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey()), true);
514
            }
504 515

  
505 516

  
506 517
        }
......
625 636
                if (pref.getValue() != null){
626 637
                    orderAreas = pref.getValue().toString();
627 638
                }else{
628
                    orderAreas = PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue().toString();
639
                    orderAreas = ((TermOrder)PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue()).getKey();
629 640
                }
630 641
            }
631 642
        }else{
......
672 683

  
673 684
    }
674 685

  
686
    @Override
687
    protected void performDefaults() {
688
        isEditorActivated = (Boolean)PreferencePredicate.DistributionEditorActivated.getDefaultValue();
689
        activateCheckButton.setSelection(isEditorActivated);
690

  
691
        displayArea = ((TermDisplayEnum)PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue()).getKey();
692
        TermDisplayEnum areaDisplay;
693
        try{
694
            if (displayArea != null){
695
                areaDisplay  = TermDisplayEnum.byKey(displayArea);
696
            }else{
697
                areaDisplay = TermDisplayEnum.Title;
698
            }
699
        }catch(IllegalArgumentException e){
700
            areaDisplay = TermDisplayEnum.Title;
701
        }
702
        int index = 0;
703
        for (String itemLabel : areaDisplaySelectionCombo.getItems()){
704
            if (itemLabel.equalsIgnoreCase(areaDisplay.getLabel())){
705
                areaDisplaySelectionCombo.select(index);
706
                break;
707
            }
708
            index++;
709
        }
710

  
711
        displayStatus = ((TermDisplayEnum)PreferencePredicate.DisplayOfStatus.getDefaultValue()).getKey();
712
        TermDisplayEnum statusDisplay;
713
        try{
714
            if (displayStatus != null){
715
                statusDisplay  = TermDisplayEnum.byKey(displayStatus);
716
            }else{
717
                statusDisplay = TermDisplayEnum.Title;
718
            }
719
        }catch(IllegalArgumentException e){
720
            statusDisplay = TermDisplayEnum.Title;
721
        }
722
        index = 0;
723
        for (String itemLabel : statusDisplaySelectionCombo.getItems()){
724
            if (itemLabel.equalsIgnoreCase(statusDisplay.getLabel())){
725
                statusDisplaySelectionCombo.select(index);
726
                break;
727
            }
728
            index++;
729
        }
730

  
731

  
732

  
733
        orderAreas = ((TermOrder)PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue()).getKey();
734
        index = 0;
735
        if (PreferencesUtil.getStringValue(PreferencePredicate.DistributionEditorActivated.getKey()) != null){
736
            TermOrder areaOrder;
737
            try{
738
                if (orderAreas != null){
739
                    areaOrder  = TermOrder.valueOf(orderAreas);
740
                }else{
741
                    areaOrder = TermOrder.IdInVoc;
742
                }
743
            }catch(IllegalArgumentException e){
744
                areaOrder = TermOrder.IdInVoc;
745
            }
746
            for (String itemLabel : areaOrderSelectionCombo.getItems()){
747
                if (itemLabel.equalsIgnoreCase(areaOrder.getLabel())){
748
                    areaOrderSelectionCombo.select(index);
749
                    break;
750
                }
751
                index++;
752
            }
753
        }
754

  
755

  
756
        isShowRank = Boolean.valueOf(PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue().toString());
757
        activateRankButton.setSelection(isShowRank);
758

  
759
        ownDescriptionForDistributionEditor = Boolean.valueOf(PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue().toString());
760

  
761
        allowOverrideActivated = true;
762
        allowOverrideActivatedButton.setSelection(allowOverrideActivated);
763
        overrideActivated = true;
764
        allowOverrideAreaDisplay = true;
765
        overrideAreaDisplay = true;
766
        allowOverrideAreaDisplayButton.setSelection(allowOverrideAreaDisplay);
767
        allowOverrideStatusDisplay = true;
768
        overrideStatusDisplay = true;
769
        allowOverrideStatusDisplayButton.setSelection(allowOverrideStatusDisplay);
770
        allowOverrideOrderAreas = true;
771
        overrideOrderAreas = true;
772
        allowOverrideOrderAreasButton.setSelection(allowOverrideOrderAreas);
773
        allowOverrideRank = true;
774
        overrideRank = true;
775
        allowOverrideRankButton.setSelection(allowOverrideRank);
776
        allowOverrideOwnDescriptionForDistributionEditor = true;
777
        overrideOwnDescriptionForDistributionEditor = true;
778

  
779
        this.statusPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, null);
780
        this.areaVocPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, null);
781
        super.performDefaults();
782
    }
783

  
675 784

  
676 785
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/CommonNameVocabularySelection.java
114 114
        }
115 115
    }
116 116

  
117
    @Override
118
    protected void performDefaults() {
119

  
120
        super.performDefaults();
121
    }
122

  
117 123

  
118 124

  
119 125

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ExternalServicesPreferences.java
102 102

  
103 103
    }
104 104

  
105
    @Override
106
    protected void performDefaults() {
107
        openUrl.presentsDefaultValue();
108
        maxHeight.presentsDefaultValue();
109
        maxWidth.presentsDefaultValue();
110
        mapService.presentsDefaultValue();
111
        super.performDefaults();
112
    }
113

  
105 114

  
106 115
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/MediaPreferences.java
52 52

  
53 53
    }
54 54

  
55
    @Override
56
    protected void performDefaults() {
57
        advanced.presentsDefaultValue();
58
        preview.presentsDefaultValue();
59
        super.performDefaults();
60
    }
61

  
55 62

  
56 63

  
57 64

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/OrderPreferences.java
24 24
	    boolean isRestoreTaxonNavigator;
25 25
	    boolean isSelectionChanged = false;
26 26
	    boolean isStrictlyAlphabeticallyOrdered;
27
	    Button activateRestoreNavigatorButton;
27 28

  
28 29
	    @Override
29 30
	    protected Control createContents(Composite parent) {
......
33 34
            Composite secondComposite = new Composite(parent, SWT.NULL);
34 35
            secondComposite.setLayout(new GridLayout());
35 36

  
36
            final Button activateRestoreNavigatorButton = new Button(secondComposite, SWT.CHECK | SWT.LEFT);
37
            activateRestoreNavigatorButton = new Button(secondComposite, SWT.CHECK | SWT.LEFT);
37 38
            activateRestoreNavigatorButton.setText(Messages.OrderPreferences_Restore);
38 39
            activateRestoreNavigatorButton.setSelection(isRestoreTaxonNavigator);
39 40
            activateRestoreNavigatorButton.addSelectionListener(new SelectionAdapter(){
......
125 126

  
126 127
        }
127 128

  
129
        @Override
130
        protected void performDefaults() {
131
            activateRestoreNavigatorButton.setSelection(false);
132
            isRestoreTaxonNavigator = false;
133
            orderActivated = NavigatorOrderEnum.RankAndNameOrder;
134
            int index = 0;
135
            for (String itemLabel : orderSelectionCombo.getItems()){
136
                if (itemLabel.equalsIgnoreCase(orderActivated.getLabel())){
137
                    orderSelectionCombo.select(index);
138
                    break;
139
                }
140
                index++;
141
            }
142
            super.performDefaults();
143
        }
144

  
128 145

  
129 146
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
846 846
		getPreferenceStore().setDefault(createPreferenceString(SORT_NODES), NavigatorOrderEnum.RankAndNameOrder.getKey());
847 847

  
848 848
		getPreferenceStore().setDefault(createPreferenceString(SORT_TAXA_BY_RANK_AND_NAME), true);
849

  
850
		getPreferenceStore().setDefault(createPreferenceString(SHOW_ADVANCED_MEDIA_SECTION), false);
851

  
852
        getPreferenceStore().setDefault(createPreferenceString(SHOW_MEDIA_PREVIEW), false);
849 853
		//override db preferences
850 854
		getPreferenceStore().setDefault(createPreferenceString(prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey())), false);
851 855
		getPreferenceStore().setDefault(createPreferenceString(prefOverrideKey(PreferencePredicate.ShowSpecimen.getKey())), true);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PublishFlagLocalPreference.java
35 35

  
36 36
    protected Combo publishFlagBehaviour;
37 37
    protected CdmPreference pref = null;
38
    Button allowOverrideButton;
38 39

  
39 40
    protected boolean allowOverride;
40 41

  
......
87 88

  
88 89
            }
89 90
        });
90
        Button allowOverrideButton = createAllowOverrideButton(composite);
91
        allowOverrideButton = createAllowOverrideButton(composite);
91 92
        allowOverrideButton.setText(Messages.GeneralPreference_override);
92 93
        allowOverrideButton.setSelection(allowOverride);
93 94
        allowOverrideButton.addSelectionListener(new SelectionAdapter(){
......
140 141
        }
141 142
    }
142 143

  
144
    @Override
145
    protected void performDefaults() {
146
        publishBehaviour = (PublishEnum)PreferencePredicate.DefaultBehaviourForPublishFlag.getDefaultValue();
147
        allowOverride = true;
148
        int index = 0;
149
        for (String itemLabel : publishFlagBehaviour.getItems()){
150
            if (itemLabel.equalsIgnoreCase(publishBehaviour.getLabel())){
151
                publishFlagBehaviour.select(index);
152
                break;
153
            }
154
            index++;
155
        }
156

  
157
        super.performDefaults();
158
    }
159

  
143 160

  
144 161
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/SpecimenOrObservationPreferences.java
372 372
    }
373 373

  
374 374

  
375

  
376
    @Override
377
    protected void performDefaults() {
378
        isShowSpecimenRelatedIssues = (Boolean)PreferencePredicate.ShowSpecimen.getDefaultValue();
379
        showSpecimenButton.setSelection(isShowSpecimenRelatedIssues);
380

  
381
        allowOverrideShowSpecimenRelatedIssues = true;
382
        allowOverrideIsShowSpecimenRelatedIssuesButton.setSelection(allowOverrideShowSpecimenRelatedIssues);
383

  
384
        isShowCollectingAreaInGeneralSection = (Boolean)PreferencePredicate.ShowCollectingAreasInGeneralSection.getDefaultValue();
385
        showCollectingAreaInGeneralSectionButton.setSelection(isShowCollectingAreaInGeneralSection);
386

  
387
        allowOverrideShowCollectingAreaInGeneralSection = true;
388
        allowOverrideShowCollectingAreaButton.setSelection(allowOverrideShowCollectingAreaInGeneralSection);
389

  
390
        isDeterminationOnlyForFieldUnits = (Boolean) PreferencePredicate.DeterminationOnlyForFieldUnits.getDefaultValue();
391
        determinationOnlyForFieldUnitsButton.setSelection(isDeterminationOnlyForFieldUnits);
392

  
393
        allowOverrideDeterminationOnlyForFieldUnits = true;
394
        allowOverridesDeterminationOnlyForFieldUnitsButton.setSelection(allowOverrideDeterminationOnlyForFieldUnits);
395

  
396
        isShowTaxonAssociation = (Boolean) PreferencePredicate.ShowTaxonAssociations.getDefaultValue();
397
        showTaxonAssociationButton.setSelection(isShowTaxonAssociation);
398

  
399
        allowOverrideShowTaxonAssociation = true;
400
        allowOverrideIsShowTaxonAssociationButton.setSelection(allowOverrideShowTaxonAssociation);
401

  
402
        isShowLifeForm = (Boolean) PreferencePredicate.ShowLifeForm.getDefaultValue();
403
        showLifeFormButton.setSelection(isShowLifeForm);
404

  
405
        allowOverrideShowLifeForm = true;
406
        allowOverrideShowLifeFormButton.setSelection(allowOverrideShowLifeForm);
407

  
408
        super.performDefaults();
409
    }
410

  
411

  
375 412
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AbstractAdminTermSelectionWizardPage.java
16 16

  
17 17
import eu.etaxonomy.cdm.model.common.TermType;
18 18
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
19
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
19 20
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
20 21

  
21 22
/**
......
33 34
    protected AbstractAdminTermSelectionWizardPage(String pageName, TermType type, CdmPreference pref) {
34 35
        super(pageName, type);
35 36
        this.pref = pref;
37
        if (localPref){
38
            this.override = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(pref.getPredicate()));
39
        }else{
40
            this.override = pref != null? this.pref.isAllowOverride(): true;
41
        }
36 42

  
37
        this.override = pref != null? this.pref.isAllowOverride(): true;
38 43
    }
39 44

  
40 45
    CdmPreference pref;
......
48 53
        final Button activateCheckButton = new Button(parent, SWT.CHECK);
49 54
       if (localPref){
50 55
           activateCheckButton.setText("Override");
56
           activateCheckButton.setSelection(override);
51 57
       }else{
52 58
           activateCheckButton.setText("Allow Override");
59
           activateCheckButton.setSelection(pref.isAllowOverride());
53 60
       }
54
       activateCheckButton.setSelection(pref.isAllowOverride());
61

  
62

  
55 63

  
56 64
        activateCheckButton.addSelectionListener(new SelectionAdapter(){
57 65
                @Override
58 66
                public void widgetSelected(SelectionEvent e) {
59 67
                    pref.setAllowOverride(activateCheckButton.getSelection());
68
                    override = activateCheckButton.getSelection();
60 69

  
61 70
                }
62 71
            });
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AbstractTermSelectionWizardPage.java
53 53
        // TODO check if configuration exists
54 54
       // CdmStore.getCurrentSessionManager().bindNullSession();
55 55
        this.type = type;
56

  
56 57
    }
57 58

  
58 59
    @Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AvailableAreaVocabulariesPage.java
68 68
            if (StringUtils.isBlank(vocString) && pref != null){
69 69
                vocString = pref.getValue();
70 70
            }
71
            this.override = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(pref.getPredicate()));
71 72
        }else if (pref != null){
72 73
            vocString = pref.getValue();
73 74
        }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AvailableDistributionStatusPage.java
44 44
        setTitle(Messages.AvailableDistributionStatusPage_PAGE_TITLE);
45 45
        setDescription(Messages.AvailableDistributionStatusPage_PAGE_DESCRIPTION);
46 46
        //if (!localPref){
47
            createAllowOverrideButton(parent);
47
        override = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableDistributionStatus.getKey()));
48
        createAllowOverrideButton(parent);
48 49
        //}
49 50
        super.createControl(parent);
50 51

  
......
58 59
           if (StringUtils.isBlank(checkedValues) && pref != null){
59 60
               checkedValues = pref.getValue();
60 61
           }
62

  
61 63
        }else {
62 64
            checkedValues = pref.getValue();
63 65
        }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AvailableDistributionStatusWizard.java
100 100
        String saveCheckedElements = StringUtils.join(listUIIDChecked, ";"); //$NON-NLS-1$
101 101

  
102 102
        PreferencesUtil.setStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(), saveCheckedElements);
103
        PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableDistributionStatus.getKey()), true);
103
        PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableDistributionStatus.getKey()), aPage.override);
104 104
        PreferencesUtil.firePreferencesChanged(this.getClass());
105 105
        return true;
106 106
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AvailableVocabularyWizard.java
97 97
            predicate = pref.getPredicate();
98 98
        }
99 99

  
100
//        if (!localPref){
100
        if (!localPref){
101 101
            CdmPreference savePref = CdmPreference.NewInstance(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.getByKey(predicate), saveCheckedElements);
102 102
            savePref.setAllowOverride(pref.isAllowOverride());
103 103
            PreferencesUtil.setPreferenceToDB(savePref);
104 104

  
105 105
            PreferencesUtil.updateDBPreferences();
106

  
106
        }else{
107
            PreferencesUtil.setStringValue(predicate, saveCheckedElements);
108
            PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(predicate), this.aPage.override);
109
        }
107 110
        return true;
108 111
    }
109 112

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)