import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.ListComponent;
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
import eu.etaxonomy.taxeditor.store.CdmStore;
//gridLayout.makeColumnsEqualWidth = true;
composite.setLayout(gridLayout);
- biocaseProviderList = new ListComponent(composite, SWT.SCROLL_LINE);
+ biocaseProviderList = new ListComponent(composite, SWT.SCROLL_LINE, isAdminPreference);
setApply(true);
return composite;
}
service.set(pref);
}
- if(isShowCheckListPerspective == null){
+ if(isShowTaxonNodeWizard == null){
service.remove(CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowTaxonNodeWizard));
}else{
pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowTaxonNodeWizard, Boolean.toString(this.isShowTaxonNodeWizard));
if (!isApply()){
return true;
}
- if (pref == null){
+ int index = useLocalOrAdmin.getSelectionIndex();
+ if (pref == null && index == 0){
PreferencesUtil.setPreferenceToDB(CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableRanks, null));
PreferencesUtil.updateDBPreferences();
PreferencesUtil.firePreferencesChanged(this.getClass());
--- /dev/null
+/**
+* Copyright (C) 2019 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
+
+import eu.etaxonomy.cdm.api.application.ICdmRepository;
+import eu.etaxonomy.cdm.api.service.IPreferenceService;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.taxeditor.preference.SearchDialogPreferences;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @since 08.08.2019
+ */
+public class SearchDialogAdminPreferences extends SearchDialogPreferences implements IE4AdminPreferencePage {
+
+
+
+
+ @Override
+ public void getValues(){
+ super.getValues();
+ if(showIdInSelectionDialogPref != null){
+ showIdInSelectionDialog = Boolean.parseBoolean(showIdInSelectionDialogPref.getValue());
+ }else{
+ showIdInSelectionDialog = null;
+ showIdInSelectionDialogPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowIdInSelectionDialog, null);
+ }
+ if (searchForIdentifierAsDefaultPref != null){
+ searchForIdentifierAsDefault = Boolean.parseBoolean(searchForIdentifierAsDefaultPref.getValue());
+ }else{
+ searchForIdentifierAsDefault = null;
+ searchForIdentifierAsDefaultPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAsDefault, null);
+ }
+ if (searchForIdentifierAndTitleCachePref != null){
+ searchForIdentifierAndTitleCache = Boolean.parseBoolean(searchForIdentifierAndTitleCachePref.getValue());
+ }else{
+ searchForIdentifierAndTitleCache = null;
+ searchForIdentifierAndTitleCachePref =CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAndTitleCache, null);
+ }
+ if (sortTaxaByRankAndNamePref != null){
+ sortTaxaByRankAndName = Boolean.parseBoolean(sortTaxaByRankAndNamePref.getValue());
+ }else{
+ sortTaxaByRankAndName = null;
+ sortTaxaByRankAndNamePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SortTaxaByRankAndName, null);
+ }
+ if (filterCommonNameReferencesPref != null){
+ filterCommonNameReferences = Boolean.parseBoolean(filterCommonNameReferencesPref.getValue());
+ }else{
+ filterCommonNameReferences = null;
+ filterCommonNameReferencesPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameReferencesWithMarker, null);
+ }
+ }
+
+ @Override
+ public boolean performOk(){
+ if (!isApply()){
+ return true;
+ }
+ ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
+ if (controller != null){
+ IPreferenceService service = controller.getPreferenceService();
+ CdmPreference pref;
+ if (showIdInSelectionDialog != null || !showIdInSelectionDialogPref.isAllowOverride()) {
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowIdInSelectionDialog, showIdInSelectionDialog != null? showIdInSelectionDialog.toString():null);
+ pref.setAllowOverride(showIdInSelectionDialogPref.isAllowOverride());
+ service.set(pref);
+ }else{
+ service.remove(showIdInSelectionDialogPref.getKey());
+ }
+
+
+ if(searchForIdentifierAsDefault != null || !searchForIdentifierAsDefaultPref.isAllowOverride()){
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAsDefault, searchForIdentifierAsDefault!= null? searchForIdentifierAsDefault.toString():null);
+ pref.setAllowOverride(searchForIdentifierAsDefaultPref.isAllowOverride());
+ service.set(pref);
+ }else{
+ service.remove(searchForIdentifierAsDefaultPref.getKey());
+ }
+
+
+ if(searchForIdentifierAndTitleCache != null){
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAndTitleCache, searchForIdentifierAndTitleCache!= null? searchForIdentifierAndTitleCache.toString():null);
+ pref.setAllowOverride(searchForIdentifierAndTitleCachePref.isAllowOverride());
+ service.set(pref);
+ }else{
+ service.remove(searchForIdentifierAndTitleCachePref.getKey());
+ }
+
+ if(sortTaxaByRankAndName != null){
+
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SortTaxaByRankAndName, sortTaxaByRankAndName!= null? sortTaxaByRankAndName.toString():null);
+ pref.setAllowOverride(sortTaxaByRankAndNamePref.isAllowOverride());
+ service.set(pref);
+ }else{
+ service.remove(sortTaxaByRankAndNamePref.getKey());
+ }
+
+
+
+ if(filterCommonNameReferences != null){
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameReferencesWithMarker, filterCommonNameReferences!= null? filterCommonNameReferences.toString():null);
+ pref.setAllowOverride(filterCommonNameReferencesPref.isAllowOverride());
+ service.set(pref);
+ }else{
+ service.remove(filterCommonNameReferencesPref.getKey());
+ }
+ }
+
+ return true;
+ }
+
+
+
+}
if (configurator instanceof CdmLightExportConfigurator){
isZip = ((CdmLightExportConfigurator)configurator).isCreateZipFile();
}
- AbstractUtility.executeMoniteredExport("Export: " + configurator.getClass().getSimpleName(),
+ AbstractUtility.executeMoniteredExport(configurator.getUserFriendlyIOName(),
uuid,
1000,
true,
import org.eclipse.swt.widgets.Text;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
}
public void saveConfigToPrefernceStore() {
-//should use PreferencePredicate.AbcdImportConfig
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS,
- configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN,
- configurator.isAddMediaAsMediaSpecimen());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS,
- configurator.isAllowReuseOtherClassifications());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS,
- configurator.isDeduplicateClassifications());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES,
- configurator.isDeduplicateReferences());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS,
- configurator.isGetSiblings());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP,
- configurator.isIgnoreAuthorship());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN,
- configurator.isIgnoreImportOfExistingSpecimen());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER,
- configurator.isMapUnitIdToAccessionNumber());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE,
- configurator.isMapUnitIdToBarcode());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER,
- configurator.isMapUnitIdToCatalogNumber());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION,
- configurator.isMoveNewTaxaToDefaultClassification());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_OVERWRITE_EXISTING_SPECIMEN,
- configurator.isOverwriteExistingSpecimens());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS,
- configurator.isReuseExistingDescriptiveGroups());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_META_DATA,
- configurator.isReuseExistingMetaData());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE,
- configurator.isReuseExistingTaxaWhenPossible());
-
- PreferencesUtil.setStringValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DNA_PROVIDER,
- textDNAProviderString.getText());
+ PreferencesUtil.setStringValue(PreferencePredicate.AbcdImportConfig.getKey(), configurator.toString());
+
}
public String createConfigString(){
import org.eclipse.swt.widgets.Text;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
import eu.etaxonomy.taxeditor.databaseAdmin.wizard.AbstractPreferenceWizard;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
}
public void saveConfigToPrefernceStore() {
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS,
- abcdImportConfigurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN,
- abcdImportConfigurator.isAddMediaAsMediaSpecimen());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS,
- abcdImportConfigurator.isAllowReuseOtherClassifications());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS,
- abcdImportConfigurator.isDeduplicateClassifications());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REMOVE_COUNTRY_FROM_LOCALITY_TEXT,
- abcdImportConfigurator.isRemoveCountryFromLocalityText());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES,
- abcdImportConfigurator.isDeduplicateReferences());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS,
- abcdImportConfigurator.isGetSiblings());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP,
- abcdImportConfigurator.isIgnoreAuthorship());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN,
- abcdImportConfigurator.isIgnoreImportOfExistingSpecimen());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER,
- abcdImportConfigurator.isMapUnitIdToAccessionNumber());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE,
- abcdImportConfigurator.isMapUnitIdToBarcode());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER,
- abcdImportConfigurator.isMapUnitIdToCatalogNumber());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION,
- abcdImportConfigurator.isMoveNewTaxaToDefaultClassification());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_OVERWRITE_EXISTING_SPECIMEN,
- abcdImportConfigurator.isOverwriteExistingSpecimens());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS,
- abcdImportConfigurator.isReuseExistingDescriptiveGroups());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_META_DATA,
- abcdImportConfigurator.isReuseExistingMetaData());
- PreferencesUtil.setBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE,
- abcdImportConfigurator.isReuseExistingTaxaWhenPossible());
- if ( abcdImportConfigurator.getNomenclaturalCode() != null){
- PreferencesUtil.setStringValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_NOMENCLATURAL_CODE, abcdImportConfigurator.getNomenclaturalCode().getKey());
- }
- if ( textDNAProviderString.getText() != null){
- PreferencesUtil.setStringValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DNA_PROVIDER, textDNAProviderString.getText());
- }
+ PreferencesUtil.setStringValue(PreferencePredicate.AbcdImportConfig.getKey(), abcdImportConfigurator.toString());
}
}
public void createAbcdImportConfig() {
- this.abcdImportConfigurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS));
- this.abcdImportConfigurator.setAddMediaAsMediaSpecimen(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN));
- this.abcdImportConfigurator.setAllowReuseOtherClassifications(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS));
- //this.abcdImportConfigurator.setClassificationUuid(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_CLASSIFICATION_UUID));
- this.abcdImportConfigurator.setDeduplicateClassifications(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS));
- this.abcdImportConfigurator.setDeduplicateReferences(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES));
- // this.abcdImportConfigurator.setDefaultAuthor(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEFAULT_AUTHOR));
- this.abcdImportConfigurator.setGetSiblings(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS));
- this.abcdImportConfigurator.setIgnoreAuthorship(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP));
- this.abcdImportConfigurator.setIgnoreImportOfExistingSpecimen(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN));
- this.abcdImportConfigurator.setMapUnitIdToAccessionNumber(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER));
- this.abcdImportConfigurator.setMapUnitIdToBarcode(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE));
- this.abcdImportConfigurator.setMapUnitIdToCatalogNumber(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER));
- this.abcdImportConfigurator.setMoveNewTaxaToDefaultClassification(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION));
- this.abcdImportConfigurator.setReuseExistingDescriptiveGroups(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS));
- this.abcdImportConfigurator.setReuseExistingTaxaWhenPossible(PreferencesUtil.getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE));
+ this.abcdImportConfigurator = PreferencesUtil.getLocalAbcdImportConfigurator();
}
}
public static String DatabasePreferencesPage_Specimen_Or_Observation;
public static String DatabasePreferencesPage_SetPublishFlag;
+ public static String DatabasePreferncesPage_Show_Id_In_SelectionDialog;
+ public static String DatabasePreferncesPage_Search_for_identifier_as_default;
+ public static String DatabasePreferncesPage_search_for_identifier_and_titleCache;
+ public static String DatabasePreferncesPage_Sort_Taxa_By_Name_And_Rank;
+ public static String DatabasePreferncesPage_CommonNameFilter;
+
public static String ImportFromFileAndChooseVocIdWizardPage_AreaVoc;
public static String ImportFromFileAndChooseVocIdWizardOage_AreaVoc_toolTip;
public static String Preference_Use_Default;
+
+
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
DatabasePreferncesPage_Show_ChecklistPerspective=Show Checklist Perspective as default Perspective
DatabasePreferncesPage_Show_TaxonNodeWizard=Taxon Nodes can be edited in Wizard
+DatabasePreferncesPage_Show_Id_In_SelectionDialog=Show ID in selection dialogs
+DatabasePreferncesPage_Search_for_identifier_as_default=Use identifier search as default
+DatabasePreferncesPage_search_for_identifier_and_titleCache=Search also for titlecache if identifier search is activated
+DatabasePreferncesPage_Sort_Taxa_By_Name_And_Rank=Sort taxa by rank and name
+DatabasePreferncesPage_CommonNameFilter=Filter common name references
+
Distribution_status_selection=Status Selection
DistributionAdminPreferences_SELECT_STATUS=List of available distribution status
DistributionAdminPreferences_PER_AREA_STATUS=List of preferences defining available status per area.\nIn this list you can define whether the preference can be overwritten or delete it.
DatabasePreferncesPage_Show_ChecklistPerspective=Checklist Perspektive als Default Perspektive anzeigen
DatabasePreferncesPage_Show_TaxonNodeWizard=Wizard zum Editieren der Taxon Knoten anzeigen
+DatabasePreferncesPage_Show_Id_In_SelectionDialog=Zeige ID in Selection Dialogen
+DatabasePreferncesPage_Search_for_identifier_as_default=Nutze Identifier Suche als Default
+DatabasePreferncesPage_search_for_identifier_and_titleCache=Suche nach Identifier und TitleCache, wenn Identifier Suche aktiviert ist
+DatabasePreferncesPage_Sort_Taxa_By_Name_And_Rank=Sortiere Taxa nach Rang und Namen
+DatabasePreferncesPage_CommonNameFilter=Filtere Referenzen, die als Referenzen für Trivialnamen markiert sind
+
Distribution_status_selection=Status Auswahl
DistributionAdminPreferences_SELECT_STATUS=Liste der verfügbaren Verbreitungs-Status
DistributionAdminPreferences_PER_AREA_STATUS=Liste der pro Area definierten Status Preferenzen\nSie können in der Liste definieren, ob das lokale Überschreiben erlaubt sein soll und die Preferenz löschen
--- /dev/null
+/**
+* Copyright (C) 2018 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.preference;
+
+import java.net.URI;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.api.application.ICdmRepository;
+import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @since 23.03.2018
+ *
+ */
+public class AbcdImportPreference extends CdmPreferencePage implements IE4PreferencePage, SelectionListener {
+
+ private Abcd206ImportConfigurator configurator;
+
+ private Combo nomenclaturalCodeSelectionCombo;
+
+ private boolean allowOverride = true;
+ private boolean override = true;
+ private CdmPreference preference = null;
+ Text textDNAProviderString;
+ private Composite composite;
+ Combo overrideCombo;
+
+ @Override
+ protected Control createContents(Composite parent) {
+
+
+
+
+ getValues();
+
+
+ //configurator = PreferencesUtil.getAbcdImportConfigurationPreference();
+ final CLabel description = new CLabel(parent, SWT.NULL);
+ description.setText(Messages.AbcdImportPreference_description);
+// final CLabel overrideDescription = new CLabel(parent, SWT.NULL);
+// overrideDescription.setText("");
+// GridData textGrid = createTextGridData();
+// textGrid.verticalSpan = 2;
+// overrideDescription.setLayoutData(textGrid);
+
+ overrideCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+
+ overrideCombo.add(LocalOrDefaultEnum.Default.getLabel(), 0);
+ overrideCombo.add(LocalOrDefaultEnum.Local.getLabel(), 1);
+ overrideCombo.addSelectionListener(this);
+ if (override){
+ overrideCombo.select(1);
+ }else{
+ overrideCombo.select(0);
+ }
+
+ composite = new Composite(parent, SWT.NULL);
+
+ GridLayout gridLayout = new GridLayout();
+ composite.setLayout(gridLayout);
+ Button checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
+ checkBoxMediaSpecimen.setSelection(configurator.isAddMediaAsMediaSpecimen());
+ checkBoxMediaSpecimen.setText(Messages.AbcdImportPreference_media_as_mediaSpecimen);
+ checkBoxMediaSpecimen
+ .setToolTipText(Messages.AbcdImportPreference_media_as_subUnit);
+ checkBoxMediaSpecimen.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setAddMediaAsMediaSpecimen(!configurator.isAddMediaAsMediaSpecimen());
+ setApply(true);
+ }
+ });
+
+ Button checkBoxIgnoreExisting = new Button(composite, SWT.CHECK);
+ checkBoxIgnoreExisting.setSelection(configurator.isIgnoreImportOfExistingSpecimen());
+ checkBoxIgnoreExisting.setText(Messages.AbcdImportPreference_not_import_existing_specimen);
+ checkBoxIgnoreExisting
+ .setToolTipText(Messages.AbcdImportPreference_not_import_existing_specimen_tooltip);
+ checkBoxIgnoreExisting.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setIgnoreImportOfExistingSpecimen(!configurator.isIgnoreImportOfExistingSpecimen());
+ setApply(true);
+ }
+ });
+
+ Button checkBoxIgnoreAuthorship = new Button(composite, SWT.CHECK);
+ checkBoxIgnoreAuthorship.setSelection(configurator.isIgnoreAuthorship());
+ checkBoxIgnoreAuthorship.setText(Messages.AbcdImportPreference_ignore_author);
+ checkBoxIgnoreAuthorship
+ .setToolTipText(Messages.AbcdImportPreference_ignore_author_tooltip);
+ checkBoxIgnoreAuthorship.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setIgnoreAuthorship(!configurator.isIgnoreAuthorship());
+ setApply(true);
+ }
+ });
+
+ Button checkBoxMapUnitIdToCatalogNumber = new Button(composite, SWT.CHECK);
+ checkBoxMapUnitIdToCatalogNumber.setSelection(configurator.isMapUnitIdToCatalogNumber());
+ checkBoxMapUnitIdToCatalogNumber.setText(Messages.AbcdImportPreference_map_unit_nr_catalog_number);
+ checkBoxMapUnitIdToCatalogNumber
+ .setToolTipText(Messages.AbcdImportPreference_map_unit_number_catalog_number_tooltip);
+ checkBoxMapUnitIdToCatalogNumber.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setMapUnitIdToCatalogNumber(!configurator.isMapUnitIdToCatalogNumber());
+ setApply(true);
+ }
+ });
+//TODO: only one of the mappings can be checked!
+ Button checkBoxMapUnitIdToAccessionNumber = new Button(composite, SWT.CHECK);
+ checkBoxMapUnitIdToAccessionNumber.setSelection(configurator.isMapUnitIdToAccessionNumber());
+ checkBoxMapUnitIdToAccessionNumber.setText(Messages.AbcdImportPreference_map_unit_number_to_accession_number);
+ checkBoxMapUnitIdToAccessionNumber
+ .setToolTipText(Messages.AbcdImportPreference_map_unit_number_accession_number_tooltip);
+ checkBoxMapUnitIdToAccessionNumber.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setMapUnitIdToAccessionNumber(!configurator.isMapUnitIdToAccessionNumber());
+ setApply(true);
+ }
+ });
+
+ Button checkBoxMapUnitIdToBarcode = new Button(composite, SWT.CHECK);
+ checkBoxMapUnitIdToBarcode.setSelection(configurator.isMapUnitIdToBarcode());
+ checkBoxMapUnitIdToBarcode.setText(Messages.AbcdImportPreference_map_unit_number_barcode);
+ checkBoxMapUnitIdToBarcode
+ .setToolTipText(Messages.AbcdImportPreference_map_unit_number_barcode_tooltip);
+ checkBoxMapUnitIdToBarcode.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setMapUnitIdToBarcode(!configurator.isMapUnitIdToBarcode());
+ setApply(true);
+ }
+ });
+
+ Button checkBoxRemoveCountry = new Button(composite, SWT.CHECK);
+ checkBoxRemoveCountry.setSelection(configurator.isRemoveCountryFromLocalityText());
+ checkBoxRemoveCountry.setText(Messages.AbcdImportPreference_remove_country_from_locality);
+ checkBoxRemoveCountry
+ .setToolTipText(Messages.AbcdImportPreference_remove_country_from_locality_tooltip);
+ checkBoxRemoveCountry.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setRemoveCountryFromLocalityText(!configurator.isRemoveCountryFromLocalityText());
+ setApply(true);
+ }
+ });
+
+ Button checkBoxMoveToDefaultClassification = new Button(composite, SWT.CHECK);
+ checkBoxMoveToDefaultClassification.setSelection(configurator.isMoveNewTaxaToDefaultClassification());
+ checkBoxMoveToDefaultClassification.setText(Messages.AbcdImportPreference_create_new_classification_new_taxa);
+ checkBoxMoveToDefaultClassification
+ .setToolTipText(Messages.AbcdImportPreference_create_new_classification_new_taxa_tooltip);
+ checkBoxMoveToDefaultClassification.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setMoveNewTaxaToDefaultClassification(!configurator.isMoveNewTaxaToDefaultClassification());
+ setApply(true);
+ }
+ });
+
+ Button checkBoxImportSiblings = new Button(composite, SWT.CHECK);
+ checkBoxImportSiblings.setSelection(configurator.isGetSiblings());
+ checkBoxImportSiblings.setText(Messages.AbcdImportPreference_import_all_children_for_cultures_or_tissues);
+ checkBoxImportSiblings
+ .setToolTipText(Messages.AbcdImportPreference_import_all_children_for_cultures_or_tissues_tooltip);
+ checkBoxImportSiblings.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setGetSiblings(!configurator.isGetSiblings());
+ setApply(true);
+ }
+ });
+
+ Button checkBoxAddIndividualsAssociations = new Button(composite, SWT.CHECK);
+ checkBoxAddIndividualsAssociations.setSelection(configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
+ checkBoxAddIndividualsAssociations.setText(Messages.AbcdImportPreference_create_Individual_Association);
+ checkBoxAddIndividualsAssociations
+ .setToolTipText(Messages.AbcdImportPreference_create_Individual_Association_tooltip);
+ checkBoxAddIndividualsAssociations.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(!configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
+ setApply(true);
+ }
+ });
+
+ Button checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
+ checkBoxReuseDescriptiveGroups.setSelection(configurator.isReuseExistingDescriptiveGroups());
+ checkBoxReuseDescriptiveGroups.setText(Messages.AbcdImportPreference_reuse_descriptive_group);
+ checkBoxReuseDescriptiveGroups
+ .setToolTipText(Messages.AbcdImportPreference_reuse_descriptive_group_tooltip);
+ checkBoxReuseDescriptiveGroups.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setReuseExistingDescriptiveGroups(!configurator.isReuseExistingDescriptiveGroups());
+ setApply(true);
+ }
+ });
+
+ Button checkBoxReuseExistingTaxa = new Button(composite, SWT.CHECK);
+ checkBoxReuseExistingTaxa.setSelection(configurator.isReuseExistingTaxaWhenPossible());
+ checkBoxReuseExistingTaxa.setText(Messages.AbcdImportPreference_reuse_existing_taxa);
+ checkBoxReuseExistingTaxa
+ .setToolTipText(Messages.AbcdImportPreference_reuse_existing_taxa_tooltip);
+ checkBoxReuseExistingTaxa.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setReuseExistingTaxaWhenPossible(!configurator.isReuseExistingTaxaWhenPossible());
+ setApply(true);
+ }
+ });
+
+ Label labelRef = new Label(composite, SWT.NONE);
+ labelRef.setText("Biocase provider for associated DNA");
+ new Label(composite, SWT.NONE);
+ textDNAProviderString = new Text(composite, SWT.NONE);
+ textDNAProviderString.setEnabled(true);
+ textDNAProviderString.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1));
+ textDNAProviderString.setText(configurator.getDnaSoure().toString());
+ GridData gridData = new GridData();
+ gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
+ gridData.horizontalIndent = 5;
+// classificationSelection.setLayoutData(gridData);
+
+ nomenclaturalCodeSelectionCombo = new Combo(composite, SWT.BORDER| SWT.READ_ONLY);
+ nomenclaturalCodeSelectionCombo.setLayoutData(gridData);
+ for(NomenclaturalCode code: NomenclaturalCode.values()){
+ nomenclaturalCodeSelectionCombo.add(code.getKey());
+ }
+ int index = 0;
+ if (configurator.getNomenclaturalCode() != null){
+ for (String label : nomenclaturalCodeSelectionCombo.getItems()){
+ if (label.equals(configurator.getNomenclaturalCode().getKey())){
+ nomenclaturalCodeSelectionCombo.select(index);
+
+ }
+ index++;
+ }
+ }
+
+ // TODO remember last selection
+ nomenclaturalCodeSelectionCombo.addSelectionListener(this);
+ if (preference != null){
+ allowOverride = preference.isAllowOverride();
+ }
+
+ if (!override){
+ //composite.setEnabled(false);
+ PreferencesUtil.recursiveSetEnabled(composite, override);
+ }
+
+ return composite;
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (e.getSource().equals(nomenclaturalCodeSelectionCombo)){
+ this.configurator.setNomenclaturalCode(NomenclaturalCode.getByKey(nomenclaturalCodeSelectionCombo.getText()));
+ }
+ if (e.getSource().equals(overrideCombo)) {
+ override = overrideCombo.getText().equals(LocalOrDefaultEnum.Local.getLabel())?true:false;
+ }
+ PreferencesUtil.recursiveSetEnabled(composite, override);
+ setApply(true);
+
+ }
+
+ @Override
+ public boolean performOk() {
+ if (!isApply()){
+ return true;
+ }
+ if (configurator != null){
+ String configString = configurator.toString();
+
+
+ if (override){
+ PreferencesUtil.setStringValue(PreferencePredicate.AbcdImportConfig.getKey(), configString);
+ PreferencesUtil.setBooleanValue( PreferencesUtil.prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey()), override);
+
+ }else{
+ PreferencesUtil.setBooleanValue( PreferencesUtil.prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey()), override);
+ }
+
+
+ }
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ protected void performDefaults() {
+ configurator = Abcd206ImportConfigurator.NewInstance(null,null);
+ preference = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AbcdImportConfig, configurator.toString());
+ preference.setAllowOverride(true);
+ super.performDefaults();
+ }
+
+ @Override
+ public void getValues() {
+ isAdminPreference = false;
+ configurator = Abcd206ImportConfigurator.NewInstance(null,null);
+ ICdmRepository controller;
+ controller = CdmStore.getCurrentApplicationConfiguration();
+ PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AbcdImportConfig);
+ preference = controller.getPreferenceService().find(key);
+
+ if (preference != null ){
+ allowOverride = preference.isAllowOverride();
+ }else{
+ preference = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AbcdImportConfig, configurator.toString());
+ }
+
+ override = PreferencesUtil.getBooleanValue(
+ PreferencesUtil.prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey()), true) != null? PreferencesUtil.getBooleanValue(
+ PreferencesUtil.prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey()), true):false;
+
+ String configString;
+ if (!override){
+ configString = preference.getValue();
+ }else{
+ configString = PreferencesUtil.getStringValue(PreferencePredicate.AbcdImportConfig.getKey(), true);
+ }
+ if(configString!=null){
+ String[] configArray = configString.split(";"); //$NON-NLS-1$
+
+ for (String configItem: configArray){
+ String[] keyValue = configItem.split(":"); //$NON-NLS-1$
+ if(keyValue.length==2){
+ String keyString = keyValue[0];
+ String valueString = keyValue[1];
+ if (keyString.equals("ignoreImportOfExistingSpecimen")){ //$NON-NLS-1$
+ configurator.setIgnoreImportOfExistingSpecimen(Boolean.valueOf(valueString));
+ }else if (keyString.equals("addIndividualsAssociationsSuchAsSpecimenAndObservations")){ //$NON-NLS-1$
+ configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(Boolean.valueOf(valueString));
+ }else if (keyString.equals("reuseExistingTaxaWhenPossible")){ //$NON-NLS-1$
+ configurator.setReuseExistingTaxaWhenPossible(Boolean.valueOf(valueString));
+ }else if (keyString.equals("ignoreAuthorship")){ //$NON-NLS-1$
+ configurator.setIgnoreAuthorship(Boolean.valueOf(valueString));
+ }else if (keyString.equals("addMediaAsMediaSpecimen")){ //$NON-NLS-1$
+ configurator.setAddMediaAsMediaSpecimen(Boolean.valueOf(valueString));
+ }else if (keyString.equals("reuseExistingMetaData")){ //$NON-NLS-1$
+ configurator.setReuseExistingMetaData(Boolean.valueOf(valueString));
+ }else if (keyString.equals("reuseExistingDescriptiveGroups")){ //$NON-NLS-1$
+ configurator.setReuseExistingDescriptiveGroups(Boolean.valueOf(valueString));
+ }else if (keyString.equals("allowReuseOtherClassifications")){ //$NON-NLS-1$
+ configurator.setAllowReuseOtherClassifications(Boolean.valueOf(valueString));
+ }else if (keyString.equals("deduplicateReferences")){ //$NON-NLS-1$
+ configurator.setDeduplicateReferences(Boolean.valueOf(valueString));
+ }else if (keyString.equals("deduplicateClassifications")){ //$NON-NLS-1$
+ configurator.setDeduplicateClassifications(Boolean.valueOf(valueString));
+ }else if (keyString.equals("moveNewTaxaToDefaultClassification")){ //$NON-NLS-1$
+ configurator.setMoveNewTaxaToDefaultClassification(Boolean.valueOf(valueString));
+ }else if (keyString.equals("mapUnitIdToCatalogNumber")){ //$NON-NLS-1$
+ configurator.setMapUnitIdToCatalogNumber(Boolean.valueOf(valueString));
+ }else if (keyString.equals("mapUnitIdToAccessionNumber")){ //$NON-NLS-1$
+ configurator.setMapUnitIdToAccessionNumber(Boolean.valueOf(valueString));
+ }else if (keyString.equals("mapUnitIdToBarcode")){ //$NON-NLS-1$
+ configurator.setMapUnitIdToBarcode(Boolean.valueOf(valueString));
+ }else if (keyString.equals("overwriteExistingSpecimens")){ //$NON-NLS-1$
+ configurator.setOverwriteExistingSpecimens(Boolean.valueOf(valueString));
+ }else if (keyString.equals("nomenclaturalCode")){ //$NON-NLS-1$
+ configurator.setNomenclaturalCode(NomenclaturalCode.fromString(valueString));
+ }else if (keyString.equals("getSiblings")){ //$NON-NLS-1$
+ configurator.setGetSiblings(Boolean.valueOf(valueString));
+ }else if (keyString.equals("removeCountryFromLocalityText")){ //$NON-NLS-1$
+ configurator.setRemoveCountryFromLocalityText(Boolean.valueOf(valueString));
+ }else if (keyString.equals("dnaSource")){ //$NON-NLS-1$
+ configurator.setDnaSoure(URI.create(valueString));
+ }
+
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2018 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.preference;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
+
+/**
+ * @author k.luther
+ * @since 23.03.2018
+ *
+ */
+public class AbcdImportProvider extends CdmPreferencePage implements IE4PreferencePage{
+
+ private ListComponent biocaseProviderList;
+
+ @Override
+ protected Control createContents(Composite parent) {
+ final Composite composite = new Composite(parent, SWT.NULL);
+ final CLabel description = new CLabel(composite, SWT.NULL);
+ description.setText(Messages.AbcdImportProvider_description);
+ GridLayout gridLayout = new GridLayout();
+ composite.setLayout(gridLayout);
+
+ gridLayout.numColumns = 3;
+ //gridLayout.horizontalSpacing= 5;
+ //gridLayout.makeColumnsEqualWidth = true;
+
+ composite.setLayout(gridLayout);
+ biocaseProviderList = new ListComponent(composite, SWT.SCROLL_LINE,false);
+ setApply(true);
+ return composite;
+ }
+
+ @Override
+ public boolean performOk() {
+ String providerList = null;
+ if (biocaseProviderList != null){
+ providerList = biocaseProviderList.createAllProviderString();
+ PreferencesUtil.setStringValue(PreferencePredicate.BioCaseProvider.getKey(), providerList);
+
+
+ }
+
+ return true;
+ }
+
+}
areaOrderSelectionCombo = createCombo(child, TermOrder.values(), PreferencePredicate.AreasSortedInDistributionEditor, Messages.ChecklistEditorGeneralPreference_Configure_area_order, isAdminPreference);\r
\r
index = 0;\r
- TermOrder areaOrder;\r
- try {\r
- if (orderAreas != null) {\r
- areaOrder = TermOrder.valueOf(orderAreas);\r
- } else {\r
- areaOrder = TermOrder.IdInVoc;\r
- }\r
- } catch (IllegalArgumentException e) {\r
- areaOrder = TermOrder.IdInVoc;\r
- }\r
+\r
for (String itemLabel : areaOrderSelectionCombo.getItems()) {\r
if (itemLabel.startsWith(Messages.Preference_Use_Default) && orderAreas == null){\r
areaOrderSelectionCombo.select(index);\r
break;\r
}\r
- if (itemLabel.startsWith(areaOrder.getLabel())) {\r
+ if (itemLabel.startsWith(orderAreas)) {\r
areaOrderSelectionCombo.select(index);\r
break;\r
}\r
\r
\r
index = 0;\r
- TermDisplayEnum areaDisplay;\r
- try {\r
- if (displayArea != null) {\r
- areaDisplay = TermDisplayEnum.valueOf(displayArea);\r
- } else {\r
- areaDisplay = TermDisplayEnum.Title;\r
- }\r
- } catch (IllegalArgumentException e) {\r
- areaDisplay = TermDisplayEnum.Title;\r
- }\r
+\r
for (String itemLabel : areaDisplaySelectionCombo.getItems()) {\r
if (itemLabel.startsWith(Messages.Preference_Use_Default) && displayArea == null){\r
areaDisplaySelectionCombo.select(index);\r
break;\r
- }\r
- if (itemLabel.startsWith(areaDisplay.getLabel())) {\r
+ }else if (itemLabel.startsWith(displayArea)) {\r
areaDisplaySelectionCombo.select(index);\r
break;\r
}\r
statusDisplaySelectionCombo = createCombo(child, TermDisplayEnum.values(), PreferencePredicate.DisplayOfStatus, Messages.ChecklistEditorGeneralPreference_Configure_display_of_Status, isAdminPreference);\r
\r
index = 0;\r
- TermDisplayEnum statusDisplay;\r
- try {\r
- if (displayStatus != null) {\r
- statusDisplay = TermDisplayEnum.valueOf(displayStatus);\r
- } else {\r
- statusDisplay = TermDisplayEnum.Title;\r
- }\r
- } catch (IllegalArgumentException e) {\r
- statusDisplay = TermDisplayEnum.Title;\r
- }\r
+\r
for (String itemLabel : statusDisplaySelectionCombo.getItems()) {\r
if (itemLabel.startsWith(Messages.Preference_Use_Default) && displayStatus == null){\r
statusDisplaySelectionCombo.select(index);\r
break;\r
}\r
- if (itemLabel.startsWith(statusDisplay.getLabel())) {\r
+ if (itemLabel.startsWith(displayStatus)) {\r
statusDisplaySelectionCombo.select(index);\r
break;\r
}\r
statusDisplayInComboSelectionCombo = createCombo(child, TermComboEnum.values(), PreferencePredicate.DisplayOfStatusInCombo, Messages.ChecklistEditorGeneralPreference_Configure_display_of_Status_in_Combo, isAdminPreference);\r
\r
index = 0;\r
- TermComboEnum statusComboDisplay;\r
- try {\r
- if (displayStatusCombo != null) {\r
- statusComboDisplay = TermComboEnum.byKey(displayStatusCombo);\r
- } else {\r
- statusComboDisplay = TermComboEnum.Title;\r
- }\r
- } catch (IllegalArgumentException e) {\r
- statusComboDisplay = TermComboEnum.Title;\r
- }\r
+\r
for (String itemLabel : statusDisplayInComboSelectionCombo.getItems()) {\r
if (itemLabel.startsWith(Messages.Preference_Use_Default) && displayStatusCombo == null){\r
statusDisplayInComboSelectionCombo.select(index);\r
break;\r
}\r
- if (itemLabel.startsWith(statusComboDisplay.getLabel())) {\r
+ if (itemLabel.startsWith(displayStatus)) {\r
statusDisplayInComboSelectionCombo.select(index);\r
break;\r
}\r
\r
\r
override = false;\r
- if (!orderAreas.startsWith(Messages.Preference_Use_Default) ) {\r
+ if (orderAreas != null ) {\r
override = true;\r
PreferencesUtil.setSortNamedAreasInDistributionEditor(orderAreas);\r
}\r
\r
\r
override = false;\r
- if (!displayStatus.startsWith(Messages.Preference_Use_Default)) {\r
+ if (displayStatus != null) {\r
override = true;\r
PreferencesUtil.setDisplayStatusInChecklistEditor(displayStatus);\r
}\r
override);\r
\r
override = false;\r
- if (!displayStatusCombo.startsWith(Messages.Preference_Use_Default)) {\r
+ if (displayStatusCombo != null) {\r
override = true;\r
PreferencesUtil.setStringValue(PreferencePredicate.DisplayOfStatusInCombo.getKey(), displayStatusCombo);\r
}\r
\r
\r
override = false;\r
- if (!displayArea.startsWith(Messages.Preference_Use_Default) ) {\r
+ if (displayArea != null) {\r
override = true;\r
PreferencesUtil.setAreaDisplayInChecklistEditor(displayArea);\r
}\r
\r
\r
\r
- PreferencesUtil.setOwnDescriptionForChecklistEditor(ownDescriptionForDistributionEditor);\r
- PreferencesUtil.setBooleanValue(\r
- PreferencesUtil.prefOverrideKey(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey()),\r
- true);\r
+// PreferencesUtil.setOwnDescriptionForChecklistEditor(ownDescriptionForDistributionEditor);\r
+// PreferencesUtil.setBooleanValue(\r
+// PreferencesUtil.prefOverrideKey(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey()),\r
+// true);\r
\r
PreferencesUtil.firePreferencesChanged(this.getClass());\r
\r
\r
ownDescriptionForDistributionEditor = null;\r
\r
- allowOverrideActivatedButton.setSelection(true);\r
+ if (isAdminPreference){\r
+ allowOverrideActivatedButton.setSelection(true);\r
+ allowOverrideAreaDisplayButton.setSelection(true);\r
+ allowOverrideStatusDisplayButton.setSelection(true);\r
+ allowOverrideOrderAreasButton.setSelection(true);\r
+ allowOverrideRankButton.setSelection(true);\r
+ }\r
overrideActivated = true;\r
-\r
overrideAreaDisplay = true;\r
- allowOverrideAreaDisplayButton.setSelection(true);\r
-\r
overrideStatusDisplay = true;\r
- allowOverrideStatusDisplayButton.setSelection(true);\r
-\r
overrideOrderAreas = true;\r
- allowOverrideOrderAreasButton.setSelection(true);\r
-\r
overrideRank = true;\r
- allowOverrideRankButton.setSelection(true);\r
-\r
overrideOwnDescriptionForDistributionEditor = true;\r
\r
\r
if (!isAdminPreference) {\r
- PreferencesUtil.recursiveSetEnabled(child, isEditorActivated);\r
-\r
-\r
- if (!prefRank.isAllowOverride()) {\r
- activateRankCombo.setEnabled(false);\r
-\r
- if (!prefAreaSort.isAllowOverride()) {\r
- areaOrderSelectionCombo.setEnabled(false);\r
- allowOverrideOrderAreasButton.setEnabled(false);\r
- }\r
- if (!prefAreaDisplay.isAllowOverride()) {\r
- allowOverrideAreaDisplayButton.setEnabled(false);\r
- }\r
- if (!prefStatusDisplay.isAllowOverride()) {\r
- allowOverrideStatusDisplayButton.setEnabled(false);\r
- }\r
- }\r
+ PreferencesUtil.recursiveSetEnabled(child, Boolean.parseBoolean(distributionEditorPref.getValue()));\r
+// if (!prefRank.isAllowOverride()) {\r
+// activateRankCombo.setEnabled(false);\r
+//\r
+// if (!prefAreaSort.isAllowOverride()) {\r
+// areaOrderSelectionCombo.setEnabled(false);\r
+// }\r
+// if (!prefAreaDisplay.isAllowOverride()) {\r
+// allowOverrideAreaDisplayButton.setEnabled(false);\r
+// }\r
+// if (!prefStatusDisplay.isAllowOverride()) {\r
+// allowOverrideStatusDisplayButton.setEnabled(false);\r
+// }\r
+// }\r
super.performDefaults();\r
}\r
}\r
@Override
public boolean performOk() {
+ if (!isApply()){
+ return true;
+ }
if (isAllowOverrideShowCheckListPerspective){
PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowChecklistPerspective.getKey()), isOverrideShowCheckListPerspective);
PreferencesUtil.setBooleanValue(PreferencePredicate.ShowChecklistPerspective.getKey(), isShowCheckListPerspective);
+
}
if (isAllowOverrideShowIOMenu){
PreferencesUtil.setBooleanValue(PreferencePredicate.ShowImportExportMenu.getKey(), isShowIOMenu);
if (e.getSource().equals(this.showIOMenuButton)) {
String text = showIOMenuButton.getText();
if (text.startsWith(Messages.Preference_Use_Default)){
- isOverrideShowIOMenu = true;
+ isOverrideShowIOMenu = false;
isShowIOMenu = null;
- }
- if (text.equals(SHOW)){
+ }else if (text.equals(SHOW)){
isShowIOMenu = true;
}else{
isShowIOMenu = false;
if (e.getSource().equals(this.showChecklistPerspectiveButton)) {
String text = showChecklistPerspectiveButton.getText();
if (text.startsWith(Messages.Preference_Use_Default)){
- isOverrideShowCheckListPerspective = true;
+ isOverrideShowCheckListPerspective = false;
isShowCheckListPerspective = null;
- }
- if (text.equals(SHOW)){
+ }else if (text.equals(SHOW)){
isShowCheckListPerspective = true;
}else{
isShowCheckListPerspective = false;
if (e.getSource().equals(this.showTaxonNodeWizardButton)) {
String text = showTaxonNodeWizardButton.getText();
if (text.startsWith(Messages.Preference_Use_Default)){
- isOverrideShowTaxonNodeWizard = true;
+ isOverrideShowTaxonNodeWizard = false;
isShowTaxonNodeWizard = null;
- }
- if (text.equals(SHOW)){
+ }else if (text.equals(SHOW)){
isShowTaxonNodeWizard = true;
}else{
isShowTaxonNodeWizard = false;
parent.setLayout(new GridLayout());
useLocalOrAdmin = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
if (localPref){
- useLocalOrAdmin.add(LocalOrDefaultEnum.Default.getLabel());
- useLocalOrAdmin.add(LocalOrDefaultEnum.Local.getLabel());
+ useLocalOrAdmin.add(LocalOrDefaultEnum.Default.getLabel(), 0);
+ useLocalOrAdmin.add(LocalOrDefaultEnum.Local.getLabel(), 1);
}else{
- useLocalOrAdmin.add(LocalOrDefaultEnum.Database.getLabel());
- useLocalOrAdmin.add(LocalOrDefaultEnum.AllowOverride.getLabel());
+ useLocalOrAdmin.add(LocalOrDefaultEnum.AllowOverride.getLabel(), 0);
+ useLocalOrAdmin.add(LocalOrDefaultEnum.Database.getLabel(), 1);
}
public static final String ALLOW_OVERRIDE_RL = "eu.etaxonomy.taxeditor.isRL.allow_override";
- /*
- * Keys for the Abcd Import Configurator
- *
- */
- public static final String ABCD_IMPORT_CONFIGURATOR_SOURCE_URI = "eu.etaxonomy.taxeditor.abcd_import_configurator.sourceUri";
- public static final String ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS = "eu.etaxonomy.taxeditor.abcd_import_configurator.doSiblings";
- public static final String ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN= "eu.etaxonomy.taxeditor.abcd_import_configurator.ignoreImportOfExistingSpecimen";
- public static final String ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE= "eu.etaxonomy.taxeditor.abcd_import_configurator.reuseExistingTaxaWhenPossible";
- public static final String ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP= "eu.etaxonomy.taxeditor.abcd_import_configurator.ignoreAuthorship";
- public static final String ABCD_IMPORT_CONFIGURATOR_REMOVE_COUNTRY_FROM_LOCALITY_TEXT= "eu.etaxonomy.taxeditor.abcd_import_configurator.removeCountryFromLocalityText";
- public static final String ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN= "eu.etaxonomy.taxeditor.abcd_import_configurator.addMediaAsMediaSpecimen";
- public static final String ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_META_DATA= "eu.etaxonomy.taxeditor.abcd_import_configurator.reuseExistingMetaData";
- public static final String ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS= "eu.etaxonomy.taxeditor.abcd_import_configurator.addIndividualsAssociationsSuchAsSpecimenAndObservations";
- public static final String ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS= "eu.etaxonomy.taxeditor.abcd_import_configurator.reuseExistingDescriptiveGroups";
- public static final String ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS= "eu.etaxonomy.taxeditor.abcd_import_configurator.allowReuseOtherClassifications";
- public static final String ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES= "eu.etaxonomy.taxeditor.abcd_import_configurator.deduplicateReferences";
- public static final String ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS= "eu.etaxonomy.taxeditor.abcd_import_configurator.deduplicateClassifications";
- public static final String ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION= "eu.etaxonomy.taxeditor.abcd_import_configurator.moveNewTaxaToDefaultClassification";
- public static final String ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER= "eu.etaxonomy.taxeditor.abcd_import_configurator.mapUnitIdToCatalogNumber";
- public static final String ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER= "eu.etaxonomy.taxeditor.abcd_import_configurator.mapUnitIdToAccessionNumber";
- public static final String ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE= "eu.etaxonomy.taxeditor.abcd_import_configurator.mapUnitIdToBarcode";
- public static final String ABCD_IMPORT_CONFIGURATOR_OVERWRITE_EXISTING_SPECIMEN= "eu.etaxonomy.taxeditor.abcd_import_configurator.overwriteExistingSpecimens";
- public static final String ABCD_IMPORT_CONFIGURATOR_DEFAULT_AUTHOR = "eu.etaxonomy.taxeditor.abcd_import_configurator.defaultAuthor";
- public static final String ABCD_IMPORT_CONFIGURATOR_CLASSIFICATION_UUID = "eu.etaxonomy.taxeditor.abcd_import_configurator.classificationUuid";
- public static final String ABCD_IMPORT_CONFIGURATOR_NOMENCLATURAL_CODE = "eu.etaxonomy.taxeditor.abcd_import_configurator.nomenclaturalCode";
- public static final String ABCD_IMPORT_CONFIGURATOR_DNA_PROVIDER = "eu.etaxonomy.taxeditor.abcd_import_configurator.dnaProvider";
-
-
-
- /*
- * Keys for the biocase providers
- */
-
- public static final String BIOCASE_PROVIDER_LIST = "eu.etaxonomy.taxeditor.abcd_import.biocaseProviderList" ;
public static final String SHOW_ADVANCED_MEDIA_SECTION = "eu.etaxonomy.taxeditor.media.showAdvancedMedia" + CdmStore.getActiveCdmSource().getName();
public static final String SHOW_MEDIA_PREVIEW = "eu.etaxonomy.taxeditor.media.showMediaPreview"+ CdmStore.getActiveCdmSource().getName();
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
+package eu.etaxonomy.taxeditor.preference;
import java.awt.Toolkit;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.taxeditor.l10n.Messages;
-import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
private static final String noProvider = Messages.ListComponent_NO_PROVIDER_AVAILABLE;
private Button removeButton;
private Text providerURI;
+ boolean isAdmin = false;
- public ListComponent(Composite parent, int style) {
-
- list = new List(parent, SWT.BORDER | SWT.V_SCROLL);
+ public ListComponent(Composite parent, int style, boolean isAdmin) {
+ this.isAdmin= isAdmin;
+ list = new List(parent, SWT.BORDER | SWT.V_SCROLL);
GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true, 2, 3);
gridData.grabExcessHorizontalSpace = true;
list.setLayoutData(gridData);
CdmPreference providerListPreference = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.BioCaseProvider);
String allProviderString = ""; //$NON-NLS-1$
- if (providerListPreference != null){
- allProviderString = providerListPreference.getValue();
+ if (!isAdmin && providerListPreference.isAllowOverride()){
+ allProviderString = PreferencesUtil.getStringValue(PreferencePredicate.BioCaseProvider.getKey(), true);
+ }else{
+ if (providerListPreference != null){
+ allProviderString = providerListPreference.getValue();
+ }
}
// = PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.BIOCASE_PROVIDER_LIST);
//the string is structured like this: http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank;http:...;
String allProviderString = null;
boolean first = true;
for (String item: list.getItems()){
- if (first || allProviderString == null || allProviderString == ""){ //$NON-NLS-1$
+ if (item.equals(noProvider)){
+ //do nothing
+ }else if (first || allProviderString == null || allProviderString == ""){ //$NON-NLS-1$
allProviderString = item.trim();
first = false;
- }else{
+ }else {
allProviderString +=";"+ item.trim(); //$NON-NLS-1$
}
}
@Override
public void widgetSelected(SelectionEvent e) {
setApply(true);
- if (isAdminPreference){
- isAllowOverride = allowLocalPreference.getSelection();
- }else{
- isOverride = allowLocalPreference.getSelection();
- }
-
+ isAllowOverride = allowLocalPreference.getSelection();
}
});
@Override
public boolean performOk() {
- if (nameDetailsConfig != null){
- PreferencesUtil.setStringValue(PreferencePredicate.NameDetailsView.getKey(), nameDetailsConfig.toString());
- if (nameDetailsPref == null || !nameDetailsConfig.toString().equals(nameDetailsPref.getValue())) {
- PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NameDetailsView.getKey()), true);
+ if (isApply()){
+ if (isOverride){
+ PreferencesUtil.setStringValue(PreferencePredicate.NameDetailsView.getKey(), nameDetailsConfig.toString());
+ if (nameDetailsPref == null || !nameDetailsConfig.toString().equals(nameDetailsPref.getValue())) {
+ PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NameDetailsView.getKey()), true);
+ }
+ }else {
+ PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NameDetailsView.getKey()), false);
}
- }
+ }
return true;
}
protected void setButtonSelections(){
int index = 0;
- if (isSimpleDetailsViewActivated != null){
+ if (isSimpleDetailsViewActivated != null && isOverride){
if (isSimpleDetailsViewActivated){
index = 1;
}else{
showHybrid.setSelection(isShowHybrid);
showNameApprobiation.setSelection(isShowNameApprobiation);
secEnabled.setSelection(isSecEnabled);
- secEnabled.setEnabled(isShowTaxon);
+ //secEnabled.setEnabled(isShowTaxon);
showSecDetail.setSelection(isSecDetailsActivated);
- showSecDetail.setEnabled(isShowTaxon);
+ //showSecDetail.setEnabled(isShowTaxon);
}
if (isAdminPreference){
nameDetailsPref.setAllowOverride(true);
allowLocalPreference.setSelection(true);
+ }else{
+ isOverride = false;
}
return;
}
+ isOverride = true;
if (text.equals(ENABLE)){
isSimpleDetailsViewActivated = true;
return config;
} else{
String configString = preference.getValue();
- if(configString!=null){
- String[] configArray = configString.split(";");
-
- for (String configItem: configArray){
- String[] keyValue = configItem.split(":");
- String keyString = keyValue[0];
- String valueString = null;
- if (keyValue.length>1){
- valueString = keyValue[1];
+ extractAbcdConfiguratorFromPreferenceString(config, configString);
+ }
+ return config;
+ }
+
+ public static void extractAbcdConfiguratorFromPreferenceString(Abcd206ImportConfigurator config,
+ String configString) {
+ if(configString!=null){
+ String[] configArray = configString.split(";");
+
+ for (String configItem: configArray){
+ String[] keyValue = configItem.split(":");
+ String keyString = keyValue[0];
+ String valueString = null;
+ if (keyValue.length>1){
+ valueString = keyValue[1];
+ if (keyValue.length>2){
+
+ for (int index = 2; index< keyValue.length; index++){
+ valueString += ":"+ keyValue[index];
+ }
}
- if (keyString.equals("ignoreImportOfExistingSpecimen")){
- config.setIgnoreImportOfExistingSpecimen(Boolean.valueOf(valueString));
- }else if (keyString.equals("addIndividualsAssociationsSuchAsSpecimenAndObservations")){
- config.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(Boolean.valueOf(valueString));
- }else if (keyString.equals("reuseExistingTaxaWhenPossible")){
- config.setReuseExistingTaxaWhenPossible(Boolean.valueOf(valueString));
- }else if (keyString.equals("ignoreAuthorship")){
- config.setIgnoreAuthorship(Boolean.valueOf(valueString));
- }else if (keyString.equals("addMediaAsMediaSpecimen")){
- config.setAddMediaAsMediaSpecimen(Boolean.valueOf(valueString));
- }else if (keyString.equals("reuseExistingMetaData")){
- config.setReuseExistingMetaData(Boolean.valueOf(valueString));
- }else if (keyString.equals("reuseExistingDescriptiveGroups")){
- config.setReuseExistingDescriptiveGroups(Boolean.valueOf(valueString));
- }else if (keyString.equals("allowReuseOtherClassifications")){
- config.setAllowReuseOtherClassifications(Boolean.valueOf(valueString));
- }else if (keyString.equals("deduplicateReferences")){
- config.setDeduplicateReferences(Boolean.valueOf(valueString));
- }else if (keyString.equals("deduplicateClassifications")){
- config.setDeduplicateClassifications(Boolean.valueOf(valueString));
- }else if (keyString.equals("moveNewTaxaToDefaultClassification")){
- config.setMoveNewTaxaToDefaultClassification(Boolean.valueOf(valueString));
- }else if (keyString.equals("mapUnitIdToCatalogNumber")){
- config.setMapUnitIdToCatalogNumber(Boolean.valueOf(valueString));
- }else if (keyString.equals("mapUnitIdToAccessionNumber")){
- config.setMapUnitIdToAccessionNumber(Boolean.valueOf(valueString));
- }else if (keyString.equals("mapUnitIdToBarcode")){
- config.setMapUnitIdToBarcode(Boolean.valueOf(valueString));
- }else if (keyString.equals("overwriteExistingSpecimens")){
- config.setOverwriteExistingSpecimens(Boolean.valueOf(valueString));
- }else if (keyString.equals("nomenclaturalCode")){
- config.setNomenclaturalCode(NomenclaturalCode.fromString(valueString));
- }else{
- logger.debug("This key of the abcd configurator needs to be added to the transformer: " + keyString);
+ }
+ if (keyString.equals("ignoreImportOfExistingSpecimen")){
+ config.setIgnoreImportOfExistingSpecimen(Boolean.valueOf(valueString));
+ }else if (keyString.equals("addIndividualsAssociationsSuchAsSpecimenAndObservations")){
+ config.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(Boolean.valueOf(valueString));
+ }else if (keyString.equals("reuseExistingTaxaWhenPossible")){
+ config.setReuseExistingTaxaWhenPossible(Boolean.valueOf(valueString));
+ }else if (keyString.equals("ignoreAuthorship")){
+ config.setIgnoreAuthorship(Boolean.valueOf(valueString));
+ }else if (keyString.equals("addMediaAsMediaSpecimen")){
+ config.setAddMediaAsMediaSpecimen(Boolean.valueOf(valueString));
+ }else if (keyString.equals("reuseExistingMetaData")){
+ config.setReuseExistingMetaData(Boolean.valueOf(valueString));
+ }else if (keyString.equals("reuseExistingDescriptiveGroups")){
+ config.setReuseExistingDescriptiveGroups(Boolean.valueOf(valueString));
+ }else if (keyString.equals("allowReuseOtherClassifications")){
+ config.setAllowReuseOtherClassifications(Boolean.valueOf(valueString));
+ }else if (keyString.equals("deduplicateReferences")){
+ config.setDeduplicateReferences(Boolean.valueOf(valueString));
+ }else if (keyString.equals("deduplicateClassifications")){
+ config.setDeduplicateClassifications(Boolean.valueOf(valueString));
+ }else if (keyString.equals("moveNewTaxaToDefaultClassification")){
+ config.setMoveNewTaxaToDefaultClassification(Boolean.valueOf(valueString));
+ }else if (keyString.equals("mapUnitIdToCatalogNumber")){
+ config.setMapUnitIdToCatalogNumber(Boolean.valueOf(valueString));
+ }else if (keyString.equals("mapUnitIdToAccessionNumber")){
+ config.setMapUnitIdToAccessionNumber(Boolean.valueOf(valueString));
+ }else if (keyString.equals("mapUnitIdToBarcode")){
+ config.setMapUnitIdToBarcode(Boolean.valueOf(valueString));
+ }else if (keyString.equals("overwriteExistingSpecimens")){
+ config.setOverwriteExistingSpecimens(Boolean.valueOf(valueString));
+ }else if (keyString.equals("nomenclaturalCode")){
+ config.setNomenclaturalCode(NomenclaturalCode.fromString(valueString));
+ }else if (keyString.equals("removeCountryFromLocalityText")){
+ config.setRemoveCountryFromLocalityText(Boolean.valueOf(valueString));
+ }else if (keyString.equals("getSiblings")){
+ config.setGetSiblings(Boolean.valueOf(valueString));
+ }else if (keyString.equals("dnaSource")){
+ try{
+ config.setDnaSoure(URI.create(valueString));
+ }catch(Exception e){
+ config.setDnaSoure(null);
}
+ }else{
+ logger.debug("This key of the abcd configurator needs to be added to the transformer: " + keyString);
}
+
+
}
}
- return config;
}
public static Abcd206ImportConfigurator getLocalAbcdImportConfigurator(){
Abcd206ImportConfigurator config = Abcd206ImportConfigurator.NewInstance(null,null);
-
- config.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS));
-
- config.setAddMediaAsMediaSpecimen(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN));
-
- config.setAllowReuseOtherClassifications(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS));
- config.setDeduplicateClassifications(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS));
- config.setDeduplicateReferences(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES));
- config.setRemoveCountryFromLocalityText(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REMOVE_COUNTRY_FROM_LOCALITY_TEXT));
- config.setGetSiblings(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS));
- config.setIgnoreAuthorship(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP));
- config.setIgnoreImportOfExistingSpecimen(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN));
- config.setMapUnitIdToAccessionNumber(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER));
- config.setMapUnitIdToBarcode(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE));
- config.setMapUnitIdToCatalogNumber(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER));
- config.setMoveNewTaxaToDefaultClassification(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION));
- config.setOverwriteExistingSpecimens(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_OVERWRITE_EXISTING_SPECIMEN));
- config.setReuseExistingDescriptiveGroups(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS));
- config.setReuseExistingMetaData(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_META_DATA));
- config.setReuseExistingTaxaWhenPossible(getBooleanValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE));
- config.setNomenclaturalCode(NomenclaturalCode.getByKey(getStringValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_NOMENCLATURAL_CODE)));
- try{
- config.setDnaSoure(!StringUtils.isBlank(getStringValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DNA_PROVIDER))? URI.create(getStringValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DNA_PROVIDER)):null);
- }catch(Exception e){
- config.setDnaSoure(null);
- }
- return config;
+ String configString = getStringValue(PreferencePredicate.AbcdImportConfig.getKey(), true);
+ extractAbcdConfiguratorFromPreferenceString(config, configString);
+ return config;
}
public static void resetToDBPreferenceAbcdCOnfigurator(){
Abcd206ImportConfigurator config = getDBAbcdImportConfigurationPreference();
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS, config.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN, config.isAddMediaAsMediaSpecimen());
-
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS, config.isAllowReuseOtherClassifications());
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS, config.isDeduplicateClassifications());
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES, config.isDeduplicateReferences());
-
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS, config.isGetSiblings());
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP, config.isIgnoreAuthorship());
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN, config.isIgnoreImportOfExistingSpecimen());
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER, config.isMapUnitIdToAccessionNumber());
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE, config.isMapUnitIdToBarcode());
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER, config.isMapUnitIdToCatalogNumber());
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION, config.isMoveNewTaxaToDefaultClassification());
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_OVERWRITE_EXISTING_SPECIMEN, config.isOverwriteExistingSpecimens());
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS, config.isReuseExistingDescriptiveGroups());
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_META_DATA, config.isReuseExistingMetaData());
- setBooleanValue(ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE, config.isReuseExistingTaxaWhenPossible());
- if (config.getNomenclaturalCode() != null){
- setStringValue(ABCD_IMPORT_CONFIGURATOR_NOMENCLATURAL_CODE, config.getNomenclaturalCode().getKey());
- }
+ setStringValue(PreferencePredicate.AbcdImportConfig.getKey(), config.toString());
+
}
public static boolean isSortTaxaByRankAndName() {
Button allowOverrideButton;
protected boolean allowOverride;
+ private boolean override = true;
@Override
@Override
public boolean performOk() {
- if (publishFlagBehaviour != null){
+ if (publishBehaviour != null){
String text = publishFlagBehaviour.getText();
for (PublishEnum display: PublishEnum.values()){
if (text.startsWith(display.getLabel())){
PreferencesUtil.setStringValue(PreferencePredicate.DefaultBehaviourForPublishFlag.getKey(), text);
if (pref == null || !pref.getValue().equals(text)){
PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DefaultBehaviourForPublishFlag.getKey()), true);
- }else{
- PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DefaultBehaviourForPublishFlag.getKey()), false);
}
+ }else{
+ PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DefaultBehaviourForPublishFlag.getKey()), false);
}
return true;
}
@Override
public void getValues(){
-
+ publishBehaviour = null;
try{
- publishBehaviour = PublishEnum.valueOf(PreferencesUtil.getStringValue(PreferencePredicate.DefaultBehaviourForPublishFlag.getKey(), true));
+ String publishString = PreferencesUtil.getStringValue(PreferencePredicate.DefaultBehaviourForPublishFlag.getKey(), true);
+
+ if (publishString != null){
+ publishBehaviour = PublishEnum.valueOf(publishString);
+ }
}catch (IllegalArgumentException e){
publishBehaviour = PublishEnum.InheritFromParent;
}
+
+ override = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DefaultBehaviourForPublishFlag.getKey()));
+ if (!override){
+ publishBehaviour = null;
+ }
}
@Override
@Override
protected void performDefaults() {
rememberCheckedValues(null);
- useLocalOrAdmin.select(1);
+ useLocalOrAdmin.select(0);
allowOverride = true;
setApply(true);
}
*/
package eu.etaxonomy.taxeditor.preference;
-import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.taxeditor.l10n.Messages;
-import eu.etaxonomy.taxeditor.preference.menu.FieldEditorPreferencePageE4;
+import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
/**
* @author k.luther
* @since 16.10.2018
*
*/
-public class SearchDialogPreferences extends FieldEditorPreferencePageE4 {
+public class SearchDialogPreferences extends CdmPreferencePage implements SelectionListener {
+
+ protected CdmPreference showIdInSelectionDialogPref;
+ protected CdmPreference searchForIdentifierAsDefaultPref;
+ protected CdmPreference searchForIdentifierAndTitleCachePref;
+ protected CdmPreference sortTaxaByRankAndNamePref;
+ protected CdmPreference filterCommonNameReferencesPref;
+
+
+ protected Boolean showIdInSelectionDialog;
+ protected Boolean searchForIdentifierAsDefault;
+ protected Boolean searchForIdentifierAndTitleCache;
+ protected Boolean sortTaxaByRankAndName;
+ protected Boolean filterCommonNameReferences;
+
+ private boolean overrideShowIdInSelectionDialog;
+ private boolean overrideSearchForIdentifierAsDefault;
+ private boolean overrideSearchForIdentifierAndTitleCache;
+ private boolean overrideSortTaxaByRankAndName;
+ private boolean overrideFilterCommonNameReferences;
+
+ protected Combo showIdInSelectionDialogButton;
+ protected Button allowOverrideIsShowIdInSelectionDialogButton;
+ protected Combo searchForIdentifierAsDefaultButton;
+ protected Button allowOverrideSearchForIdentifierAsDefaultButton;
+ protected Combo searchForIdentifierAndTitleCacheButton;
+ protected Button allowOverridesSearchForIdentifierAndTitleCacheButton;
+ protected Combo sortTaxaByRankAndNameButton;
+ protected Button allowOverrideIsSortTaxaByRankAndNameButton;
+ protected Combo filterCommonNameReferenceButton;
+ protected Button allowOverrideFilterCommonNameReferencesButton;
+
+
+
+ @Override
+ public void getValues(){
+
+ showIdInSelectionDialogPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowIdInSelectionDialog);
+ searchForIdentifierAsDefaultPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.SearchForIdentifierAsDefault);
+ searchForIdentifierAndTitleCachePref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.SearchForIdentifierAndTitleCache);
+ sortTaxaByRankAndNamePref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.SortTaxaByRankAndName);
+ filterCommonNameReferencesPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameReferencesWithMarker);
+
+ overrideShowIdInSelectionDialog = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.ShowIdInSelectionDialog.getKey()));
+ overrideSearchForIdentifierAsDefault = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.SearchForIdentifierAsDefault.getKey()));
+ overrideSearchForIdentifierAndTitleCache = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey()));
+ overrideSortTaxaByRankAndName = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.SortTaxaByRankAndName.getKey()));
+ overrideFilterCommonNameReferences = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.CommonNameReferencesWithMarker.getKey()));
+
+ showIdInSelectionDialog = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSelectionDialog.getKey());
+ searchForIdentifierAsDefault = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAsDefault.getKey());
+ searchForIdentifierAndTitleCache = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey());
+ sortTaxaByRankAndName = PreferencesUtil.getBooleanValue(PreferencePredicate.SortTaxaByRankAndName.getKey());
+ filterCommonNameReferences = PreferencesUtil.getBooleanValue(PreferencePredicate.CommonNameReferencesWithMarker.getKey());
+
+
+ }
+
+
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setApply(true);
+ if (e.getSource().equals(this.showIdInSelectionDialogButton)) {
+ String text = showIdInSelectionDialogButton.getText();
+ if(text.startsWith(Messages.Preference_Use_Default)){
+ showIdInSelectionDialog = null;
+ if (isAdminPreference){
+ showIdInSelectionDialogPref.setAllowOverride(true);
+ allowOverrideIsShowIdInSelectionDialogButton.setSelection(true);
+ }
+ return;
+ }
+ if (text.equals(Messages.GeneralPreference_yes)){
+ showIdInSelectionDialog = true;
+ }else{
+ showIdInSelectionDialog = false;
+ }
+ }
+
+ if (e.getSource().equals(this.searchForIdentifierAsDefaultButton)) {
+ String text = searchForIdentifierAsDefaultButton.getText();
+ if(text.startsWith(Messages.Preference_Use_Default)){
+ searchForIdentifierAsDefault = null;
+ if (isAdminPreference){
+ searchForIdentifierAsDefaultPref.setAllowOverride(true);
+ allowOverrideSearchForIdentifierAsDefaultButton.setSelection(true);
+ }
+ return;
+ }
+ if (text.equals(Messages.GeneralPreference_yes)){
+ searchForIdentifierAsDefault = true;
+ }else{
+ searchForIdentifierAsDefault = false;
+ }
+ }
+
+ if (e.getSource().equals(this.searchForIdentifierAndTitleCacheButton)) {
+ String text = searchForIdentifierAndTitleCacheButton.getText();
+ if(text.startsWith(Messages.Preference_Use_Default)){
+ searchForIdentifierAndTitleCache = null;
+ if (isAdminPreference){
+ searchForIdentifierAndTitleCachePref.setAllowOverride(true);
+ allowOverridesSearchForIdentifierAndTitleCacheButton.setSelection(true);
+ }
+ return;
+ }
+ if (text.equals(Messages.GeneralPreference_yes)){
+ searchForIdentifierAndTitleCache = true;
+ }else{
+ searchForIdentifierAndTitleCache = false;
+ }
+ }
+
+ if (e.getSource().equals(this.sortTaxaByRankAndNameButton)) {
+ String text = sortTaxaByRankAndNameButton.getText();
+ if(text.startsWith(Messages.Preference_Use_Default)){
+ sortTaxaByRankAndName = null;
+ if (isAdminPreference){
+ sortTaxaByRankAndNamePref.setAllowOverride(true);
+ allowOverrideIsSortTaxaByRankAndNameButton.setSelection(true);
+ }
+ return;
+ }
+ if (text.equals(Messages.GeneralPreference_yes)){
+ sortTaxaByRankAndName = true;
+ }else{
+ sortTaxaByRankAndName = false;
+ }
+ }
+
+ if (e.getSource().equals(this.filterCommonNameReferenceButton)) {
+ String text = filterCommonNameReferenceButton.getText();
+ if(text.startsWith(Messages.Preference_Use_Default)){
+ filterCommonNameReferences = null;
+ if (isAdminPreference){
+ filterCommonNameReferencesPref.setAllowOverride(true);
+ allowOverrideFilterCommonNameReferencesButton.setSelection(true);
+ }
+ return;
+ }
+ if (text.equals(Messages.GeneralPreference_yes)){
+ filterCommonNameReferences = true;
+ }else{
+ filterCommonNameReferences = false;
+ }
+ }
+
+
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
- /**
- * {@inheritDoc}
- */
@Override
- protected void createFieldEditors() {
- addField(new BooleanFieldEditor(PreferencesUtil.createPreferenceString(IPreferenceKeys.SHOW_ID_IN_ENTITY_SELECTION_DIAOLOG),
- Messages.SearchDialogPreferences_0,
- getFieldEditorParent()));
- addField(new BooleanFieldEditor(PreferencesUtil.createPreferenceString(IPreferenceKeys.IS_SEARCH_FOR_IDENTIFIER_AS_DEFAULT),
- Messages.SearchDialogPreferences_1,
- getFieldEditorParent()));
- addField(new BooleanFieldEditor(PreferencesUtil.createPreferenceString(IPreferenceKeys.SEARCH_FOR_IDENTIFIER_AND_TITLECACHE),
- Messages.SearchDialogPreferences_2,
- getFieldEditorParent()));
- addField(new BooleanFieldEditor(PreferencesUtil.createPreferenceString(IPreferenceKeys.SORT_TAXA_BY_RANK_AND_NAME),
- Messages.SearchDialogPreferences_3,
- getFieldEditorParent()));
- addField(new BooleanFieldEditor(PreferencesUtil.createPreferenceString(
- IPreferenceKeys.FILTER_COMMON_NAME_REFERENCES),
- Messages.SearchDialogPreferences_4, getFieldEditorParent()));
+ protected Control createContents(Composite parent) {
+ getValues();
+ Composite titleComp = createComposite(parent);
+ GridData gridData = createTextGridData();
+ Label separator= new Label(titleComp, SWT.HORIZONTAL | SWT.SEPARATOR);
+ separator.setLayoutData(gridData);
+ separator.setVisible(false);
+ showIdInSelectionDialogButton = createBooleanCombo(titleComp, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.ShowIdInSelectionDialog, Messages.DatabasePreferncesPage_Show_Id_In_SelectionDialog, isAdminPreference);
+ showIdInSelectionDialogButton.addSelectionListener(this);
+ int index = 0;
+ for (String itemLabel : showIdInSelectionDialogButton.getItems()) {
+ if (itemLabel.startsWith(Messages.Preference_Use_Default) && showIdInSelectionDialog == null) {
+ showIdInSelectionDialogButton.select(index);
+ break;
+ }
+ if (itemLabel.equals(Messages.GeneralPreference_yes) && showIdInSelectionDialog){
+ showIdInSelectionDialogButton.select(index);
+ break;
+ }
+ if (itemLabel.equals(Messages.GeneralPreference_no) && !showIdInSelectionDialog){
+ showIdInSelectionDialogButton.select(index);
+ break;
+ }
+ index++;
+ }
+ if (!isAdminPreference && showIdInSelectionDialogPref != null){
+ showIdInSelectionDialogButton.setEnabled(showIdInSelectionDialogPref.isAllowOverride());
+ }
+ if (isAdminPreference){
+ allowOverrideIsShowIdInSelectionDialogButton = createAllowOverrideButton(titleComp);
+ allowOverrideIsShowIdInSelectionDialogButton.setSelection(showIdInSelectionDialogPref != null? showIdInSelectionDialogPref.isAllowOverride(): true);
+ allowOverrideIsShowIdInSelectionDialogButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setApply(true);
+ if (showIdInSelectionDialogPref == null){
+ showIdInSelectionDialogPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowIdInSelectionDialog, null);
+ }
+ showIdInSelectionDialogPref.setAllowOverride(allowOverrideIsShowIdInSelectionDialogButton.getSelection());
+ }
+ });
+ }
+
+ Composite composite = createComposite(parent);
+ //composite.setEnabled(isShowSpecimenRelatedIssues);
+ gridData = createTextGridData();
+
+ separator= new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ separator.setLayoutData(gridData);
+
+ searchForIdentifierAsDefaultButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.SearchForIdentifierAsDefault, Messages.DatabasePreferncesPage_Search_for_identifier_as_default, isAdminPreference);
+
+ searchForIdentifierAsDefaultButton.addSelectionListener(this);
+ index = 0;
+ for (String itemLabel : searchForIdentifierAsDefaultButton.getItems()) {
+ if (searchForIdentifierAsDefault == null && itemLabel.startsWith(Messages.Preference_Use_Default)) {
+ searchForIdentifierAsDefaultButton.select(index);
+ break;
+ }
+ if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAsDefault){
+ searchForIdentifierAsDefaultButton.select(index);
+ break;
+ }
+ if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAsDefault){
+ searchForIdentifierAsDefaultButton.select(index);
+ break;
+ }
+ index++;
+ }
+ if (isAdminPreference){
+ allowOverrideSearchForIdentifierAsDefaultButton = createAllowOverrideButton(composite);
+ allowOverrideSearchForIdentifierAsDefaultButton.setSelection(searchForIdentifierAsDefaultPref != null?searchForIdentifierAsDefaultPref.isAllowOverride(): true);
+ allowOverrideSearchForIdentifierAsDefaultButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setApply(true);
+ if (searchForIdentifierAsDefaultPref == null){
+ searchForIdentifierAsDefaultPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAsDefault, null);
+ }
+ searchForIdentifierAsDefaultPref.setAllowOverride(allowOverrideSearchForIdentifierAsDefaultButton.getSelection());
+ }
+ });
+ }
+ if(!isAdminPreference && searchForIdentifierAsDefaultPref != null){
+ searchForIdentifierAsDefaultButton.setEnabled(searchForIdentifierAsDefaultPref.isAllowOverride());
+ }
+
+ searchForIdentifierAndTitleCacheButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.SearchForIdentifierAndTitleCache, Messages.DatabasePreferncesPage_search_for_identifier_and_titleCache, isAdminPreference);
+ searchForIdentifierAndTitleCacheButton.addSelectionListener(this);
+ index = 0;
+ for (String itemLabel : searchForIdentifierAndTitleCacheButton.getItems()) {
+ if (searchForIdentifierAndTitleCache == null && itemLabel.startsWith(Messages.Preference_Use_Default)) {
+ searchForIdentifierAndTitleCacheButton.select(index);
+ break;
+ }
+ if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAndTitleCache){
+ searchForIdentifierAndTitleCacheButton.select(index);
+ break;
+ }
+ if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAndTitleCache){
+ searchForIdentifierAndTitleCacheButton.select(index);
+ break;
+ }
+ index++;
+ }
+ if(!isAdminPreference && searchForIdentifierAndTitleCachePref != null){
+ searchForIdentifierAndTitleCacheButton.setEnabled(searchForIdentifierAndTitleCachePref.isAllowOverride());
+ }
+
+ if (isAdminPreference){
+ allowOverridesSearchForIdentifierAndTitleCacheButton = createAllowOverrideButton(composite);
+ allowOverridesSearchForIdentifierAndTitleCacheButton.setSelection(searchForIdentifierAndTitleCachePref != null?searchForIdentifierAndTitleCachePref.isAllowOverride():true);
+ allowOverridesSearchForIdentifierAndTitleCacheButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setApply(true);
+ if (searchForIdentifierAndTitleCachePref == null){
+ searchForIdentifierAndTitleCachePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SearchForIdentifierAndTitleCache, null);
+ }
+ searchForIdentifierAndTitleCachePref.setAllowOverride(allowOverridesSearchForIdentifierAndTitleCacheButton.getSelection());
+ }
+ });
+ }
+
+ sortTaxaByRankAndNameButton =createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.SortTaxaByRankAndName, Messages.DatabasePreferncesPage_Sort_Taxa_By_Name_And_Rank, isAdminPreference);
+
+
+ sortTaxaByRankAndNameButton.addSelectionListener(this);
+ index = 0;
+ for (String itemLabel : sortTaxaByRankAndNameButton.getItems()) {
+ if (sortTaxaByRankAndName == null && itemLabel.startsWith(Messages.Preference_Use_Default)) {
+ sortTaxaByRankAndNameButton.select(index);
+ break;
+ }
+ if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_yes) && sortTaxaByRankAndName){
+ sortTaxaByRankAndNameButton.select(index);
+ break;
+ }
+ if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_no) && !sortTaxaByRankAndName){
+ sortTaxaByRankAndNameButton.select(index);
+ break;
+ }
+ index++;
+ }
+ if ( !isAdminPreference && sortTaxaByRankAndNamePref != null){
+ sortTaxaByRankAndNameButton.setEnabled(sortTaxaByRankAndNamePref.isAllowOverride());
+ }
+
+ if (isAdminPreference){
+ allowOverrideIsSortTaxaByRankAndNameButton = createAllowOverrideButton(composite);
+ allowOverrideIsSortTaxaByRankAndNameButton.setSelection(sortTaxaByRankAndNamePref != null? sortTaxaByRankAndNamePref.isAllowOverride(): true);
+ allowOverrideIsSortTaxaByRankAndNameButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setApply(true);
+ if (sortTaxaByRankAndNamePref == null){
+ sortTaxaByRankAndNamePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.SortTaxaByRankAndName, null);
+ }
+ sortTaxaByRankAndNamePref.setAllowOverride(allowOverrideIsSortTaxaByRankAndNameButton.getSelection());
+ }
+ });
+ }
+
+ filterCommonNameReferenceButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.CommonNameReferencesWithMarker, Messages.DatabasePreferncesPage_CommonNameFilter, isAdminPreference);
+ filterCommonNameReferenceButton.addSelectionListener(this);
+
+ index = 0;
+ for (String itemLabel: filterCommonNameReferenceButton.getItems()) {
+ if (filterCommonNameReferences == null && itemLabel.startsWith(Messages.Preference_Use_Default)) {
+ filterCommonNameReferenceButton.select(index);
+ break;
+ }
+ if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_yes) && filterCommonNameReferences){
+ filterCommonNameReferenceButton.select(index);
+ break;
+ }
+ if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_no) && !filterCommonNameReferences){
+ filterCommonNameReferenceButton.select(index);
+ break;
+ }
+ index++;
+ }
+ if (!isAdminPreference && filterCommonNameReferencesPref != null){
+ filterCommonNameReferenceButton.setEnabled(filterCommonNameReferencesPref.isAllowOverride());
+ }
+
+ if (isAdminPreference){
+ allowOverrideFilterCommonNameReferencesButton = createAllowOverrideButton(composite);
+ allowOverrideFilterCommonNameReferencesButton.setSelection(filterCommonNameReferencesPref != null? filterCommonNameReferencesPref.isAllowOverride():true);
+ allowOverrideFilterCommonNameReferencesButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setApply(true);
+ if (filterCommonNameReferencesPref == null){
+ filterCommonNameReferencesPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameReferencesWithMarker, null);
+ }
+ filterCommonNameReferencesPref.setAllowOverride(allowOverrideFilterCommonNameReferencesButton.getSelection());
+ }
+ });
+ }
+
+
+
+ return composite;
+ }
+
+ @Override
+ protected void performDefaults() {
+ //TODO
+ super.performDefaults();
}
+ @Override
+ public boolean performOk(){
+ if (!isApply()){
+ return true;
+ }
+ boolean override = false;
+ if (showIdInSelectionDialog != null ) {
+ override = true;
+ PreferencesUtil.setStringValue(PreferencePredicate.ShowIdInSelectionDialog.getKey(), showIdInSelectionDialog.toString());
+ }
+ PreferencesUtil.setBooleanValue(
+ PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowIdInSelectionDialog.getKey()),
+ override);
+
+ override = false;
+
+ if(searchForIdentifierAsDefault != null){
+ override = true;
+ PreferencesUtil.setStringValue(PreferencePredicate.SearchForIdentifierAsDefault.getKey(), searchForIdentifierAsDefault.toString());
+ }
+ PreferencesUtil.setBooleanValue(
+ PreferencesUtil.prefOverrideKey(PreferencePredicate.SearchForIdentifierAsDefault.getKey()),
+ override);
+ override = false;
+
+ if(searchForIdentifierAndTitleCache != null){
+ override = true;
+ PreferencesUtil.setStringValue(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey(), searchForIdentifierAndTitleCache.toString());
+ }
+ PreferencesUtil.setBooleanValue(
+ PreferencesUtil.prefOverrideKey(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey()),
+ override);
+ override = false;
+
+ if(sortTaxaByRankAndName != null){
+ override = true;
+ PreferencesUtil.setStringValue(PreferencePredicate.SortTaxaByRankAndName.getKey(), sortTaxaByRankAndName.toString());
+ }
+ PreferencesUtil.setBooleanValue(
+ PreferencesUtil.prefOverrideKey(PreferencePredicate.SortTaxaByRankAndName.getKey()),
+ override);
+ override = false;
+
+
+ if(filterCommonNameReferences != null){
+ override = true;
+ PreferencesUtil.setStringValue(PreferencePredicate.CommonNameReferencesWithMarker.getKey(), filterCommonNameReferences.toString());
+ }
+ PreferencesUtil.setBooleanValue(
+ PreferencesUtil.prefOverrideKey(PreferencePredicate.CommonNameReferencesWithMarker.getKey()),
+ override);
+ override = false;
+
+ return true;
+ }
+
+
}