From 76b874f88b5e44d9cf572760d39fecad6a99cdf7 Mon Sep 17 00:00:00 2001 From: Katja Luther Date: Thu, 20 Oct 2016 13:55:27 +0200 Subject: [PATCH 1/1] fix #6050: add the possibility to configure which fields should be displayed in name details view --- .../taxeditor/preference/IPreferenceKeys.java | 11 +++- .../taxeditor/preference/PreferencesUtil.java | 12 ++++ .../TaxonomicEditorGeneralPreferences.java | 62 +++++++++---------- .../ui/section/name/NameDetailElement.java | 23 ++++--- .../name/NonViralNameDetailElement.java | 31 +++++++++- .../taxeditor/view/detail/DetailsViewer.java | 56 ++++++++++------- 6 files changed, 134 insertions(+), 61 deletions(-) diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java index b5485c6df..ccbc6b96e 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java @@ -156,9 +156,11 @@ public interface IPreferenceKeys { public static final String SHOW_ADVANCED_MEDIA_SECTION = "eu.etaxonomy.taxeditor.media.showAdvancedMedia"; public static final String SHOW_SIMPLE_NAME_DETAILS_SECTION = "eu.etaxonomy.taxeditor.name.showSimpleName"; + public static final String SHOW_SIMPLE_NAME_DETAILS_TAXON = "eu.etaxonomy.taxeditor.name.showNameTaxon"; public static final String SHOW_NAME_DETAILS_SECTION_LSID = "eu.etaxonomy.taxeditor.name.showNameLsid"; public static final String SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE = "eu.etaxonomy.taxeditor.name.showNameNomenclaturalCode"; public static final String SHOW_NAME_DETAILS_SECTION_RANK = "eu.etaxonomy.taxeditor.name.showNameRank"; + public static final String SHOW_NAME_DETAILS_SECTION_NAMECACHE = "eu.etaxonomy.taxeditor.name.showNameNameCache"; public static final String SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS = "eu.etaxonomy.taxeditor.name.showNameAtomisedEpithets"; public static final String SHOW_NAME_DETAILS_SECTION_AUTHORSHIP = "eu.etaxonomy.taxeditor.name.showNameAuthorship"; public static final String SHOW_NAME_DETAILS_SECTION_HYBRID = "eu.etaxonomy.taxeditor.name.showNameHybrid"; @@ -167,7 +169,9 @@ public interface IPreferenceKeys { public static final String SHOW_NAME_DETAILS_SECTION_PROTOLOGUE = "eu.etaxonomy.taxeditor.name.showNameProtologue"; public static final String SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION = "eu.etaxonomy.taxeditor.name.showNameTypeDesignation"; public static final String SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP = "eu.etaxonomy.taxeditor.name.showNameNameRelationship"; - + public static final String SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE = "eu.etaxonomy.taxeditor.name.showNameAppendedPhrase"; + public static final String SHOW_NAME_DETAILS_SECTION_CACHE = "eu.etaxonomy.taxeditor.name.showNameCache"; + public static final String PROMPT_FOR_OPEN_SPECIMEN_IN_EDITOR = "eu.etaxonomy.taxeditor.specimen.promptForOpenSpecimenInEditor"; // TODO RL @@ -182,6 +186,11 @@ public interface IPreferenceKeys { */ public static final String P2_REPOSITORY_LIST = "eu.etaxonomy.taxeditor.p2.repositories"; + + + + + } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java index e7eb2a4d1..0dd68af2e 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java @@ -451,6 +451,18 @@ public class PreferencesUtil implements IPreferenceKeys { getPreferenceStore().setDefault(OPENURL_IMAGE_MAX_HEIGHT, "1000"); getPreferenceStore().setDefault(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE, false); getPreferenceStore().setDefault(CHECKLIST_ID_IN_VOCABULARY, true); + getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, true); + getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, true); + getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_HYBRID, true); + getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_LSID, true); + getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, true); + getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NAMECACHE, true); + getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, true); + getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, true); + getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, true); + getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, true); + getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_RANK, true); + getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, true); } /** diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java index 1b68e53ad..38f5377ab 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java @@ -70,42 +70,42 @@ public class TaxonomicEditorGeneralPreferences extends addField(new BooleanFieldEditor(IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS, "Open search results in separate windows", getFieldEditorParent())); - addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, - "Show only a simple name details view", - getFieldEditorParent())); +// addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, +// "Show only a simple name details view", +// getFieldEditorParent())); Composite composite = new Composite(getFieldEditorParent(), SWT.NULL); composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1)); composite.setLayout(new RowLayout(1)); - final Label label = new Label(composite, SWT.NONE); - label.setText("Choose the prefered match mode for searches."); - - final Combo combo_MatchMode = new Combo(composite, SWT.NONE); - - MatchMode[] matchModes = MatchMode.values(); - int currentSelectionIndex = 0; - for(int i = 0; i < matchModes.length; i++){ - MatchMode mode = matchModes[i]; - combo_MatchMode.add(mode.name(),i); - //TODO:the correct preselection is needed here!! - if (mode.equals(PreferencesUtil.getSearchConfigurator().getMatchMode())){ - currentSelectionIndex = i; - } - } - - combo_MatchMode.select(currentSelectionIndex); - - combo_MatchMode.addSelectionListener(new SelectionAdapter() { - /* (non-Javadoc) - * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - @Override - public void widgetSelected(SelectionEvent e) { - int selectionIndex = combo_MatchMode.getSelectionIndex(); - PreferencesUtil.getSearchConfigurator().setMatchMode(MatchMode.valueOf(combo_MatchMode.getItem(selectionIndex))); - } - }); +// final Label label = new Label(composite, SWT.NONE); +// label.setText("Choose the prefered match mode for searches."); +// +// final Combo combo_MatchMode = new Combo(composite, SWT.NONE); +// +// MatchMode[] matchModes = MatchMode.values(); +// int currentSelectionIndex = 0; +// for(int i = 0; i < matchModes.length; i++){ +// MatchMode mode = matchModes[i]; +// combo_MatchMode.add(mode.name(),i); +// //TODO:the correct preselection is needed here!! +// if (mode.equals(PreferencesUtil.getSearchConfigurator().getMatchMode())){ +// currentSelectionIndex = i; +// } +// } +// +// combo_MatchMode.select(currentSelectionIndex); +// +// combo_MatchMode.addSelectionListener(new SelectionAdapter() { +// /* (non-Javadoc) +// * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) +// */ +// @Override +// public void widgetSelected(SelectionEvent e) { +// int selectionIndex = combo_MatchMode.getSelectionIndex(); +// PreferencesUtil.getSearchConfigurator().setMatchMode(MatchMode.valueOf(combo_MatchMode.getItem(selectionIndex))); +// } +// }); diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java index b4e733ed7..ca153c81f 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java @@ -79,18 +79,27 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement