2 * Copyright (C) 2018 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
.NamedAreaSearchField
;
24 import eu
.etaxonomy
.cdm
.model
.metadata
.PreferencePredicate
;
25 import eu
.etaxonomy
.taxeditor
.l10n
.Messages
;
26 import eu
.etaxonomy
.taxeditor
.preference
.menu
.CdmPreferencePage
;
33 public class SearchDialogPreferences
extends CdmPreferencePage
implements SelectionListener
{
35 protected CdmPreference showIdInSelectionDialogPref
;
36 protected CdmPreference searchForIdentifierAsDefaultPref
;
37 protected CdmPreference searchForIdentifierAndTitleCachePref
;
38 protected CdmPreference sortTaxaByRankAndNamePref
;
39 protected CdmPreference filterCommonNameReferencesPref
;
40 protected CdmPreference searchNamedAreasByAbbrevPref
;
43 protected Boolean showIdInSelectionDialog
;
44 protected Boolean searchForIdentifierAsDefault
;
45 protected Boolean searchForIdentifierAndTitleCache
;
46 protected Boolean sortTaxaByRankAndName
;
47 protected Boolean filterCommonNameReferences
;
48 protected NamedAreaSearchField searchNamedAreasByAbbrev
;
50 private boolean overrideShowIdInSelectionDialog
= true;
51 private boolean overrideSearchForIdentifierAsDefault
= true;
52 private boolean overrideSearchForIdentifierAndTitleCache
= true;
53 private boolean overrideSortTaxaByRankAndName
= true;
54 private boolean overrideFilterCommonNameReferences
= true;
55 private boolean overrideSearchNamedAreasByAbbrev
= true;
57 protected Combo showIdInSelectionDialogButton
;
58 protected Button allowOverrideIsShowIdInSelectionDialogButton
;
59 protected Combo searchForIdentifierAsDefaultButton
;
60 protected Button allowOverrideSearchForIdentifierAsDefaultButton
;
61 protected Combo searchForIdentifierAndTitleCacheButton
;
62 protected Button allowOverridesSearchForIdentifierAndTitleCacheButton
;
63 protected Combo sortTaxaByRankAndNameButton
;
64 protected Button allowOverrideIsSortTaxaByRankAndNameButton
;
65 protected Combo filterCommonNameReferenceButton
;
66 protected Button allowOverrideFilterCommonNameReferencesButton
;
67 protected Combo searchNamedAreasByAbbrevButton
;
68 protected Button allowOverridesearchNamedAreasByAbbrevButton
;
73 public void getValues(){
75 showIdInSelectionDialogPref
= PreferencesUtil
.getPreferenceFromDB(PreferencePredicate
.ShowIdInSelectionDialog
);
76 searchForIdentifierAsDefaultPref
= PreferencesUtil
.getPreferenceFromDB(PreferencePredicate
.SearchForIdentifierAsDefault
);
77 searchForIdentifierAndTitleCachePref
= PreferencesUtil
.getPreferenceFromDB(PreferencePredicate
.SearchForIdentifierAndTitleCache
);
78 sortTaxaByRankAndNamePref
= PreferencesUtil
.getPreferenceFromDB(PreferencePredicate
.SortTaxaByRankAndName
);
79 filterCommonNameReferencesPref
= PreferencesUtil
.getPreferenceFromDB(PreferencePredicate
.CommonNameReferencesWithMarker
);
80 searchNamedAreasByAbbrevPref
= PreferencesUtil
.getPreferenceFromDB(PreferencePredicate
.NamedAreaSearchForAbbrev
);
82 overrideShowIdInSelectionDialog
= PreferencesUtil
.getOverrideForPreference(PreferencePredicate
.ShowIdInSelectionDialog
.getKey());
83 overrideSearchForIdentifierAsDefault
= PreferencesUtil
.getOverrideForPreference(PreferencePredicate
.SearchForIdentifierAsDefault
.getKey());
84 overrideSearchForIdentifierAndTitleCache
= PreferencesUtil
.getOverrideForPreference(PreferencePredicate
.SearchForIdentifierAndTitleCache
.getKey());
85 overrideSortTaxaByRankAndName
= PreferencesUtil
.getOverrideForPreference(PreferencePredicate
.SortTaxaByRankAndName
.getKey());
86 overrideFilterCommonNameReferences
= PreferencesUtil
.getOverrideForPreference(PreferencePredicate
.CommonNameReferencesWithMarker
.getKey());
87 overrideSearchNamedAreasByAbbrev
= PreferencesUtil
.getOverrideForPreference(PreferencePredicate
.NamedAreaSearchForAbbrev
.getKey());
89 if(overrideShowIdInSelectionDialog
){
90 showIdInSelectionDialog
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowIdInSelectionDialog
.getKey(), true);
92 if(overrideSearchForIdentifierAsDefault
){
93 searchForIdentifierAsDefault
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.SearchForIdentifierAsDefault
.getKey(), true);
95 if(overrideSearchForIdentifierAndTitleCache
){
96 searchForIdentifierAndTitleCache
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.SearchForIdentifierAndTitleCache
.getKey(), true);
98 if(overrideSortTaxaByRankAndName
){
99 sortTaxaByRankAndName
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.SortTaxaByRankAndName
.getKey(), true);
101 if(overrideFilterCommonNameReferences
){
102 filterCommonNameReferences
= PreferencesUtil
.getBooleanValue(PreferencePredicate
.CommonNameReferencesWithMarker
.getKey(), true);
104 if(overrideSearchNamedAreasByAbbrev
){
105 String stringValue
= PreferencesUtil
.getStringValue(PreferencePredicate
.NamedAreaSearchForAbbrev
.getKey(), true);
106 searchNamedAreasByAbbrev
= stringValue
!= null? NamedAreaSearchField
.byKey(stringValue
):null;
116 public void widgetSelected(SelectionEvent e
) {
118 if (e
.getSource().equals(this.showIdInSelectionDialogButton
)) {
119 String text
= showIdInSelectionDialogButton
.getText();
120 if(text
.startsWith(Messages
.Preference_Use_Default
)){
121 showIdInSelectionDialog
= null;
125 if (text
.equals(Messages
.GeneralPreference_yes
)){
126 showIdInSelectionDialog
= true;
128 showIdInSelectionDialog
= false;
132 if (e
.getSource().equals(this.searchForIdentifierAsDefaultButton
)) {
133 String text
= searchForIdentifierAsDefaultButton
.getText();
134 if(text
.startsWith(Messages
.Preference_Use_Default
)){
135 searchForIdentifierAsDefault
= null;
139 if (text
.equals(Messages
.GeneralPreference_yes
)){
140 searchForIdentifierAsDefault
= true;
142 searchForIdentifierAsDefault
= false;
146 if (e
.getSource().equals(this.searchForIdentifierAndTitleCacheButton
)) {
147 String text
= searchForIdentifierAndTitleCacheButton
.getText();
148 if(text
.startsWith(Messages
.Preference_Use_Default
)){
149 searchForIdentifierAndTitleCache
= null;
153 if (text
.equals(Messages
.GeneralPreference_yes
)){
154 searchForIdentifierAndTitleCache
= true;
156 searchForIdentifierAndTitleCache
= false;
160 if (e
.getSource().equals(this.sortTaxaByRankAndNameButton
)) {
161 String text
= sortTaxaByRankAndNameButton
.getText();
162 if(text
.startsWith(Messages
.Preference_Use_Default
)){
163 sortTaxaByRankAndName
= null;
167 if (text
.equals(Messages
.GeneralPreference_yes
)){
168 sortTaxaByRankAndName
= true;
170 sortTaxaByRankAndName
= false;
174 if (e
.getSource().equals(this.filterCommonNameReferenceButton
)) {
175 String text
= filterCommonNameReferenceButton
.getText();
176 if(text
.startsWith(Messages
.Preference_Use_Default
)){
177 filterCommonNameReferences
= null;
181 if (text
.equals(Messages
.GeneralPreference_yes
)){
182 filterCommonNameReferences
= true;
184 filterCommonNameReferences
= false;
188 if (e
.getSource().equals(this.searchNamedAreasByAbbrevButton
)) {
189 String text
= searchNamedAreasByAbbrevButton
.getText();
190 if(text
.startsWith(Messages
.Preference_Use_Default
)){
191 searchNamedAreasByAbbrev
= null;
194 searchNamedAreasByAbbrev
= (NamedAreaSearchField
) searchNamedAreasByAbbrevButton
.getData(text
);
203 public void widgetDefaultSelected(SelectionEvent e
) {
204 // TODO Auto-generated method stub
209 protected Control
createContents(Composite parent
) {
212 Composite titleComp
= createComposite(parent
);
213 GridData gridData
= createTextGridData();
215 Label separator
= new Label(titleComp
, SWT
.HORIZONTAL
| SWT
.SEPARATOR
);
216 separator
.setLayoutData(gridData
);
217 separator
.setVisible(false);
218 showIdInSelectionDialogButton
= createBooleanCombo(titleComp
, Messages
.GeneralPreference_yes
, Messages
.GeneralPreference_no
, PreferencePredicate
.ShowIdInSelectionDialog
, Messages
.DatabasePreferncesPage_Show_Id_In_SelectionDialog
, isAdminPreference
);
220 showIdInSelectionDialogButton
.addSelectionListener(this);
222 if (!isAdminPreference
&& showIdInSelectionDialogPref
!= null){
223 showIdInSelectionDialogButton
.setEnabled(showIdInSelectionDialogPref
.isAllowOverride());
226 if (isAdminPreference
){
227 allowOverrideIsShowIdInSelectionDialogButton
= createAllowOverrideButton(titleComp
);
228 allowOverrideIsShowIdInSelectionDialogButton
.setSelection(showIdInSelectionDialogPref
!= null? showIdInSelectionDialogPref
.isAllowOverride(): true);
229 allowOverrideIsShowIdInSelectionDialogButton
.addSelectionListener(new SelectionAdapter(){
231 public void widgetSelected(SelectionEvent e
) {
233 if (showIdInSelectionDialogPref
== null){
234 showIdInSelectionDialogPref
= CdmPreference
.NewTaxEditorInstance(PreferencePredicate
.ShowIdInSelectionDialog
, null);
236 showIdInSelectionDialogPref
.setAllowOverride(allowOverrideIsShowIdInSelectionDialogButton
.getSelection());
241 Composite composite
= createComposite(parent
);
242 //composite.setEnabled(isShowSpecimenRelatedIssues);
243 gridData
= createTextGridData();
245 separator
= new Label(composite
, SWT
.HORIZONTAL
| SWT
.SEPARATOR
);
246 separator
.setLayoutData(gridData
);
248 searchForIdentifierAsDefaultButton
= createBooleanCombo(composite
, Messages
.GeneralPreference_yes
, Messages
.GeneralPreference_no
, PreferencePredicate
.SearchForIdentifierAsDefault
, Messages
.DatabasePreferncesPage_Search_for_identifier_as_default
, isAdminPreference
);
250 searchForIdentifierAsDefaultButton
.addSelectionListener(this);
252 if (isAdminPreference
){
253 allowOverrideSearchForIdentifierAsDefaultButton
= createAllowOverrideButton(composite
);
254 allowOverrideSearchForIdentifierAsDefaultButton
.setSelection(searchForIdentifierAsDefaultPref
!= null?searchForIdentifierAsDefaultPref
.isAllowOverride(): true);
255 allowOverrideSearchForIdentifierAsDefaultButton
.addSelectionListener(new SelectionAdapter(){
257 public void widgetSelected(SelectionEvent e
) {
259 if (searchForIdentifierAsDefaultPref
== null && !allowOverrideSearchForIdentifierAsDefaultButton
.getSelection()){
260 searchForIdentifierAsDefaultPref
= CdmPreference
.NewTaxEditorInstance(PreferencePredicate
.SearchForIdentifierAsDefault
, null);
262 searchForIdentifierAsDefaultPref
.setAllowOverride(allowOverrideSearchForIdentifierAsDefaultButton
.getSelection());
266 if(!isAdminPreference
&& searchForIdentifierAsDefaultPref
!= null){
267 searchForIdentifierAsDefaultButton
.setEnabled(searchForIdentifierAsDefaultPref
.isAllowOverride());
270 searchForIdentifierAndTitleCacheButton
= createBooleanCombo(composite
, Messages
.GeneralPreference_yes
, Messages
.GeneralPreference_no
, PreferencePredicate
.SearchForIdentifierAndTitleCache
, Messages
.DatabasePreferncesPage_search_for_identifier_and_titleCache
, isAdminPreference
);
271 searchForIdentifierAndTitleCacheButton
.addSelectionListener(this);
273 if(!isAdminPreference
&& searchForIdentifierAndTitleCachePref
!= null){
274 searchForIdentifierAndTitleCacheButton
.setEnabled(searchForIdentifierAndTitleCachePref
.isAllowOverride());
277 if (isAdminPreference
){
278 allowOverridesSearchForIdentifierAndTitleCacheButton
= createAllowOverrideButton(composite
);
279 allowOverridesSearchForIdentifierAndTitleCacheButton
.setSelection(searchForIdentifierAndTitleCachePref
!= null?searchForIdentifierAndTitleCachePref
.isAllowOverride():true);
280 allowOverridesSearchForIdentifierAndTitleCacheButton
.addSelectionListener(new SelectionAdapter(){
282 public void widgetSelected(SelectionEvent e
) {
284 if (searchForIdentifierAndTitleCachePref
== null && !allowOverridesSearchForIdentifierAndTitleCacheButton
.getSelection()){
285 searchForIdentifierAndTitleCachePref
= CdmPreference
.NewTaxEditorInstance(PreferencePredicate
.SearchForIdentifierAndTitleCache
, null);
287 searchForIdentifierAndTitleCachePref
.setAllowOverride(allowOverridesSearchForIdentifierAndTitleCacheButton
.getSelection());
292 sortTaxaByRankAndNameButton
=createBooleanCombo(composite
, Messages
.GeneralPreference_yes
, Messages
.GeneralPreference_no
, PreferencePredicate
.SortTaxaByRankAndName
, Messages
.DatabasePreferncesPage_Sort_Taxa_By_Name_And_Rank
, isAdminPreference
);
295 sortTaxaByRankAndNameButton
.addSelectionListener(this);
297 if ( !isAdminPreference
&& sortTaxaByRankAndNamePref
!= null){
298 sortTaxaByRankAndNameButton
.setEnabled(sortTaxaByRankAndNamePref
.isAllowOverride());
301 if (isAdminPreference
){
302 allowOverrideIsSortTaxaByRankAndNameButton
= createAllowOverrideButton(composite
);
303 allowOverrideIsSortTaxaByRankAndNameButton
.setSelection(sortTaxaByRankAndNamePref
!= null? sortTaxaByRankAndNamePref
.isAllowOverride(): true);
304 allowOverrideIsSortTaxaByRankAndNameButton
.addSelectionListener(new SelectionAdapter(){
306 public void widgetSelected(SelectionEvent e
) {
308 if (sortTaxaByRankAndNamePref
== null && !allowOverrideIsSortTaxaByRankAndNameButton
.getSelection()){
309 sortTaxaByRankAndNamePref
= CdmPreference
.NewTaxEditorInstance(PreferencePredicate
.SortTaxaByRankAndName
, null);
311 sortTaxaByRankAndNamePref
.setAllowOverride(allowOverrideIsSortTaxaByRankAndNameButton
.getSelection());
316 filterCommonNameReferenceButton
= createBooleanCombo(composite
, Messages
.GeneralPreference_yes
, Messages
.GeneralPreference_no
, PreferencePredicate
.CommonNameReferencesWithMarker
, Messages
.DatabasePreferncesPage_CommonNameFilter
, isAdminPreference
);
317 filterCommonNameReferenceButton
.addSelectionListener(this);
320 if (!isAdminPreference
&& filterCommonNameReferencesPref
!= null){
321 filterCommonNameReferenceButton
.setEnabled(filterCommonNameReferencesPref
.isAllowOverride());
324 if (isAdminPreference
){
325 allowOverrideFilterCommonNameReferencesButton
= createAllowOverrideButton(composite
);
326 allowOverrideFilterCommonNameReferencesButton
.setSelection(filterCommonNameReferencesPref
!= null? filterCommonNameReferencesPref
.isAllowOverride():true);
327 allowOverrideFilterCommonNameReferencesButton
.addSelectionListener(new SelectionAdapter(){
329 public void widgetSelected(SelectionEvent e
) {
331 if (filterCommonNameReferencesPref
== null && !allowOverrideFilterCommonNameReferencesButton
.getSelection()){
332 filterCommonNameReferencesPref
= CdmPreference
.NewTaxEditorInstance(PreferencePredicate
.CommonNameReferencesWithMarker
, null);
334 filterCommonNameReferencesPref
.setAllowOverride(allowOverrideFilterCommonNameReferencesButton
.getSelection());
339 searchNamedAreasByAbbrevButton
= createCombo(composite
, NamedAreaSearchField
.values(), PreferencePredicate
.NamedAreaSearchForAbbrev
, Messages
.DatabasePreferncesPage_NamedAreaSearchField
, isAdminPreference
);
340 searchNamedAreasByAbbrevButton
.addSelectionListener(this);
343 if (!isAdminPreference
&& searchNamedAreasByAbbrevPref
!= null){
344 searchNamedAreasByAbbrevButton
.setEnabled(searchNamedAreasByAbbrevPref
.isAllowOverride());
347 if (isAdminPreference
){
348 allowOverridesearchNamedAreasByAbbrevButton
= createAllowOverrideButton(composite
);
349 allowOverridesearchNamedAreasByAbbrevButton
.setSelection(searchNamedAreasByAbbrevPref
!= null? searchNamedAreasByAbbrevPref
.isAllowOverride():true);
350 allowOverridesearchNamedAreasByAbbrevButton
.addSelectionListener(new SelectionAdapter(){
352 public void widgetSelected(SelectionEvent e
) {
354 if (searchNamedAreasByAbbrevPref
== null && !allowOverridesearchNamedAreasByAbbrevButton
.getSelection()){
355 searchNamedAreasByAbbrevPref
= CdmPreference
.NewTaxEditorInstance(PreferencePredicate
.NamedAreaSearchForAbbrev
, null);
357 searchNamedAreasByAbbrevPref
.setAllowOverride(allowOverridesearchNamedAreasByAbbrevButton
.getSelection());
368 protected void performDefaults() {
369 showIdInSelectionDialogButton
.select(0);
370 showIdInSelectionDialog
= null;
371 if (isAdminPreference
){
372 allowOverrideIsShowIdInSelectionDialogButton
.setSelection(true);
373 showIdInSelectionDialogPref
.setAllowOverride(true);
375 searchForIdentifierAsDefaultButton
.select(0);
376 searchForIdentifierAsDefault
= null;
377 if (isAdminPreference
){
378 allowOverrideSearchForIdentifierAsDefaultButton
.setSelection(true);
379 searchForIdentifierAsDefaultPref
.setAllowOverride(true);
381 searchForIdentifierAndTitleCacheButton
.select(0);
382 searchForIdentifierAndTitleCache
= null;
383 if (isAdminPreference
){
384 allowOverridesSearchForIdentifierAndTitleCacheButton
.setSelection(true);
385 searchForIdentifierAndTitleCachePref
.setAllowOverride(true);
387 sortTaxaByRankAndNameButton
.select(0);
388 sortTaxaByRankAndName
= null;
389 if (isAdminPreference
){
390 allowOverrideIsSortTaxaByRankAndNameButton
.setSelection(true);
391 sortTaxaByRankAndNamePref
.setAllowOverride(true);
393 filterCommonNameReferenceButton
.select(0);
394 filterCommonNameReferences
= null;
395 if (isAdminPreference
){
396 allowOverrideFilterCommonNameReferencesButton
.setSelection(true);
397 filterCommonNameReferencesPref
.setAllowOverride(true);
399 searchNamedAreasByAbbrevButton
.select(0);
400 searchNamedAreasByAbbrev
= null;
401 if (isAdminPreference
){
402 allowOverridesearchNamedAreasByAbbrevButton
.setSelection(true);
403 searchNamedAreasByAbbrevPref
.setAllowOverride(true);
409 public boolean performOk(){
413 boolean override
= false;
414 if (showIdInSelectionDialog
!= null ) {
416 PreferencesUtil
.setStringValue(PreferencePredicate
.ShowIdInSelectionDialog
.getKey(), showIdInSelectionDialog
.toString());
418 PreferencesUtil
.setBooleanValue(
419 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.ShowIdInSelectionDialog
.getKey()),
424 if(searchForIdentifierAsDefault
!= null){
426 PreferencesUtil
.setStringValue(PreferencePredicate
.SearchForIdentifierAsDefault
.getKey(), searchForIdentifierAsDefault
.toString());
428 PreferencesUtil
.setBooleanValue(
429 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.SearchForIdentifierAsDefault
.getKey()),
433 if(searchForIdentifierAndTitleCache
!= null){
435 PreferencesUtil
.setStringValue(PreferencePredicate
.SearchForIdentifierAndTitleCache
.getKey(), searchForIdentifierAndTitleCache
.toString());
437 PreferencesUtil
.setBooleanValue(
438 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.SearchForIdentifierAndTitleCache
.getKey()),
442 if(sortTaxaByRankAndName
!= null){
444 PreferencesUtil
.setStringValue(PreferencePredicate
.SortTaxaByRankAndName
.getKey(), sortTaxaByRankAndName
.toString());
446 PreferencesUtil
.setBooleanValue(
447 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.SortTaxaByRankAndName
.getKey()),
452 if(filterCommonNameReferences
!= null){
454 PreferencesUtil
.setStringValue(PreferencePredicate
.CommonNameReferencesWithMarker
.getKey(), filterCommonNameReferences
.toString());
456 PreferencesUtil
.setBooleanValue(
457 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.CommonNameReferencesWithMarker
.getKey()),
461 if(searchNamedAreasByAbbrev
!= null){
463 PreferencesUtil
.setStringValue(PreferencePredicate
.NamedAreaSearchForAbbrev
.getKey(), searchNamedAreasByAbbrev
.getKey());
465 PreferencesUtil
.setBooleanValue(
466 PreferencesUtil
.prefOverrideKey(PreferencePredicate
.NamedAreaSearchForAbbrev
.getKey()),
474 protected void setSelections(){
477 for (String itemLabel
: showIdInSelectionDialogButton
.getItems()) {
478 if (itemLabel
.startsWith(Messages
.Preference_Use_Default
) && (showIdInSelectionDialog
== null || (!overrideShowIdInSelectionDialog
&& !isAdminPreference
))) {
479 showIdInSelectionDialogButton
.select(index
);
482 if (itemLabel
.equals(Messages
.GeneralPreference_yes
) && showIdInSelectionDialog
){
483 showIdInSelectionDialogButton
.select(index
);
486 if (itemLabel
.equals(Messages
.GeneralPreference_no
) && !showIdInSelectionDialog
){
487 showIdInSelectionDialogButton
.select(index
);
494 for (String itemLabel
: searchForIdentifierAsDefaultButton
.getItems()) {
495 if ((searchForIdentifierAsDefault
== null || (!overrideSearchForIdentifierAsDefault
&& !isAdminPreference
)) && itemLabel
.startsWith(Messages
.Preference_Use_Default
)) {
496 searchForIdentifierAsDefaultButton
.select(index
);
499 if (searchForIdentifierAsDefault
!= null && itemLabel
.equals(Messages
.GeneralPreference_yes
) && searchForIdentifierAsDefault
){
500 searchForIdentifierAsDefaultButton
.select(index
);
503 if (searchForIdentifierAsDefault
!= null && itemLabel
.equals(Messages
.GeneralPreference_no
) && !searchForIdentifierAsDefault
){
504 searchForIdentifierAsDefaultButton
.select(index
);
511 for (String itemLabel
: searchForIdentifierAndTitleCacheButton
.getItems()) {
512 if ((searchForIdentifierAndTitleCache
== null || (!overrideSearchForIdentifierAndTitleCache
&& !isAdminPreference
))&& itemLabel
.startsWith(Messages
.Preference_Use_Default
)) {
513 searchForIdentifierAndTitleCacheButton
.select(index
);
516 if (searchForIdentifierAndTitleCache
!= null && itemLabel
.equals(Messages
.GeneralPreference_yes
) && searchForIdentifierAndTitleCache
){
517 searchForIdentifierAndTitleCacheButton
.select(index
);
520 if (searchForIdentifierAndTitleCache
!= null && itemLabel
.equals(Messages
.GeneralPreference_no
) && !searchForIdentifierAndTitleCache
){
521 searchForIdentifierAndTitleCacheButton
.select(index
);
528 for (String itemLabel
: sortTaxaByRankAndNameButton
.getItems()) {
529 if ((sortTaxaByRankAndName
== null || (!overrideSortTaxaByRankAndName
&& !isAdminPreference
))&& itemLabel
.startsWith(Messages
.Preference_Use_Default
)) {
530 sortTaxaByRankAndNameButton
.select(index
);
533 if (sortTaxaByRankAndName
!= null && itemLabel
.equals(Messages
.GeneralPreference_yes
) && sortTaxaByRankAndName
){
534 sortTaxaByRankAndNameButton
.select(index
);
537 if (sortTaxaByRankAndName
!= null && itemLabel
.equals(Messages
.GeneralPreference_no
) && !sortTaxaByRankAndName
){
538 sortTaxaByRankAndNameButton
.select(index
);
545 for (String itemLabel
: filterCommonNameReferenceButton
.getItems()) {
546 if ((filterCommonNameReferences
== null || (!overrideFilterCommonNameReferences
&& !isAdminPreference
)) && itemLabel
.startsWith(Messages
.Preference_Use_Default
)) {
547 filterCommonNameReferenceButton
.select(index
);
550 if (filterCommonNameReferences
!= null && itemLabel
.equals(Messages
.GeneralPreference_yes
) && filterCommonNameReferences
){
551 filterCommonNameReferenceButton
.select(index
);
554 if (filterCommonNameReferences
!= null && itemLabel
.equals(Messages
.GeneralPreference_no
) && !filterCommonNameReferences
){
555 filterCommonNameReferenceButton
.select(index
);
561 for (String itemLabel
: searchNamedAreasByAbbrevButton
.getItems()) {
562 if ((searchNamedAreasByAbbrev
== null || (!overrideSearchNamedAreasByAbbrev
&& !isAdminPreference
)) && itemLabel
.startsWith(Messages
.Preference_Use_Default
)) {
563 searchNamedAreasByAbbrevButton
.select(index
);
568 if (searchNamedAreasByAbbrev
!= null && itemLabel
.equals(searchNamedAreasByAbbrev
.getLabel())){
569 searchNamedAreasByAbbrevButton
.select(index
);