Project

General

Profile

Revision 94c6459b

ID94c6459bf51b934d2b0101f32382c09960f642ae
Parent 0ae3531b
Child c1662123

Added by Katja Luther over 1 year ago

fix search dialog default handling

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/SearchDialogAdminPreferences.java
70 70
            IPreferenceService service = controller.getPreferenceService();
71 71
            CdmPreference pref;
72 72
            if (showIdInSelectionDialog != null || !showIdInSelectionDialogPref.isAllowOverride()) {
73
                pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowIdInSelectionDialog, showIdInSelectionDialog != null? showIdInSelectionDialog.toString():null);
73
                pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowIdInSelectionDialog, showIdInSelectionDialog != null? showIdInSelectionDialog.toString():PreferencePredicate.ShowIdInSelectionDialog.getDefaultValue().toString());
74 74
                pref.setAllowOverride(showIdInSelectionDialogPref.isAllowOverride());
75 75
                service.set(pref);
76 76
            }else{
......
79 79

  
80 80

  
81 81
            if(searchForIdentifierAsDefault != null || !searchForIdentifierAsDefaultPref.isAllowOverride()){
82
                pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAsDefault, searchForIdentifierAsDefault!= null? searchForIdentifierAsDefault.toString():null);
82
                pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAsDefault, searchForIdentifierAsDefault!= null? searchForIdentifierAsDefault.toString():PreferencePredicate.SearchForIdentifierAsDefault.getDefaultValue().toString());
83 83
                pref.setAllowOverride(searchForIdentifierAsDefaultPref.isAllowOverride());
84 84
                service.set(pref);
85 85
            }else{
......
87 87
            }
88 88

  
89 89

  
90
            if(searchForIdentifierAndTitleCache != null){
91
                pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAndTitleCache, searchForIdentifierAndTitleCache!= null? searchForIdentifierAndTitleCache.toString():null);
90
            if(searchForIdentifierAndTitleCache != null || !searchForIdentifierAndTitleCachePref.isAllowOverride()){
91
                pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAndTitleCache, searchForIdentifierAndTitleCache!= null? searchForIdentifierAndTitleCache.toString():PreferencePredicate.SearchForIdentifierAndTitleCache.getDefaultValue().toString());
92 92
                pref.setAllowOverride(searchForIdentifierAndTitleCachePref.isAllowOverride());
93 93
                service.set(pref);
94 94
            }else{
95 95
                service.remove(searchForIdentifierAndTitleCachePref.getKey());
96 96
            }
97 97

  
98
            if(sortTaxaByRankAndName != null){
98
            if(sortTaxaByRankAndName != null || !sortTaxaByRankAndNamePref.isAllowOverride()){
99 99

  
100
                pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SortTaxaByRankAndName, sortTaxaByRankAndName!= null? sortTaxaByRankAndName.toString():null);
100
                pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SortTaxaByRankAndName, sortTaxaByRankAndName!= null? sortTaxaByRankAndName.toString():PreferencePredicate.SortTaxaByRankAndName.getDefaultValue().toString());
101 101
                pref.setAllowOverride(sortTaxaByRankAndNamePref.isAllowOverride());
102 102
                service.set(pref);
