Revision e649e0cb
Added by Katja Luther over 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/SearchDialogPreferences.java | ||
---|---|---|
44 | 44 |
protected Boolean sortTaxaByRankAndName; |
45 | 45 |
protected Boolean filterCommonNameReferences; |
46 | 46 |
|
47 |
private boolean overrideShowIdInSelectionDialog; |
|
48 |
private boolean overrideSearchForIdentifierAsDefault; |
|
49 |
private boolean overrideSearchForIdentifierAndTitleCache; |
|
50 |
private boolean overrideSortTaxaByRankAndName; |
|
51 |
private boolean overrideFilterCommonNameReferences; |
|
47 |
private boolean overrideShowIdInSelectionDialog = true;
|
|
48 |
private boolean overrideSearchForIdentifierAsDefault = true;
|
|
49 |
private boolean overrideSearchForIdentifierAndTitleCache = true;
|
|
50 |
private boolean overrideSortTaxaByRankAndName = true;
|
|
51 |
private boolean overrideFilterCommonNameReferences = true;
|
|
52 | 52 |
|
53 | 53 |
protected Combo showIdInSelectionDialogButton; |
54 | 54 |
protected Button allowOverrideIsShowIdInSelectionDialogButton; |
... | ... | |
77 | 77 |
overrideSearchForIdentifierAndTitleCache = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey())); |
78 | 78 |
overrideSortTaxaByRankAndName = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.SortTaxaByRankAndName.getKey())); |
79 | 79 |
overrideFilterCommonNameReferences = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.CommonNameReferencesWithMarker.getKey())); |
80 |
|
|
81 |
showIdInSelectionDialog = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSelectionDialog.getKey()); |
|
82 |
searchForIdentifierAsDefault = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAsDefault.getKey()); |
|
83 |
searchForIdentifierAndTitleCache = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey()); |
|
84 |
sortTaxaByRankAndName = PreferencesUtil.getBooleanValue(PreferencePredicate.SortTaxaByRankAndName.getKey()); |
|
85 |
filterCommonNameReferences = PreferencesUtil.getBooleanValue(PreferencePredicate.CommonNameReferencesWithMarker.getKey()); |
|
80 |
if(overrideShowIdInSelectionDialog){ |
|
81 |
showIdInSelectionDialog = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSelectionDialog.getKey(), true); |
|
82 |
} |
|
83 |
if(overrideSearchForIdentifierAsDefault){ |
|
84 |
searchForIdentifierAsDefault = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAsDefault.getKey(), true); |
|
85 |
} |
|
86 |
if(overrideSearchForIdentifierAndTitleCache){ |
|
87 |
searchForIdentifierAndTitleCache = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey(), true); |
|
88 |
} |
|
89 |
if(overrideSortTaxaByRankAndName){ |
|
90 |
sortTaxaByRankAndName = PreferencesUtil.getBooleanValue(PreferencePredicate.SortTaxaByRankAndName.getKey(), true); |
|
91 |
} |
|
92 |
if(overrideFilterCommonNameReferences){ |
|
93 |
filterCommonNameReferences = PreferencesUtil.getBooleanValue(PreferencePredicate.CommonNameReferencesWithMarker.getKey(), true); |
|
94 |
} |
|
86 | 95 |
|
87 | 96 |
|
88 | 97 |
} |
... | ... | |
199 | 208 |
showIdInSelectionDialogButton = createBooleanCombo(titleComp, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.ShowIdInSelectionDialog, Messages.DatabasePreferncesPage_Show_Id_In_SelectionDialog, isAdminPreference); |
200 | 209 |
|
201 | 210 |
showIdInSelectionDialogButton.addSelectionListener(this); |
202 |
int index = 0; |
|
203 |
for (String itemLabel : showIdInSelectionDialogButton.getItems()) { |
|
204 |
if (itemLabel.startsWith(Messages.Preference_Use_Default) && showIdInSelectionDialog == null) { |
|
205 |
showIdInSelectionDialogButton.select(index); |
|
206 |
break; |
|
207 |
} |
|
208 |
if (itemLabel.equals(Messages.GeneralPreference_yes) && showIdInSelectionDialog){ |
|
209 |
showIdInSelectionDialogButton.select(index); |
|
210 |
break; |
|
211 |
} |
|
212 |
if (itemLabel.equals(Messages.GeneralPreference_no) && !showIdInSelectionDialog){ |
|
213 |
showIdInSelectionDialogButton.select(index); |
|
214 |
break; |
|
215 |
} |
|
216 |
index++; |
|
217 |
} |
|
211 |
|
|
218 | 212 |
if (!isAdminPreference && showIdInSelectionDialogPref != null){ |
219 | 213 |
showIdInSelectionDialogButton.setEnabled(showIdInSelectionDialogPref.isAllowOverride()); |
220 | 214 |
} |
... | ... | |
244 | 238 |
searchForIdentifierAsDefaultButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.SearchForIdentifierAsDefault, Messages.DatabasePreferncesPage_Search_for_identifier_as_default, isAdminPreference); |
245 | 239 |
|
246 | 240 |
searchForIdentifierAsDefaultButton.addSelectionListener(this); |
247 |
index = 0; |
|
248 |
for (String itemLabel : searchForIdentifierAsDefaultButton.getItems()) { |
|
249 |
if (searchForIdentifierAsDefault == null && itemLabel.startsWith(Messages.Preference_Use_Default)) { |
|
250 |
searchForIdentifierAsDefaultButton.select(index); |
|
251 |
break; |
|
252 |
} |
|
253 |
if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAsDefault){ |
|
254 |
searchForIdentifierAsDefaultButton.select(index); |
|
255 |
break; |
|
256 |
} |
|
257 |
if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAsDefault){ |
|
258 |
searchForIdentifierAsDefaultButton.select(index); |
|
259 |
break; |
|
260 |
} |
|
261 |
index++; |
|
262 |
} |
|
241 |
|
|
263 | 242 |
if (isAdminPreference){ |
264 | 243 |
allowOverrideSearchForIdentifierAsDefaultButton = createAllowOverrideButton(composite); |
265 | 244 |
allowOverrideSearchForIdentifierAsDefaultButton.setSelection(searchForIdentifierAsDefaultPref != null?searchForIdentifierAsDefaultPref.isAllowOverride(): true); |
... | ... | |
280 | 259 |
|
281 | 260 |
searchForIdentifierAndTitleCacheButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.SearchForIdentifierAndTitleCache, Messages.DatabasePreferncesPage_search_for_identifier_and_titleCache, isAdminPreference); |
282 | 261 |
searchForIdentifierAndTitleCacheButton.addSelectionListener(this); |
283 |
index = 0; |
|
284 |
for (String itemLabel : searchForIdentifierAndTitleCacheButton.getItems()) { |
|
285 |
if (searchForIdentifierAndTitleCache == null && itemLabel.startsWith(Messages.Preference_Use_Default)) { |
|
286 |
searchForIdentifierAndTitleCacheButton.select(index); |
|
287 |
break; |
|
288 |
} |
|
289 |
if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAndTitleCache){ |
|
290 |
searchForIdentifierAndTitleCacheButton.select(index); |
|
291 |
break; |
|
292 |
} |
|
293 |
if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAndTitleCache){ |
|
294 |
searchForIdentifierAndTitleCacheButton.select(index); |
|
295 |
break; |
|
296 |
} |
|
297 |
index++; |
|
298 |
} |
|
262 |
|
|
299 | 263 |
if(!isAdminPreference && searchForIdentifierAndTitleCachePref != null){ |
300 | 264 |
searchForIdentifierAndTitleCacheButton.setEnabled(searchForIdentifierAndTitleCachePref.isAllowOverride()); |
301 | 265 |
} |
... | ... | |
319 | 283 |
|
320 | 284 |
|
321 | 285 |
sortTaxaByRankAndNameButton.addSelectionListener(this); |
322 |
index = 0; |
|
323 |
for (String itemLabel : sortTaxaByRankAndNameButton.getItems()) { |
|
324 |
if (sortTaxaByRankAndName == null && itemLabel.startsWith(Messages.Preference_Use_Default)) { |
|
325 |
sortTaxaByRankAndNameButton.select(index); |
|
326 |
break; |
|
327 |
} |
|
328 |
if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_yes) && sortTaxaByRankAndName){ |
|
329 |
sortTaxaByRankAndNameButton.select(index); |
|
330 |
break; |
|
331 |
} |
|
332 |
if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_no) && !sortTaxaByRankAndName){ |
|
333 |
sortTaxaByRankAndNameButton.select(index); |
|
334 |
break; |
|
335 |
} |
|
336 |
index++; |
|
337 |
} |
|
286 |
|
|
338 | 287 |
if ( !isAdminPreference && sortTaxaByRankAndNamePref != null){ |
339 | 288 |
sortTaxaByRankAndNameButton.setEnabled(sortTaxaByRankAndNamePref.isAllowOverride()); |
340 | 289 |
} |
... | ... | |
357 | 306 |
filterCommonNameReferenceButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.CommonNameReferencesWithMarker, Messages.DatabasePreferncesPage_CommonNameFilter, isAdminPreference); |
358 | 307 |
filterCommonNameReferenceButton.addSelectionListener(this); |
359 | 308 |
|
360 |
index = 0; |
|
361 |
for (String itemLabel: filterCommonNameReferenceButton.getItems()) { |
|
362 |
if (filterCommonNameReferences == null && itemLabel.startsWith(Messages.Preference_Use_Default)) { |
|
363 |
filterCommonNameReferenceButton.select(index); |
|
364 |
break; |
|
365 |
} |
|
366 |
if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_yes) && filterCommonNameReferences){ |
|
367 |
filterCommonNameReferenceButton.select(index); |
|
368 |
break; |
|
369 |
} |
|
370 |
if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_no) && !filterCommonNameReferences){ |
|
371 |
filterCommonNameReferenceButton.select(index); |
|
372 |
break; |
|
373 |
} |
|
374 |
index++; |
|
375 |
} |
|
309 |
|
|
376 | 310 |
if (!isAdminPreference && filterCommonNameReferencesPref != null){ |
377 | 311 |
filterCommonNameReferenceButton.setEnabled(filterCommonNameReferencesPref.isAllowOverride()); |
378 | 312 |
} |
... | ... | |
392 | 326 |
}); |
393 | 327 |
} |
394 | 328 |
|
395 |
|
|
329 |
setSelections(); |
|
396 | 330 |
|
397 | 331 |
return composite; |
398 | 332 |
} |
... | ... | |
488 | 422 |
return true; |
489 | 423 |
} |
490 | 424 |
|
425 |
protected void setSelections(){ |
|
426 |
|
|
427 |
int index = 0; |
|
428 |
for (String itemLabel : showIdInSelectionDialogButton.getItems()) { |
|
429 |
if (itemLabel.startsWith(Messages.Preference_Use_Default) && (showIdInSelectionDialog == null || (!overrideShowIdInSelectionDialog && !isAdminPreference))) { |
|
430 |
showIdInSelectionDialogButton.select(index); |
|
431 |
break; |
|
432 |
} |
|
433 |
if (itemLabel.equals(Messages.GeneralPreference_yes) && showIdInSelectionDialog){ |
|
434 |
showIdInSelectionDialogButton.select(index); |
|
435 |
break; |
|
436 |
} |
|
437 |
if (itemLabel.equals(Messages.GeneralPreference_no) && !showIdInSelectionDialog){ |
|
438 |
showIdInSelectionDialogButton.select(index); |
|
439 |
break; |
|
440 |
} |
|
441 |
index++; |
|
442 |
} |
|
443 |
|
|
444 |
index = 0; |
|
445 |
for (String itemLabel : searchForIdentifierAsDefaultButton.getItems()) { |
|
446 |
if ((searchForIdentifierAsDefault == null || (!overrideSearchForIdentifierAsDefault && !isAdminPreference)) && itemLabel.startsWith(Messages.Preference_Use_Default)) { |
|
447 |
searchForIdentifierAsDefaultButton.select(index); |
|
448 |
break; |
|
449 |
} |
|
450 |
if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAsDefault){ |
|
451 |
searchForIdentifierAsDefaultButton.select(index); |
|
452 |
break; |
|
453 |
} |
|
454 |
if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAsDefault){ |
|
455 |
searchForIdentifierAsDefaultButton.select(index); |
|
456 |
break; |
|
457 |
} |
|
458 |
index++; |
|
459 |
} |
|
460 |
|
|
461 |
index = 0; |
|
462 |
for (String itemLabel : searchForIdentifierAndTitleCacheButton.getItems()) { |
|
463 |
if ((searchForIdentifierAndTitleCache == null || (!overrideSearchForIdentifierAndTitleCache && !isAdminPreference))&& itemLabel.startsWith(Messages.Preference_Use_Default)) { |
|
464 |
searchForIdentifierAndTitleCacheButton.select(index); |
|
465 |
break; |
|
466 |
} |
|
467 |
if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAndTitleCache){ |
|
468 |
searchForIdentifierAndTitleCacheButton.select(index); |
|
469 |
break; |
|
470 |
} |
|
471 |
if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAndTitleCache){ |
|
472 |
searchForIdentifierAndTitleCacheButton.select(index); |
|
473 |
break; |
|
474 |
} |
|
475 |
index++; |
|
476 |
} |
|
477 |
|
|
478 |
index = 0; |
|
479 |
for (String itemLabel : sortTaxaByRankAndNameButton.getItems()) { |
|
480 |
if ((sortTaxaByRankAndName == null || (!overrideSortTaxaByRankAndName && !isAdminPreference))&& itemLabel.startsWith(Messages.Preference_Use_Default)) { |
|
481 |
sortTaxaByRankAndNameButton.select(index); |
|
482 |
break; |
|
483 |
} |
|
484 |
if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_yes) && sortTaxaByRankAndName){ |
|
485 |
sortTaxaByRankAndNameButton.select(index); |
|
486 |
break; |
|
487 |
} |
|
488 |
if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_no) && !sortTaxaByRankAndName){ |
|
489 |
sortTaxaByRankAndNameButton.select(index); |
|
490 |
break; |
|
491 |
} |
|
492 |
index++; |
|
493 |
} |
|
494 |
|
|
495 |
index = 0; |
|
496 |
for (String itemLabel: filterCommonNameReferenceButton.getItems()) { |
|
497 |
if ((filterCommonNameReferences == null || (!overrideFilterCommonNameReferences && !isAdminPreference)) && itemLabel.startsWith(Messages.Preference_Use_Default)) { |
|
498 |
filterCommonNameReferenceButton.select(index); |
|
499 |
break; |
|
500 |
} |
|
501 |
if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_yes) && filterCommonNameReferences){ |
|
502 |
filterCommonNameReferenceButton.select(index); |
|
503 |
break; |
|
504 |
} |
|
505 |
if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_no) && !filterCommonNameReferences){ |
|
506 |
filterCommonNameReferenceButton.select(index); |
|
507 |
break; |
|
508 |
} |
|
509 |
index++; |
|
510 |
} |
|
511 |
} |
|
512 |
|
|
491 | 513 |
|
492 | 514 |
} |
Also available in: Unified diff
ref #8385: label issues, search dialog prefs...