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