Revision 432276e4
Added by Katja Luther over 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java | ||
---|---|---|
12 | 12 |
import org.eclipse.swt.custom.CLabel; |
13 | 13 |
import org.eclipse.swt.events.SelectionAdapter; |
14 | 14 |
import org.eclipse.swt.events.SelectionEvent; |
15 |
import org.eclipse.swt.events.SelectionListener; |
|
16 |
import org.eclipse.swt.layout.GridData; |
|
15 | 17 |
import org.eclipse.swt.layout.GridLayout; |
16 | 18 |
import org.eclipse.swt.widgets.Button; |
19 |
import org.eclipse.swt.widgets.Combo; |
|
17 | 20 |
import org.eclipse.swt.widgets.Composite; |
18 | 21 |
import org.eclipse.swt.widgets.Control; |
19 | 22 |
import org.eclipse.swt.widgets.Label; |
... | ... | |
22 | 25 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
23 | 26 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
24 | 27 |
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage; |
25 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
26 | 28 |
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton; |
27 | 29 |
|
28 | 30 |
/** |
... | ... | |
30 | 32 |
* @date 21.07.2014 |
31 | 33 |
* |
32 | 34 |
*/ |
33 |
public class ChecklistEditorGeneralPreference extends CdmPreferencePage { |
|
35 |
public class ChecklistEditorGeneralPreference extends CdmPreferencePage implements SelectionListener {
|
|
34 | 36 |
|
35 |
boolean isEditorActivated; |
|
37 |
protected boolean isEditorActivated; |
|
38 |
protected boolean allowOverrideActivated; |
|
36 | 39 |
boolean isUseLocal; |
37 |
boolean isShowRank; |
|
38 |
boolean isSortByVocabularyOrder; |
|
39 |
boolean isShowSymbol; |
|
40 |
boolean isShowIdInVocabulary; |
|
41 |
boolean isShowSymbol1; |
|
42 |
boolean isShowSymbol2; |
|
43 |
boolean isShowTitle; |
|
40 |
protected boolean isShowRank; |
|
41 |
protected boolean isSortByVocabularyOrder; |
|
42 |
protected String displayStatus; |
|
43 |
protected String displayArea; |
|
44 |
protected boolean allowOverrideStatus; |
|
45 |
protected boolean allowOverrideRank; |
|
46 |
protected boolean allowOverrideOrderAreas; |
|
47 |
protected boolean allowOverrideAreaDisplay; |
|
48 |
protected boolean allowOverrideStatusDisplay; |
|
49 |
Combo statusDisplaySelectionCombo; |
|
50 |
Combo areaDisplaySelectionCombo; |
|
51 |
|
|
52 |
protected String commandHandlerString; |
|
53 |
protected String commandHandlerStringStatus; |
|
54 |
|
|
55 |
protected CdmPreference distributionEditorPref; |
|
44 | 56 |
Composite child ; |
45 |
boolean isAllowOverride; |
|
57 |
protected boolean isAllowOverride;
|
|
46 | 58 |
|
47 | 59 |
@Override |
48 | 60 |
protected Control createContents(Composite parent) { |
... | ... | |
50 | 62 |
Composite composite = new Composite(parent, SWT.NULL); |
51 | 63 |
composite.setLayout(new GridLayout()); |
52 | 64 |
|
53 |
CdmPreference distributionEditorPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DistributionEditorActivated); |
|
54 |
isAllowOverride = false; |
|
55 |
if (distributionEditorPref != null){ |
|
56 |
isAllowOverride = distributionEditorPref.isAllowOverride(); |
|
57 |
}else{ |
|
58 |
isAllowOverride = true; |
|
59 |
} |
|
60 |
|
|
61 | 65 |
|
62 |
if (isAllowOverride){
|
|
63 |
isEditorActivated = PreferencesUtil.getBooleanValue(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE);
|
|
64 |
final Button activateCheckButton = new Button(composite, SWT.CHECK);
|
|
65 |
activateCheckButton.setText("Enable Distribution Editor");
|
|
66 |
if (isAllowOverride || isAdminPreference){
|
|
67 |
Composite activateComp = createComposite(composite);
|
|
68 |
final Button activateCheckButton = new Button(activateComp, SWT.CHECK);
|
|
69 |
activateCheckButton.setText(Messages.ChecklistEditorGeneralPreference_enable);
|
|
66 | 70 |
activateCheckButton.setSelection(isEditorActivated); |
67 | 71 |
activateCheckButton.addSelectionListener(new SelectionAdapter(){ |
68 | 72 |
@Override |
... | ... | |
80 | 84 |
} |
81 | 85 |
}); |
82 | 86 |
|
83 |
child = new Composite(composite, SWT.NULL); |
|
84 |
child.setLayout(new GridLayout()); |
|
85 |
child.setVisible(isEditorActivated); |
|
86 |
final CLabel label = new CLabel(child, SWT.NULL); |
|
87 |
label.setText("Please open the wizard below, in order to \n" + "choose the area vocabularies for the Distribution Editor"); |
|
88 |
final CommandHandlerButton button_openFeatureTree = new CommandHandlerButton(child, SWT.PUSH, |
|
89 |
"eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler"); |
|
90 |
|
|
91 |
button_openFeatureTree.setText("Select Areas"); |
|
92 |
|
|
93 |
final CLabel description = new CLabel(child, SWT.NULL); |
|
94 |
description.setText(Messages.ChecklistEditorGeneralPreference_Configure_display_of_Areas); |
|
95 |
|
|
96 |
final Button showIdInVocabulary = new Button(child, SWT.RADIO); |
|
97 |
isShowIdInVocabulary = PreferencesUtil.isShowIdInVocabularyInChecklistEditor(); |
|
98 |
showIdInVocabulary.setText("Show Id in Vocabulary instead of full title of the areas"); |
|
99 |
showIdInVocabulary.setSelection(isShowIdInVocabulary); |
|
100 |
showIdInVocabulary.addSelectionListener(new SelectionAdapter(){ |
|
101 |
@Override |
|
102 |
public void widgetSelected(SelectionEvent e) { |
|
103 |
isShowIdInVocabulary = showIdInVocabulary.getSelection(); |
|
104 |
|
|
105 |
} |
|
106 |
}); |
|
107 |
|
|
108 |
|
|
109 |
final Button showSymbol1 = new Button(child, SWT.RADIO); |
|
110 |
isShowSymbol1 = PreferencesUtil.isShowSymbol1InChecklistEditor(); |
|
111 |
|
|
112 |
showSymbol1.setText(Messages.ChecklistEditorGeneralPreference_show_symbol1); |
|
113 |
showSymbol1.setSelection(isShowSymbol1); |
|
114 |
showSymbol1.addSelectionListener(new SelectionAdapter(){ |
|
115 |
@Override |
|
116 |
public void widgetSelected(SelectionEvent e) { |
|
117 |
isShowSymbol1 = showSymbol1.getSelection(); |
|
118 |
|
|
119 |
} |
|
120 |
}); |
|
121 |
final Button showSymbol2 = new Button(child, SWT.RADIO); |
|
122 |
isShowSymbol2 = PreferencesUtil.isShowSymbol2InChecklistEditor(); |
|
87 |
if (isAdminPreference){ |
|
88 |
Button allowOverrideActivatedButton = createAllowOverrideButton(activateComp); |
|
89 |
allowOverrideActivatedButton.setSelection(allowOverrideActivated); |
|
123 | 90 |
|
124 |
showSymbol2.setText(Messages.ChecklistEditorGeneralPreference_show_symbol2); |
|
125 |
showSymbol2.setSelection(isShowSymbol2); |
|
126 |
showSymbol2.addSelectionListener(new SelectionAdapter(){ |
|
127 |
@Override |
|
128 |
public void widgetSelected(SelectionEvent e) { |
|
129 |
isShowSymbol2 = showSymbol2.getSelection(); |
|
91 |
allowOverrideActivatedButton.addSelectionListener(new SelectionAdapter(){ |
|
92 |
@Override |
|
93 |
public void widgetSelected(SelectionEvent e) { |
|
94 |
allowOverrideActivated = allowOverrideActivatedButton.getSelection(); |
|
95 |
} |
|
96 |
}); |
|
97 |
} |
|
130 | 98 |
|
131 |
} |
|
132 |
}); |
|
133 | 99 |
|
134 |
final Button showTitle = new Button(child, SWT.RADIO); |
|
135 |
isShowTitle = !(isShowIdInVocabulary || isShowSymbol1 || isShowSymbol2); |
|
100 |
child = createComposite(composite); |
|
136 | 101 |
|
137 |
showTitle.setText(Messages.ChecklistEditorGeneralPreference_show_title);
|
|
138 |
showTitle.setSelection(isShowTitle);
|
|
139 |
showTitle.addSelectionListener(new SelectionAdapter(){
|
|
140 |
@Override
|
|
141 |
public void widgetSelected(SelectionEvent e) {
|
|
142 |
isShowTitle = showTitle.getSelection();
|
|
102 |
child.setVisible(isEditorActivated);
|
|
103 |
Label separator= new Label(child, SWT.HORIZONTAL | SWT.SEPARATOR);
|
|
104 |
GridData sepGrid = new GridData(GridData.FILL_HORIZONTAL);
|
|
105 |
if (isAdminPreference){
|
|
106 |
sepGrid.horizontalSpan = 2;
|
|
107 |
}
|
|
143 | 108 |
|
144 |
} |
|
145 |
}); |
|
109 |
GridData textGrid = new GridData(GridData.FILL_HORIZONTAL); |
|
110 |
if (isAdminPreference){ |
|
111 |
textGrid.horizontalSpan = 2; |
|
112 |
} |
|
113 |
textGrid.verticalSpan = 2; |
|
114 |
separator.setLayoutData(sepGrid); |
|
146 | 115 |
|
147 | 116 |
|
148 |
final Button showSymbol = new Button(child, SWT.CHECK); |
|
149 |
isShowSymbol = PreferencesUtil.isShowSymbolInChecklistEditor(); |
|
150 |
showSymbol.setText("Show Symbol of the Status, if existing"); |
|
151 |
showSymbol.setSelection(isShowSymbol); |
|
152 |
showSymbol.addSelectionListener(new SelectionAdapter(){ |
|
153 |
@Override |
|
154 |
public void widgetSelected(SelectionEvent e) { |
|
155 |
isShowSymbol = showSymbol.getSelection(); |
|
156 |
} |
|
157 |
}); |
|
158 |
PreferencesUtil.recursiveSetEnabled(button_openFeatureTree, CdmStore.isActive()); |
|
159 |
isShowRank = PreferencesUtil.isShowRankInChecklistEditor(); |
|
160 | 117 |
final Button activateRankButton = new Button(child, SWT.CHECK); |
161 |
activateRankButton.setText("Show Rank in Distribution Editor");
|
|
118 |
activateRankButton.setText(Messages.ChecklistEditorGeneralPreference_show_rank);
|
|
162 | 119 |
activateRankButton.setSelection(isShowRank); |
163 | 120 |
activateRankButton.addSelectionListener(new SelectionAdapter(){ |
164 | 121 |
@Override |
... | ... | |
166 | 123 |
isShowRank = activateRankButton.getSelection(); |
167 | 124 |
} |
168 | 125 |
}); |
126 |
|
|
127 |
if (isAdminPreference){ |
|
128 |
Button allowOverrideRankButton = createAllowOverrideButton(child); |
|
129 |
allowOverrideRankButton.setSelection(allowOverrideRank); |
|
130 |
|
|
131 |
allowOverrideRankButton.addSelectionListener(new SelectionAdapter(){ |
|
132 |
@Override |
|
133 |
public void widgetSelected(SelectionEvent e) { |
|
134 |
allowOverrideRank = allowOverrideRankButton.getSelection(); |
|
135 |
} |
|
136 |
}); |
|
137 |
}else{ |
|
138 |
if (!allowOverrideRank){ |
|
139 |
activateRankButton.setEnabled(false); |
|
140 |
} |
|
141 |
} |
|
142 |
|
|
143 |
|
|
169 | 144 |
final Button sortNamedAreaByVocabularyOrder = new Button(child, SWT.CHECK); |
170 |
isSortByVocabularyOrder = PreferencesUtil.isSortNamedAreaByOrderInVocabulary(); |
|
171 |
sortNamedAreaByVocabularyOrder.setText("Sort Areas by Order in Vocabulary"); |
|
145 |
sortNamedAreaByVocabularyOrder.setText(Messages.ChecklistEditorGeneralPreference_sort_areas); |
|
172 | 146 |
sortNamedAreaByVocabularyOrder.setSelection(isSortByVocabularyOrder); |
173 | 147 |
sortNamedAreaByVocabularyOrder.addSelectionListener(new SelectionAdapter(){ |
174 | 148 |
@Override |
... | ... | |
177 | 151 |
} |
178 | 152 |
}); |
179 | 153 |
|
154 |
if (isAdminPreference){ |
|
155 |
Button allowOverrideOrderAreasButton = createAllowOverrideButton(child); |
|
156 |
allowOverrideOrderAreasButton.setSelection(allowOverrideOrderAreas); |
|
157 |
|
|
158 |
allowOverrideOrderAreasButton.addSelectionListener(new SelectionAdapter(){ |
|
159 |
@Override |
|
160 |
public void widgetSelected(SelectionEvent e) { |
|
161 |
allowOverrideOrderAreas = allowOverrideOrderAreasButton.getSelection(); |
|
162 |
} |
|
163 |
}); |
|
164 |
}else{ |
|
165 |
if (!allowOverrideOrderAreas){ |
|
166 |
sortNamedAreaByVocabularyOrder.setEnabled(false); |
|
167 |
} |
|
168 |
} |
|
169 |
|
|
170 |
separator= new Label(child, SWT.HORIZONTAL | SWT.SEPARATOR); |
|
171 |
separator.setLayoutData(sepGrid); |
|
172 |
|
|
173 |
// final CLabel label = new CLabel(child, SWT.NULL); |
|
174 |
// label.setText(Messages.ChecklistEditorGeneralPreference_open_wizard); |
|
175 |
// label.setLayoutData(textGrid); |
|
176 |
// |
|
177 |
// |
|
178 |
// final CommandHandlerButton button_openSelectAreas = new CommandHandlerButton(child, SWT.PUSH, |
|
179 |
// commandHandlerString); |
|
180 |
// |
|
181 |
// button_openSelectAreas.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection); |
|
182 |
// |
|
183 |
// if (isAdminPreference){ |
|
184 |
// createAllowOverrideButton(child); |
|
185 |
// } |
|
186 |
|
|
187 |
|
|
188 |
final CLabel description = new CLabel(child, SWT.NULL); |
|
189 |
description.setText(Messages.ChecklistEditorGeneralPreference_Configure_display_of_Areas); |
|
190 |
description.setLayoutData(textGrid); |
|
191 |
|
|
192 |
GridData gridData = new GridData(); |
|
193 |
gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false); |
|
194 |
//gridData.horizontalIndent = 5; |
|
195 |
|
|
196 |
|
|
197 |
areaDisplaySelectionCombo = new Combo(child, SWT.BORDER| SWT.READ_ONLY); |
|
198 |
areaDisplaySelectionCombo.setLayoutData(gridData); |
|
199 |
|
|
200 |
for(TermDisplayEnum display: TermDisplayEnum.values()){ |
|
201 |
areaDisplaySelectionCombo.add(display.getLabel()); |
|
202 |
} |
|
203 |
int index = 0; |
|
204 |
if (PreferencesUtil.getStringValue(IPreferenceKeys.CHECKLIST_AREA_DISPLAY) != null){ |
|
205 |
TermDisplayEnum areaDisplay = TermDisplayEnum.valueOf(displayArea); |
|
206 |
for (String itemLabel : areaDisplaySelectionCombo.getItems()){ |
|
207 |
if (itemLabel.equalsIgnoreCase(areaDisplay.getLabel())){ |
|
208 |
areaDisplaySelectionCombo.select(index); |
|
209 |
break; |
|
210 |
} |
|
211 |
index++; |
|
212 |
} |
|
213 |
} |
|
214 |
areaDisplaySelectionCombo.addSelectionListener(this); |
|
215 |
|
|
216 |
if (isAdminPreference){ |
|
217 |
Button allowOverrideOrderAreaDisplayButton = createAllowOverrideButton(child); |
|
218 |
allowOverrideOrderAreaDisplayButton.setSelection(allowOverrideAreaDisplay); |
|
219 |
|
|
220 |
allowOverrideOrderAreaDisplayButton.addSelectionListener(new SelectionAdapter(){ |
|
221 |
@Override |
|
222 |
public void widgetSelected(SelectionEvent e) { |
|
223 |
allowOverrideAreaDisplay = allowOverrideOrderAreaDisplayButton.getSelection(); |
|
224 |
} |
|
225 |
}); |
|
226 |
}else{ |
|
227 |
if (!allowOverrideAreaDisplay){ |
|
228 |
areaDisplaySelectionCombo.setEnabled(false); |
|
229 |
} |
|
230 |
} |
|
231 |
|
|
232 |
final CLabel descriptionStatus = new CLabel(child, SWT.NULL); |
|
233 |
descriptionStatus.setText(Messages.ChecklistEditorGeneralPreference_Configure_display_of_Status); |
|
234 |
descriptionStatus.setLayoutData(textGrid); |
|
235 |
|
|
236 |
|
|
237 |
|
|
238 |
statusDisplaySelectionCombo = new Combo(child, SWT.BORDER| SWT.READ_ONLY); |
|
239 |
statusDisplaySelectionCombo.setLayoutData(gridData); |
|
240 |
|
|
241 |
for(TermDisplayEnum display: TermDisplayEnum.values()){ |
|
242 |
statusDisplaySelectionCombo.add(display.getLabel()); |
|
243 |
} |
|
244 |
index = 0; |
|
245 |
if (PreferencesUtil.displayStatusInChecklistEditor() != null){ |
|
246 |
TermDisplayEnum statusDisplay = TermDisplayEnum.valueOf(displayStatus); |
|
247 |
for (String itemLabel : areaDisplaySelectionCombo.getItems()){ |
|
248 |
if (itemLabel.equalsIgnoreCase(statusDisplay.getLabel())){ |
|
249 |
statusDisplaySelectionCombo.select(index); |
|
250 |
break; |
|
251 |
} |
|
252 |
index++; |
|
253 |
} |
|
254 |
} |
|
255 |
|
|
256 |
statusDisplaySelectionCombo.addSelectionListener(this); |
|
257 |
if (isAdminPreference){ |
|
258 |
Button allowOverrideOrderStatusDisplayButton = createAllowOverrideButton(child); |
|
259 |
allowOverrideOrderStatusDisplayButton.setSelection(allowOverrideStatusDisplay); |
|
260 |
|
|
261 |
allowOverrideOrderStatusDisplayButton.addSelectionListener(new SelectionAdapter(){ |
|
262 |
@Override |
|
263 |
public void widgetSelected(SelectionEvent e) { |
|
264 |
allowOverrideStatusDisplay = allowOverrideOrderStatusDisplayButton.getSelection(); |
|
265 |
} |
|
266 |
}); |
|
267 |
}else{ |
|
268 |
if (!allowOverrideStatusDisplay){ |
|
269 |
statusDisplaySelectionCombo.setEnabled(false); |
|
270 |
} |
|
271 |
} |
|
272 |
|
|
273 |
if (isAdminPreference){ |
|
274 |
final CLabel labelStatus = new CLabel(child, SWT.NULL); |
|
275 |
labelStatus.setText(Messages.DistributionAdminPreferences_SELECT_STATUS); |
|
276 |
labelStatus.setLayoutData(textGrid); |
|
277 |
|
|
278 |
final CommandHandlerButton button_openStatusWizard = new CommandHandlerButton(child, SWT.PUSH, |
|
279 |
commandHandlerStringStatus); //$NON-NLS-1$ |
|
280 |
|
|
281 |
button_openStatusWizard.setText(Messages.Distribution_status_selection); |
|
282 |
|
|
283 |
} |
|
284 |
|
|
285 |
// PreferencesUtil.recursiveSetEnabled(child, CdmStore.isActive()); |
|
286 |
|
|
180 | 287 |
if(isEditorActivated){ |
181 | 288 |
child.setEnabled(true); |
182 | 289 |
}else{ |
... | ... | |
191 | 298 |
return composite; |
192 | 299 |
} |
193 | 300 |
|
301 |
|
|
302 |
|
|
303 |
private Button createAllowOverrideButton(Composite activateComp) { |
|
304 |
final Button allowOverrideCheckButton = new Button(activateComp, SWT.CHECK); |
|
305 |
allowOverrideCheckButton.setText(Messages.ChecklistEditorGeneralPreference_allowOverride); |
|
306 |
return allowOverrideCheckButton; |
|
307 |
} |
|
308 |
|
|
194 | 309 |
@Override |
195 | 310 |
public boolean performOk() { |
196 | 311 |
if (isAllowOverride){ |
197 | 312 |
PreferencesUtil.setBooleanValue(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE, isEditorActivated); |
198 | 313 |
PreferencesUtil.setSortNamedAreasByOrderInVocabulary(isSortByVocabularyOrder); |
199 | 314 |
PreferencesUtil.setShowRankInChecklistEditor(isShowRank); |
200 |
PreferencesUtil.setShowSymbolInChecklistEditor(isShowSymbol); |
|
201 |
String displayString; |
|
202 |
if (isShowIdInVocabulary){ |
|
203 |
displayString = IPreferenceKeys.CHECKLIST_AREA_DISPLAY_TITLE; |
|
204 |
}else if (isShowSymbol1){ |
|
205 |
displayString = IPreferenceKeys.CHECKLIST_AREA_DISPLAY_SYMBOL1; |
|
206 |
}else if (isShowSymbol2){ |
|
207 |
displayString = IPreferenceKeys.CHECKLIST_AREA_DISPLAY_SYMBOL2; |
|
208 |
}else{ |
|
209 |
displayString = IPreferenceKeys.CHECKLIST_AREA_DISPLAY_TITLE; |
|
210 |
} |
|
211 |
PreferencesUtil.setShowIdInVocabularyInChecklistEditor(displayString); |
|
315 |
PreferencesUtil.setDisplayStatusInChecklistEditor(displayStatus); |
|
316 |
PreferencesUtil.setAreaDisplayInChecklistEditor(displayArea); |
|
317 |
|
|
318 |
|
|
212 | 319 |
} |
213 | 320 |
return true; |
214 | 321 |
} |
215 | 322 |
|
323 |
/** |
|
324 |
* {@inheritDoc} |
|
325 |
*/ |
|
326 |
@Override |
|
327 |
public void widgetSelected(SelectionEvent e) { |
|
328 |
if (e.getSource().equals(statusDisplaySelectionCombo)){ |
|
329 |
String text = statusDisplaySelectionCombo.getText(); |
|
330 |
for (TermDisplayEnum display: TermDisplayEnum.values()){ |
|
331 |
if (display.getLabel().equals(text)){ |
|
332 |
displayStatus = display.getKey(); |
|
333 |
break; |
|
334 |
} |
|
335 |
} |
|
336 |
} |
|
337 |
if (e.getSource().equals(areaDisplaySelectionCombo)){ |
|
338 |
String text = areaDisplaySelectionCombo.getText(); |
|
339 |
for (TermDisplayEnum display: TermDisplayEnum.values()){ |
|
340 |
if (display.getLabel().equals(text)){ |
|
341 |
displayArea = display.getKey(); |
|
342 |
break; |
|
343 |
} |
|
344 |
} |
|
345 |
} |
|
346 |
|
|
347 |
} |
|
348 |
|
|
349 |
/** |
|
350 |
* {@inheritDoc} |
|
351 |
*/ |
|
352 |
@Override |
|
353 |
public void widgetDefaultSelected(SelectionEvent e) { |
|
354 |
// TODO Auto-generated method stub |
|
355 |
|
|
356 |
} |
|
357 |
|
|
358 |
@Override |
|
359 |
public void init() { |
|
360 |
isAdminPreference = false; |
|
361 |
setPreferenceStore(PreferencesUtil.getPreferenceStore()); |
|
362 |
distributionEditorPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DistributionEditorActivated); |
|
363 |
|
|
364 |
|
|
365 |
if (distributionEditorPref != null){ |
|
366 |
isAllowOverride = distributionEditorPref.isAllowOverride(); |
|
367 |
if (isAllowOverride){ |
|
368 |
isEditorActivated = PreferencesUtil.getBooleanValue(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE); |
|
369 |
}else{ |
|
370 |
isEditorActivated = Boolean.valueOf(distributionEditorPref.getValue()); |
|
371 |
} |
|
372 |
}else{ |
|
373 |
isEditorActivated = PreferencesUtil.getBooleanValue(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE); |
|
374 |
isAllowOverride = true; |
|
375 |
} |
|
376 |
CdmPreference prefStatus = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionStatus); |
|
377 |
|
|
378 |
allowOverrideStatus = prefStatus != null?prefStatus.isAllowOverride():false; |
|
379 |
|
|
380 |
CdmPreference pref = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.DisplayOfAreasInDistributionEditor); |
|
381 |
if (pref != null){ |
|
382 |
this.allowOverrideAreaDisplay = pref.isAllowOverride(); |
|
383 |
if (allowOverrideAreaDisplay){ |
|
384 |
displayArea = PreferencesUtil.getStringValue(IPreferenceKeys.CHECKLIST_AREA_DISPLAY); |
|
385 |
}else{ |
|
386 |
displayArea = pref.getValue(); |
|
387 |
} |
|
388 |
}else{ |
|
389 |
displayArea = PreferencesUtil.getStringValue(IPreferenceKeys.CHECKLIST_AREA_DISPLAY); |
|
390 |
this.allowOverrideAreaDisplay = true; |
|
391 |
} |
|
392 |
|
|
393 |
pref = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.DisplayOfStatus); |
|
394 |
if (pref != null){ |
|
395 |
this.allowOverrideStatusDisplay = pref.isAllowOverride(); |
|
396 |
if (allowOverrideStatusDisplay){ |
|
397 |
displayStatus = PreferencesUtil.displayStatusInChecklistEditor(); |
|
398 |
}else{ |
|
399 |
this.displayStatus = pref.getValue(); |
|
400 |
} |
|
401 |
}else{ |
|
402 |
displayStatus = PreferencesUtil.displayStatusInChecklistEditor(); |
|
403 |
this.allowOverrideStatusDisplay = true; |
|
404 |
} |
|
405 |
|
|
406 |
pref = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.AreasSortedByIdInVocabulary); |
|
407 |
if (pref != null){ |
|
408 |
|
|
409 |
this.allowOverrideOrderAreas = pref.isAllowOverride(); |
|
410 |
if (allowOverrideOrderAreas){ |
|
411 |
isSortByVocabularyOrder = PreferencesUtil.isSortNamedAreaByOrderInVocabulary(); |
|
412 |
}else{ |
|
413 |
this.isSortByVocabularyOrder = Boolean.valueOf(pref.getValue().toString()); |
|
414 |
} |
|
415 |
}else{ |
|
416 |
isSortByVocabularyOrder = PreferencesUtil.isSortNamedAreaByOrderInVocabulary(); |
|
417 |
this.allowOverrideOrderAreas = true; |
|
418 |
} |
|
419 |
|
|
420 |
pref = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.ShowRankInDistributionEditor); |
|
421 |
if (pref != null){ |
|
422 |
|
|
423 |
this.allowOverrideRank = pref.isAllowOverride(); |
|
424 |
if (allowOverrideRank){ |
|
425 |
isShowRank = PreferencesUtil.isShowRankInChecklistEditor(); |
|
426 |
}else{ |
|
427 |
this.isShowRank = Boolean.valueOf(pref.getValue().toString()); |
|
428 |
} |
|
429 |
}else{ |
|
430 |
isShowRank = PreferencesUtil.isShowRankInChecklistEditor(); |
|
431 |
this.allowOverrideRank = true; |
|
432 |
} |
|
433 |
|
|
434 |
|
|
435 |
|
|
436 |
commandHandlerString = "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler"; |
|
437 |
commandHandlerStringStatus = "eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardHandler"; |
|
438 |
|
|
439 |
} |
|
216 | 440 |
} |
Also available in: Unified diff
ref #7849: harmonize admin and local preferences for distribution editor and use drop down instead of radio buttons