Revision 0eccefea
Added by Katja Luther about 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java | ||
---|---|---|
47 | 47 |
boolean isUseLocal; |
48 | 48 |
protected Boolean isShowRank; |
49 | 49 |
protected TermOrder orderAreas; |
50 |
protected TermOrder orderStatus; |
|
50 | 51 |
protected TermDisplayEnum displayStatus; |
51 | 52 |
protected TermComboEnum displayStatusCombo; |
52 | 53 |
protected TermDisplayEnum displayArea; |
... | ... | |
61 | 62 |
protected boolean overrideStatusDisplay; |
62 | 63 |
protected boolean overrideStatusDisplayCombo; |
63 | 64 |
protected boolean overrideNumberOfStatus; |
65 |
protected boolean overrideOrderStatus; |
|
64 | 66 |
|
65 | 67 |
protected Combo areaOrderSelectionCombo; |
66 | 68 |
protected Button allowOverrideOrderAreasButton; |
... | ... | |
70 | 72 |
protected Button allowOverrideStatusDisplayInComboButton; |
71 | 73 |
protected Combo areaDisplaySelectionCombo; |
72 | 74 |
protected Button allowOverrideAreaDisplayButton; |
75 |
protected Combo statusSortSelectionCombo; |
|
76 |
protected Button allowOverrideStatusSortButton; |
|
73 | 77 |
|
74 | 78 |
|
75 | 79 |
protected Text numberOfStatusText; |
... | ... | |
86 | 90 |
protected CdmPreference prefRank; |
87 | 91 |
protected CdmPreference prefOwnDescription; |
88 | 92 |
protected CdmPreference prefNumberStatus; |
93 |
protected CdmPreference prefStatusSort; |
|
89 | 94 |
Composite child; |
90 | 95 |
|
91 | 96 |
protected Combo activateCombo; |
... | ... | |
347 | 352 |
}); |
348 | 353 |
} |
349 | 354 |
|
355 |
statusSortSelectionCombo = createCombo(child, TermOrder.values(), PreferencePredicate.StatusSortedInDistributionEditor, Messages.ChecklistEditorGeneralPreference_Configure_status_order, isAdminPreference); |
|
356 |
|
|
357 |
index = 0; |
|
358 |
|
|
359 |
for (String itemLabel : statusSortSelectionCombo.getItems()) { |
|
360 |
if (itemLabel.startsWith(Messages.Preference_Use_Default) && orderStatus == null){ |
|
361 |
statusSortSelectionCombo.select(index); |
|
362 |
break; |
|
363 |
} |
|
364 |
if (itemLabel.equals(orderStatus.getLabel())) { |
|
365 |
statusSortSelectionCombo.select(index); |
|
366 |
break; |
|
367 |
} |
|
368 |
|
|
369 |
index++; |
|
370 |
} |
|
371 |
|
|
372 |
statusSortSelectionCombo.addSelectionListener(this); |
|
373 |
|
|
374 |
if (isAdminPreference) { |
|
375 |
allowOverrideStatusSortButton = createAllowOverrideButton(child); |
|
376 |
allowOverrideStatusSortButton.setSelection(prefStatusSort != null? prefStatusSort.isAllowOverride(): true); |
|
377 |
allowOverrideStatusSortButton.addSelectionListener(new SelectionAdapter() { |
|
378 |
@Override |
|
379 |
public void widgetSelected(SelectionEvent e) { |
|
380 |
setApply(true); |
|
381 |
if (prefStatusSort == null){ |
|
382 |
prefStatusSort = CdmPreference.NewTaxEditorInstance(PreferencePredicate.StatusSortedInDistributionEditor, PreferencePredicate.StatusSortedInDistributionEditor.getDefaultValue() != null ? PreferencePredicate.StatusSortedInDistributionEditor.getDefaultValue().toString(): null); |
|
383 |
} |
|
384 |
prefStatusSort.setAllowOverride(allowOverrideStatusSortButton.getSelection()); |
|
385 |
} |
|
386 |
}); |
|
387 |
} |
|
388 |
|
|
389 |
|
|
390 |
|
|
350 | 391 |
final CLabel description = new CLabel(child, SWT.NULL); |
351 |
description.setText("Number of status shown in drop down");
|
|
392 |
description.setText(Messages.ChecklistEditorGeneralPreference_numberOfStatus);
|
|
352 | 393 |
GridData numberOfStatusGrid= createTextGridData(); |
353 | 394 |
numberOfStatusGrid.verticalSpan = 1; |
354 | 395 |
description.setLayoutData(numberOfStatusGrid); |
355 |
description.setToolTipText("Number of status shown in drop down without scrollbar");
|
|
396 |
description.setToolTipText(Messages.ChecklistEditorGeneralPreference_tooltip_numberOfStatus);
|
|
356 | 397 |
|
357 | 398 |
numberOfStatusText = new Text(child, SWT.BORDER); |
358 | 399 |
if (numberOfStatus != null){ |
... | ... | |
371 | 412 |
numberFormatExceptionLabel.setVisible(false); |
372 | 413 |
}catch(NumberFormatException ex){ |
373 | 414 |
numberFormatExceptionLabel.setVisible(true); |
374 |
numberFormatExceptionLabel.setText("The value needs to be a number.");
|
|
415 |
numberFormatExceptionLabel.setText(Messages.ChecklistEditorGeneralPreference_numberFormatExceptionLabel);
|
|
375 | 416 |
} |
376 | 417 |
|
377 | 418 |
} |
378 | 419 |
}); |
420 |
|
|
421 |
|
|
422 |
if (isAdminPreference) { |
|
423 |
allowOverrideNumberOfStatusButton = createAllowOverrideButton(child); |
|
424 |
allowOverrideNumberOfStatusButton.setSelection(this.distributionEditorPref != null? this.distributionEditorPref.isAllowOverride(): true); |
|
425 |
allowOverrideNumberOfStatusButton.addSelectionListener(new SelectionAdapter() { |
|
426 |
@Override |
|
427 |
public void widgetSelected(SelectionEvent e) { |
|
428 |
setApply(true); |
|
429 |
if (prefNumberStatus == null){ |
|
430 |
prefNumberStatus = CdmPreference.NewTaxEditorInstance(PreferencePredicate.NumberOfVisibleStatusInDropDown, PreferencePredicate.NumberOfVisibleStatusInDropDown.getDefaultValue() != null ? PreferencePredicate.NumberOfVisibleStatusInDropDown.getDefaultValue().toString(): null); |
|
431 |
} |
|
432 |
prefNumberStatus.setAllowOverride(!prefNumberStatus.isAllowOverride()); |
|
433 |
} |
|
434 |
}); |
|
435 |
} |
|
436 |
|
|
379 | 437 |
numberFormatExceptionLabel = new Label(child, SWT.NULL); |
380 |
// numberFormatExceptionLabel.setForeground(Color.RED);
|
|
438 |
// numberFormatExceptionLabel.setForeground(Color.RED); |
|
381 | 439 |
numberFormatExceptionLabel.setVisible(false); |
382 | 440 |
|
383 | 441 |
if (!isAdminPreference) { |
... | ... | |
400 | 458 |
if (prefStatusDisplay != null && !prefStatusDisplay.isAllowOverride()) { |
401 | 459 |
statusDisplaySelectionCombo.setEnabled(false); |
402 | 460 |
} |
461 |
if (prefStatusSort != null && !prefStatusSort.isAllowOverride()) { |
|
462 |
statusSortSelectionCombo.setEnabled(false); |
|
463 |
} |
|
403 | 464 |
if (prefStatusDisplayInCombo != null && !prefStatusDisplayInCombo.isAllowOverride()) { |
404 | 465 |
statusDisplayInComboSelectionCombo.setEnabled(false); |
405 | 466 |
} |
... | ... | |
475 | 536 |
|
476 | 537 |
PreferencesUtil.firePreferencesChanged(this.getClass()); |
477 | 538 |
|
539 |
override = false; |
|
540 |
if (orderStatus != null) { |
|
541 |
override = true; |
|
542 |
PreferencesUtil.setStringValue(PreferencePredicate.StatusSortedInDistributionEditor.getKey(), orderStatus.getKey()); |
|
543 |
} |
|
544 |
PreferencesUtil.setBooleanValue( |
|
545 |
PreferencesUtil.prefOverrideKey(PreferencePredicate.StatusSortedInDistributionEditor.getKey()), |
|
546 |
override); |
|
547 |
|
|
478 | 548 |
override = false; |
479 | 549 |
if (numberOfStatus != null) { |
480 | 550 |
override = true; |
... | ... | |
553 | 623 |
} |
554 | 624 |
} |
555 | 625 |
} |
626 |
|
|
627 |
if (e.getSource().equals(statusSortSelectionCombo)) { |
|
628 |
String text = statusSortSelectionCombo.getText(); |
|
629 |
if(text.startsWith(Messages.Preference_Use_Default)){ |
|
630 |
orderStatus = null; |
|
631 |
return; |
|
632 |
} |
|
633 |
|
|
634 |
for (TermOrder display : TermOrder.values()) { |
|
635 |
if (text.startsWith(display.getLabel())) { |
|
636 |
orderStatus = display; |
|
637 |
break; |
|
638 |
} |
|
639 |
} |
|
640 |
} |
|
556 | 641 |
if (e.getSource().equals(this.activateRankCombo)) { |
557 | 642 |
String text = activateRankCombo.getText(); |
558 | 643 |
if(text.startsWith(Messages.Preference_Use_Default)){ |
... | ... | |
741 | 826 |
//prefAreaSort = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AreasSortedInDistributionEditor, PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue() != null ? PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue().toString(): null); |
742 | 827 |
} |
743 | 828 |
|
829 |
prefStatusSort = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.StatusSortedInDistributionEditor); |
|
830 |
overrideOrderStatus = PreferencesUtil.getBooleanValue( |
|
831 |
PreferencesUtil.prefOverrideKey(PreferencePredicate.StatusSortedInDistributionEditor.getKey()), true) != null? PreferencesUtil.getBooleanValue( |
|
832 |
PreferencesUtil.prefOverrideKey(PreferencePredicate.StatusSortedInDistributionEditor.getKey()), true): false; |
|
833 |
if (prefStatusSort != null) { |
|
834 |
if (prefStatusSort.isAllowOverride()){ |
|
835 |
if(overrideOrderStatus) { |
|
836 |
orderStatus = TermOrder.valueOf(PreferencesUtil.getStringValue(PreferencePredicate.StatusSortedInDistributionEditor.getKey())); |
|
837 |
}else{ |
|
838 |
orderStatus = null; |
|
839 |
} |
|
840 |
} else { |
|
841 |
if (prefStatusSort.getValue() != null) { |
|
842 |
orderStatus = prefStatusSort.getValue() != null? TermOrder.valueOf(prefStatusSort.getValue().toString()): null; |
|
843 |
} else { |
|
844 |
orderStatus = ((TermOrder) PreferencePredicate.StatusSortedInDistributionEditor.getDefaultValue()); |
|
845 |
} |
|
846 |
|
|
847 |
} |
|
848 |
} else { |
|
849 |
if (overrideOrderStatus){ |
|
850 |
orderStatus = TermOrder.valueOf(PreferencesUtil.getStringValue(PreferencePredicate.StatusSortedInDistributionEditor.getKey())); |
|
851 |
}else{ |
|
852 |
orderStatus = null; |
|
853 |
} |
|
854 |
//prefAreaSort = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AreasSortedInDistributionEditor, PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue() != null ? PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue().toString(): null); |
|
855 |
} |
|
856 |
|
|
744 | 857 |
prefRank = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowRankInDistributionEditor); |
745 | 858 |
overrideRank = PreferencesUtil.getBooleanValue( |
746 | 859 |
PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowRankInDistributionEditor.getKey()), true) != null? PreferencesUtil.getBooleanValue( |
... | ... | |
848 | 961 |
} |
849 | 962 |
index++; |
850 | 963 |
} |
964 |
orderStatus = null; |
|
965 |
|
|
851 | 966 |
|
967 |
index = 0; |
|
968 |
for (String itemLabel : statusSortSelectionCombo.getItems()) { |
|
969 |
if (itemLabel.startsWith(Messages.Preference_Use_Default)) { |
|
970 |
statusSortSelectionCombo.select(index); |
|
971 |
break; |
|
972 |
} |
|
973 |
index++; |
|
974 |
} |
|
852 | 975 |
|
853 | 976 |
isShowRank = null; |
854 | 977 |
|
Also available in: Unified diff
ref #8047: status order in drop down