2 * Copyright (C) 2014 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.preference
;
11 import org
.eclipse
.swt
.SWT
;
12 import org
.eclipse
.swt
.events
.SelectionAdapter
;
13 import org
.eclipse
.swt
.events
.SelectionEvent
;
14 import org
.eclipse
.swt
.events
.SelectionListener
;
15 import org
.eclipse
.swt
.layout
.GridData
;
16 import org
.eclipse
.swt
.widgets
.Button
;
17 import org
.eclipse
.swt
.widgets
.Combo
;
18 import org
.eclipse
.swt
.widgets
.Composite
;
19 import org
.eclipse
.swt
.widgets
.Control
;
20 import org
.eclipse
.swt
.widgets
.Label
;
22 import eu
.etaxonomy
.cdm
.model
.metadata
.CdmPreference
;
23 import eu
.etaxonomy
.cdm
.model
.metadata
.CdmPreference
.PrefKey
;
24 import eu
.etaxonomy
.cdm
.model
.metadata
.PreferencePredicate
;
25 import eu
.etaxonomy
.cdm
.model
.metadata
.PreferenceSubject
;
26 import eu
.etaxonomy
.taxeditor
.l10n
.Messages
;
27 import eu
.etaxonomy
.taxeditor
.preference
.menu
.CdmPreferencePage
;
28 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
35 public class SpecimenOrObservationPreferences
extends CdmPreferencePage
implements SelectionListener
{
37 private static final String LOCAL_SETTINGS_NOT_ALLOWED
= Messages
.SpecimenOrObservationPreferences_0
;
38 private static final String DESCRIPTION
= Messages
.SpecimenOrObservationPreferences_1
;
40 protected Boolean isShowSpecimenRelatedIssues
;
41 protected boolean allowOverrideShowSpecimenRelatedIssues
;
42 protected boolean overrideShowSpecimenRelatedIssues
;
43 protected Boolean isShowCollectingAreaInGeneralSection
;
44 protected boolean allowOverrideShowCollectingAreaInGeneralSection
;
45 protected boolean overrideShowCollectionAreaInGeneralSection
;
46 protected Boolean isDeterminationOnlyForFieldUnits
;
47 protected boolean allowOverrideDeterminationOnlyForFieldUnits
;
48 protected boolean overrideDeterminationOnlyForFieldUnits
;
49 protected Boolean isShowTaxonAssociation
;
50 protected boolean allowOverrideShowTaxonAssociation
;
51 protected boolean overrideShowTaxonAssociation
;
52 protected Boolean isShowLifeForm
;
53 protected boolean allowOverrideShowLifeForm
;
54 protected boolean overrideShowLifeForm
;
57 protected Combo showSpecimenButton
;
58 protected Button allowOverrideIsShowSpecimenRelatedIssuesButton
;
59 protected Combo showCollectingAreaInGeneralSectionButton
;
60 protected Button allowOverrideShowCollectingAreaButton
;
61 protected Combo determinationOnlyForFieldUnitsButton
;
62 protected Button allowOverridesDeterminationOnlyForFieldUnitsButton
;
63 protected Combo showTaxonAssociationButton
;
64 protected Button allowOverrideIsShowTaxonAssociationButton
;
65 protected Button allowOverrideShowLifeFormButton
;
66 protected Combo showLifeFormButton
;
68 CdmPreference showSpecimenPref
;
69 CdmPreference showCollectingAreaInGeneralSection
;
70 CdmPreference showDeterminationOnlyForFieldUnits
;
71 CdmPreference showTaxonAssociation
;
72 CdmPreference showLifeForm
;
77 // setPreferenceStore(PreferencesUtil.getPreferenceStore());
78 if(!CdmStore
.isActive()){
89 protected Control
createContents(Composite parent
) {
92 boolean isEditingAllowed
= true;
93 if(!isAdminPreference
){
94 CdmPreferenceCache cache
= CdmPreferenceCache
.instance();
96 if (showSpecimenPref
!= null){
97 if (!showSpecimenPref
.isAllowOverride() ){
98 isEditingAllowed
= false;
102 if (isEditingAllowed
){
103 Label label
= new Label(parent
, SWT
.NONE
);
104 label
.setText(DESCRIPTION
);
106 Label label
= new Label(parent
, SWT
.NONE
);
107 label
.setText(LOCAL_SETTINGS_NOT_ALLOWED
);
108 this.noDefaultAndApplyButton();
111 Composite titleComp
= createComposite(parent
);
112 GridData gridData
= createTextGridData();
114 Label separator
= new Label(titleComp
, SWT
.HORIZONTAL
| SWT
.SEPARATOR
);
115 separator
.setLayoutData(gridData
);
116 separator
.setVisible(false);
117 showSpecimenButton
= createBooleanCombo(titleComp
, Messages
.GeneralPreference_yes
, Messages
.GeneralPreference_no
, PreferencePredicate
.ShowSpecimen
, Messages
.DatabasePreferncesPage_Show_Specimen
, isAdminPreference
);
119 showSpecimenButton
.addSelectionListener(this);
121 for (String itemLabel
: showSpecimenButton
.getItems()) {
122 if (isShowSpecimenRelatedIssues
== null && itemLabel
.startsWith(Messages
.Preference_Use_Default
)) {
123 showSpecimenButton
.select(index
);
126 if (isShowSpecimenRelatedIssues
!= null && itemLabel
.equals(Messages
.GeneralPreference_yes
) && isShowSpecimenRelatedIssues
){
127 showSpecimenButton
.select(index
);
130 if (isShowSpecimenRelatedIssues
!= null && itemLabel
.equals(Messages
.GeneralPreference_no
) && !isShowSpecimenRelatedIssues
){
131 showSpecimenButton
.select(index
);
136 showSpecimenButton
.setEnabled(isEditingAllowed
);
138 if (isAdminPreference
){
139 allowOverrideIsShowSpecimenRelatedIssuesButton
= createAllowOverrideButton(titleComp
);
140 allowOverrideIsShowSpecimenRelatedIssuesButton
.setSelection(allowOverrideShowSpecimenRelatedIssues
);
141 // allowOverrideIsShowSpecimenRelatedIssuesButton.setEnabled(isShowSpecimenRelatedIssues != null);
142 allowOverrideIsShowSpecimenRelatedIssuesButton
.addSelectionListener(new SelectionAdapter(){
144 public void widgetSelected(SelectionEvent e
) {
146 allowOverrideShowSpecimenRelatedIssues
= allowOverrideIsShowSpecimenRelatedIssuesButton
.getSelection();
151 composite
= createComposite(parent
);
152 //composite.setEnabled(isShowSpecimenRelatedIssues);
153 gridData
= createTextGridData();
155 separator
= new Label(composite
, SWT
.HORIZONTAL
| SWT
.SEPARATOR
);
156 separator
.setLayoutData(gridData
);
158 showCollectingAreaInGeneralSectionButton
= createBooleanCombo(composite
, Messages
.GeneralPreference_yes
, Messages
.GeneralPreference_no
, PreferencePredicate
.ShowCollectingAreasInGeneralSection
, Messages
.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section
, isAdminPreference
);
160 showCollectingAreaInGeneralSectionButton
.addSelectionListener(this);
162 for (String itemLabel
: showCollectingAreaInGeneralSectionButton
.getItems()) {
163 if (isShowCollectingAreaInGeneralSection
== null && itemLabel
.startsWith(Messages
.Preference_Use_Default
)) {
164 showCollectingAreaInGeneralSectionButton
.select(index
);
167 if (isShowCollectingAreaInGeneralSection
!= null && itemLabel
.equals(Messages
.GeneralPreference_yes
) && isShowCollectingAreaInGeneralSection
){
168 showCollectingAreaInGeneralSectionButton
.select(index
);
171 if (isShowCollectingAreaInGeneralSection
!= null && itemLabel
.equals(Messages
.GeneralPreference_no
) && !isShowCollectingAreaInGeneralSection
){
172 showCollectingAreaInGeneralSectionButton
.select(index
);
177 if (isAdminPreference
){
178 allowOverrideShowCollectingAreaButton
= createAllowOverrideButton(composite
);
179 allowOverrideShowCollectingAreaButton
.setSelection(allowOverrideShowCollectingAreaInGeneralSection
);
180 // allowOverrideShowCollectingAreaButton.setEnabled(isShowCollectingAreaInGeneralSection != null);
181 allowOverrideShowCollectingAreaButton
.addSelectionListener(new SelectionAdapter(){
183 public void widgetSelected(SelectionEvent e
) {
185 allowOverrideShowCollectingAreaInGeneralSection
= allowOverrideShowCollectingAreaButton
.getSelection();
189 isEditingAllowed
= true;
190 if (showCollectingAreaInGeneralSection
!= null && !showCollectingAreaInGeneralSection
.isAllowOverride() ){
191 isEditingAllowed
= false;
193 showCollectingAreaInGeneralSectionButton
.setEnabled(isEditingAllowed
);
194 determinationOnlyForFieldUnitsButton
= createBooleanCombo(composite
, Messages
.GeneralPreference_yes
, Messages
.GeneralPreference_no
, PreferencePredicate
.DeterminationOnlyForFieldUnits
, Messages
.DatabasePreferncesPage_Determination_only_for_field_unnits
, isAdminPreference
);
197 determinationOnlyForFieldUnitsButton
.addSelectionListener(this);
199 for (String itemLabel
: determinationOnlyForFieldUnitsButton
.getItems()) {
200 if (isDeterminationOnlyForFieldUnits
== null && itemLabel
.startsWith(Messages
.Preference_Use_Default
)) {
201 determinationOnlyForFieldUnitsButton
.select(index
);
204 if (isDeterminationOnlyForFieldUnits
!= null && itemLabel
.equals(Messages
.GeneralPreference_yes
) && isDeterminationOnlyForFieldUnits
){
205 determinationOnlyForFieldUnitsButton
.select(index
);
208 if (isDeterminationOnlyForFieldUnits
!= null && itemLabel
.equals(Messages
.GeneralPreference_no
) && !isDeterminationOnlyForFieldUnits
){
209 determinationOnlyForFieldUnitsButton
.select(index
);
214 isEditingAllowed
= true;
215 if (showDeterminationOnlyForFieldUnits
!= null && !showDeterminationOnlyForFieldUnits
.isAllowOverride() ){
216 isEditingAllowed
= false;
219 determinationOnlyForFieldUnitsButton
.setEnabled(isEditingAllowed
);
220 if (isAdminPreference
){
221 allowOverridesDeterminationOnlyForFieldUnitsButton
= createAllowOverrideButton(composite
);
222 allowOverridesDeterminationOnlyForFieldUnitsButton
.setSelection(allowOverrideDeterminationOnlyForFieldUnits
);
223 // allowOverridesDeterminationOnlyForFieldUnitsButton.setEnabled(showDeterminationOnlyForFieldUnits != null);
224 allowOverridesDeterminationOnlyForFieldUnitsButton
.addSelectionListener(new SelectionAdapter(){
226 public void widgetSelected(SelectionEvent e
) {
228 allowOverrideDeterminationOnlyForFieldUnits
= allowOverridesDeterminationOnlyForFieldUnitsButton
.getSelection();
233 showTaxonAssociationButton
=createBooleanCombo(composite
, Messages
.GeneralPreference_yes
, Messages
.GeneralPreference_no
, PreferencePredicate
.ShowTaxonAssociations
, Messages
.DatabasePreferncesPage_Taxon_Associations
, isAdminPreference
);
236 showTaxonAssociationButton
.addSelectionListener(this);
238 for (String itemLabel
: showTaxonAssociationButton
.getItems()) {
239 if (isShowTaxonAssociation
== null && itemLabel
.startsWith(Messages
.Preference_Use_Default
)) {
240 showTaxonAssociationButton
.select(index
);
243 if (isShowTaxonAssociation
!= null && itemLabel
.equals(Messages
.GeneralPreference_yes
) && isShowTaxonAssociation
){
244 showTaxonAssociationButton
.select(index
);
247 if (isShowTaxonAssociation
!= null && itemLabel
.equals(Messages
.GeneralPreference_no
) && !isShowTaxonAssociation
){
248 showTaxonAssociationButton
.select(index
);
253 isEditingAllowed
= true;
254 if (showTaxonAssociation
!= null && !showTaxonAssociation
.isAllowOverride() ){
255 isEditingAllowed
= false;
257 showTaxonAssociationButton
.setEnabled(isEditingAllowed
);
258 if (isAdminPreference
){
259 allowOverrideIsShowTaxonAssociationButton
= createAllowOverrideButton(composite
);
260 allowOverrideIsShowTaxonAssociationButton
.setSelection(allowOverrideShowTaxonAssociation
);
261 // allowOverrideIsShowTaxonAssociationButton.setEnabled(showTaxonAssociation != null);
262 allowOverrideIsShowTaxonAssociationButton
.addSelectionListener(new SelectionAdapter(){
264 public void widgetSelected(SelectionEvent e
) {
266 allowOverrideShowTaxonAssociation
= allowOverrideIsShowTaxonAssociationButton
.getSelection();
271 showLifeFormButton
= createBooleanCombo(composite
, Messages
.GeneralPreference_yes
, Messages
.GeneralPreference_no
, PreferencePredicate
.ShowLifeForm
, Messages
.DatabasePreferncesPage_Life_Form
, isAdminPreference
);
272 showLifeFormButton
.addSelectionListener(this);
275 for (String itemLabel
: showLifeFormButton
.getItems()) {
276 if (isShowLifeForm
== null && itemLabel
.startsWith(Messages
.Preference_Use_Default
)) {
277 showLifeFormButton
.select(index
);
280 if (isShowLifeForm
!= null && itemLabel
.equals(Messages
.GeneralPreference_yes
) && isShowLifeForm
){
281 showLifeFormButton
.select(index
);
284 if (isShowLifeForm
!= null && itemLabel
.equals(Messages
.GeneralPreference_no
) && !isShowLifeForm
){
285 showLifeFormButton
.select(index
);
290 isEditingAllowed
= true;
291 if (showLifeForm
!= null && !showLifeForm
.isAllowOverride() ){
292 isEditingAllowed
= false;
294 showLifeFormButton
.setEnabled(isEditingAllowed
);
295 if (isAdminPreference
){
296 allowOverrideShowLifeFormButton
= createAllowOverrideButton(composite
);
297 allowOverrideShowLifeFormButton
.setSelection(allowOverrideShowLifeForm
);
298 // allowOverrideShowLifeFormButton.setEnabled(showLifeForm != null);
299 allowOverrideShowLifeFormButton
.addSelectionListener(new SelectionAdapter(){
301 public void widgetSelected(SelectionEvent e
) {
303 allowOverrideShowLifeForm
= allowOverrideShowLifeFormButton
.getSelection();
308 if (!isEditingAllowed
){
309 PreferencesUtil
.recursiveSetEnabled(composite
, false);
320 protected void getValues() {
321 CdmPreferenceCache cache
= CdmPreferenceCache
.instance();
324 overrideShowSpecimenRelatedIssues
= PreferencesUtil
.getBooleanValue(
325 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.ShowSpecimen
.getKey()), true) != null? PreferencesUtil
.getBooleanValue(
326 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.ShowSpecimen
.getKey()), true): false;
328 PrefKey key
= CdmPreference
.NewKey(PreferenceSubject
.NewTaxEditorInstance(), PreferencePredicate
.ShowSpecimen
);
329 showSpecimenPref
= PreferencesUtil
.getPreferenceFromDB(PreferencePredicate
.ShowSpecimen
);
332 if (showSpecimenPref
!= null) {
333 if (showSpecimenPref
.isAllowOverride() ) {
334 if (overrideShowSpecimenRelatedIssues
){
335 isShowSpecimenRelatedIssues
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowSpecimen
.getKey(), true);
338 isShowSpecimenRelatedIssues
= Boolean
.valueOf(showSpecimenPref
.getValue());
342 if(!overrideShowSpecimenRelatedIssues
){
343 isShowSpecimenRelatedIssues
= null;
345 isShowSpecimenRelatedIssues
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowSpecimen
.getKey(), true);
347 showSpecimenPref
= CdmPreference
.NewTaxEditorInstance(PreferencePredicate
.ShowSpecimen
, PreferencePredicate
.ShowSpecimen
.getDefaultValue() != null ? PreferencePredicate
.ShowSpecimen
.getDefaultValue().toString(): null);
353 key
= CdmPreference
.NewKey(PreferenceSubject
.NewTaxEditorInstance(), PreferencePredicate
.ShowCollectingAreasInGeneralSection
);
354 showCollectingAreaInGeneralSection
= PreferencesUtil
.getPreferenceFromDB(PreferencePredicate
.ShowCollectingAreasInGeneralSection
);
355 overrideShowCollectionAreaInGeneralSection
= PreferencesUtil
.getBooleanValue(
356 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.ShowCollectingAreasInGeneralSection
.getKey()), true) != null? PreferencesUtil
.getBooleanValue(
357 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.ShowCollectingAreasInGeneralSection
.getKey()), true): false;
358 allowOverrideShowCollectingAreaInGeneralSection
= showCollectingAreaInGeneralSection
!= null ? showCollectingAreaInGeneralSection
.isAllowOverride():true;
359 if (showCollectingAreaInGeneralSection
!= null) {
360 if (showCollectingAreaInGeneralSection
.isAllowOverride() ) {
361 if (overrideShowCollectionAreaInGeneralSection
){
362 isShowCollectingAreaInGeneralSection
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowCollectingAreasInGeneralSection
.getKey(), true);
366 isShowCollectingAreaInGeneralSection
= Boolean
.valueOf(showCollectingAreaInGeneralSection
.getValue());
371 if(!overrideShowCollectionAreaInGeneralSection
){
372 isShowCollectingAreaInGeneralSection
= null;
374 isShowCollectingAreaInGeneralSection
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowCollectingAreasInGeneralSection
.getKey(), true);
376 showCollectingAreaInGeneralSection
= CdmPreference
.NewTaxEditorInstance(PreferencePredicate
.ShowCollectingAreasInGeneralSection
, PreferencePredicate
.ShowCollectingAreasInGeneralSection
.getDefaultValue() != null ? PreferencePredicate
.ShowCollectingAreasInGeneralSection
.getDefaultValue().toString(): null);
380 key
= CdmPreference
.NewKey(PreferenceSubject
.NewTaxEditorInstance(), PreferencePredicate
.DeterminationOnlyForFieldUnits
);
381 showDeterminationOnlyForFieldUnits
= PreferencesUtil
.getPreferenceFromDB(PreferencePredicate
.DeterminationOnlyForFieldUnits
);
382 overrideDeterminationOnlyForFieldUnits
= PreferencesUtil
.getBooleanValue(
383 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.DeterminationOnlyForFieldUnits
.getKey()), true) != null? PreferencesUtil
.getBooleanValue(
384 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.DeterminationOnlyForFieldUnits
.getKey()), true): false;
385 if (showDeterminationOnlyForFieldUnits
!= null) {
386 if (showDeterminationOnlyForFieldUnits
.isAllowOverride() ) {
387 if (overrideDeterminationOnlyForFieldUnits
){
388 isDeterminationOnlyForFieldUnits
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.DeterminationOnlyForFieldUnits
.getKey());
392 isDeterminationOnlyForFieldUnits
= Boolean
.valueOf(showDeterminationOnlyForFieldUnits
.getValue());
397 if(!overrideDeterminationOnlyForFieldUnits
){
398 isDeterminationOnlyForFieldUnits
= null;
400 isDeterminationOnlyForFieldUnits
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.DeterminationOnlyForFieldUnits
.getKey(), true);
402 showDeterminationOnlyForFieldUnits
= CdmPreference
.NewTaxEditorInstance(PreferencePredicate
.DeterminationOnlyForFieldUnits
, PreferencePredicate
.DeterminationOnlyForFieldUnits
.getDefaultValue() != null ? PreferencePredicate
.DeterminationOnlyForFieldUnits
.getDefaultValue().toString(): null);
405 allowOverrideDeterminationOnlyForFieldUnits
= showDeterminationOnlyForFieldUnits
!= null ? showDeterminationOnlyForFieldUnits
.isAllowOverride():true;
408 key
= CdmPreference
.NewKey(PreferenceSubject
.NewTaxEditorInstance(), PreferencePredicate
.ShowTaxonAssociations
);
409 showTaxonAssociation
= PreferencesUtil
.getPreferenceFromDB(PreferencePredicate
.ShowTaxonAssociations
);
410 overrideShowTaxonAssociation
= PreferencesUtil
.getBooleanValue(
411 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.ShowTaxonAssociations
.getKey()), true) != null? PreferencesUtil
.getBooleanValue(
412 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.ShowTaxonAssociations
.getKey()), true): false;
413 if (showTaxonAssociation
!= null) {
414 if (showTaxonAssociation
.isAllowOverride() ) {
415 if (overrideShowTaxonAssociation
){
416 isShowTaxonAssociation
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowTaxonAssociations
.getKey());
420 isShowTaxonAssociation
= Boolean
.valueOf(showTaxonAssociation
.getValue());
425 if(!overrideShowTaxonAssociation
){
426 isShowTaxonAssociation
= null;
428 isShowTaxonAssociation
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowTaxonAssociations
.getKey(), true);
430 showTaxonAssociation
= CdmPreference
.NewTaxEditorInstance(PreferencePredicate
.ShowTaxonAssociations
, PreferencePredicate
.ShowTaxonAssociations
.getDefaultValue() != null ? PreferencePredicate
.ShowTaxonAssociations
.getDefaultValue().toString(): null);
433 allowOverrideShowTaxonAssociation
= showTaxonAssociation
!= null ? showTaxonAssociation
.isAllowOverride():true;
436 key
= CdmPreference
.NewKey(PreferenceSubject
.NewTaxEditorInstance(), PreferencePredicate
.ShowLifeForm
);
437 showLifeForm
= PreferencesUtil
.getPreferenceFromDB(PreferencePredicate
.ShowLifeForm
);
438 overrideShowLifeForm
= PreferencesUtil
.getBooleanValue(
439 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.ShowLifeForm
.getKey()), true) != null? PreferencesUtil
.getBooleanValue(
440 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.ShowLifeForm
.getKey()), true): false;
441 if (showLifeForm
!= null) {
442 if (showLifeForm
.isAllowOverride() ) {
443 if (overrideShowLifeForm
){
444 isShowLifeForm
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowLifeForm
.getKey());
448 isShowLifeForm
= Boolean
.valueOf(showLifeForm
.getValue());
453 if(!overrideShowLifeForm
){
454 isShowLifeForm
= null;
456 isShowLifeForm
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowLifeForm
.getKey(), true);
458 showLifeForm
= CdmPreference
.NewTaxEditorInstance(PreferencePredicate
.ShowLifeForm
, PreferencePredicate
.ShowLifeForm
.getDefaultValue() != null ? PreferencePredicate
.ShowLifeForm
.getDefaultValue().toString(): null);
461 allowOverrideShowLifeForm
= showLifeForm
!= null ? showLifeForm
.isAllowOverride():true;
467 public boolean performOk() {
469 boolean override
= false;
470 if (isShowSpecimenRelatedIssues
!= null ) {
472 PreferencesUtil
.setStringValue(PreferencePredicate
.ShowSpecimen
.getKey(), isShowSpecimenRelatedIssues
.toString());
474 PreferencesUtil
.setBooleanValue(
475 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.ShowSpecimen
.getKey()),
479 if (isShowCollectingAreaInGeneralSection
!= null ) {
481 PreferencesUtil
.setStringValue(PreferencePredicate
.ShowCollectingAreasInGeneralSection
.getKey(), isShowCollectingAreaInGeneralSection
.toString());
483 PreferencesUtil
.setBooleanValue(
484 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.ShowCollectingAreasInGeneralSection
.getKey()),
488 if (isDeterminationOnlyForFieldUnits
!= null ) {
490 PreferencesUtil
.setStringValue(PreferencePredicate
.DeterminationOnlyForFieldUnits
.getKey(), isDeterminationOnlyForFieldUnits
.toString());
492 PreferencesUtil
.setBooleanValue(
493 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.DeterminationOnlyForFieldUnits
.getKey()),
497 if (isShowTaxonAssociation
!= null ) {
499 PreferencesUtil
.setStringValue(PreferencePredicate
.ShowTaxonAssociations
.getKey(), isShowTaxonAssociation
.toString());
501 PreferencesUtil
.setBooleanValue(
502 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.ShowTaxonAssociations
.getKey()),
506 if (isShowLifeForm
!= null ) {
508 PreferencesUtil
.setStringValue(PreferencePredicate
.ShowLifeForm
.getKey(), isShowLifeForm
.toString());
510 PreferencesUtil
.setBooleanValue(
511 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.ShowLifeForm
.getKey()),
520 protected void performDefaults() {
521 isShowSpecimenRelatedIssues
= null;
522 showSpecimenButton
.select(0);
524 if (allowOverrideIsShowSpecimenRelatedIssuesButton
!= null){
525 allowOverrideShowSpecimenRelatedIssues
= true;
526 allowOverrideIsShowSpecimenRelatedIssuesButton
.setSelection(allowOverrideShowSpecimenRelatedIssues
);
528 isShowCollectingAreaInGeneralSection
= null;
529 showCollectingAreaInGeneralSectionButton
.select(0);
531 if (allowOverrideShowCollectingAreaButton
!= null){
532 allowOverrideShowCollectingAreaInGeneralSection
= true;
533 allowOverrideShowCollectingAreaButton
.setSelection(allowOverrideShowSpecimenRelatedIssues
);
535 isDeterminationOnlyForFieldUnits
= null;
536 determinationOnlyForFieldUnitsButton
.select(0);
538 if (allowOverridesDeterminationOnlyForFieldUnitsButton
!= null){
539 allowOverrideDeterminationOnlyForFieldUnits
= true;
540 allowOverridesDeterminationOnlyForFieldUnitsButton
.setSelection(allowOverrideShowSpecimenRelatedIssues
);
543 isShowTaxonAssociation
= null;
544 showTaxonAssociationButton
.select(0);
546 if (allowOverrideIsShowTaxonAssociationButton
!= null){
547 allowOverrideShowTaxonAssociation
= true;
548 allowOverrideIsShowTaxonAssociationButton
.setSelection(allowOverrideShowSpecimenRelatedIssues
);
552 isShowLifeForm
= null;
554 showLifeFormButton
.select(0);
556 if (allowOverrideShowLifeFormButton
!= null){
557 allowOverrideShowLifeForm
= true;
558 allowOverrideShowLifeFormButton
.setSelection(allowOverrideShowSpecimenRelatedIssues
);
562 super.performDefaults();
569 public void widgetSelected(SelectionEvent e
) {
571 if (e
.getSource().equals(this.showSpecimenButton
)) {
572 String text
= showSpecimenButton
.getText();
573 if(text
.startsWith(Messages
.Preference_Use_Default
)){
574 isShowSpecimenRelatedIssues
= null;
578 if (text
.equals(Messages
.GeneralPreference_yes
)){
579 isShowSpecimenRelatedIssues
= true;
581 isShowSpecimenRelatedIssues
= false;
585 if (e
.getSource().equals(this.showCollectingAreaInGeneralSectionButton
)) {
586 String text
= showCollectingAreaInGeneralSectionButton
.getText();
587 if(text
.startsWith(Messages
.Preference_Use_Default
)){
588 isShowCollectingAreaInGeneralSection
= null;
592 if (text
.equals(Messages
.GeneralPreference_yes
)){
593 isShowCollectingAreaInGeneralSection
= true;
595 isShowCollectingAreaInGeneralSection
= false;
599 if (e
.getSource().equals(this.determinationOnlyForFieldUnitsButton
)) {
600 String text
= determinationOnlyForFieldUnitsButton
.getText();
601 if(text
.startsWith(Messages
.Preference_Use_Default
)){
602 isDeterminationOnlyForFieldUnits
= null;
605 if (text
.equals(Messages
.GeneralPreference_yes
)){
606 isDeterminationOnlyForFieldUnits
= true;
608 isDeterminationOnlyForFieldUnits
= false;
612 if (e
.getSource().equals(this.showTaxonAssociationButton
)) {
613 String text
= showTaxonAssociationButton
.getText();
614 if(text
.startsWith(Messages
.Preference_Use_Default
)){
615 isShowTaxonAssociation
= null;
619 if (text
.equals(Messages
.GeneralPreference_yes
)){
620 isShowTaxonAssociation
= true;
622 isShowTaxonAssociation
= false;
626 if (e
.getSource().equals(this.showLifeFormButton
)) {
627 String text
= showLifeFormButton
.getText();
628 if(text
.startsWith(Messages
.Preference_Use_Default
)){
629 isShowLifeForm
= null;
633 if (text
.equals(Messages
.GeneralPreference_yes
)){
634 isShowLifeForm
= true;
636 isShowLifeForm
= false;
646 public void widgetDefaultSelected(SelectionEvent e
) {
647 // TODO Auto-generated method stub