handledmenuitem.label.23 = Owl Import\r
\r
page.name.104 = Distribution Data\r
-page.name.105 = Vocabularies and Status
+page.name.105 = Status\r
+page.name.106 = Named area vocabularies
\r
page.name.sources = Sources
partdescriptor.label.4 = Character Tree Editor
page.name.48 = Auswahldialoge
command.name.111 = \u00d6ffne Admin Verbreitungsstatus-Wizard
command.name.112 = \u00d6ffne Admin Common Name Area-Wizard
-command.name.112 = \u00d6ffne Common Name Area-Wizard
+command.name.120 = \u00d6ffne Common Name Area-Wizard
handledmenuitem.label.1 = Neu
handledmenuitem.label.2 = Term als Kind hinzufügen
handledmenuitem.label.3 = Term hinzufügen
handledmenuitem.label.23 = Owl Import
page.name.104 = Verbreitungsdaten
-page.name.105 = Vokabulare und Status
-
+page.name.105 = Status
+page.name.106 = Gebietsvokabulare
page.name.sources = Quellen
partdescriptor.label.4 = Character-Baum-Editor
partdescriptor.label.5 = Struktur-Baum-Editor
<elements xsi:type="commands:Command" xmi:id="_FTpC0MVSEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler" commandName="%command.name.11"/>
<elements xsi:type="commands:Command" xmi:id="_Vs75kMVfEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler" commandName="%command.name.110"/>
<elements xsi:type="commands:Command" xmi:id="_tPtdwMiIEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardAdminHandler" commandName="%command.name.111"/>
- <elements xsi:type="commands:Command" xmi:id="_tRsg8MrcEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.store.open.OpenCommonNameAreaWizardAdminHandler" commandName="%command.name.112"/>
+ <elements xsi:type="commands:Command" xmi:id="_tRsg8MrcEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardHandler" commandName="%command.name.112"/>
<elements xsi:type="commands:Command" xmi:id="_nP0XMNhHEeijwMElCRdOhg" elementId="org.eclipse.ui.file.restartWorkbench" commandName="%command.commandname.10"/>
<elements xsi:type="commands:Command" xmi:id="_cMyQ4NjyEeidDMMI9xTsbQ" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.copyFeature" commandName="%command.commandname.11"/>
<elements xsi:type="commands:Command" xmi:id="_xDk5kNjyEeidDMMI9xTsbQ" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.pasteFeature" commandName="%command.commandname.12"/>
<elements xsi:type="commands:Command" xmi:id="_lJi2sGZvEemew5ARzf3JfA" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionPerAreaStatusWizardHandler" commandName="%command.commandname.18"/>
<elements xsi:type="commands:Command" xmi:id="_QnWnMGZ-Eemew5ARzf3JfA" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionAreaWizardHandler" commandName="%command.commandname.19"/>
<elements xsi:type="commands:Command" xmi:id="_WISF0H1LEem6uMX-L-maww" elementId="eu.etaxonomy.taxeditor.store.command.export.term.owl" commandName="%command.commandname.21"/>
+ <elements xsi:type="commands:Command" xmi:id="_sKIVINL6Eem35L6JVBxwwA" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler" commandName="%command.name.120"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="xpath:/">
<elements xsi:type="commands:Handler" xmi:id="_rVEdIGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
<elements xsi:type="commands:Handler" xmi:id="_zdDe8BWNEeiazYUJirF0Pw" elementId="eu.etaxonomy.taxeditor.handler.update.UpdateHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.update.UpdateHandler" command="_jSJrsBWPEeiazYUJirF0Pw"/>
<elements xsi:type="commands:Handler" xmi:id="_4owEkMVREeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionEditorWizardHandlerAdminE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionEditorWizardHandlerAdminE4" command="_Vs75kMVfEeiKErB3UVzQug"/>
<elements xsi:type="commands:Handler" xmi:id="_VBYX4MiQEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStausWizardAdminHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStatusWizardAdminHandler" command="_tPtdwMiIEeiKErB3UVzQug"/>
- <elements xsi:type="commands:Handler" xmi:id="_jnQb8MrcEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler" command="_tRsg8MrcEeiKErB3UVzQug"/>
+ <elements xsi:type="commands:Handler" xmi:id="_jnQb8MrcEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler" command="_tRsg8MrcEeiKErB3UVzQug"/>
<elements xsi:type="commands:Handler" xmi:id="_H_c_EEq2EeeN-dEYnw7m3g" elementId="eu.etaxonomy.taxeditor.featuretree.handler.SaveHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.SaveHandler" command="_LlbAMEq2EeeN-dEYnw7m3g"/>
<elements xsi:type="commands:Handler" xmi:id="_hPTxMBezEeiXusClKZjycQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.AddChildFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.AddChildFeatureHandler" command="_aPYxsBezEeiXusClKZjycQ"/>
<elements xsi:type="commands:Handler" xmi:id="_i-FlkNjyEeidDMMI9xTsbQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.CopyFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.CopyFeatureHandler" command="_cMyQ4NjyEeidDMMI9xTsbQ"/>
<elements xsi:type="commands:Handler" xmi:id="_e-sBgGZwEemew5ARzf3JfA" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStatusPerAreaWizardHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionPerAreaStatusWizardHandler" command="_lJi2sGZvEemew5ARzf3JfA"/>
<elements xsi:type="commands:Handler" xmi:id="_XxpDoGZ-Eemew5ARzf3JfA" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionAreaWizardHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionAreaWizardHandler" command="_QnWnMGZ-Eemew5ARzf3JfA"/>
<elements xsi:type="commands:Handler" xmi:id="_nhGLwH1LEem6uMX-L-maww" elementId="eu.etaxonomy.taxeditor.io.e4.out.owl.OpenOwlTermExportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.out.owl.OpenOwlTermExportWizard" command="_WISF0H1LEem6uMX-L-maww"/>
+ <elements xsi:type="commands:Handler" xmi:id="_3AxAINL9Eem35L6JVBxwwA" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler" command="_sKIVINL6Eem35L6JVBxwwA"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_qT4hgIfTEeecZ4F2Y9Z0Og" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.window" positionInList="before:eu.etaxonomy.taxeditor.application.windowMenu.last">
<elements xsi:type="menu:Menu" xmi:id="_LT3P8IfcEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menu.termeditor" label="%menu.label.1">
</page>
<page
category="eu.etaxonomy.taxeditor.preference.DistributionGeneralPreference"
- class="eu.etaxonomy.taxeditor.preference.DistributionStatusAndNamedAreaVocabularies"
- id="eu.etaxonomy.taxeditor.preference.DistributionStatusAndNamedAreaVocabulariesPage"
+ class="eu.etaxonomy.taxeditor.preference.DistributionStatusPreferencePage"
+ id="eu.etaxonomy.taxeditor.preference.DistributionStatusPreferencePage"
name="%page.name.105">
</page>
+ <page
+ category="eu.etaxonomy.taxeditor.preference.DistributionGeneralPreference"
+ class="eu.etaxonomy.taxeditor.preference.NamedAreaVocabularyPreferencePage"
+ id="eu.etaxonomy.taxeditor.preference.NamedAreaVocabularyPreferencePage"
+ name="%page.name.106">
+ </page>
<page
category="eu.etaxonomy.taxeditor.preferences.general"
class="eu.etaxonomy.taxeditor.preference.LanguageEditorPreferencePage"
</page>
<page
category="eu.etaxonomy.taxeditor.store.Distribution"
- class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.DistributionStatusAndNamedAreaVocabulariesAdminPreference"
+ class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.DistributionStatusAdminPreference"
id="eu.etaxonomy.taxeditor.store.distributionVocabulariesAndStatus"
name="%page.name.105">
</page>
+ <page
+ category="eu.etaxonomy.taxeditor.store.Distribution"
+ class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.NamedAreaVocabularyAdminPreferencePage"
+ id="eu.etaxonomy.taxeditor.store.distributionNamedAreaVocabularies"
+ name="%page.name.106">
+ </page>
<page
category="eu.etaxonomy.taxeditor.store.abcdImportPreference"
class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.AbcdImportProviderAdminPreferencePage"
--- /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.databaseAdmin.preferencePage;
+
+import java.util.List;
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.taxeditor.preference.CommonNameVocabularyPreference;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @since 05.10.2018
+ *
+ */
+public class CommonNameVocabularyAdminPreference extends CommonNameVocabularyPreference implements IE4AdminPreferencePage {
+
+
+
+
+ @Override
+ public boolean performOk() {
+ if (!isApply()){
+ return true;
+ }
+ PreferencesUtil.setPreferenceToDB(pref);
+ PreferencesUtil.updateDBPreferences();
+
+ return true;
+
+ }
+
+ @Override
+ protected void performDefaults() {
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameAreaVocabularies, null);
+ pref.setAllowOverride(true);
+
+ super.performDefaults();
+ }
+
+ @Override
+ public void getValues() {
+ this.isAdminPreference = true;
+ setPreferenceStore(PreferencesUtil.getPreferenceStore());
+ pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
+ if (pref != null){
+ allowOverride = pref.isAllowOverride();
+ if (pref.getValue() != null){
+ List<UUID> uuids = PreferencesUtil.createUuidList(pref.getValue());
+ vocabularies = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByVocabularyUuids(uuids);
+ }else{
+ vocabularies = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(TermType.NamedArea);
+ }
+
+ }else{
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameAreaVocabularies, "");
+ allowOverride = true;
+ vocabularies = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(TermType.NamedArea);
+ }
+ }
+}
*/
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
-import eu.etaxonomy.taxeditor.preference.DistributionStatusAndNamedAreaVocabularies;
+import eu.etaxonomy.taxeditor.preference.DistributionStatusPreferencePage;
/**
* @author k.luther
* @since 02.07.2019
*
*/
-public class DistributionStatusAndNamedAreaVocabulariesAdminPreference
- extends DistributionStatusAndNamedAreaVocabularies {
+public class DistributionStatusAdminPreference
+ extends DistributionStatusPreferencePage {
@Override
public void getValues() {
super.getValues();
isAdminPreference = true;
- commandHandlerString = "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler";
commandHandlerStringStatus = "eu.etaxonomy.taxeditor.store.open.OpenDistributionPerAreaStatusWizardHandler";
}
--- /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.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.taxeditor.preference.CdmPreferenceCache;
+import eu.etaxonomy.taxeditor.preference.NamedAreaVocabularyPreferencePage;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+
+/**
+ * @author k.luther
+ * @since 12.09.2019
+ */
+public class NamedAreaVocabularyAdminPreferencePage extends NamedAreaVocabularyPreferencePage {
+
+ public NamedAreaVocabularyAdminPreferencePage(){
+ isAdminPreference = true;
+ setPredicate(PreferencePredicate.AvailableDistributionAreaVocabularies);
+ type = TermType.NamedArea;
+
+ }
+ @Override
+ public void getValues() {
+ type = TermType.NamedArea;
+ isAdminPreference = true;
+ CdmPreferenceCache cache = CdmPreferenceCache.instance();
+ cache.getAllTaxEditorDBPreferences();
+ pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies);
+ if (pref == null){
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, PreferencePredicate.AvailableDistributionAreaVocabularies.getDefaultValue() != null ? PreferencePredicate.AvailableDistributionAreaVocabularies.getDefaultValue().toString(): null);
+ }
+
+ }
+
+}
+++ /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.databaseAdmin.preferencePage;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-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;
-import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
-import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
-
-/**
- * @author k.luther
- * @since 05.10.2018
- *
- */
-public class VocabularyAdminPreferences extends CdmPreferencePage implements IE4AdminPreferencePage {
-
- boolean allowOverride;
- CdmPreference pref = null;
-
- @Override
- protected Control createContents(Composite parent) {
- this.isAdminPreference = true;
- Composite composite = createComposite(parent);
- //pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
-
-
- final CLabel commonNameAreaLabel = new CLabel(composite, SWT.NULL);
- commonNameAreaLabel.setText(Messages.VokabularyAdminPreferences_SELECT_VOCABULARY_TEXT);
-
- GridData gridData = new GridData();
- gridData.horizontalSpan = 2;
- commonNameAreaLabel.setLayoutData(gridData);
-
- final CommandHandlerButton button_opencommonNameAreaWizard = new CommandHandlerButton(composite, SWT.PUSH,
- "eu.etaxonomy.taxeditor.store.open.OpenCommonNameAreaWizardAdminHandler"); //$NON-NLS-1$
-
- button_opencommonNameAreaWizard.setText(Messages.GeneralPreference_open_common_name_area_selection);
-// final Button allowOverrideCommonNameAreaCheckButton = createAllowOverrideButton(composite);
-//
-// if (pref != null){
-// allowOverride = pref.isAllowOverride();
-// allowOverrideCommonNameAreaCheckButton.setSelection(allowOverride);
-// }
-// else{
-// allowOverrideCommonNameAreaCheckButton.setSelection(true);
-// }
-//
-// allowOverrideCommonNameAreaCheckButton.addSelectionListener(new SelectionAdapter(){
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// setApply(true);
-// allowOverride = allowOverrideCommonNameAreaCheckButton.getSelection();
-//
-// }
-// });
-
- return composite;
- }
-
- @Override
- public boolean performOk() {
- if (!isApply()){
- return true;
- }
- PreferencesUtil.setPreferenceToDB(pref);
- PreferencesUtil.updateDBPreferences();
-
- return true;
-
- }
-
- @Override
- protected void performDefaults() {
- pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameAreaVocabularies, null);
- pref.setAllowOverride(true);
-
- super.performDefaults();
- }
-}
public static String AbcdImportPreference_reuse_descriptive_group_tooltip;
public static String AbcdImportPreference_reuse_existing_taxa;
public static String AbcdImportPreference_reuse_existing_taxa_tooltip;
- public static String AbcdImportPreference_allow_override;
public static String AbcdImportPreference_allow_override_tooltip;
public static String AbcdImportPreference_override;
public static String AbcdImportPreference_override_tooltip;
public static String DatabasePreferncesPage_NamedAreaSearchField;
+ public static String Preference_allow_override;
+ public static String Delete;
+
AbcdImportPreference_reuse_descriptive_group_tooltip=Reuse one of the existing descriptive groups or create a new one for every import
AbcdImportPreference_reuse_existing_taxa=Reuse existing taxa when possible
AbcdImportPreference_reuse_existing_taxa_tooltip=Reuse existing taxa when the name matches the identified name of the specimen
-AbcdImportPreference_allow_override=Allow override
+Preference_allow_override=Allow override
AbcdImportPreference_allow_override_tooltip=It is allowed to change this preference locally.
AbcdImportPreference_override=Use local preference
AbcdImportPreference_override_tooltip=Use local preference for ABCD import configurator.
SupplementalDataSourcePreferences_SHOW_NAMESPACE=Show ID Namespace
OrderPreferencePage_NotAllowed=The DB preference does not allow to edit this preference locally
+Delete=Delete
AbcdImportPreference_reuse_descriptive_group_tooltip=Bei Taxa, die bereits Faktendaten besitzen, werden die Individual Associations in die bereits existierenden Faktengruppen integriert, sonst wird für jeden Import eine neue Faktengruppe erzeugt.
AbcdImportPreference_reuse_existing_taxa=Existierende Taxa wieder verwenden
AbcdImportPreference_reuse_existing_taxa_tooltip=Wenn Taxa schon existieren, dann werden die Individual Associations an diese angehängt.
-AbcdImportPreference_allow_override=Erlaube Überschreiben
+Preference_allow_override=Erlaube Überschreiben
AbcdImportPreference_allow_override_tooltip=Es dürfen lokale Änderungen an den Präferenzen vorgenommen werden.
AbcdImportPreference_override=Nutze lokale Präferenzen
AbcdImportPreference_override_tooltip=Die lokale Präferenzen für den ABCD Import Konfigurator sollen verwendet werden.
SupplementalDataSourcePreferences_SHOW_NAMESPACE=ID-Namensraum anzeigen
OrderPreferencePage_NotAllowed=Die Datenbank Präferenz erlaub kein Editieren
+Delete=Löschen
checkAllowOverride = new Button(composite, SWT.CHECK);
if (isAdminPreference){
checkAllowOverride.setSelection(allowOverride);
- checkAllowOverride.setText(Messages.AbcdImportPreference_allow_override);
+ checkAllowOverride.setText(Messages.Preference_allow_override);
checkAllowOverride
.setToolTipText(Messages.AbcdImportPreference_allow_override_tooltip);
}else{
--- /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.preference;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Table;
+
+import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
+import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @since 30.08.2019
+ */
+public abstract class AbstractVocabularySelectionPreference extends CdmPreferencePage {
+ protected Table table;
+
+ protected CdmPreference pref;
+ protected TermType type;
+ protected List<CdmPreference> prefsToDelete = new ArrayList<>();
+ protected List<TermVocabularyDto> vocabularies;
+ protected boolean override;
+
+ @Override
+ protected Control createContents(Composite parent) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ *
+ */
+ protected void refresh() {
+ //getValues();
+ table.removeAll();
+ if (pref != null){
+ createTableRow(pref);
+ }
+ table.redraw();
+ table.pack();
+
+ }
+
+ public abstract void createTableRow(CdmPreference pref) ;
+ // public abstract String getUUIDFromSubject(CdmPreference pref);
+
+ protected void fillVocabularies(CdmPreference vocPref){
+ List<UUID> uuids = null;
+ if (isAdminPreference){
+ uuids = PreferencesUtil.createUuidList(vocPref.getValue());
+ }else{
+ uuids = PreferencesUtil.createUUIDListFromStringPref(vocPref.getPredicate(), false);
+ }
+ if (uuids == null || uuids.isEmpty()){
+ vocabularies = new ArrayList();
+ vocabularies = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(type);
+ }else{
+ vocabularies = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByVocabularyUuids(uuids);
+ }
+ }
+
+}
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.layout.GridData;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
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.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.l10n.Messages;
-import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
* @since 05.10.2018
*
*/
-public class CommonNameVocabularySelection extends CdmPreferencePage implements IE4PreferencePage {
+public class CommonNameVocabularyPreference extends AbstractVocabularySelectionPreference implements IE4PreferencePage {
+
+ protected boolean allowOverride;
+ protected CdmPreference pref = null;
- boolean allowOverride;
- CdmPreference pref = null;
@Override
protected Control createContents(Composite parent) {
Composite composite = createComposite(parent);
- getValues();
-
-
+ getValues();
+ final CLabel commonNameAreaSelectionLabel = new CLabel(composite, SWT.NULL);
+ commonNameAreaSelectionLabel.setText("Actually selected vocabularies, for editing the selection use the button below");
+ createTable(composite);
final CLabel commonNameAreaLabel = new CLabel(composite, SWT.NULL);
commonNameAreaLabel.setText(Messages.VokabularyAdminPreferences_SELECT_VOCABULARY_TEXT);
commonNameAreaLabel.setLayoutData(gridData);
final CommandHandlerButton button_opencommonNameAreaWizard = new CommandHandlerButton(composite, SWT.PUSH,
- "eu.etaxonomy.taxeditor.store.open.OpenCommonNameAreaWizardHandler"); //$NON-NLS-1$
+ "eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardHandler"); //$NON-NLS-1$
- button_opencommonNameAreaWizard.setText(Messages.GeneralPreference_open_common_name_area_selection);
- final Button allowOverrideCommonNameAreaCheckButton = createAllowOverrideButton(composite);
-
- if (pref != null){
- allowOverride = pref.isAllowOverride();
- allowOverrideCommonNameAreaCheckButton.setSelection(allowOverride);
- }
- else{
- allowOverrideCommonNameAreaCheckButton.setSelection(true);
- }
- allowOverrideCommonNameAreaCheckButton.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- setApply(true);
- allowOverride = allowOverrideCommonNameAreaCheckButton.getSelection();
+ button_opencommonNameAreaWizard.setEnabled(true);
+ button_opencommonNameAreaWizard.setText(Messages.GeneralPreference_open_common_name_area_selection);
- }
- });
return composite;
}
pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameAreaVocabularies, "");
}
pref.setAllowOverride(allowOverride);
- service.set(pref);
+ if ( pref.getValue() == null && allowOverride){
+ service.remove(pref.getKey());
+ }else{
+ service.set(pref);
+ }
PreferencesUtil.updateDBPreferences();
}
}
+
+
+ @Override
+ protected void performDefaults() {
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameAreaVocabularies, null);
+ allowOverride = true;
+
+ super.performDefaults();
+ }
+ @Override
+ public void createTableRow(CdmPreference pref) {
+ String namedAreaString = null;
+
+ for (TermVocabularyDto voc: vocabularies){
+ TableItem item = new TableItem(table, SWT.NONE);
+ item.setText(0, voc.getRepresentations().iterator().next().getLabel());
+ }
+
+
+//
+ }
+
+
+ @Override
+ public boolean isApply() {
+
+ return super.isApply();
+ }
+
+ public void createTable(Composite composite) {
+ table = new Table(
+ composite, SWT.BORDER /*| SWT.CHECK */| SWT.FULL_SELECTION | SWT.SINGLE
+ );
+
+ table.setLinesVisible(true);
+ table.setHeaderVisible(true);
+ GridData tableGrid = createTextGridData();
+ table.setLayoutData(tableGrid);
+
+
+ TableColumn column = new TableColumn(table, SWT.NONE);
+ column.setText("Vocabulary");
+ column.setWidth(500);
+
+ if (pref.getValue() != null){
+ createTableRow(pref);
+ }
+
+
+ }
+
@Override
public void getValues() {
this.isAdminPreference = false;
- setPreferenceStore(PreferencesUtil.getPreferenceStore());
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
-
if (pref != null){
allowOverride = pref.isAllowOverride();
}else{
pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameAreaVocabularies, "");
allowOverride = true;
}
- }
+ fillVocabularies(pref);
- @Override
- protected void performDefaults() {
-
- super.performDefaults();
}
-
-
}
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.custom.TableEditor;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.metadata.PreferenceResolver;
+import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.ImageResources;
-import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
+import eu.etaxonomy.taxeditor.preference.wizard.AvailableDistributionPerAreaStatusWizard;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
* @since 02.07.2019
*
*/
-public class DistributionStatusAndNamedAreaVocabularies extends CdmPreferencePage implements IPropertyChangeListener{
+public class DistributionStatusPreferencePage extends AbstractVocabularySelectionPreference implements IPropertyChangeListener{
- protected String commandHandlerString;
protected String commandHandlerStringStatus;
protected List<CdmPreference> prefStatus;
protected List<CdmPreference> prefStatusToDelete = new ArrayList<>();
- protected CdmPreference prefAreaVoc;
-
- private CommandHandlerButton button_openSelectAreaVocabularies;
-
private CommandHandlerButton button_openStatusWizard;
private Map<UUID, NamedArea> namedAreaUUIDMap = new HashMap();
final CLabel labelPerAreaStatus = new CLabel(composite, SWT.NULL);
labelPerAreaStatus.setText(Messages.DistributionAdminPreferences_PER_AREA_STATUS);
labelPerAreaStatus.setLayoutData(textGrid);
- createTable(composite);
+
+ }else{
+ final CLabel labelPerAreaStatus = new CLabel(composite, SWT.NULL);
+ labelPerAreaStatus.setText("Actual status selection, the area specific selection is only available for serverside preferences.\n"
+ + "For editing the general status selection use the button below");
+ labelPerAreaStatus.setLayoutData(textGrid);
+
}
+ createStatusTable(composite);
- final CLabel labelStatus = new CLabel(composite, SWT.NULL);
- labelStatus.setText(Messages.DistributionAdminPreferences_SELECT_STATUS);
- labelStatus.setLayoutData(textGrid);
composite.pack ();
+
+
button_openStatusWizard = new CommandHandlerButton(composite, SWT.PUSH, commandHandlerStringStatus);
button_openStatusWizard.setText(Messages.Distribution_status_selection);
}
});
- final CLabel label = new CLabel(composite, SWT.NULL);
- label.setText(Messages.ChecklistEditorGeneralPreference_open_wizard);
- label.setLayoutData(textGrid);
-
- button_openSelectAreaVocabularies = new CommandHandlerButton(composite, SWT.PUSH, commandHandlerString);
- button_openSelectAreaVocabularies
- .setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection);
- if (!isAdminPreference){
- if (prefAreaVoc != null && !prefAreaVoc.isAllowOverride()) {
- button_openSelectAreaVocabularies.setButtonEnabled(false);
- }
-// if (prefStatus != null && !prefStatus.isAllowOverride()) {
-// button_openStatusWizard.setButtonEnabled(false);
-// }
- }
return composite;
}
- public void createTable(Composite composite) {
+
+
+ public void createStatusTable(Composite composite) {
table = new Table(
composite, SWT.BORDER /*| SWT.CHECK */| SWT.FULL_SELECTION | SWT.SINGLE
);
CdmPreference pref;
TableColumn column = new TableColumn(table, SWT.NONE);
column.setText("Predicate/Subject");
- column.setWidth(500);
- column = new TableColumn(table, SWT.NONE);
+ column.setWidth(300);
+
if (isAdminPreference){
- column.setText("Allow Override");
- }else{
- column.setText("Use Default");
+ column = new TableColumn(table, SWT.NONE);
+ column.setText(Messages.Preference_allow_override);
+ column.setWidth(100);
+ column = new TableColumn(table, SWT.NONE);
+ column.setText(Messages.Delete);
+ column.setWidth(100);
+ column = new TableColumn(table, SWT.NONE);
+ column.setText("Status");
+ column.setWidth(100);
}
- column.setWidth(100);
- column = new TableColumn(table, SWT.NONE);
- column.setText("Delete");
- column.setWidth(100);
-
while (prefIterator.hasNext()){
}
}
+ @Override
public void createTableRow(CdmPreference pref) {
TableItem item = new TableItem(table, SWT.NONE);
- for (int col = 0; col < 3; col ++) {
- String namedAreaString = null;
+ String uuidString = getUUIDFromSubject(pref);
+ String namedAreaString = null;
+ if (uuidString != null){
+ try{
+ UUID uuid = UUID.fromString(uuidString);
+ namedAreaString = namedAreaUUIDMap.get(UUID.fromString(uuidString)).getLabel();
+ }catch(IllegalArgumentException e){
+ // no UUID
+ }
+ }
+ for (int col = 0; col < 4; col ++) {
if (col == 0){
- String uuidString = getUUIDFromSubject(pref);
- if (uuidString != null){
- try{
- UUID uuid = UUID.fromString(uuidString);
- namedAreaString = namedAreaUUIDMap.get(UUID.fromString(uuidString)).getLabel();
- }catch(IllegalArgumentException e){
- // no UUID
- }
- }
if (namedAreaString != null){
String subjectString = pref.getSubjectString().replace(pref.getSubject().getLastPart(), namedAreaString);
item.setText(col, pref.getPredicate() +subjectString);
item.setText(col, pref.getPredicate() +pref.getSubjectString());
}
- }else if (col == 1) {
+ }else if (col == 1 && isAdminPreference) {
Button allowOverrideButton = new Button(table, SWT.CHECK);
allowOverrideButton.setData(pref);
TableEditor editor = new TableEditor(table);
editor.grabHorizontal = true;
editor.setEditor(allowOverrideButton, item, col);
allowOverrideButton.setSelection(pref.isAllowOverride());
+
allowOverrideButton.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e){
}
}
});
- } else if (col == 2){
+ } else if (col == 2 && isAdminPreference){
Button delButton = new Button(table, SWT.PUSH);
delButton.setImage(ImageResources
.getImage(ImageResources.TRASH_ICON));
editor.setEditor(delButton, item, col);
}
+ else if (col == 3 && isAdminPreference){
+ Button listButton = new Button(table, SWT.PUSH);
+ listButton.setImage(ImageResources
+ .getImage(ImageResources.EDIT_ICON));
+ listButton.setData(pref);
+ listButton.pack();
+ listButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e){
+ Button thisButton= (Button) e.widget;
+ AvailableDistributionPerAreaStatusWizard wizard = new AvailableDistributionPerAreaStatusWizard();
+ CdmPreference actualPref = CdmPreferenceCache.instance().findBestMatching(pref.getKey());
+ wizard.setActualPref(actualPref);
+ String uuidString = getUUIDFromSubject(actualPref);
+ String namedAreaString = null;
+ if (uuidString != null){
+ try{
+ UUID uuid = UUID.fromString(uuidString);
+ NamedArea area = namedAreaUUIDMap.get(UUID.fromString(uuidString));
+ wizard.setNamedArea(area);
+
+ }catch(IllegalArgumentException ex){
+ // no UUID
+ }
+ }
+
+
+ WizardDialog dialog = new WizardDialog(null,
+ wizard);
+
+ dialog.open();
+ thisButton.setData(CdmPreferenceCache.instance().findBestMatching(pref.getKey()));
+
+
+ }
+ });
+ TableEditor editor = new TableEditor(table);
+ editor.horizontalAlignment = SWT.LEFT;
+ editor.grabHorizontal = true;
+ editor.setEditor(listButton, item, col);
+
+ }
}
}
@Override
public void getValues() {
isAdminPreference = false;
+ type = TermType.NamedArea;
CdmPreferenceCache cache = CdmPreferenceCache.instance();
cache.getAllTaxEditorDBPreferences();
- prefAreaVoc = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies);
- if (prefAreaVoc == null){
- prefAreaVoc = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, PreferencePredicate.AvailableDistributionAreaVocabularies.getDefaultValue() != null ? PreferencePredicate.AvailableDistributionAreaVocabularies.getDefaultValue().toString(): null);
- }
-
prefStatus = cache.getAllForPredicate(PreferencePredicate.AvailableDistributionStatus.getKey());
if (prefStatus == null){
}
createNamedAreaUUIDMap();
- commandHandlerString = "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler";
commandHandlerStringStatus = "eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardHandler";
// setApply(true);
}
}
+
public String getUUIDFromSubject(CdmPreference pref) {
String lastPart = pref.getSubject().getLastPart();
lastPart = lastPart.replace("NamedArea[", "");
@Override
protected void performDefaults() {
- if (!isAdminPreference){
- if (!prefAreaVoc.isAllowOverride()) {
- button_openSelectAreaVocabularies.setButtonEnabled(false);
- }
-
- }
prefStatus = null;
- prefAreaVoc = null;
refresh();
setApply(true);
List<CdmPreference> prefsToDelete =cache.getAllForPredicate(PreferencePredicate.AvailableDistributionStatus.getKey());
PreferencesUtil.removeFromDB(prefsToDelete);
}
- if (prefAreaVoc == null){
- List<CdmPreference> prefsToDelete =cache.getAllForPredicate(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey());
- PreferencesUtil.removeFromDB(prefsToDelete);
- }
+
List<CdmPreference> toDelete = new ArrayList<>();
for (CdmPreference pref:prefStatusToDelete){
CdmPreference prefToDelete = CdmPreference.NewInstance(pref.getKey(), null);
}
}
- /**
- *
- */
- private void refresh() {
- //getValues();
- table.removeAll();
- if (prefStatus != null){
- Iterator<CdmPreference> prefIterator = prefStatus.iterator();
- CdmPreference pref;
- while (prefIterator.hasNext()){
- pref = prefIterator.next();
- createTableRow(pref);
- }
- }
- table.redraw();
- table.pack();
- }
+
+
+
+
}
*/
abstract public class GeneralTermPreference extends CdmPreferencePage implements ISelectionChangedListener, SelectionListener{
protected CheckBoxTreeComposite treeComposite;
- private List<TermVocabularyDto> vocabularies = new ArrayList<>();
+ protected List<TermVocabularyDto> vocabularies = new ArrayList<>();
protected Combo useLocalOrAdmin ;
protected boolean isOverride;
protected boolean allowOverride;
protected CdmPreference pref;
protected IPreferencePredicate predicate;
- private boolean localPref;
+ protected boolean localPref;
public GeneralTermPreference(){
super();
if (listValue.isEmpty()){
List<DefinedTermBase> terms = CdmStore.getTermManager().getAllTerms(type, null);
for (DefinedTermBase term: terms){
- if (!(term instanceof eu.etaxonomy.cdm.model.description.Character)){
+ if (!(term instanceof eu.etaxonomy.cdm.model.description.Character) && term != null){
termlist.add(TermDto.fromTerm(term, true));
}
}
setVocabularies(vocs);
}
- protected abstract List<TermVocabularyDto> getVocabulariesFromPreference();
-
-
protected void getPreferenceValues(){
pref = PreferencesUtil.getPreferenceFromDB(predicate);
this.allowOverride = pref!= null?pref.isAllowOverride():true;
--- /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.preference;
+
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.taxeditor.preference.wizard.GeneralVocabularyPreferencePage;
+
+/**
+ * @author k.luther
+ * @since 12.09.2019
+ */
+public class NamedAreaVocabularyPreferencePage extends GeneralVocabularyPreferencePage {
+
+ public NamedAreaVocabularyPreferencePage(){
+ isAdminPreference = false;
+ setPredicate(PreferencePredicate.AvailableDistributionAreaVocabularies);
+ type = TermType.NamedArea;
+
+ }
+
+
+
+
+// @Override
+// protected void performDefaults() {
+// if (!isAdminPreference){
+// if (!pref.isAllowOverride()) {
+// button_openSelectAreaVocabularies.setButtonEnabled(false);
+// }
+//
+// }
+//
+// prefAreaVoc = null;
+// refresh();
+// setApply(true);
+//
+// }
+
+
+
+
+
+}
package eu.etaxonomy.taxeditor.preference;
-import java.util.List;
-
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
/**
* <p>NomenclaturalStatusTypeMenuPreferences class.</p>
- /**
- * {@inheritDoc}
- */
- @Override
- protected List<TermVocabularyDto> getVocabulariesFromPreference() {
- // TODO Auto-generated method stub
- return null;
- }
-
type = TermType.Rank;
}
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected List<TermVocabularyDto> getVocabulariesFromPreference() {
- // TODO Auto-generated method stub
- return null;
- }
-
@Override
protected void initialiseVocabularies() {
type = TermType.Feature;
}
- @Override
- protected List<TermVocabularyDto> getVocabulariesFromPreference() {
- // TODO Auto-generated method stub
- return null;
- }
+
@Override
public boolean performOk(){
type = TermType.Feature;
}
- @Override
- protected List<TermVocabularyDto> getVocabulariesFromPreference() {
- // TODO Auto-generated method stub
- return null;
- }
+
@Override
public boolean performOk(){
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.preference.GeneralTermPreference;
import eu.etaxonomy.taxeditor.preference.LocalOrDefaultEnum;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
type = TermType.NameTypeDesignationStatus;
}
- /**
- * {@inheritDoc}
- */
- @Override
- protected List<TermVocabularyDto> getVocabulariesFromPreference() {
- // TODO Auto-generated method stub
- return null;
- }
-
@Override
public boolean performOk() {
if (!isApply()){
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.preference.GeneralTermPreference;
import eu.etaxonomy.taxeditor.preference.LocalOrDefaultEnum;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
- /**
- * {@inheritDoc}
- */
- @Override
- protected List<TermVocabularyDto> getVocabulariesFromPreference() {
- // TODO Auto-generated method stub
- return null;
- }
+
@Override
setTitle(String.format(Messages.AvailableAreaVocabulariesPage_PAGE_TITLE, featureTitle));
setDescription(String.format(Messages.AvailableAreaVocabulariesPage_PAGE_DESCRIPTION, featureTitle));
- if (isLocalPrefExist()){
+ if (!localPref){
createAllowOverrideButton(parent);
}
NamedArea actualArea;
CdmPreference actualPref;
Text areaText;
+ String namedAreaString;
+
+
+
Button btnSelectArea;
Button btnRemove;
Label status;
countTerms = CdmStore.getTermManager().getPreferredTerms(type).size();
}
+
+
@Override
public void createControl(Composite parent) {
setTitle(Messages.AvailableDistributionStatusPage_PAGE_TITLE);
areaText.setBackground(StoreUtil
.getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND));
areaText.setLayoutData(textData);
+ if (actualArea != null){
+ areaText.setText(actualArea.getLabel());
+ areaText.setEnabled(false);
+ }
btnSelectArea = new Button(toolbar, SWT.PUSH | SWT.FLAT );
btnSelectArea.setImage(ImageResources
.getImage(ImageResources.BROWSE_ICON));
}
+ public void setActualPreference(CdmPreference pref){
+
+ this.actualPref = pref;
+
+
+ }
+
+
}
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
}
+ public void setActualPref(CdmPreference pref){
+ this.aPage.setActualPreference(pref);
+ }
+
+ public void setNamedArea(NamedArea namedArea){
+ this.aPage.actualArea = namedArea;
+
+ }
+
@Override
public void addPages() {
addPage(aPage);
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
-import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.TermStore;
/**
* @author k.luther
}
+ public AvailableDistributionStatusWizard(CdmPreference pref) {
+ setWindowTitle(Messages.AvailableDistributionStatusWizard_WIZARD_TITLE);
+ // TODO if preferenceStore has elements checked load elements in wizard
+
+ if (pref == null) {
+ pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, null);
+ }
+ aPage = new AvailableDistributionStatusPage(Messages.AvailableDistributionStatusWizard_PAGE_TITLE, pref, true);
+
+ }
+
@Override
public void addPages() {
addPage(aPage);
Object[] checkedElements = aPage.getViewer().getCheckedElements();
List<UUID> listUIIDChecked = new ArrayList<>();
- List<DefinedTermBase> preferredTerms = new ArrayList<>();
+ List<TermDto> preferredTerms = new ArrayList<>();
for (Object o : checkedElements) {
if(o instanceof TermDto){
TermDto termDto = (TermDto) o;
listUIIDChecked.add(termDto.getUuid());
- preferredTerms.add(CdmStore.getService(ITermService.class).load(termDto.getUuid()));
+ preferredTerms.add(termDto);
}
}
String saveCheckedElements = StringUtils.join(listUIIDChecked, ";"); //$NON-NLS-1$
PreferencesUtil.setStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(), saveCheckedElements);
PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableDistributionStatus.getKey()), aPage.override);
- CdmStore.getTermManager().setPreferredTerms(preferredTerms, TermStore.getTerms(TermType.PresenceAbsenceTerm, null));
+ CdmStore.getTermManager().setPreferredTermsByType(preferredTerms, TermType.PresenceAbsenceTerm);
PreferencesUtil.firePreferencesChanged(this.getClass());
return true;
}
--- /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.preference.wizard;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
+import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermSorter;
+import eu.etaxonomy.taxeditor.editor.definedterm.RootElementsOnlyTreeContentProvider;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermDtoLabelProvider;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.GeneralTermPreference;
+import eu.etaxonomy.taxeditor.preference.LocalOrDefaultEnum;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @since 13.09.2019
+ */
+public class GeneralVocabularyPreferencePage extends GeneralTermPreference implements ISelectionChangedListener, SelectionListener{
+
+
+ protected List<TermVocabularyDto> getVocabulariesFromPreference() {
+
+ return null;
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ // getValues();
+ getPreferenceValues();
+ if (!isAdminPreference && !allowOverride){
+ final CLabel description = new CLabel(parent, SWT.NULL);
+ description.setText(Messages.NameDetailsViewConfiguration_description_not_available);
+ this.setDefaultButtonActivated(false);
+ return parent;
+
+ }
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ container.setLayout(gridLayout);
+ parent.setLayout(new GridLayout());
+ useLocalOrAdmin = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+ if (!isAdminPreference){
+ useLocalOrAdmin.add(LocalOrDefaultEnum.Default.getLabel(), 0);
+ useLocalOrAdmin.add(LocalOrDefaultEnum.Local.getLabel(), 1);
+
+ }else{
+ useLocalOrAdmin.add(LocalOrDefaultEnum.AllowOverride.getLabel(), 0);
+ useLocalOrAdmin.add(LocalOrDefaultEnum.Database.getLabel(), 1);
+ }
+
+
+ treeComposite = new CheckBoxTreeComposite(container, new RootElementsOnlyTreeContentProvider(), new TermDtoLabelProvider(), SWT.NONE);
+ treeComposite.getViewer().setComparator(new DefinedTermSorter());
+ treeComposite.setAllowTopLevelSelection(true);
+ rememberCheckedValues(getCheckedValuesFromPreferences());
+
+ if (!isAdminPreference){
+ if (isOverride){
+ useLocalOrAdmin.select(1);
+ }else{
+ useLocalOrAdmin.select(0);
+ treeComposite.setEnabled(false);
+ }
+ }else{
+ if (allowOverride){
+ useLocalOrAdmin.select(0);
+ }else{
+ useLocalOrAdmin.select(1);
+ }
+ }
+ useLocalOrAdmin.addSelectionListener(this);
+
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
+ data.heightHint = 300;
+ treeComposite.setLayoutData(data);
+ treeComposite.getViewer().addSelectionChangedListener(this);
+
+ return container;
+
+ }
+
+ @Override
+ protected void rememberCheckedValues(String checkedValues) {
+ initialiseVocabularies();
+ treeComposite.getViewer().getTree().deselectAll();
+ treeComposite.getViewer().refresh();
+ treeComposite.getViewer().setInput(getVocabularies());
+
+ if (checkedValues != null && checkedValues != "") { //$NON-NLS-1$
+ String[] listChecked = checkedValues.split(";"); //$NON-NLS-1$
+ String[] listCheckedComma = checkedValues.split(","); //$NON-NLS-1$
+ List<String> checked = new ArrayList<>();
+ if (listChecked != null ){
+ checked = Arrays.asList(listChecked);
+ }
+ if (listCheckedComma != null && checkedValues.contains(",")){ //$NON-NLS-1$
+ checked = Arrays.asList(listCheckedComma);
+ }
+ List<TermVocabularyDto> termsFromStringValues = getVocabulariesFromStringValues(checked);
+ treeComposite.setCheckedElements(termsFromStringValues.toArray());
+
+ }else{
+ List<TermVocabularyDto> termsFromStringValues = getVocabulariesFromStringValues(new ArrayList<String>());
+ treeComposite.setCheckedElements(termsFromStringValues.toArray());
+ treeComposite.getViewer().refresh();
+ treeComposite.redraw();
+
+ }
+ }
+
+
+ protected List<TermVocabularyDto> getVocabulariesFromStringValues(List<String> listValue) {
+ List<TermVocabularyDto> vocList = new ArrayList<>();
+ List<UUID> uuids = new ArrayList();
+ IVocabularyService vocService = CdmStore.getService(IVocabularyService.class);
+ for (String s : listValue) {
+ if (!StringUtils.isBlank(s)){
+ UUID uuid = UUID.fromString(s);
+ uuids.add(uuid);
+ }
+ }
+ vocList = vocService.findVocabularyDtoByVocabularyUuids(uuids);
+
+
+ if (listValue.isEmpty()){
+ vocList =vocService.findVocabularyDtoByTermType(type);
+ }
+
+ return vocList;
+ }
+
+ @Override
+ public boolean performOk() {
+ if (!isApply()){
+ return true;
+ }
+ Object[] checkedElements = treeComposite.getViewer().getCheckedElements();
+ List<UUID> listUIIDChecked = new ArrayList<>();
+
+ for (Object o : checkedElements) {
+ if(o instanceof TermVocabularyDto){
+ TermVocabularyDto termDto = (TermVocabularyDto) o;
+ listUIIDChecked.add(termDto.getUuid());
+ }
+ }
+ String saveCheckedElements = StringUtils.join(listUIIDChecked, ";"); //$NON-NLS-1$
+ if (isAdminPreference){
+ CdmPreference savePref = CdmPreference.NewTaxEditorInstance(predicate, saveCheckedElements);
+ String text = this.useLocalOrAdmin.getText();
+ if (text.equals(LocalOrDefaultEnum.Database.getLabel()) ){
+ savePref.setAllowOverride(false);
+ }else if (text.equals(LocalOrDefaultEnum.AllowOverride.getLabel())){
+ savePref.setAllowOverride(true);
+ }
+ PreferencesUtil.setPreferenceToDB(savePref);
+ PreferencesUtil.updateDBPreferences();
+ }else{
+ PreferencesUtil.setStringValue(predicate.getKey(), saveCheckedElements);
+ String text = this.useLocalOrAdmin.getText();
+ if (text.equals(LocalOrDefaultEnum.Database.getLabel()) || text.equals(LocalOrDefaultEnum.Default.getLabel())){
+ PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(predicate.getKey()), false);
+ }else if (text.equals(LocalOrDefaultEnum.Local.getLabel())){
+ PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(predicate.getKey()), true);
+ }
+ }
+
+ PreferencesUtil.firePreferencesChanged(this.getClass());
+ return true;
+ }
+
+}