Revision 755105d4
Added by Katja Luther almost 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/ChecklistEditorGeneralAdminPreference.java | ||
---|---|---|
50 | 50 |
IPreferenceService service = controller.getPreferenceService(); |
51 | 51 |
|
52 | 52 |
CdmPreference pref = CdmPreference.NewTaxEditorInstance( PreferencePredicate.DistributionEditorActivated, Boolean.toString(isEditorActivated)); |
53 |
pref.setAllowOverride(this.allowOverrideActivated);
|
|
53 |
pref.setAllowOverride(this.distributionEditorPref.isAllowOverride());
|
|
54 | 54 |
service.set(pref); |
55 | 55 |
|
56 | 56 |
pref = CdmPreference.NewTaxEditorInstance( PreferencePredicate.DisplayOfAreasInDistributionEditor, this.displayArea); |
57 |
pref.setAllowOverride(this.allowOverrideAreaDisplay);
|
|
57 |
pref.setAllowOverride(prefAreaDisplay.isAllowOverride());
|
|
58 | 58 |
service.set(pref); |
59 | 59 |
|
60 | 60 |
pref = CdmPreference.NewTaxEditorInstance( PreferencePredicate.DisplayOfStatus, this.displayStatus); |
61 |
pref.setAllowOverride(this.allowOverrideStatusDisplay);
|
|
61 |
pref.setAllowOverride(prefStatusDisplay.isAllowOverride());
|
|
62 | 62 |
service.set(pref); |
63 | 63 |
|
64 | 64 |
pref = CdmPreference.NewTaxEditorInstance( PreferencePredicate.ShowRankInDistributionEditor, Boolean.toString(isShowRank)); |
65 |
pref.setAllowOverride(this.allowOverrideRank);
|
|
65 |
pref.setAllowOverride(prefRank.isAllowOverride());
|
|
66 | 66 |
service.set(pref); |
67 | 67 |
|
68 | 68 |
pref = CdmPreference.NewTaxEditorInstance( PreferencePredicate.AreasSortedInDistributionEditor, this.orderAreas); |
69 |
pref.setAllowOverride(this.allowOverrideOrderAreas);
|
|
69 |
pref.setAllowOverride(prefAreaSort.isAllowOverride());
|
|
70 | 70 |
service.set(pref); |
71 | 71 |
|
72 | 72 |
pref = CdmPreference.NewTaxEditorInstance( PreferencePredicate.OwnDescriptionForDistributionEditor, Boolean.toString(ownDescriptionForDistributionEditor)); |
73 |
pref.setAllowOverride(this.allowOverrideOwnDescriptionForDistributionEditor);
|
|
73 |
pref.setAllowOverride(prefOwnDescription.isAllowOverride());
|
|
74 | 74 |
service.set(pref); |
75 | 75 |
|
76 |
if (statusPref != null){ |
|
77 |
service.set(statusPref); |
|
78 |
} |
|
79 |
if (areaVocPref != null){ |
|
80 |
service.set(areaVocPref); |
|
81 |
} |
|
76 |
// if (statusPref != null){
|
|
77 |
// service.set(statusPref);
|
|
78 |
// }
|
|
79 |
// if (areaVocPref != null){
|
|
80 |
// service.set(areaVocPref);
|
|
81 |
// }
|
|
82 | 82 |
PreferencesUtil.updateDBPreferences(); |
83 | 83 |
|
84 | 84 |
return true; |
... | ... | |
86 | 86 |
|
87 | 87 |
@Override |
88 | 88 |
public void getValues() { |
89 |
|
|
89 |
super.getValues(); |
|
90 | 90 |
distributionEditorPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DistributionEditorActivated); |
91 | 91 |
if (distributionEditorPref == null){ |
92 | 92 |
distributionEditorPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DistributionEditorActivated, PreferencePredicate.DistributionEditorActivated.getDefaultValue().toString()); |
93 | 93 |
} |
94 | 94 |
isEditorActivated = Boolean.valueOf(distributionEditorPref.getValue()); |
95 |
allowOverrideActivated = distributionEditorPref.isAllowOverride(); |
|
95 |
// allowOverrideActivated = distributionEditorPref.isAllowOverride();
|
|
96 | 96 |
isAdminPreference = true; |
97 | 97 |
|
98 |
CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DisplayOfAreasInDistributionEditor); |
|
99 |
if (pref != null){ |
|
100 |
this.displayArea = pref.getValue(); |
|
101 |
this.allowOverrideAreaDisplay = pref.isAllowOverride(); |
|
98 |
if (prefAreaDisplay != null){ |
|
99 |
this.displayArea = prefAreaDisplay.getValue(); |
|
102 | 100 |
}else{ |
103 | 101 |
this.displayArea = ((TermDisplayEnum)PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue()).getKey(); |
104 |
this.allowOverrideAreaDisplay = true; |
|
105 | 102 |
} |
106 | 103 |
|
107 |
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DisplayOfStatus); |
|
108 |
if (pref != null){ |
|
109 |
this.displayStatus = pref.getValue(); |
|
110 |
this.allowOverrideStatusDisplay = pref.isAllowOverride(); |
|
104 |
|
|
105 |
if (prefStatusDisplay != null){ |
|
106 |
this.displayStatus = prefStatusDisplay.getValue(); |
|
111 | 107 |
}else{ |
112 | 108 |
this.displayStatus = ((TermDisplayEnum)PreferencePredicate.DisplayOfStatus.getDefaultValue()).getKey(); |
113 |
this.allowOverrideStatusDisplay = true; |
|
114 | 109 |
} |
115 | 110 |
|
116 |
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AreasSortedInDistributionEditor); |
|
117 |
if (pref != null){ |
|
118 |
if (pref.getValue() != null){ |
|
119 |
this.orderAreas = pref.getValue().toString(); |
|
111 |
if (prefAreaSort != null){ |
|
112 |
if (prefAreaSort.getValue() != null){ |
|
113 |
this.orderAreas = prefAreaSort.getValue().toString(); |
|
120 | 114 |
}else{ |
121 | 115 |
this.orderAreas = ((TermOrder)PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue()).getKey(); |
122 | 116 |
} |
123 |
this.allowOverrideOrderAreas = pref.isAllowOverride(); |
|
117 |
|
|
124 | 118 |
}else{ |
125 | 119 |
this.orderAreas = ((TermOrder)PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue()).getKey(); |
126 |
this.allowOverrideOrderAreas = true; |
|
120 |
|
|
127 | 121 |
} |
128 | 122 |
|
129 |
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowRankInDistributionEditor); |
|
130 |
if (pref != null){ |
|
131 |
this.isShowRank = Boolean.valueOf(pref.getValue().toString()); |
|
132 |
this.allowOverrideRank = pref.isAllowOverride(); |
|
123 |
|
|
124 |
if (prefRank != null){
|
|
125 |
this.isShowRank = Boolean.valueOf(prefRank.getValue().toString());
|
|
126 |
|
|
133 | 127 |
}else{ |
134 | 128 |
this.isShowRank = Boolean.valueOf(PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue().toString()); |
135 |
this.allowOverrideRank = true; |
|
136 | 129 |
} |
137 | 130 |
|
138 |
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.OwnDescriptionForDistributionEditor); |
|
139 |
if (pref != null){ |
|
140 |
this.ownDescriptionForDistributionEditor = Boolean.valueOf(pref.getValue().toString()); |
|
141 |
this.allowOverrideOwnDescriptionForDistributionEditor= pref.isAllowOverride(); |
|
131 |
|
|
132 |
if (prefOwnDescription != null){ |
|
133 |
this.ownDescriptionForDistributionEditor = Boolean.valueOf(prefOwnDescription.getValue().toString()); |
|
142 | 134 |
}else{ |
143 | 135 |
this.ownDescriptionForDistributionEditor = Boolean.valueOf(PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue().toString()); |
144 |
this.allowOverrideOwnDescriptionForDistributionEditor = true; |
|
145 | 136 |
} |
146 | 137 |
|
147 | 138 |
commandHandlerString = "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler"; |
148 |
commandHandlerStringStatus = "eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardAdminHandler";
|
|
139 |
commandHandlerStringStatus = "eu.etaxonomy.taxeditor.store.open.OpenDistributionPerAreaStatusWizardHandler";
|
|
149 | 140 |
|
150 | 141 |
setValid(false); |
151 | 142 |
} |
Also available in: Unified diff
ref #8045: show possible entries for preferences in combo boxes and show default value - continue