103 103
            }else{
......
106 106

  
107 107

  
108 108

  
109
            if(filterCommonNameReferences != null){
110
                pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameReferencesWithMarker, filterCommonNameReferences!= null? filterCommonNameReferences.toString():null);
109
            if(filterCommonNameReferences != null || !filterCommonNameReferencesPref.isAllowOverride()){
110
                pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameReferencesWithMarker, filterCommonNameReferences!= null? filterCommonNameReferences.toString():PreferencePredicate.CommonNameReferencesWithMarker.getDefaultValue().toString());
111 111
                pref.setAllowOverride(filterCommonNameReferencesPref.isAllowOverride());
112 112
                service.set(pref);
113 113
            }else{
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/SearchDialogPreferences.java
267 267
                @Override
268 268
                public void widgetSelected(SelectionEvent e) {
269 269
                    setApply(true);
270
                    if (searchForIdentifierAsDefaultPref == null){
270
                    if (searchForIdentifierAsDefaultPref == null && !allowOverrideSearchForIdentifierAsDefaultButton.getSelection()){
271 271
                        searchForIdentifierAsDefaultPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAsDefault, null);
272 272
                    }
273 273
                    searchForIdentifierAsDefaultPref.setAllowOverride(allowOverrideSearchForIdentifierAsDefaultButton.getSelection());
......
307 307
                @Override
308 308
                public void widgetSelected(SelectionEvent e) {
309 309
                    setApply(true);
310
                    if (searchForIdentifierAndTitleCachePref == null){
310
                    if (searchForIdentifierAndTitleCachePref == null && !allowOverridesSearchForIdentifierAndTitleCacheButton.getSelection()){
311 311
                        searchForIdentifierAndTitleCachePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAndTitleCache, null);
312 312
                    }
313 313
                    searchForIdentifierAndTitleCachePref.setAllowOverride(allowOverridesSearchForIdentifierAndTitleCacheButton.getSelection());
......
346 346
                @Override
347 347
                public void widgetSelected(SelectionEvent e) {
348 348
                    setApply(true);
349
                    if (sortTaxaByRankAndNamePref == null){
349
                    if (sortTaxaByRankAndNamePref == null && !allowOverrideIsSortTaxaByRankAndNameButton.getSelection()){
350 350
                        sortTaxaByRankAndNamePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SortTaxaByRankAndName, null);
351 351
                    }
352 352
                    sortTaxaByRankAndNamePref.setAllowOverride(allowOverrideIsSortTaxaByRankAndNameButton.getSelection());
......
384 384
                @Override
385 385
                public void widgetSelected(SelectionEvent e) {
386 386
                    setApply(true);
387
                    if (filterCommonNameReferencesPref == null){
387
                    if (filterCommonNameReferencesPref == null && !allowOverrideFilterCommonNameReferencesButton.getSelection()){
388 388
                        filterCommonNameReferencesPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameReferencesWithMarker, null);
389 389
                    }
390 390
                    filterCommonNameReferencesPref.setAllowOverride(allowOverrideFilterCommonNameReferencesButton.getSelection());
......
399 399

  
400 400
    @Override
401 401
    protected void performDefaults() {
402
        //TODO
403
        super.performDefaults();
402
        showIdInSelectionDialogButton.select(0);
403
        showIdInSelectionDialog = null;
404
        if (isAdminPreference){
405
            allowOverrideIsShowIdInSelectionDialogButton.setSelection(true);
406
            showIdInSelectionDialogPref.setAllowOverride(true);
407
        }
408
        searchForIdentifierAsDefaultButton.select(0);
409
        searchForIdentifierAsDefault = null;
410
        if (isAdminPreference){
411
            allowOverrideSearchForIdentifierAsDefaultButton.setSelection(true);
412
            searchForIdentifierAsDefaultPref.setAllowOverride(true);
413
        }
414
        searchForIdentifierAndTitleCacheButton.select(0);
415
        searchForIdentifierAndTitleCache = null;
416
        if (isAdminPreference){
417
            allowOverridesSearchForIdentifierAndTitleCacheButton.setSelection(true);
418
            searchForIdentifierAndTitleCachePref.setAllowOverride(true);
419
        }
420
        sortTaxaByRankAndNameButton.select(0);
421
        sortTaxaByRankAndName = null;
422
        if (isAdminPreference){
423
            allowOverrideIsSortTaxaByRankAndNameButton.setSelection(true);
424
            sortTaxaByRankAndNamePref.setAllowOverride(true);
425
        }
426
        filterCommonNameReferenceButton.select(0);
427
        filterCommonNameReferences = null;
428
        if (isAdminPreference){
429
            allowOverrideFilterCommonNameReferencesButton.setSelection(true);
430
            filterCommonNameReferencesPref.setAllowOverride(true);
431
        }
432
        setApply(true);
404 433
    }
405 434

  
406 435
    @Override

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)