1
|
/**
|
2
|
* Copyright (C) 2014 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;
|
10
|
|
11
|
import org.eclipse.swt.SWT;
|
12
|
import org.eclipse.swt.custom.CLabel;
|
13
|
import org.eclipse.swt.events.SelectionAdapter;
|
14
|
import org.eclipse.swt.events.SelectionEvent;
|
15
|
import org.eclipse.swt.events.SelectionListener;
|
16
|
import org.eclipse.swt.layout.GridData;
|
17
|
import org.eclipse.swt.layout.GridLayout;
|
18
|
import org.eclipse.swt.widgets.Button;
|
19
|
import org.eclipse.swt.widgets.Combo;
|
20
|
import org.eclipse.swt.widgets.Composite;
|
21
|
import org.eclipse.swt.widgets.Control;
|
22
|
import org.eclipse.swt.widgets.Event;
|
23
|
import org.eclipse.swt.widgets.Label;
|
24
|
import org.eclipse.swt.widgets.Listener;
|
25
|
|
26
|
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
|
27
|
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
|
28
|
import eu.etaxonomy.cdm.model.metadata.TermComboEnum;
|
29
|
import eu.etaxonomy.cdm.model.metadata.TermDisplayEnum;
|
30
|
import eu.etaxonomy.cdm.model.metadata.TermOrder;
|
31
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
32
|
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
|
33
|
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
|
34
|
|
35
|
/**
|
36
|
* @author a.oppermann
|
37
|
* @date 21.07.2014
|
38
|
*
|
39
|
*/
|
40
|
public class ChecklistEditorGeneralPreference extends CdmPreferencePage implements SelectionListener {
|
41
|
|
42
|
|
43
|
|
44
|
protected Boolean isEditorActivated;
|
45
|
|
46
|
protected boolean overrideActivated;
|
47
|
boolean isUseLocal;
|
48
|
protected Boolean isShowRank;
|
49
|
protected String orderAreas;
|
50
|
protected String displayStatus;
|
51
|
protected String displayStatusCombo;
|
52
|
protected String displayArea;
|
53
|
protected Boolean ownDescriptionForDistributionEditor;
|
54
|
|
55
|
protected boolean overrideOwnDescriptionForDistributionEditor;
|
56
|
protected boolean overrideAreaVoc;
|
57
|
protected boolean overrideRank;
|
58
|
protected boolean overrideOrderAreas;
|
59
|
protected boolean overrideAreaDisplay;
|
60
|
protected boolean overrideStatusDisplay;
|
61
|
protected boolean overrideStatusDisplayCombo;
|
62
|
|
63
|
protected Combo areaOrderSelectionCombo;
|
64
|
protected Button allowOverrideOrderAreasButton;
|
65
|
protected Combo statusDisplaySelectionCombo;
|
66
|
protected Button allowOverrideStatusDisplayButton;
|
67
|
protected Combo statusDisplayInComboSelectionCombo;
|
68
|
protected Button allowOverrideStatusDisplayInComboButton;
|
69
|
protected Combo areaDisplaySelectionCombo;
|
70
|
protected Button allowOverrideAreaDisplayButton;
|
71
|
protected String commandHandlerString;
|
72
|
protected String commandHandlerStringStatus;
|
73
|
|
74
|
protected CdmPreference distributionEditorPref;
|
75
|
protected CdmPreference prefStatus;
|
76
|
protected CdmPreference prefAreaVoc;
|
77
|
protected CdmPreference prefAreaDisplay;
|
78
|
protected CdmPreference prefStatusDisplay;
|
79
|
protected CdmPreference prefStatusDisplayInCombo;
|
80
|
protected CdmPreference prefAreaSort;
|
81
|
protected CdmPreference prefRank;
|
82
|
protected CdmPreference prefOwnDescription;
|
83
|
Composite child;
|
84
|
|
85
|
protected Combo activateCombo;
|
86
|
protected Button allowOverrideActivatedButton;
|
87
|
final String ENABLE = "Enable";
|
88
|
final String DISABLE = "Disable";
|
89
|
|
90
|
protected Combo activateRankCombo;
|
91
|
protected Button allowOverrideRankButton;
|
92
|
final String SHOW_RANK = "Show Rank";
|
93
|
final String NO_RANK = "No Rank";
|
94
|
|
95
|
protected CdmPreference areaVocPref = null;
|
96
|
protected CdmPreference statusPref = null;
|
97
|
private CommandHandlerButton button_openSelectAreaVocabularies;
|
98
|
|
99
|
private CommandHandlerButton button_openStatusWizard;
|
100
|
|
101
|
@Override
|
102
|
protected Control createContents(Composite parent) {
|
103
|
getValues();
|
104
|
Composite composite = new Composite(parent, SWT.NULL);
|
105
|
composite.setLayout(new GridLayout());
|
106
|
if (!isAdminPreference && distributionEditorPref != null && !distributionEditorPref.isAllowOverride()&& !isEditorActivated ) {
|
107
|
Label label = new Label(composite, SWT.NONE);
|
108
|
label.setText(
|
109
|
"The CDM settings don't allow to set the preferences for using the distribution editor locally. If you need to make local settings, please ask an administrator.");
|
110
|
this.setDefaultButtonActivated(false);
|
111
|
} else {
|
112
|
Composite activateComp = createComposite(composite);
|
113
|
Label separator = new Label(activateComp, SWT.HORIZONTAL | SWT.SEPARATOR);
|
114
|
GridData sepGrid = createTextGridData();
|
115
|
separator.setLayoutData(sepGrid);
|
116
|
separator.setVisible(false);
|
117
|
CdmPreference dbPref;
|
118
|
GridData textGrid = createTextGridData();
|
119
|
textGrid.verticalSpan = 2;
|
120
|
separator.setLayoutData(sepGrid);
|
121
|
|
122
|
activateCombo = createBooleanCombo(activateComp, ENABLE, DISABLE, PreferencePredicate.DistributionEditorActivated, Messages.ChecklistEditorGeneralPreference_enable, isAdminPreference);
|
123
|
|
124
|
int index = 0;
|
125
|
for (String itemLabel : activateCombo.getItems()) {
|
126
|
if (isEditorActivated == null && itemLabel.equals(Messages.Preference_Use_Default)) {
|
127
|
activateCombo.select(index);
|
128
|
break;
|
129
|
}
|
130
|
if (isEditorActivated != null && itemLabel.equals(ENABLE) && isEditorActivated){
|
131
|
activateCombo.select(index);
|
132
|
break;
|
133
|
}
|
134
|
if (isEditorActivated != null && itemLabel.equals(DISABLE) && !isEditorActivated){
|
135
|
activateCombo.select(index);
|
136
|
break;
|
137
|
}
|
138
|
index++;
|
139
|
}
|
140
|
|
141
|
|
142
|
activateCombo.addSelectionListener(this);
|
143
|
if (isAdminPreference) {
|
144
|
allowOverrideActivatedButton = createAllowOverrideButton(activateComp);
|
145
|
allowOverrideActivatedButton.setSelection(this.distributionEditorPref != null? this.distributionEditorPref.isAllowOverride(): true);
|
146
|
allowOverrideActivatedButton.addSelectionListener(new SelectionAdapter() {
|
147
|
@Override
|
148
|
public void widgetSelected(SelectionEvent e) {
|
149
|
setApply(true);
|
150
|
if (distributionEditorPref == null){
|
151
|
distributionEditorPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DistributionEditorActivated, PreferencePredicate.DistributionEditorActivated.getDefaultValue() != null ? PreferencePredicate.DistributionEditorActivated.getDefaultValue().toString(): null);
|
152
|
}
|
153
|
distributionEditorPref.setAllowOverride(!distributionEditorPref.isAllowOverride());
|
154
|
}
|
155
|
});
|
156
|
}
|
157
|
child = createComposite(composite);
|
158
|
|
159
|
if (!isAdminPreference) {
|
160
|
if (isEditorActivated != null){
|
161
|
child.setEnabled(isEditorActivated);
|
162
|
}else{
|
163
|
child.setEnabled(Boolean.parseBoolean(distributionEditorPref.getValue().toString()));
|
164
|
}
|
165
|
}
|
166
|
separator = new Label(child, SWT.HORIZONTAL | SWT.SEPARATOR);
|
167
|
sepGrid = createTextGridData();
|
168
|
separator.setLayoutData(sepGrid);
|
169
|
|
170
|
activateRankCombo = createBooleanCombo(child, SHOW_RANK, NO_RANK,
|
171
|
PreferencePredicate.ShowRankInDistributionEditor, Messages.ChecklistEditorGeneralPreference_show_rank, isAdminPreference);
|
172
|
index = 0;
|
173
|
for (String itemLabel : activateRankCombo.getItems()) {
|
174
|
if (isShowRank == null && itemLabel.equals(Messages.Preference_Use_Default)) {
|
175
|
activateRankCombo.select(index);
|
176
|
break;
|
177
|
}
|
178
|
if (isShowRank != null && itemLabel.equals(SHOW_RANK) && isShowRank){
|
179
|
activateRankCombo.select(index);
|
180
|
break;
|
181
|
}
|
182
|
if (isShowRank != null && itemLabel.equals(NO_RANK) && !isShowRank){
|
183
|
activateRankCombo.select(index);
|
184
|
break;
|
185
|
}
|
186
|
index++;
|
187
|
}
|
188
|
activateRankCombo.addSelectionListener(this);
|
189
|
if (isAdminPreference) {
|
190
|
allowOverrideRankButton = createAllowOverrideButton(child);
|
191
|
allowOverrideRankButton.setSelection(prefRank != null? prefRank.isAllowOverride():true);
|
192
|
allowOverrideRankButton.addSelectionListener(new SelectionAdapter() {
|
193
|
@Override
|
194
|
public void widgetSelected(SelectionEvent e) {
|
195
|
setApply(true);
|
196
|
if (prefRank == null){
|
197
|
prefRank = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowRankInDistributionEditor, PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue() != null ? PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue().toString(): null);
|
198
|
}
|
199
|
prefRank.setAllowOverride(allowOverrideRankButton.getSelection());
|
200
|
}
|
201
|
});
|
202
|
}
|
203
|
|
204
|
GridData gridData = new GridData();
|
205
|
gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
|
206
|
|
207
|
areaOrderSelectionCombo = createCombo(child, TermOrder.values(), PreferencePredicate.AreasSortedInDistributionEditor, Messages.ChecklistEditorGeneralPreference_Configure_area_order, isAdminPreference);
|
208
|
|
209
|
index = 0;
|
210
|
TermOrder areaOrder;
|
211
|
try {
|
212
|
if (orderAreas != null) {
|
213
|
areaOrder = TermOrder.valueOf(orderAreas);
|
214
|
} else {
|
215
|
areaOrder = TermOrder.IdInVoc;
|
216
|
}
|
217
|
} catch (IllegalArgumentException e) {
|
218
|
areaOrder = TermOrder.IdInVoc;
|
219
|
}
|
220
|
for (String itemLabel : areaOrderSelectionCombo.getItems()) {
|
221
|
if (itemLabel.equals(Messages.Preference_Use_Default) && orderAreas.equals(Messages.Preference_Use_Default)){
|
222
|
areaOrderSelectionCombo.select(index);
|
223
|
break;
|
224
|
}
|
225
|
if (itemLabel.startsWith(areaOrder.getLabel())) {
|
226
|
areaOrderSelectionCombo.select(index);
|
227
|
break;
|
228
|
}
|
229
|
|
230
|
index++;
|
231
|
}
|
232
|
|
233
|
areaOrderSelectionCombo.addSelectionListener(this);
|
234
|
|
235
|
if (isAdminPreference) {
|
236
|
allowOverrideOrderAreasButton = createAllowOverrideButton(child);
|
237
|
allowOverrideOrderAreasButton.setSelection(prefAreaSort != null? prefAreaSort.isAllowOverride(): true);
|
238
|
allowOverrideOrderAreasButton.addSelectionListener(new SelectionAdapter() {
|
239
|
@Override
|
240
|
public void widgetSelected(SelectionEvent e) {
|
241
|
setApply(true);
|
242
|
if (prefAreaSort == null){
|
243
|
prefAreaSort = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AreasSortedInDistributionEditor, PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue() != null ? PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue().toString(): null);
|
244
|
}
|
245
|
prefAreaSort.setAllowOverride(allowOverrideOrderAreasButton.getSelection());
|
246
|
}
|
247
|
});
|
248
|
}
|
249
|
|
250
|
separator = new Label(child, SWT.HORIZONTAL | SWT.SEPARATOR);
|
251
|
separator.setLayoutData(sepGrid);
|
252
|
areaDisplaySelectionCombo = createCombo(child, TermDisplayEnum.values(), PreferencePredicate.DisplayOfAreasInDistributionEditor, Messages.ChecklistEditorGeneralPreference_Configure_display_of_Areas, isAdminPreference);
|
253
|
|
254
|
|
255
|
index = 0;
|
256
|
TermDisplayEnum areaDisplay;
|
257
|
try {
|
258
|
if (displayArea != null) {
|
259
|
areaDisplay = TermDisplayEnum.valueOf(displayArea);
|
260
|
} else {
|
261
|
areaDisplay = TermDisplayEnum.Title;
|
262
|
}
|
263
|
} catch (IllegalArgumentException e) {
|
264
|
areaDisplay = TermDisplayEnum.Title;
|
265
|
}
|
266
|
for (String itemLabel : areaDisplaySelectionCombo.getItems()) {
|
267
|
if (itemLabel.equals(Messages.Preference_Use_Default) && displayArea.equals(Messages.Preference_Use_Default)){
|
268
|
areaDisplaySelectionCombo.select(index);
|
269
|
break;
|
270
|
}
|
271
|
if (itemLabel.startsWith(areaDisplay.getLabel())) {
|
272
|
areaDisplaySelectionCombo.select(index);
|
273
|
break;
|
274
|
}
|
275
|
|
276
|
index++;
|
277
|
}
|
278
|
areaDisplaySelectionCombo.addSelectionListener(this);
|
279
|
|
280
|
if (isAdminPreference) {
|
281
|
allowOverrideAreaDisplayButton = createAllowOverrideButton(child);
|
282
|
allowOverrideAreaDisplayButton.setSelection(prefAreaDisplay != null? prefAreaDisplay.isAllowOverride(): true);
|
283
|
allowOverrideAreaDisplayButton.addSelectionListener(new SelectionAdapter() {
|
284
|
@Override
|
285
|
public void widgetSelected(SelectionEvent e) {
|
286
|
setApply(true);
|
287
|
if (prefAreaDisplay == null){
|
288
|
prefAreaDisplay = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DisplayOfAreasInDistributionEditor, PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue() != null ? PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue().toString(): null);
|
289
|
}
|
290
|
prefAreaDisplay.setAllowOverride(allowOverrideOrderAreasButton.getSelection());
|
291
|
}
|
292
|
});
|
293
|
}
|
294
|
|
295
|
statusDisplaySelectionCombo = createCombo(child, TermDisplayEnum.values(), PreferencePredicate.DisplayOfStatus, Messages.ChecklistEditorGeneralPreference_Configure_display_of_Status, isAdminPreference);
|
296
|
|
297
|
index = 0;
|
298
|
TermDisplayEnum statusDisplay;
|
299
|
try {
|
300
|
if (displayStatus != null) {
|
301
|
statusDisplay = TermDisplayEnum.valueOf(displayStatus);
|
302
|
} else {
|
303
|
statusDisplay = TermDisplayEnum.Title;
|
304
|
}
|
305
|
} catch (IllegalArgumentException e) {
|
306
|
statusDisplay = TermDisplayEnum.Title;
|
307
|
}
|
308
|
for (String itemLabel : statusDisplaySelectionCombo.getItems()) {
|
309
|
if (itemLabel.equals(Messages.Preference_Use_Default) && displayStatus.equals(Messages.Preference_Use_Default)){
|
310
|
statusDisplaySelectionCombo.select(index);
|
311
|
break;
|
312
|
}
|
313
|
if (itemLabel.startsWith(statusDisplay.getLabel())) {
|
314
|
statusDisplaySelectionCombo.select(index);
|
315
|
break;
|
316
|
}
|
317
|
|
318
|
index++;
|
319
|
}
|
320
|
|
321
|
statusDisplaySelectionCombo.addSelectionListener(this);
|
322
|
|
323
|
if (isAdminPreference) {
|
324
|
allowOverrideStatusDisplayButton = createAllowOverrideButton(child);
|
325
|
allowOverrideStatusDisplayButton.setSelection(prefStatusDisplay != null ? prefStatusDisplay.isAllowOverride(): true);
|
326
|
allowOverrideStatusDisplayButton.addSelectionListener(new SelectionAdapter() {
|
327
|
@Override
|
328
|
public void widgetSelected(SelectionEvent e) {
|
329
|
setApply(true);
|
330
|
if (prefStatusDisplay == null){
|
331
|
prefStatusDisplay = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DisplayOfStatus, PreferencePredicate.DisplayOfStatus.getDefaultValue() != null ? PreferencePredicate.DisplayOfStatus.getDefaultValue().toString(): null);
|
332
|
}
|
333
|
prefStatusDisplay.setAllowOverride(allowOverrideStatusDisplayButton.getSelection());
|
334
|
}
|
335
|
});
|
336
|
}
|
337
|
|
338
|
statusDisplayInComboSelectionCombo = createCombo(child, TermComboEnum.values(), PreferencePredicate.DisplayOfStatusInCombo, Messages.ChecklistEditorGeneralPreference_Configure_display_of_Status_in_Combo, isAdminPreference);
|
339
|
|
340
|
index = 0;
|
341
|
TermComboEnum statusComboDisplay;
|
342
|
try {
|
343
|
if (displayStatusCombo != null) {
|
344
|
statusComboDisplay = TermComboEnum.byKey(displayStatusCombo);
|
345
|
} else {
|
346
|
statusComboDisplay = TermComboEnum.Title;
|
347
|
}
|
348
|
} catch (IllegalArgumentException e) {
|
349
|
statusComboDisplay = TermComboEnum.Title;
|
350
|
}
|
351
|
for (String itemLabel : statusDisplayInComboSelectionCombo.getItems()) {
|
352
|
if (itemLabel.equals(Messages.Preference_Use_Default) && displayStatusCombo.equals(Messages.Preference_Use_Default)){
|
353
|
statusDisplayInComboSelectionCombo.select(index);
|
354
|
break;
|
355
|
}
|
356
|
if (itemLabel.startsWith(statusComboDisplay.getLabel())) {
|
357
|
statusDisplayInComboSelectionCombo.select(index);
|
358
|
break;
|
359
|
}
|
360
|
|
361
|
index++;
|
362
|
}
|
363
|
|
364
|
statusDisplayInComboSelectionCombo.addSelectionListener(this);
|
365
|
|
366
|
if (isAdminPreference) {
|
367
|
allowOverrideStatusDisplayInComboButton = createAllowOverrideButton(child);
|
368
|
allowOverrideStatusDisplayInComboButton.setSelection(prefStatusDisplayInCombo != null ? prefStatusDisplayInCombo.isAllowOverride(): true);
|
369
|
allowOverrideStatusDisplayInComboButton.addSelectionListener(new SelectionAdapter() {
|
370
|
@Override
|
371
|
public void widgetSelected(SelectionEvent e) {
|
372
|
setApply(true);
|
373
|
if (prefStatusDisplayInCombo == null){
|
374
|
prefStatusDisplayInCombo = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DisplayOfStatusInCombo, PreferencePredicate.DisplayOfStatusInCombo.getDefaultValue() != null ? PreferencePredicate.DisplayOfStatusInCombo.getDefaultValue().toString(): null);
|
375
|
}
|
376
|
prefStatusDisplayInCombo.setAllowOverride(allowOverrideStatusDisplayInComboButton.getSelection());
|
377
|
}
|
378
|
});
|
379
|
}
|
380
|
|
381
|
|
382
|
final CLabel labelStatus = new CLabel(child, SWT.NULL);
|
383
|
labelStatus.setText(Messages.DistributionAdminPreferences_SELECT_STATUS);
|
384
|
labelStatus.setLayoutData(textGrid);
|
385
|
|
386
|
button_openStatusWizard = new CommandHandlerButton(child, SWT.PUSH, commandHandlerStringStatus);
|
387
|
|
388
|
button_openStatusWizard.setText(Messages.Distribution_status_selection);
|
389
|
button_openStatusWizard.addListener(SWT.Selection, new Listener() {
|
390
|
@Override
|
391
|
public void handleEvent(Event e) {
|
392
|
switch (e.type) {
|
393
|
case SWT.Selection:
|
394
|
setApply(true);
|
395
|
break;
|
396
|
}
|
397
|
}
|
398
|
});
|
399
|
|
400
|
final CLabel label = new CLabel(child, SWT.NULL);
|
401
|
label.setText(Messages.ChecklistEditorGeneralPreference_open_wizard);
|
402
|
label.setLayoutData(textGrid);
|
403
|
|
404
|
button_openSelectAreaVocabularies = new CommandHandlerButton(child, SWT.PUSH, commandHandlerString);
|
405
|
button_openSelectAreaVocabularies
|
406
|
.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection);
|
407
|
|
408
|
if (!isAdminPreference) {
|
409
|
|
410
|
//PreferencesUtil.recursiveSetEnabled(child, isEditorActivated);
|
411
|
if (distributionEditorPref != null && !distributionEditorPref.isAllowOverride()){
|
412
|
activateComp.setEnabled(false);
|
413
|
}
|
414
|
|
415
|
if (prefAreaVoc != null && !prefAreaVoc.isAllowOverride()) {
|
416
|
button_openSelectAreaVocabularies.setButtonEnabled(false);
|
417
|
}
|
418
|
if (prefStatus != null && !prefStatus.isAllowOverride()) {
|
419
|
button_openStatusWizard.setButtonEnabled(false);
|
420
|
}
|
421
|
if (prefRank != null && !prefRank.isAllowOverride()) {
|
422
|
activateRankCombo.setEnabled(false);
|
423
|
}
|
424
|
if (prefAreaSort != null && !prefAreaSort.isAllowOverride()) {
|
425
|
areaOrderSelectionCombo.setEnabled(false);
|
426
|
//allowOverrideOrderAreasButton.setEnabled(false);
|
427
|
}
|
428
|
if (prefAreaDisplay != null && !prefAreaDisplay.isAllowOverride()) {
|
429
|
areaDisplaySelectionCombo.setEnabled(false);
|
430
|
}
|
431
|
if (prefStatusDisplay != null && !prefStatusDisplay.isAllowOverride()) {
|
432
|
statusDisplaySelectionCombo.setEnabled(false);
|
433
|
}
|
434
|
if (prefStatusDisplayInCombo != null && !prefStatusDisplayInCombo.isAllowOverride()) {
|
435
|
statusDisplayInComboSelectionCombo.setEnabled(false);
|
436
|
}
|
437
|
}
|
438
|
|
439
|
}
|
440
|
setValid(true);
|
441
|
return composite;
|
442
|
}
|
443
|
|
444
|
@Override
|
445
|
public boolean performOk() {
|
446
|
if (!isApply()){
|
447
|
return true;
|
448
|
}
|
449
|
boolean override = false;
|
450
|
if (isEditorActivated != null ) {
|
451
|
override = true;
|
452
|
PreferencesUtil.setStringValue(PreferencePredicate.DistributionEditorActivated.getKey(), isEditorActivated.toString());
|
453
|
}
|
454
|
PreferencesUtil.setBooleanValue(
|
455
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.DistributionEditorActivated.getKey()),
|
456
|
override);
|
457
|
|
458
|
|
459
|
override = false;
|
460
|
if (!orderAreas.equals(Messages.Preference_Use_Default) ) {
|
461
|
override = true;
|
462
|
PreferencesUtil.setSortNamedAreasInDistributionEditor(orderAreas);
|
463
|
}
|
464
|
PreferencesUtil.setBooleanValue(
|
465
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.AreasSortedInDistributionEditor.getKey()),
|
466
|
override);
|
467
|
|
468
|
|
469
|
|
470
|
|
471
|
|
472
|
override = false;
|
473
|
if (isShowRank != null ) {
|
474
|
override = true;
|
475
|
PreferencesUtil.setShowRankInChecklistEditor(isShowRank);
|
476
|
}
|
477
|
PreferencesUtil.setBooleanValue(
|
478
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowRankInDistributionEditor.getKey()),
|
479
|
override);
|
480
|
|
481
|
|
482
|
override = false;
|
483
|
if (!displayStatus.equals(Messages.Preference_Use_Default)) {
|
484
|
override = true;
|
485
|
PreferencesUtil.setDisplayStatusInChecklistEditor(displayStatus);
|
486
|
}
|
487
|
PreferencesUtil.setBooleanValue(
|
488
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfStatus.getKey()),
|
489
|
override);
|
490
|
|
491
|
override = false;
|
492
|
if (!displayStatusCombo.equals(Messages.Preference_Use_Default)) {
|
493
|
override = true;
|
494
|
PreferencesUtil.setStringValue(PreferencePredicate.DisplayOfStatusInCombo.getKey(), displayStatusCombo);
|
495
|
}
|
496
|
PreferencesUtil.setBooleanValue(
|
497
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfStatusInCombo.getKey()),
|
498
|
override);
|
499
|
|
500
|
|
501
|
|
502
|
override = false;
|
503
|
if (!displayArea.equals(Messages.Preference_Use_Default) ) {
|
504
|
override = true;
|
505
|
PreferencesUtil.setAreaDisplayInChecklistEditor(displayArea);
|
506
|
}
|
507
|
PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(
|
508
|
PreferencePredicate.DisplayOfAreasInDistributionEditor.getKey()), override);
|
509
|
|
510
|
|
511
|
|
512
|
|
513
|
PreferencesUtil.setOwnDescriptionForChecklistEditor(ownDescriptionForDistributionEditor);
|
514
|
PreferencesUtil.setBooleanValue(
|
515
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey()),
|
516
|
true);
|
517
|
|
518
|
PreferencesUtil.firePreferencesChanged(this.getClass());
|
519
|
|
520
|
return true;
|
521
|
}
|
522
|
|
523
|
/**
|
524
|
* {@inheritDoc}
|
525
|
*/
|
526
|
@Override
|
527
|
public void widgetSelected(SelectionEvent e) {
|
528
|
setApply(true);
|
529
|
if (e.getSource().equals(statusDisplaySelectionCombo)) {
|
530
|
String text = statusDisplaySelectionCombo.getText();
|
531
|
if(text.equals(Messages.Preference_Use_Default)){
|
532
|
displayStatus = Messages.Preference_Use_Default;
|
533
|
if(isAdminPreference){
|
534
|
prefStatusDisplay.setAllowOverride(true);
|
535
|
allowOverrideStatusDisplayButton.setSelection(true);
|
536
|
}
|
537
|
|
538
|
return;
|
539
|
}
|
540
|
for (TermDisplayEnum display : TermDisplayEnum.values()) {
|
541
|
if (text.startsWith(display.getLabel())) {
|
542
|
displayStatus = display.getKey();
|
543
|
break;
|
544
|
}
|
545
|
|
546
|
}
|
547
|
}
|
548
|
if (e.getSource().equals(statusDisplayInComboSelectionCombo)) {
|
549
|
String text = statusDisplayInComboSelectionCombo.getText();
|
550
|
if(text.equals(Messages.Preference_Use_Default)){
|
551
|
displayStatusCombo = Messages.Preference_Use_Default;
|
552
|
if(isAdminPreference){
|
553
|
prefStatusDisplayInCombo.setAllowOverride(true);
|
554
|
allowOverrideStatusDisplayInComboButton.setSelection(true);
|
555
|
}
|
556
|
|
557
|
return;
|
558
|
}
|
559
|
for (TermComboEnum display : TermComboEnum.values()) {
|
560
|
if (text.startsWith(display.getLabel())) {
|
561
|
displayStatusCombo = display.getKey();
|
562
|
break;
|
563
|
}
|
564
|
|
565
|
}
|
566
|
}
|
567
|
if (e.getSource().equals(areaDisplaySelectionCombo)) {
|
568
|
String text = areaDisplaySelectionCombo.getText();
|
569
|
if(text.equals(Messages.Preference_Use_Default)){
|
570
|
displayArea = Messages.Preference_Use_Default;
|
571
|
if (isAdminPreference){
|
572
|
prefAreaDisplay.setAllowOverride(true);
|
573
|
allowOverrideAreaDisplayButton.setSelection(true);
|
574
|
}
|
575
|
return;
|
576
|
}
|
577
|
for (TermDisplayEnum display : TermDisplayEnum.values()) {
|
578
|
if (text.startsWith(display.getLabel())) {
|
579
|
displayArea = display.getKey();
|
580
|
break;
|
581
|
}
|
582
|
}
|
583
|
}
|
584
|
if (e.getSource().equals(areaOrderSelectionCombo)) {
|
585
|
String text = areaOrderSelectionCombo.getText();
|
586
|
if(text.equals(Messages.Preference_Use_Default)){
|
587
|
orderAreas = Messages.Preference_Use_Default;
|
588
|
if (isAdminPreference){
|
589
|
prefAreaSort.setAllowOverride(true);
|
590
|
allowOverrideOrderAreasButton.setSelection(true);
|
591
|
}
|
592
|
return;
|
593
|
}
|
594
|
for (TermOrder display : TermOrder.values()) {
|
595
|
if (text.startsWith(display.getLabel())) {
|
596
|
orderAreas = display.getKey();
|
597
|
break;
|
598
|
}
|
599
|
}
|
600
|
}
|
601
|
if (e.getSource().equals(this.activateRankCombo)) {
|
602
|
String text = activateRankCombo.getText();
|
603
|
if(text.equals(Messages.Preference_Use_Default)){
|
604
|
isShowRank = null;
|
605
|
if (isAdminPreference){
|
606
|
prefRank.setAllowOverride(true);
|
607
|
allowOverrideRankButton.setSelection(true);
|
608
|
}
|
609
|
return;
|
610
|
}
|
611
|
if (text.equals(SHOW_RANK)){
|
612
|
isShowRank = true;
|
613
|
}else{
|
614
|
isShowRank = false;
|
615
|
}
|
616
|
}
|
617
|
|
618
|
if (e.getSource().equals(this.activateCombo)) {
|
619
|
String text = activateCombo.getText();
|
620
|
if(text.equals(Messages.Preference_Use_Default)){
|
621
|
isEditorActivated = null;
|
622
|
if (isAdminPreference){
|
623
|
if (distributionEditorPref == null){
|
624
|
distributionEditorPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DistributionEditorActivated, PreferencePredicate.DistributionEditorActivated.getDefaultValue() != null ? PreferencePredicate.DistributionEditorActivated.getDefaultValue().toString(): null);
|
625
|
}
|
626
|
distributionEditorPref.setAllowOverride(true);
|
627
|
allowOverrideActivatedButton.setSelection(true);
|
628
|
}
|
629
|
return;
|
630
|
}
|
631
|
if (text.equals(ENABLE)){
|
632
|
isEditorActivated = true;
|
633
|
}else{
|
634
|
isEditorActivated = false;
|
635
|
}
|
636
|
|
637
|
}
|
638
|
//PreferencesUtil.recursiveSetEnabled(child, isEditorActivated);
|
639
|
}
|
640
|
|
641
|
/**
|
642
|
* {@inheritDoc}
|
643
|
*/
|
644
|
@Override
|
645
|
public void widgetDefaultSelected(SelectionEvent e) {
|
646
|
// TODO Auto-generated method stub
|
647
|
|
648
|
}
|
649
|
|
650
|
/**
|
651
|
* {@inheritDoc}
|
652
|
*/
|
653
|
@Override
|
654
|
public void getValues() {
|
655
|
isAdminPreference = false;
|
656
|
setPreferenceStore(PreferencesUtil.getPreferenceStore());
|
657
|
distributionEditorPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DistributionEditorActivated);
|
658
|
overrideActivated = PreferencesUtil.getBooleanValue(
|
659
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.DistributionEditorActivated.getKey()), true);
|
660
|
|
661
|
if (distributionEditorPref != null) {
|
662
|
if (distributionEditorPref.isAllowOverride() ) {
|
663
|
if (overrideActivated){
|
664
|
isEditorActivated = PreferencesUtil.getBooleanValue(PreferencePredicate.DistributionEditorActivated.getKey(), true);
|
665
|
}
|
666
|
|
667
|
} else {
|
668
|
isEditorActivated = Boolean.valueOf(distributionEditorPref.getValue());
|
669
|
|
670
|
}
|
671
|
|
672
|
} else {
|
673
|
if(!overrideActivated){
|
674
|
isEditorActivated = null;
|
675
|
}else{
|
676
|
isEditorActivated = PreferencesUtil.getBooleanValue(PreferencePredicate.DistributionEditorActivated.getKey(), true);
|
677
|
}
|
678
|
//distributionEditorPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DistributionEditorActivated, PreferencePredicate.DistributionEditorActivated.getDefaultValue() != null ? PreferencePredicate.DistributionEditorActivated.getDefaultValue().toString(): null);
|
679
|
}
|
680
|
|
681
|
prefAreaVoc = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies);
|
682
|
if (prefAreaVoc == null){
|
683
|
prefAreaVoc = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, PreferencePredicate.AvailableDistributionAreaVocabularies.getDefaultValue() != null ? PreferencePredicate.AvailableDistributionAreaVocabularies.getDefaultValue().toString(): null);
|
684
|
}
|
685
|
|
686
|
|
687
|
prefStatus = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionStatus);
|
688
|
if (prefStatus == null){
|
689
|
prefStatus = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, PreferencePredicate.AvailableDistributionStatus.getDefaultValue() != null ? PreferencePredicate.AvailableDistributionStatus.getDefaultValue().toString(): null);
|
690
|
}
|
691
|
|
692
|
|
693
|
prefAreaDisplay = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DisplayOfAreasInDistributionEditor);
|
694
|
overrideAreaDisplay = PreferencesUtil.getBooleanValue(
|
695
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfAreasInDistributionEditor.getKey()), true);
|
696
|
if (prefAreaDisplay != null) {
|
697
|
if (prefAreaDisplay.isAllowOverride()){
|
698
|
if (overrideActivated) {
|
699
|
displayArea = PreferencesUtil.displayAreaInChecklistEditor();
|
700
|
}else{
|
701
|
displayArea = Messages.Preference_Use_Default;
|
702
|
}
|
703
|
} else {
|
704
|
displayArea = prefAreaDisplay.getValue();
|
705
|
}
|
706
|
} else {
|
707
|
if (overrideAreaDisplay){
|
708
|
displayArea = PreferencesUtil.displayAreaInChecklistEditor();
|
709
|
} else{
|
710
|
displayArea = Messages.Preference_Use_Default;
|
711
|
}
|
712
|
//prefAreaDisplay = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DisplayOfAreasInDistributionEditor, PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue() != null ? PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue().toString(): null);
|
713
|
}
|
714
|
|
715
|
prefStatusDisplay = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DisplayOfStatus);
|
716
|
overrideStatusDisplay = PreferencesUtil
|
717
|
.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfStatus.getKey()), true);
|
718
|
if (prefStatusDisplay != null) {
|
719
|
if (prefStatusDisplay.isAllowOverride()){
|
720
|
if (overrideStatusDisplay) {
|
721
|
displayStatus = PreferencesUtil.displayStatusInChecklistEditor();
|
722
|
}else{
|
723
|
displayStatus = Messages.Preference_Use_Default;
|
724
|
}
|
725
|
} else {
|
726
|
this.displayStatus = prefStatusDisplay.getValue();
|
727
|
}
|
728
|
} else {
|
729
|
if (overrideStatusDisplay){
|
730
|
displayStatus = PreferencesUtil.displayStatusInChecklistEditor();
|
731
|
} else{
|
732
|
displayStatus = Messages.Preference_Use_Default;
|
733
|
}
|
734
|
//prefStatusDisplay = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DisplayOfStatus, PreferencePredicate.DisplayOfStatus.getDefaultValue() != null ? PreferencePredicate.DisplayOfStatus.getDefaultValue().toString(): null);
|
735
|
}
|
736
|
|
737
|
prefStatusDisplayInCombo = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DisplayOfStatusInCombo);
|
738
|
overrideStatusDisplayCombo = PreferencesUtil
|
739
|
.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfStatusInCombo.getKey()), true);
|
740
|
if (prefStatusDisplayInCombo != null) {
|
741
|
if (prefStatusDisplayInCombo.isAllowOverride()){
|
742
|
if (overrideStatusDisplayCombo) {
|
743
|
displayStatusCombo = PreferencesUtil.getStringValue(PreferencePredicate.DisplayOfStatusInCombo.getKey());
|
744
|
}else{
|
745
|
displayStatusCombo = Messages.Preference_Use_Default;
|
746
|
}
|
747
|
} else {
|
748
|
this.displayStatusCombo = prefStatusDisplayInCombo.getValue();
|
749
|
}
|
750
|
} else {
|
751
|
if (overrideStatusDisplayCombo){
|
752
|
displayStatusCombo = PreferencesUtil.getStringValue(PreferencePredicate.DisplayOfStatusInCombo.getKey());
|
753
|
} else{
|
754
|
displayStatusCombo = Messages.Preference_Use_Default;
|
755
|
}
|
756
|
|
757
|
}
|
758
|
|
759
|
|
760
|
prefAreaSort = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AreasSortedInDistributionEditor);
|
761
|
overrideOrderAreas = PreferencesUtil.getBooleanValue(
|
762
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.AreasSortedInDistributionEditor.getKey()), true);
|
763
|
if (prefAreaSort != null) {
|
764
|
if (prefAreaSort.isAllowOverride()){
|
765
|
if(overrideOrderAreas) {
|
766
|
orderAreas = PreferencesUtil.getSortNamedAreasInDistributionEditor();
|
767
|
}else{
|
768
|
orderAreas = Messages.Preference_Use_Default;
|
769
|
}
|
770
|
} else {
|
771
|
if (prefAreaSort.getValue() != null) {
|
772
|
orderAreas = prefAreaSort.getValue().toString();
|
773
|
} else {
|
774
|
orderAreas = ((TermOrder) PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue())
|
775
|
.getKey();
|
776
|
}
|
777
|
|
778
|
}
|
779
|
} else {
|
780
|
if (overrideOrderAreas){
|
781
|
orderAreas = PreferencesUtil.getSortNamedAreasInDistributionEditor();
|
782
|
}else{
|
783
|
orderAreas = Messages.Preference_Use_Default;
|
784
|
}
|
785
|
//prefAreaSort = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AreasSortedInDistributionEditor, PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue() != null ? PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue().toString(): null);
|
786
|
}
|
787
|
|
788
|
prefRank = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowRankInDistributionEditor);
|
789
|
overrideRank = PreferencesUtil.getBooleanValue(
|
790
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowRankInDistributionEditor.getKey()), true);
|
791
|
if (prefRank != null) {
|
792
|
if (prefRank.isAllowOverride()){
|
793
|
if(overrideRank) {
|
794
|
isShowRank = PreferencesUtil.isShowRankInChecklistEditor();
|
795
|
}
|
796
|
|
797
|
} else {
|
798
|
this.isShowRank = Boolean.valueOf(prefRank.getValue().toString());
|
799
|
}
|
800
|
} else {
|
801
|
if (overrideRank){
|
802
|
isShowRank = PreferencesUtil.isShowRankInChecklistEditor();
|
803
|
} else {
|
804
|
isShowRank = null;
|
805
|
}
|
806
|
|
807
|
//refRank = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowRankInDistributionEditor, PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue() != null ? PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue().toString(): null);
|
808
|
}
|
809
|
|
810
|
prefOwnDescription = PreferencesUtil
|
811
|
.getPreferenceFromDB(PreferencePredicate.OwnDescriptionForDistributionEditor);
|
812
|
if (prefOwnDescription != null) {
|
813
|
if (prefOwnDescription.isAllowOverride()) {
|
814
|
ownDescriptionForDistributionEditor = PreferencesUtil.isOwnDescriptionForChecklistEditor();
|
815
|
} else {
|
816
|
ownDescriptionForDistributionEditor = Boolean.valueOf(prefOwnDescription.getValue().toString());
|
817
|
}
|
818
|
} else {
|
819
|
ownDescriptionForDistributionEditor = PreferencesUtil.isShowRankInChecklistEditor();
|
820
|
// allowOverrideOwnDescriptionForDistributionEditor = true;
|
821
|
overrideOwnDescriptionForDistributionEditor = PreferencesUtil.getBooleanValue(
|
822
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey()), true);
|
823
|
//prefOwnDescription = CdmPreference.NewTaxEditorInstance(PreferencePredicate.OwnDescriptionForDistributionEditor, PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue() != null ? PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue().toString(): null);
|
824
|
}
|
825
|
|
826
|
commandHandlerString = "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler";
|
827
|
commandHandlerStringStatus = "eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardHandler";
|
828
|
}
|
829
|
|
830
|
@Override
|
831
|
protected void performDefaults() {
|
832
|
if (isAdminPreference){
|
833
|
isEditorActivated = (Boolean) PreferencePredicate.DistributionEditorActivated.getDefaultValue();
|
834
|
}else{
|
835
|
isEditorActivated = Boolean.parseBoolean(distributionEditorPref.getValue().toString());
|
836
|
}
|
837
|
if (isEditorActivated) {
|
838
|
activateCombo.select(0);
|
839
|
} else {
|
840
|
activateCombo.select(1);
|
841
|
}
|
842
|
|
843
|
if (isAdminPreference){
|
844
|
displayArea = ((TermDisplayEnum) PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue())
|
845
|
.getKey();
|
846
|
}else{
|
847
|
displayArea = prefAreaDisplay.getValue().toString();
|
848
|
}
|
849
|
|
850
|
TermDisplayEnum areaDisplay;
|
851
|
try {
|
852
|
if (displayArea != null) {
|
853
|
areaDisplay = TermDisplayEnum.byKey(displayArea);
|
854
|
} else {
|
855
|
areaDisplay = TermDisplayEnum.Title;
|
856
|
}
|
857
|
} catch (IllegalArgumentException e) {
|
858
|
areaDisplay = TermDisplayEnum.Title;
|
859
|
}
|
860
|
int index = 0;
|
861
|
for (String itemLabel : areaDisplaySelectionCombo.getItems()) {
|
862
|
if (itemLabel.equalsIgnoreCase(areaDisplay.getLabel())) {
|
863
|
areaDisplaySelectionCombo.select(index);
|
864
|
break;
|
865
|
}
|
866
|
index++;
|
867
|
}
|
868
|
|
869
|
if (isAdminPreference){
|
870
|
displayStatus = ((TermDisplayEnum) PreferencePredicate.DisplayOfStatus.getDefaultValue()).getKey();
|
871
|
}else{
|
872
|
displayStatus = prefStatusDisplay.getValue().toString();
|
873
|
}
|
874
|
|
875
|
TermDisplayEnum statusDisplay;
|
876
|
try {
|
877
|
if (displayStatus != null) {
|
878
|
statusDisplay = TermDisplayEnum.byKey(displayStatus);
|
879
|
} else {
|
880
|
statusDisplay = TermDisplayEnum.Title;
|
881
|
}
|
882
|
} catch (IllegalArgumentException e) {
|
883
|
statusDisplay = TermDisplayEnum.Title;
|
884
|
}
|
885
|
index = 0;
|
886
|
for (String itemLabel : statusDisplaySelectionCombo.getItems()) {
|
887
|
if (itemLabel.equalsIgnoreCase(statusDisplay.getLabel())) {
|
888
|
statusDisplaySelectionCombo.select(index);
|
889
|
break;
|
890
|
}
|
891
|
index++;
|
892
|
}
|
893
|
if (isAdminPreference){
|
894
|
orderAreas = ((TermOrder) PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue()).getKey();
|
895
|
}else{
|
896
|
orderAreas = prefAreaSort.getValue().toString();
|
897
|
}
|
898
|
|
899
|
index = 0;
|
900
|
if (PreferencesUtil.getStringValue(PreferencePredicate.DistributionEditorActivated.getKey()) != null) {
|
901
|
TermOrder areaOrder;
|
902
|
try {
|
903
|
if (orderAreas != null) {
|
904
|
areaOrder = TermOrder.valueOf(orderAreas);
|
905
|
} else {
|
906
|
areaOrder = TermOrder.IdInVoc;
|
907
|
}
|
908
|
} catch (IllegalArgumentException e) {
|
909
|
areaOrder = TermOrder.IdInVoc;
|
910
|
}
|
911
|
for (String itemLabel : areaOrderSelectionCombo.getItems()) {
|
912
|
if (itemLabel.equalsIgnoreCase(areaOrder.getLabel())) {
|
913
|
areaOrderSelectionCombo.select(index);
|
914
|
break;
|
915
|
}
|
916
|
index++;
|
917
|
}
|
918
|
}
|
919
|
|
920
|
if (isAdminPreference){
|
921
|
isShowRank = Boolean.valueOf(PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue().toString());
|
922
|
}else{
|
923
|
isShowRank = Boolean.parseBoolean(prefRank.getValue().toString());
|
924
|
}
|
925
|
|
926
|
if (isShowRank) {
|
927
|
activateRankCombo.select(0);
|
928
|
} else {
|
929
|
activateRankCombo.select(1);
|
930
|
}
|
931
|
|
932
|
ownDescriptionForDistributionEditor = Boolean
|
933
|
.valueOf(PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue().toString());
|
934
|
|
935
|
allowOverrideActivatedButton.setSelection(true);
|
936
|
overrideActivated = true;
|
937
|
|
938
|
overrideAreaDisplay = true;
|
939
|
allowOverrideAreaDisplayButton.setSelection(true);
|
940
|
|
941
|
overrideStatusDisplay = true;
|
942
|
allowOverrideStatusDisplayButton.setSelection(true);
|
943
|
|
944
|
overrideOrderAreas = true;
|
945
|
allowOverrideOrderAreasButton.setSelection(true);
|
946
|
|
947
|
overrideRank = true;
|
948
|
allowOverrideRankButton.setSelection(true);
|
949
|
|
950
|
overrideOwnDescriptionForDistributionEditor = true;
|
951
|
|
952
|
this.statusPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, null);
|
953
|
this.areaVocPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies,
|
954
|
null);
|
955
|
if (!isAdminPreference) {
|
956
|
PreferencesUtil.recursiveSetEnabled(child, isEditorActivated);
|
957
|
|
958
|
if (!prefAreaVoc.isAllowOverride()) {
|
959
|
button_openSelectAreaVocabularies.setButtonEnabled(false);
|
960
|
}
|
961
|
if (!prefStatus.isAllowOverride()) {
|
962
|
button_openStatusWizard.setButtonEnabled(false);
|
963
|
}
|
964
|
if (!prefRank.isAllowOverride()) {
|
965
|
activateRankCombo.setEnabled(false);
|
966
|
|
967
|
if (!prefAreaSort.isAllowOverride()) {
|
968
|
areaOrderSelectionCombo.setEnabled(false);
|
969
|
allowOverrideOrderAreasButton.setEnabled(false);
|
970
|
}
|
971
|
if (!prefAreaDisplay.isAllowOverride()) {
|
972
|
allowOverrideAreaDisplayButton.setEnabled(false);
|
973
|
}
|
974
|
if (!prefStatusDisplay.isAllowOverride()) {
|
975
|
allowOverrideStatusDisplayButton.setEnabled(false);
|
976
|
}
|
977
|
}
|
978
|
super.performDefaults();
|
979
|
}
|
980
|
}
|
981
|
|
982
|
}
|