--- /dev/null
+/**
+* Copyright (C) 2020 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.ui.section.reference;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.model.media.ExternalLink;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.common.ExternalLinksSection;
+
+/**
+ * @author k.luther
+ * @since Jul 2, 2020
+ */
+public class AdvancedSourceElement extends AbstractCdmDetailElement<OriginalSourceBase> {
+
+ protected TextWithLabelElement text_idInSource;
+ protected TextWithLabelElement text_idNamespace;
+ protected TextWithLabelElement text_originaleNameString;
+ protected TextWithLabelElement text_cdmsource;
+
+ protected ExternalLinksSection externalLinks;
+
+ public AdvancedSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
+ super(formFactory, formElement);
+
+ }
+
+
+
+ @Override
+ protected void createControls(ICdmFormElement formElement, OriginalSourceBase entity, int style) {
+ Display display = Display.getCurrent();
+ Color background = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
+
+ if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
+ text_idInSource = formFactory.createTextWithLabelElement(formElement, "ID in Source", entity != null?entity.getIdInSource():null, style);
+ text_idInSource.setBackground(background);
+ }
+ if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){
+ text_idNamespace = formFactory.createTextWithLabelElement(formElement, "ID Namespace", entity != null?entity.getIdNamespace():null, style);
+ text_idNamespace.setBackground(background);
+ }
+ text_originaleNameString = formFactory.createTextWithLabelElement(
+ formElement, "Original Information", entity != null?entity.getOriginalNameString():null, SWT.NULL);
+
+ text_originaleNameString.setBackground(background);
+// text_cdmsource = formFactory.createTextWithLabelElement(
+// formElement, "CDM Source", entity != null?entity.getCdmSource():null, SWT.NULL);
+ externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, ExternalLink.class.getCanonicalName()));
+ externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ externalLinks.setEntity(entity);
+ addControl(externalLinks);
+ addElement(externalLinks);
+
+
+ }
+
+ @Override
+ public void handleEvent(Object eventSource) {
+ if (eventSource.equals(text_idInSource)){
+ getEntity().setIdInSource(text_idInSource.getText());
+ }else if (eventSource.equals(text_idNamespace)){
+ getEntity().setIdNamespace(text_idNamespace.getText());
+ }else if (eventSource.equals(text_originaleNameString)){
+ getEntity().setOriginalNameString(text_originaleNameString.getText());
+ }
+
+ }
+
+
+
+}
--- /dev/null
+/**
+* Copyright (C) 2020 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.ui.section.reference;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+
+/**
+ * @author k.luther
+ * @since Jul 1, 2020
+ */
+public class OriginalSourceAdvancedSection extends AbstractCdmDetailSection<OriginalSourceBase> {
+
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param parentElement
+ * @param selectionProvider
+ * @param style
+ */
+ public OriginalSourceAdvancedSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ super(formFactory, conversation, parentElement, selectionProvider, style);
+
+
+ }
+
+ @Override
+ protected AbstractCdmDetailElement<OriginalSourceBase> createCdmDetailElement(
+ AbstractCdmDetailSection<OriginalSourceBase> parentElement, int style) {
+
+ return new AdvancedSourceElement(getFormFactory(), parentElement);
+ }
+
+ @Override
+ public String getHeading() {
+
+ return "Advanced";
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2020 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.ui.section.reference;
+
+import org.eclipse.jface.util.IPropertyChangeListener;
+
+import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
+import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+
+/**
+ * @author k.luther
+ * @since Jul 1, 2020
+ */
+public class OriginalSourceElement extends AbstractCdmDetailElement<OriginalSourceBase> implements IPropertyChangeListener{
+
+// protected EnumComboElement<OriginalSourceType> combo_origsourcetype;
+
+ private EntitySelectionElement<Reference> selection_Ref;
+ private OriginalSourceAdvancedSection advancedSection;
+
+
+// protected EntitySelectionElement<Reference> selection_reference;
+// protected TextWithLabelElement text_referenceDetail;
+
+
+ public OriginalSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
+ super(formFactory, formElement);
+// selectionArbitrator = formFactory.createSelectionArbitrator(this);
+ }
+
+ @Override
+ protected void createControls(ICdmFormElement formElement, OriginalSourceBase entity, int style) {
+
+ selection_Ref = formFactory.createSelectionElement(Reference.class,
+ formElement, Messages.TaxonNodeWizardPage_PLACEMENT_SOURCE, null,
+ EntitySelectionElement.DELETABLE, style, 100);
+
+ if (entity != null){
+ selection_Ref.setEntity(entity.getCitation());
+ }
+ selection_Ref.setBackground(this.getPersistentBackground());
+ for (ICdmFormElement element: selection_Ref.getElements()){
+ element.setBackground(getPersistentBackground());
+ }
+ advancedSection = formFactory.createOriginalSourceAdvancedSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
+ advancedSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+
+ addControl(advancedSection);
+ addElement(advancedSection);
+ advancedSection.setBackground(this.getPersistentBackground());
+ advancedSection.setEntity(entity);
+
+ }
+
+ @Override
+ public void handleEvent(Object eventSource) {
+ if (eventSource.equals(selection_Ref)){
+ getEntity().setCitation(selection_Ref.getEntity());
+ }
+
+ }
+
+
+
+}
--- /dev/null
+/**
+* Copyright (C) 2020 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.ui.section.reference;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+
+/**
+ * @author k.luther
+ * @since Jul 2, 2020
+ */
+public class SingleSourceSection extends AbstractCdmDetailSection<OriginalSourceBase> {
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param parentElement
+ * @param selectionProvider
+ * @param style
+ */
+ public SingleSourceSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ super(formFactory, conversation, parentElement, selectionProvider, style);
+
+
+ }
+
+ @Override
+ protected AbstractCdmDetailElement<OriginalSourceBase> createCdmDetailElement(
+ AbstractCdmDetailSection<OriginalSourceBase> parentElement, int style) {
+
+ return new OriginalSourceElement(getFormFactory(), parentElement);
+ }
+
+ @Override
+ public String getHeading() {
+
+ return "";
+ }
+
+ public Reference getRef() {
+ return ((OriginalSourceElement)detailElement).getEntity().getCitation();
+ }
+}