Revision a0257f6e
Added by Katja Luther almost 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/SpecimenOrObservationPreferences.java | ||
---|---|---|
52 | 52 |
protected Boolean isShowLifeForm; |
53 | 53 |
protected boolean allowOverrideShowLifeForm; |
54 | 54 |
protected boolean overrideShowLifeForm; |
55 |
protected Boolean isShowListEditor; |
|
56 |
protected boolean allowOverrideShowListEditor; |
|
57 |
protected boolean overrideShowListEditor; |
|
58 |
|
|
55 | 59 |
Composite composite; |
56 | 60 |
|
57 | 61 |
protected Combo showSpecimenButton; |
... | ... | |
64 | 68 |
protected Button allowOverrideIsShowTaxonAssociationButton; |
65 | 69 |
protected Button allowOverrideShowLifeFormButton; |
66 | 70 |
protected Combo showLifeFormButton; |
71 |
protected Button allowOverrideShowListEditorButton; |
|
72 |
protected Combo showListEditorButton; |
|
67 | 73 |
|
68 | 74 |
CdmPreference showSpecimenPref; |
69 | 75 |
CdmPreference showCollectingAreaInGeneralSection; |
70 | 76 |
CdmPreference showDeterminationOnlyForFieldUnits; |
71 | 77 |
CdmPreference showTaxonAssociation; |
72 | 78 |
CdmPreference showLifeForm; |
79 |
CdmPreference showListEditor; |
|
73 | 80 |
|
74 | 81 |
@Override |
75 | 82 |
public void init() { |
... | ... | |
155 | 162 |
separator= new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR); |
156 | 163 |
separator.setLayoutData(gridData); |
157 | 164 |
|
165 |
showListEditorButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.ShowSpecimenListEditor, Messages.DatabasePreferncesPage_Show_Specimen_List_Editor, isAdminPreference); |
|
166 |
|
|
167 |
showListEditorButton.addSelectionListener(this); |
|
168 |
index = 0; |
|
169 |
for (String itemLabel : showListEditorButton.getItems()) { |
|
170 |
if (isShowListEditor == null && itemLabel.startsWith(Messages.Preference_Use_Default)) { |
|
171 |
showListEditorButton.select(index); |
|
172 |
break; |
|
173 |
} |
|
174 |
if (isShowListEditor != null && itemLabel.equals(Messages.GeneralPreference_yes) && isShowListEditor){ |
|
175 |
showListEditorButton.select(index); |
|
176 |
break; |
|
177 |
} |
|
178 |
if (isShowListEditor != null && itemLabel.equals(Messages.GeneralPreference_no) && !isShowListEditor){ |
|
179 |
showListEditorButton.select(index); |
|
180 |
break; |
|
181 |
} |
|
182 |
index++; |
|
183 |
} |
|
184 |
if (isAdminPreference){ |
|
185 |
allowOverrideShowListEditorButton = createAllowOverrideButton(composite); |
|
186 |
allowOverrideShowListEditorButton.setSelection(allowOverrideShowListEditor); |
|
187 |
// allowOverrideShowCollectingAreaButton.setEnabled(isShowCollectingAreaInGeneralSection != null); |
|
188 |
allowOverrideShowListEditorButton.addSelectionListener(new SelectionAdapter(){ |
|
189 |
@Override |
|
190 |
public void widgetSelected(SelectionEvent e) { |
|
191 |
setApply(true); |
|
192 |
allowOverrideShowListEditor = allowOverrideShowListEditorButton.getSelection(); |
|
193 |
} |
|
194 |
}); |
|
195 |
} |
|
196 |
isEditingAllowed = true; |
|
197 |
if (showListEditor != null && !showListEditor.isAllowOverride() ){ |
|
198 |
isEditingAllowed = false; |
|
199 |
} |
|
200 |
showListEditorButton.setEnabled(isEditingAllowed); |
|
201 |
|
|
158 | 202 |
showCollectingAreaInGeneralSectionButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.ShowCollectingAreasInGeneralSection, Messages.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section, isAdminPreference); |
159 | 203 |
|
160 | 204 |
showCollectingAreaInGeneralSectionButton.addSelectionListener(this); |
... | ... | |
347 | 391 |
showSpecimenPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowSpecimen, PreferencePredicate.ShowSpecimen.getDefaultValue() != null ? PreferencePredicate.ShowSpecimen.getDefaultValue().toString(): null); |
348 | 392 |
} |
349 | 393 |
|
394 |
key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowSpecimenListEditor); |
|
395 |
showListEditor = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowSpecimenListEditor); |
|
396 |
|
|
397 |
overrideShowListEditor = PreferencesUtil.getBooleanValue( |
|
398 |
PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowSpecimenListEditor.getKey()), true) != null? PreferencesUtil.getBooleanValue( |
|
399 |
PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowSpecimenListEditor.getKey()), true): false; |
|
400 |
if (showListEditor != null) { |
|
401 |
if (showListEditor.isAllowOverride() ) { |
|
402 |
if (overrideShowListEditor){ |
|
403 |
isShowListEditor = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowSpecimenListEditor.getKey(), true); |
|
404 |
} |
|
405 |
} else { |
|
406 |
isShowListEditor = Boolean.valueOf(showListEditor.getValue()); |
|
407 |
} |
|
408 |
|
|
409 |
} else { |
|
410 |
if(!overrideShowListEditor){ |
|
411 |
isShowListEditor = null; |
|
412 |
}else{ |
|
413 |
isShowListEditor = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowSpecimenListEditor.getKey(), true); |
|
414 |
} |
|
415 |
showListEditor = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowSpecimenListEditor, PreferencePredicate.ShowSpecimenListEditor.getDefaultValue() != null ? PreferencePredicate.ShowSpecimenListEditor.getDefaultValue().toString(): null); |
|
416 |
} |
|
350 | 417 |
|
351 | 418 |
|
352 | 419 |
|
... | ... | |
474 | 541 |
PreferencesUtil.setBooleanValue( |
475 | 542 |
PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowSpecimen.getKey()), |
476 | 543 |
override); |
544 |
override = false; |
|
545 |
if (isShowListEditor != null ) { |
|
546 |
override = true; |
|
547 |
PreferencesUtil.setStringValue(PreferencePredicate.ShowSpecimenListEditor.getKey(), isShowListEditor.toString()); |
|
548 |
} |
|
549 |
PreferencesUtil.setBooleanValue( |
|
550 |
PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowSpecimenListEditor.getKey()), |
|
551 |
override); |
|
477 | 552 |
|
478 | 553 |
override = false; |
479 | 554 |
if (isShowCollectingAreaInGeneralSection != null ) { |
... | ... | |
525 | 600 |
allowOverrideShowSpecimenRelatedIssues = true; |
526 | 601 |
allowOverrideIsShowSpecimenRelatedIssuesButton.setSelection(allowOverrideShowSpecimenRelatedIssues); |
527 | 602 |
} |
603 |
|
|
604 |
isShowListEditor = null; |
|
605 |
showListEditorButton.select(0); |
|
606 |
|
|
607 |
if (allowOverrideShowListEditorButton != null){ |
|
608 |
allowOverrideShowListEditor = true; |
|
609 |
allowOverrideShowListEditorButton.setSelection(allowOverrideShowListEditor); |
|
610 |
} |
|
611 |
|
|
528 | 612 |
isShowCollectingAreaInGeneralSection = null; |
529 | 613 |
showCollectingAreaInGeneralSectionButton.select(0); |
530 | 614 |
|
531 | 615 |
if (allowOverrideShowCollectingAreaButton != null){ |
532 | 616 |
allowOverrideShowCollectingAreaInGeneralSection = true; |
533 |
allowOverrideShowCollectingAreaButton.setSelection(allowOverrideShowSpecimenRelatedIssues);
|
|
617 |
allowOverrideShowCollectingAreaButton.setSelection(allowOverrideShowCollectingAreaInGeneralSection);
|
|
534 | 618 |
} |
535 | 619 |
isDeterminationOnlyForFieldUnits = null; |
536 | 620 |
determinationOnlyForFieldUnitsButton.select(0); |
537 | 621 |
|
538 | 622 |
if (allowOverridesDeterminationOnlyForFieldUnitsButton != null){ |
539 | 623 |
allowOverrideDeterminationOnlyForFieldUnits = true; |
540 |
allowOverridesDeterminationOnlyForFieldUnitsButton.setSelection(allowOverrideShowSpecimenRelatedIssues);
|
|
624 |
allowOverridesDeterminationOnlyForFieldUnitsButton.setSelection(allowOverrideDeterminationOnlyForFieldUnits);
|
|
541 | 625 |
} |
542 | 626 |
|
543 | 627 |
isShowTaxonAssociation = null; |
... | ... | |
545 | 629 |
|
546 | 630 |
if (allowOverrideIsShowTaxonAssociationButton != null){ |
547 | 631 |
allowOverrideShowTaxonAssociation = true; |
548 |
allowOverrideIsShowTaxonAssociationButton.setSelection(allowOverrideShowSpecimenRelatedIssues);
|
|
632 |
allowOverrideIsShowTaxonAssociationButton.setSelection(allowOverrideShowTaxonAssociation);
|
|
549 | 633 |
} |
550 | 634 |
|
551 | 635 |
|
... | ... | |
555 | 639 |
|
556 | 640 |
if (allowOverrideShowLifeFormButton != null){ |
557 | 641 |
allowOverrideShowLifeForm = true; |
558 |
allowOverrideShowLifeFormButton.setSelection(allowOverrideShowSpecimenRelatedIssues);
|
|
642 |
allowOverrideShowLifeFormButton.setSelection(allowOverrideShowLifeForm);
|
|
559 | 643 |
} |
560 | 644 |
setApply(true); |
561 | 645 |
|
... | ... | |
582 | 666 |
} |
583 | 667 |
} |
584 | 668 |
|
669 |
if (e.getSource().equals(this.showListEditorButton)) { |
|
670 |
String text = showListEditorButton.getText(); |
|
671 |
if(text.startsWith(Messages.Preference_Use_Default)){ |
|
672 |
isShowListEditor = null; |
|
673 |
return; |
|
674 |
} |
|
675 |
|
|
676 |
if (text.equals(Messages.GeneralPreference_yes)){ |
|
677 |
isShowListEditor = true; |
|
678 |
}else{ |
|
679 |
isShowListEditor = false; |
|
680 |
} |
|
681 |
} |
|
682 |
|
|
585 | 683 |
if (e.getSource().equals(this.showCollectingAreaInGeneralSectionButton)) { |
586 | 684 |
String text = showCollectingAreaInGeneralSectionButton.getText(); |
587 | 685 |
if(text.startsWith(Messages.Preference_Use_Default)){ |
Also available in: Unified diff
fix #9066: visibility of specimen list editor configurable