From: Patrick Plitzner Date: Tue, 15 Nov 2016 09:50:49 +0000 (+0100) Subject: fix #6198 Remove synonymrelationships in TaxEditor X-Git-Tag: 4.4.0^2~28 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/69410b96c9c8e1e23d68cd782867171c2e1cd084 fix #6198 Remove synonymrelationships in TaxEditor --- diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipDetailElement.java deleted file mode 100644 index ce60b9ffa..000000000 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipDetailElement.java +++ /dev/null @@ -1,115 +0,0 @@ -//// $Id$ -///** -//* Copyright (C) 2014 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.name; -// -//import org.eclipse.swt.events.SelectionListener; -//import org.eclipse.swt.graphics.Color; -// -//import eu.etaxonomy.cdm.model.name.NameRelationship; -//import eu.etaxonomy.cdm.model.taxon.Synonym; -//import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType; -//import eu.etaxonomy.taxeditor.model.MessagingUtils; -//import eu.etaxonomy.taxeditor.ui.combo.TermComboElement; -//import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; -//import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; -//import eu.etaxonomy.taxeditor.ui.element.CheckboxElement; -//import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; -//import eu.etaxonomy.taxeditor.ui.element.LabelElement; -//import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement; -//import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractReferencedEntityElement; -//import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; -// -///** -// * @author pplitzner -// * @date 28.01.2014 -// * -// */ -//public class SynonymRelationshipDetailElement extends AbstractReferencedEntityElement{ -// -// private TextWithLabelElement text_ruleConsidered; -// private LabelElement label; -// private EntitySelectionElement selection_toName; -// private TermComboElement combo_relationshipType; -// private CheckboxElement checkProParte; -// private CheckboxElement checkPartial; -// -// /** -// *

Constructor for NameRelationshipDetailElement.

-// * -// * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object. -// * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object. -// * @param entity a {@link eu.etaxonomy.cdm.model.name.NameRelationship} object. -// * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object. -// * @param style a int. -// */ -// public SynonymRelationshipDetailElement(CdmFormFactory cdmFormFactory, -// AbstractFormSection formElement, -// Synonym entity, SelectionListener removeListener, int style) { -// super(cdmFormFactory, formElement, entity, removeListener, style); -// } -// -// /* (non-Javadoc) -// * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#createControls(org.eclipse.swt.widgets.Composite, int) -// */ -// /** {@inheritDoc} */ -// @Override -// public void createControls(ICdmFormElement element, int style) { -// label = formFactory.createLabel(element, null); -// checkProParte = formFactory.createCheckbox(element, "Pro Parte Synonym", null, style); -// checkPartial= formFactory.createCheckbox(element, "Partial Synonym", null, style); -// super.createControls(element, style); -// } -// -// /** {@inheritDoc} */ -// @Override -// public void setEntity(Synonym entity) { -// String text = entity.getTitleCache() + " is " + entity.getType().getLabel() + " " + entity.getAcceptedTaxon().getTitleCache(); -// -// label.setText(text); -// -// checkPartial.setSelection(entity.isPartial()); -// checkProParte.setSelection(entity.isProParte()); -// -// super.setEntity(entity); -// } -// -// /** {@inheritDoc} */ -// @Override -// public void handleEvent(Object eventSource) { -// if(eventSource == combo_relationshipType){ -// getEntity().setType(combo_relationshipType.getSelection()); -// } -// else if(eventSource == selection_toName){ -// MessagingUtils.error(getClass(), "No API call available.", null); -// } -// else if(eventSource == checkPartial){ -// getEntity().setPartial(checkPartial.getSelection()); -// } -// else if(eventSource == checkProParte){ -// getEntity().setProParte(checkProParte.getSelection()); -// } -// else if(eventSource == selection_reference){ -// getEntity().setSec(selection_reference.getSelection()); -// } -// else if(eventSource == text_referenceDetail){ -// getEntity().setSecMicroReference(text_referenceDetail.getText()); -// } -// } -// -// /** {@inheritDoc} */ -// @Override -// public void setBackground(Color color) { -// if(label != null) { -// label.setBackground(color); -// } -// super.setBackground(color); -// } -// -//} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipDetailSection.java deleted file mode 100644 index cefc22af3..000000000 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipDetailSection.java +++ /dev/null @@ -1,90 +0,0 @@ -//// $Id$ -///** -//* Copyright (C) 2014 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.name; -// -//import java.util.Collection; -// -//import org.eclipse.core.runtime.IStatus; -//import org.eclipse.jface.wizard.WizardDialog; -// -//import eu.etaxonomy.cdm.api.conversation.ConversationHolder; -//import eu.etaxonomy.cdm.model.taxon.Synonym; -//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.section.AbstractEntityCollectionSection; -// -///** -// * @author pplitzner -// * @date 27.01.2014 -// * -// */ -//public class SynonymRelationshipDetailSection extends AbstractEntityCollectionSection { -// -// /** -// *

Constructor for NameRelationshipDetailSection.

-// * -// * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object. -// * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. -// * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object. -// * @param style a int. -// */ -// public SynonymRelationshipDetailSection(CdmFormFactory formFactory, ConversationHolder conversation, -// ICdmFormElement parentElement, int style) { -// super(formFactory, conversation, parentElement, "Synonym Relationship", style); -// } -// -// /** {@inheritDoc} */ -// @Override -// public void addElement(Synonym element) { -// // nothing -// } -// -// /** {@inheritDoc} */ -// @Override -// public SynonymRelationship createNewElement() { -// -// SynonymRelationshipWizard wizard = new SynonymRelationshipWizard(this); -// WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard); -// int status = dialog.open(); -// -// if(status == IStatus.OK) { -// return wizard.getSynonymRelationship(); -// } -// -// return null; -// } -// -// /** {@inheritDoc} */ -// @Override -// public Collection getCollection(Synonym entity) { -// Collection allSynonymRelationships = entity.getSynonymRelations(); -// return allSynonymRelationships; -// } -// -// /** {@inheritDoc} */ -// @Override -// public String getEmptyString() { -// return "No synonym relationships yet."; -// } -// -// /** {@inheritDoc} */ -// @Override -// protected String getTooltipString() { -// return "Add a new synonym relationship from this name."; -// } -// -// /** {@inheritDoc} */ -// @Override -// public void removeElement(SynonymRelationship element) { -// getEntity().removeSynonymRelation(element); -// } -// -//} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipWizard.java deleted file mode 100644 index a47df4add..000000000 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipWizard.java +++ /dev/null @@ -1,79 +0,0 @@ -//// $Id$ -///** -//* Copyright (C) 2014 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.name; -// -//import org.eclipse.jface.wizard.Wizard; -// -//import eu.etaxonomy.cdm.api.conversation.ConversationHolder; -//import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; -//import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; -// -///** -// * @author pplitzner -// * @date 27.01.2014 -// * -// */ -//public class SynonymRelationshipWizard extends Wizard implements IConversationEnabled{ -// -// private static SynonymRelationshipDetailSection callingSection; -// -// /** -// *

Constructor for NameRelationshipWizard.

-// * -// * @param callingSection a {@link eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection} object. -// */ -// public SynonymRelationshipWizard(SynonymRelationshipDetailSection callingSection) { -// SynonymRelationshipWizard.callingSection = callingSection; -// } -// -// private SynonymRelationshipWizardPage page; -// -// /** {@inheritDoc} */ -// @Override -// public void addPages() { -// page = new SynonymRelationshipWizardPage(callingSection); -// -// addPage(page); -// } -// -// /* (non-Javadoc) -// * @see org.eclipse.jface.wizard.Wizard#performFinish() -// */ -// /** {@inheritDoc} */ -// @Override -// public boolean performFinish() { -// return page.isPageComplete(); -// } -// -// -// -// /** -// *

getNameRelationship

-// * -// * @return a {@link eu.etaxonomy.cdm.model.name.NameRelationship} object. -// */ -// public SynonymRelationship getSynonymRelationship() { -// return page.getSynonymRelationship(); -// } -// -// /** -// *

getConversationHolder

-// * -// * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. -// */ -// @Override -// public ConversationHolder getConversationHolder() { -// return callingSection.getConversationHolder(); -// } -// -// /** {@inheritDoc} */ -// @Override -// public void update(CdmDataChangeMap changeEvents) {} -//} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipWizardPage.java deleted file mode 100644 index b7b4b35fc..000000000 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipWizardPage.java +++ /dev/null @@ -1,137 +0,0 @@ -//// $Id$ -///** -// * Copyright (C) 2014 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.name; -// -//import org.eclipse.jface.util.IPropertyChangeListener; -//import org.eclipse.jface.util.PropertyChangeEvent; -//import org.eclipse.swt.SWT; -//import org.eclipse.swt.widgets.Composite; -// -//import eu.etaxonomy.cdm.model.common.TermType; -//import eu.etaxonomy.cdm.model.taxon.Synonym; -//import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType; -//import eu.etaxonomy.cdm.model.taxon.Taxon; -//import eu.etaxonomy.taxeditor.ui.AbstractEntityCollectionElementWizardPage; -//import eu.etaxonomy.taxeditor.ui.combo.TermComboElement; -//import eu.etaxonomy.taxeditor.ui.element.CheckboxElement; -//import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; -// -///** -// * @author pplitzner -// * @date 27.01.2014 -// * -// */ -//public class SynonymRelationshipWizardPage extends AbstractEntityCollectionElementWizardPage implements IPropertyChangeListener { -// -// -// private EntitySelectionElement selection_relatedTo; -// -// private TermComboElement combo_relationshipType; -// -// private CheckboxElement checkboxProParte; -// -// private boolean isProParte; -// -// private CheckboxElement checkboxPartial; -// -// private boolean isPartial; -// -// private final Synonym entity; -// -// private SynonymRelationshipType type; -// -// private Taxon taxon; -// -// -// /** -// *

-// * Constructor for NameRelationshipWizardPage. -// *

-// * -// * @param callingSection -// * a -// * {@link eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection} -// * object. -// */ -// protected SynonymRelationshipWizardPage( -// SynonymRelationshipDetailSection callingSection) { -// super("SynonymRelationshipWizardPage"); -// setTitle("New Synonym Relationship"); -// setDescription(callingSection.getEntity().getTitleCache()); -// this.entity = callingSection.getEntity(); -// this.formFactory = callingSection.getFormFactory(); -// -// formFactory.addPropertyChangeListener(this); -// } -// -// /* -// * (non-Javadoc) -// * -// * @see -// * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets -// * .Composite) -// */ -// /** {@inheritDoc} */ -// @Override -// public void createControl(Composite parent) { -// super.createControl(parent); -// -// combo_relationshipType = formFactory.createDefinedTermComboElement(TermType.SynonymRelationshipType, -// rootElement, "Synonym Relationship Type", null, SWT.NULL); -// -// selection_relatedTo = formFactory -// .createSelectionElement(Taxon.class, -// ((SynonymRelationshipWizard) getWizard()) -// .getConversationHolder(), rootElement, -// "Related to", null, EntitySelectionElement.ALL, -// SWT.NULL); -// -// checkboxProParte = formFactory.createCheckbox(rootElement, "Pro Parte Synonym", null, SWT.NULL); -// -// checkboxPartial = formFactory.createCheckbox(rootElement, "Partial Synonym", null, SWT.NULL); -// -// } -// -// /** -// *

-// * getNameRelationship -// *

-// * -// * @return a {@link eu.etaxonomy.cdm.model.name.NameRelationship} object. -// */ -// public SynonymRelationship getSynonymRelationship() { -// SynonymRelationship synonymRelationship = taxon.addSynonym(entity, combo_relationshipType.getSelection()); -// synonymRelationship.setPartial(isPartial); -// synonymRelationship.setProParte(isProParte); -// return synonymRelationship; -// } -// -// /** {@inheritDoc} */ -// @Override -// public void propertyChange(PropertyChangeEvent event) { -// if (event == null) { -// return; -// } -// Object eventSource = event.getSource(); -// if (eventSource == combo_relationshipType) { -// type = combo_relationshipType.getSelection(); -// } else if (eventSource == selection_relatedTo) { -// taxon = selection_relatedTo.getEntity(); -// } else if (eventSource == checkboxProParte) { -// isProParte = checkboxProParte.getSelection(); -// } else if (eventSource == checkboxPartial) { -// isPartial = checkboxPartial.getSelection(); -// } -// -// boolean complete = type != null && taxon != null; -// setPageComplete(complete); -// } -// -//} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java index 8c956f111..eab5fabfe 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java @@ -15,13 +15,17 @@ import java.util.Arrays; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.SWT; +import eu.etaxonomy.cdm.model.common.TermType; import eu.etaxonomy.cdm.model.reference.Reference; +import eu.etaxonomy.cdm.model.taxon.Synonym; +import eu.etaxonomy.cdm.model.taxon.SynonymType; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.persistence.hibernate.permission.Role; import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; import eu.etaxonomy.taxeditor.preference.PreferencesUtil; import eu.etaxonomy.taxeditor.store.CdmStore; +import eu.etaxonomy.taxeditor.ui.combo.TermComboElement; import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; import eu.etaxonomy.taxeditor.ui.element.CheckboxElement; import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; @@ -30,10 +34,6 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; /** - *

- * TaxonBaseDetailElement class. - *

- * * @author n.hoffmann * @created Feb 26, 2010 * @version 1.0 @@ -52,20 +52,10 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem private CheckboxElement checkbox_published; -// private SynonymRelationshipDetailSection sectionSynonymRelationship; - - /** - *

- * Constructor for TaxonBaseDetailElement. - *

- * - * @param cdmFormFactory - * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object. - * @param formElement - * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object. - * @param style - * a int. - */ + private TermComboElement combo_relationshipType; + private CheckboxElement checkProParte; + private CheckboxElement checkPartial; + public TaxonBaseDetailElement(CdmFormFactory cdmFormFactory, ICdmFormElement formElement, int style) { super(cdmFormFactory, formElement); @@ -113,12 +103,11 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem "Taxon is published", ((Taxon) entity).isPublish(), style); } -//#5974 -// if(entity instanceof Synonym){ -// sectionSynonymRelationship = formFactory.createSynonymRelationshipDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE); -// sectionSynonymRelationship.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); -// sectionSynonymRelationship.setEntity((Synonym) entity); -// } + if(entity instanceof Synonym){ + combo_relationshipType = formFactory.createDefinedTermComboElement(TermType.SynonymType, formElement, "Synonym Type", ((Synonym) entity).getType(), style); + checkProParte = formFactory.createCheckbox(formElement, "Pro Parte Synonym", null, style); + checkPartial= formFactory.createCheckbox(formElement, "Partial Synonym", null, style); + } } private void updateCheckboxPublish() { @@ -164,11 +153,17 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem getEntity().setSec(selection_secundum.getSelection()); } else if (eventSource == text_appendedPhrase) { getEntity().setAppendedPhrase(text_appendedPhrase.getText()); - }else if (eventSource == text_secundum_microreference) { + } else if (eventSource == text_secundum_microreference) { getEntity().setSecMicroReference(text_secundum_microreference.getText()); } else if (eventSource == checkbox_published) { ((Taxon)getEntity()).setPublish(checkbox_published.getSelection()); - } + } else if(eventSource == combo_relationshipType){ + ((Synonym) getEntity()).setType(combo_relationshipType.getSelection()); + } else if(eventSource == checkPartial){ + ((Synonym) getEntity()).setPartial(checkPartial.getSelection()); + } else if(eventSource == checkProParte){ + ((Synonym) getEntity()).setProParte(checkProParte.getSelection()); + } } @Override protected void handleToggleableCacheField() {