Revision c2a446b0
Added by Katja Luther over 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java | ||
---|---|---|
84 | 84 |
|
85 | 85 |
protected Combo activateRankCombo; |
86 | 86 |
protected Button allowOverrideRankButton; |
87 |
final String SHOW_RANK = "Show Rank";
|
|
88 |
final String NO_RANK = "No Rank";
|
|
87 |
final String SHOW_RANK = "Yes";
|
|
88 |
final String NO_RANK = "No"; |
|
89 | 89 |
|
90 | 90 |
|
91 | 91 |
|
... | ... | |
416 | 416 |
|
417 | 417 |
|
418 | 418 |
override = false; |
419 |
if (!orderAreas.equals(Messages.Preference_Use_Default) ) {
|
|
419 |
if (!orderAreas.startsWith(Messages.Preference_Use_Default) ) {
|
|
420 | 420 |
override = true; |
421 | 421 |
PreferencesUtil.setSortNamedAreasInDistributionEditor(orderAreas); |
422 | 422 |
} |
... | ... | |
439 | 439 |
|
440 | 440 |
|
441 | 441 |
override = false; |
442 |
if (!displayStatus.equals(Messages.Preference_Use_Default)) {
|
|
442 |
if (!displayStatus.startsWith(Messages.Preference_Use_Default)) {
|
|
443 | 443 |
override = true; |
444 | 444 |
PreferencesUtil.setDisplayStatusInChecklistEditor(displayStatus); |
445 | 445 |
} |
... | ... | |
448 | 448 |
override); |
449 | 449 |
|
450 | 450 |
override = false; |
451 |
if (!displayStatusCombo.equals(Messages.Preference_Use_Default)) {
|
|
451 |
if (!displayStatusCombo.startsWith(Messages.Preference_Use_Default)) {
|
|
452 | 452 |
override = true; |
453 | 453 |
PreferencesUtil.setStringValue(PreferencePredicate.DisplayOfStatusInCombo.getKey(), displayStatusCombo); |
454 | 454 |
} |
... | ... | |
459 | 459 |
|
460 | 460 |
|
461 | 461 |
override = false; |
462 |
if (!displayArea.equals(Messages.Preference_Use_Default) ) {
|
|
462 |
if (!displayArea.startsWith(Messages.Preference_Use_Default) ) {
|
|
463 | 463 |
override = true; |
464 | 464 |
PreferencesUtil.setAreaDisplayInChecklistEditor(displayArea); |
465 | 465 |
} |
... | ... | |
487 | 487 |
setApply(true); |
488 | 488 |
if (e.getSource().equals(statusDisplaySelectionCombo)) { |
489 | 489 |
String text = statusDisplaySelectionCombo.getText(); |
490 |
if(text.equals(Messages.Preference_Use_Default)){
|
|
490 |
if(text.startsWith(Messages.Preference_Use_Default)){
|
|
491 | 491 |
displayStatus = Messages.Preference_Use_Default; |
492 | 492 |
if(isAdminPreference){ |
493 | 493 |
prefStatusDisplay.setAllowOverride(true); |
... | ... | |
506 | 506 |
} |
507 | 507 |
if (e.getSource().equals(statusDisplayInComboSelectionCombo)) { |
508 | 508 |
String text = statusDisplayInComboSelectionCombo.getText(); |
509 |
if(text.equals(Messages.Preference_Use_Default)){
|
|
510 |
displayStatusCombo = Messages.Preference_Use_Default;
|
|
509 |
if(text.startsWith(Messages.Preference_Use_Default)){
|
|
510 |
displayStatusCombo = null;
|
|
511 | 511 |
if(isAdminPreference){ |
512 | 512 |
prefStatusDisplayInCombo.setAllowOverride(true); |
513 | 513 |
allowOverrideStatusDisplayInComboButton.setSelection(true); |
... | ... | |
525 | 525 |
} |
526 | 526 |
if (e.getSource().equals(areaDisplaySelectionCombo)) { |
527 | 527 |
String text = areaDisplaySelectionCombo.getText(); |
528 |
if(text.equals(Messages.Preference_Use_Default)){
|
|
529 |
displayArea = Messages.Preference_Use_Default;
|
|
528 |
if(text.startsWith(Messages.Preference_Use_Default)){
|
|
529 |
displayArea = null;
|
|
530 | 530 |
if (isAdminPreference){ |
531 | 531 |
prefAreaDisplay.setAllowOverride(true); |
532 | 532 |
allowOverrideAreaDisplayButton.setSelection(true); |
... | ... | |
542 | 542 |
} |
543 | 543 |
if (e.getSource().equals(areaOrderSelectionCombo)) { |
544 | 544 |
String text = areaOrderSelectionCombo.getText(); |
545 |
if(text.equals(Messages.Preference_Use_Default)){
|
|
545 |
if(text.startsWith(Messages.Preference_Use_Default)){
|
|
546 | 546 |
orderAreas = Messages.Preference_Use_Default; |
547 | 547 |
if (isAdminPreference){ |
548 | 548 |
prefAreaSort.setAllowOverride(true); |
... | ... | |
559 | 559 |
} |
560 | 560 |
if (e.getSource().equals(this.activateRankCombo)) { |
561 | 561 |
String text = activateRankCombo.getText(); |
562 |
if(text.equals(Messages.Preference_Use_Default)){
|
|
562 |
if(text.startsWith(Messages.Preference_Use_Default)){
|
|
563 | 563 |
isShowRank = null; |
564 | 564 |
if (isAdminPreference){ |
565 | 565 |
prefRank.setAllowOverride(true); |
... | ... | |
576 | 576 |
|
577 | 577 |
if (e.getSource().equals(this.activateCombo)) { |
578 | 578 |
String text = activateCombo.getText(); |
579 |
if(text.equals(Messages.Preference_Use_Default)){
|
|
579 |
if(text.startsWith(Messages.Preference_Use_Default)){
|
|
580 | 580 |
isEditorActivated = null; |
581 | 581 |
if (isAdminPreference){ |
582 | 582 |
if (distributionEditorPref == null){ |
... | ... | |
785 | 785 |
|
786 | 786 |
@Override |
787 | 787 |
protected void performDefaults() { |
788 |
if (isAdminPreference){ |
|
789 |
isEditorActivated = (Boolean) PreferencePredicate.DistributionEditorActivated.getDefaultValue(); |
|
790 |
}else{ |
|
791 |
isEditorActivated = Boolean.parseBoolean(distributionEditorPref.getValue().toString()); |
|
792 |
} |
|
793 |
if (isEditorActivated) { |
|
788 |
setApply(true); |
|
789 |
|
|
790 |
isEditorActivated = null; |
|
791 |
|
|
792 |
if (isEditorActivated == null) { |
|
794 | 793 |
activateCombo.select(0); |
795 |
} else { |
|
794 |
} else if (isEditorActivated){
|
|
796 | 795 |
activateCombo.select(1); |
796 |
} else{ |
|
797 |
activateCombo.select(2); |
|
797 | 798 |
} |
798 | 799 |
|
799 |
if (isAdminPreference){ |
|
800 |
displayArea = ((TermDisplayEnum) PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue()) |
|
801 |
.getKey(); |
|
802 |
}else{ |
|
803 |
displayArea = prefAreaDisplay.getValue().toString(); |
|
804 |
} |
|
800 |
displayArea = Messages.Preference_Use_Default; |
|
805 | 801 |
|
806 |
TermDisplayEnum areaDisplay; |
|
807 |
try { |
|
808 |
if (displayArea != null) { |
|
809 |
areaDisplay = TermDisplayEnum.byKey(displayArea); |
|
810 |
} else { |
|
811 |
areaDisplay = TermDisplayEnum.Title; |
|
812 |
} |
|
813 |
} catch (IllegalArgumentException e) { |
|
814 |
areaDisplay = TermDisplayEnum.Title; |
|
815 |
} |
|
816 | 802 |
int index = 0; |
817 | 803 |
for (String itemLabel : areaDisplaySelectionCombo.getItems()) { |
818 |
if (itemLabel.equalsIgnoreCase(areaDisplay.getLabel())) {
|
|
804 |
if (itemLabel.equalsIgnoreCase(Messages.Preference_Use_Default)) {
|
|
819 | 805 |
areaDisplaySelectionCombo.select(index); |
820 | 806 |
break; |
821 | 807 |
} |
822 | 808 |
index++; |
823 | 809 |
} |
824 | 810 |
|
825 |
if (isAdminPreference){ |
|
826 |
displayStatus = ((TermDisplayEnum) PreferencePredicate.DisplayOfStatus.getDefaultValue()).getKey(); |
|
827 |
}else{ |
|
828 |
displayStatus = prefStatusDisplay.getValue().toString(); |
|
829 |
} |
|
811 |
displayStatus = Messages.Preference_Use_Default; |
|
812 |
|
|
813 |
|
|
830 | 814 |
|
831 |
TermDisplayEnum statusDisplay; |
|
832 |
try { |
|
833 |
if (displayStatus != null) { |
|
834 |
statusDisplay = TermDisplayEnum.byKey(displayStatus); |
|
835 |
} else { |
|
836 |
statusDisplay = TermDisplayEnum.Title; |
|
837 |
} |
|
838 |
} catch (IllegalArgumentException e) { |
|
839 |
statusDisplay = TermDisplayEnum.Title; |
|
840 |
} |
|
841 | 815 |
index = 0; |
842 | 816 |
for (String itemLabel : statusDisplaySelectionCombo.getItems()) { |
843 |
if (itemLabel.equalsIgnoreCase(statusDisplay.getLabel())) {
|
|
817 |
if (itemLabel.equalsIgnoreCase(displayStatus)) {
|
|
844 | 818 |
statusDisplaySelectionCombo.select(index); |
845 | 819 |
break; |
846 | 820 |
} |
847 | 821 |
index++; |
848 | 822 |
} |
849 |
if (isAdminPreference){ |
|
850 |
orderAreas = ((TermOrder) PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue()).getKey(); |
|
851 |
}else{ |
|
852 |
orderAreas = prefAreaSort.getValue().toString(); |
|
853 |
} |
|
823 |
|
|
824 |
orderAreas = Messages.Preference_Use_Default; |
|
825 |
|
|
854 | 826 |
|
855 | 827 |
index = 0; |
856 | 828 |
if (PreferencesUtil.getStringValue(PreferencePredicate.DistributionEditorActivated.getKey()) != null) { |
857 |
TermOrder areaOrder; |
|
858 |
try { |
|
859 |
if (orderAreas != null) { |
|
860 |
areaOrder = TermOrder.valueOf(orderAreas); |
|
861 |
} else { |
|
862 |
areaOrder = TermOrder.IdInVoc; |
|
863 |
} |
|
864 |
} catch (IllegalArgumentException e) { |
|
865 |
areaOrder = TermOrder.IdInVoc; |
|
866 |
} |
|
829 |
|
|
867 | 830 |
for (String itemLabel : areaOrderSelectionCombo.getItems()) { |
868 |
if (itemLabel.equalsIgnoreCase(areaOrder.getLabel())) {
|
|
831 |
if (itemLabel.equalsIgnoreCase(orderAreas)) {
|
|
869 | 832 |
areaOrderSelectionCombo.select(index); |
870 | 833 |
break; |
871 | 834 |
} |
... | ... | |
873 | 836 |
} |
874 | 837 |
} |
875 | 838 |
|
876 |
if (isAdminPreference){ |
|
877 |
isShowRank = Boolean.valueOf(PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue().toString()); |
|
878 |
}else{ |
|
879 |
isShowRank = Boolean.parseBoolean(prefRank.getValue().toString()); |
|
839 |
|
|
840 |
isShowRank = null; |
|
841 |
|
|
842 |
index = 0; |
|
843 |
for (String itemLabel : activateRankCombo.getItems()) { |
|
844 |
if (itemLabel.equalsIgnoreCase(Messages.Preference_Use_Default)) { |
|
845 |
activateRankCombo.select(index); |
|
846 |
break; |
|
847 |
} |
|
848 |
index++; |
|
880 | 849 |
} |
881 | 850 |
|
882 |
if (isShowRank) { |
|
883 |
activateRankCombo.select(0); |
|
884 |
} else { |
|
885 |
activateRankCombo.select(1); |
|
851 |
displayStatusCombo = null; |
|
852 |
index = 0; |
|
853 |
for (String itemLabel : statusDisplayInComboSelectionCombo.getItems()) { |
|
854 |
if (itemLabel.equalsIgnoreCase(Messages.Preference_Use_Default)) { |
|
855 |
statusDisplayInComboSelectionCombo.select(index); |
|
856 |
break; |
|
857 |
} |
|
858 |
index++; |
|
886 | 859 |
} |
887 | 860 |
|
888 | 861 |
ownDescriptionForDistributionEditor = Boolean |
Also available in: Unified diff
ref #8385: fixes in preferences - getDefaults() for all pages