Project

General

Profile

« Previous | Next » 

Revision 69410b96

Added by Patrick Plitzner over 6 years ago

fix #6198 Remove synonymrelationships in TaxEditor

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipDetailElement.java
1
//// $Id$
2
///**
3
//* Copyright (C) 2014 EDIT
4
//* European Distributed Institute of Taxonomy
5
//* http://www.e-taxonomy.eu
6
//*
7
//* The contents of this file are subject to the Mozilla Public License Version 1.1
8
//* See LICENSE.TXT at the top of this package for the full license terms.
9
//*/
10
//package eu.etaxonomy.taxeditor.ui.section.name;
11
//
12
//import org.eclipse.swt.events.SelectionListener;
13
//import org.eclipse.swt.graphics.Color;
14
//
15
//import eu.etaxonomy.cdm.model.name.NameRelationship;
16
//import eu.etaxonomy.cdm.model.taxon.Synonym;
17
//import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
18
//import eu.etaxonomy.taxeditor.model.MessagingUtils;
19
//import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
20
//import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
21
//import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
22
//import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
23
//import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
24
//import eu.etaxonomy.taxeditor.ui.element.LabelElement;
25
//import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
26
//import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractReferencedEntityElement;
27
//import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
28
//
29
///**
30
// * @author pplitzner
31
// * @date 28.01.2014
32
// *
33
// */
34
//public class SynonymRelationshipDetailElement extends AbstractReferencedEntityElement<Synonym>{
35
//
36
//    private TextWithLabelElement text_ruleConsidered;
37
//    private LabelElement label;
38
//    private EntitySelectionElement selection_toName;
39
//    private TermComboElement<SynonymRelationshipType> combo_relationshipType;
40
//    private CheckboxElement checkProParte;
41
//    private CheckboxElement checkPartial;
42
//
43
//    /**
44
//     * <p>Constructor for NameRelationshipDetailElement.</p>
45
//     *
46
//     * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
47
//     * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
48
//     * @param entity a {@link eu.etaxonomy.cdm.model.name.NameRelationship} object.
49
//     * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
50
//     * @param style a int.
51
//     */
52
//    public SynonymRelationshipDetailElement(CdmFormFactory cdmFormFactory,
53
//            AbstractFormSection formElement,
54
//            Synonym entity, SelectionListener removeListener, int style) {
55
//        super(cdmFormFactory, formElement, entity, removeListener, style);
56
//    }
57
//
58
//    /* (non-Javadoc)
59
//     * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#createControls(org.eclipse.swt.widgets.Composite, int)
60
//     */
61
//    /** {@inheritDoc} */
62
//    @Override
63
//    public void createControls(ICdmFormElement element, int style) {
64
//        label = formFactory.createLabel(element, null);
65
//        checkProParte = formFactory.createCheckbox(element, "Pro Parte Synonym", null, style);
66
//        checkPartial= formFactory.createCheckbox(element, "Partial Synonym", null, style);
67
//        super.createControls(element, style);
68
//    }
69
//
70
//    /** {@inheritDoc} */
71
//    @Override
72
//    public void setEntity(Synonym entity) {
73
//        String text = entity.getTitleCache() + " is " + entity.getType().getLabel() + " " + entity.getAcceptedTaxon().getTitleCache();
74
//
75
//        label.setText(text);
76
//
77
//        checkPartial.setSelection(entity.isPartial());
78
//        checkProParte.setSelection(entity.isProParte());
79
//
80
//        super.setEntity(entity);
81
//    }
82
//
83
//    /** {@inheritDoc} */
84
//    @Override
85
//    public void handleEvent(Object eventSource) {
86
//        if(eventSource == combo_relationshipType){
87
//            getEntity().setType(combo_relationshipType.getSelection());
88
//        }
89
//        else if(eventSource == selection_toName){
90
//            MessagingUtils.error(getClass(), "No API call available.", null);
91
//        }
92
//        else if(eventSource == checkPartial){
93
//            getEntity().setPartial(checkPartial.getSelection());
94
//        }
95
//        else if(eventSource == checkProParte){
96
//            getEntity().setProParte(checkProParte.getSelection());
97
//        }
98
//        else if(eventSource == selection_reference){
99
//            getEntity().setSec(selection_reference.getSelection());
100
//        }
101
//        else if(eventSource == text_referenceDetail){
102
//            getEntity().setSecMicroReference(text_referenceDetail.getText());
103
//        }
104
//    }
105
//
106
//    /** {@inheritDoc} */
107
//    @Override
108
//    public void setBackground(Color color) {
109
//        if(label != null) {
110
//            label.setBackground(color);
111
//        }
112
//        super.setBackground(color);
113
//    }
114
//
115
//}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipDetailSection.java
1
//// $Id$
2
///**
3
//* Copyright (C) 2014 EDIT
4
//* European Distributed Institute of Taxonomy
5
//* http://www.e-taxonomy.eu
6
//*
7
//* The contents of this file are subject to the Mozilla Public License Version 1.1
8
//* See LICENSE.TXT at the top of this package for the full license terms.
9
//*/
10
//package eu.etaxonomy.taxeditor.ui.section.name;
11
//
12
//import java.util.Collection;
13
//
14
//import org.eclipse.core.runtime.IStatus;
15
//import org.eclipse.jface.wizard.WizardDialog;
16
//
17
//import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
18
//import eu.etaxonomy.cdm.model.taxon.Synonym;
19
//import eu.etaxonomy.taxeditor.store.StoreUtil;
20
//import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
21
//import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
22
//import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
23
//
24
///**
25
// * @author pplitzner
26
// * @date 27.01.2014
27
// *
28
// */
29
//public class SynonymRelationshipDetailSection extends AbstractEntityCollectionSection<Synonym, SynonymRelationship> {
30
//
31
//    /**
32
//     * <p>Constructor for NameRelationshipDetailSection.</p>
33
//     *
34
//     * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
35
//     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
36
//     * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
37
//     * @param style a int.
38
//     */
39
//    public SynonymRelationshipDetailSection(CdmFormFactory formFactory, ConversationHolder conversation,
40
//            ICdmFormElement parentElement, int style) {
41
//        super(formFactory, conversation, parentElement, "Synonym Relationship", style);
42
//    }
43
//
44
//    /** {@inheritDoc} */
45
//    @Override
46
//    public void addElement(Synonym element) {
47
//        // nothing
48
//    }
49
//
50
//    /** {@inheritDoc} */
51
//    @Override
52
//    public SynonymRelationship createNewElement() {
53
//
54
//        SynonymRelationshipWizard wizard = new SynonymRelationshipWizard(this);
55
//        WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard);
56
//        int status = dialog.open();
57
//
58
//        if(status == IStatus.OK) {
59
//            return wizard.getSynonymRelationship();
60
//        }
61
//
62
//        return null;
63
//    }
64
//
65
//    /** {@inheritDoc} */
66
//    @Override
67
//    public Collection<SynonymRelationship> getCollection(Synonym entity) {
68
//        Collection<SynonymRelationship> allSynonymRelationships = entity.getSynonymRelations();
69
//        return allSynonymRelationships;
70
//    }
71
//
72
//    /** {@inheritDoc} */
73
//    @Override
74
//    public String getEmptyString() {
75
//        return "No synonym relationships yet.";
76
//    }
77
//
78
//    /** {@inheritDoc} */
79
//    @Override
80
//    protected String getTooltipString() {
81
//        return "Add a new synonym relationship from this name.";
82
//    }
83
//
84
//    /** {@inheritDoc} */
85
//    @Override
86
//    public void removeElement(SynonymRelationship element) {
87
//        getEntity().removeSynonymRelation(element);
88
//    }
89
//
90
//}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipWizard.java
1
//// $Id$
2
///**
3
//* Copyright (C) 2014 EDIT
4
//* European Distributed Institute of Taxonomy
5
//* http://www.e-taxonomy.eu
6
//*
7
//* The contents of this file are subject to the Mozilla Public License Version 1.1
8
//* See LICENSE.TXT at the top of this package for the full license terms.
9
//*/
10
//package eu.etaxonomy.taxeditor.ui.section.name;
11
//
12
//import org.eclipse.jface.wizard.Wizard;
13
//
14
//import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15
//import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
16
//import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
17
//
18
///**
19
// * @author pplitzner
20
// * @date 27.01.2014
21
// *
22
// */
23
//public class SynonymRelationshipWizard  extends Wizard implements IConversationEnabled{
24
//
25
//    private static SynonymRelationshipDetailSection callingSection;
26
//
27
//    /**
28
//     * <p>Constructor for NameRelationshipWizard.</p>
29
//     *
30
//     * @param callingSection a {@link eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection} object.
31
//     */
32
//    public SynonymRelationshipWizard(SynonymRelationshipDetailSection callingSection) {
33
//        SynonymRelationshipWizard.callingSection = callingSection;
34
//    }
35
//
36
//    private SynonymRelationshipWizardPage page;
37
//
38
//    /** {@inheritDoc} */
39
//    @Override
40
//    public void addPages() {
41
//        page = new SynonymRelationshipWizardPage(callingSection);
42
//
43
//        addPage(page);
44
//    }
45
//
46
//    /* (non-Javadoc)
47
//     * @see org.eclipse.jface.wizard.Wizard#performFinish()
48
//     */
49
//    /** {@inheritDoc} */
50
//    @Override
51
//    public boolean performFinish() {
52
//        return page.isPageComplete();
53
//    }
54
//
55
//
56
//
57
//    /**
58
//     * <p>getNameRelationship</p>
59
//     *
60
//     * @return a {@link eu.etaxonomy.cdm.model.name.NameRelationship} object.
61
//     */
62
//    public SynonymRelationship getSynonymRelationship() {
63
//        return page.getSynonymRelationship();
64
//    }
65
//
66
//    /**
67
//     * <p>getConversationHolder</p>
68
//     *
69
//     * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
70
//     */
71
//    @Override
72
//    public ConversationHolder getConversationHolder() {
73
//        return callingSection.getConversationHolder();
74
//    }
75
//
76
//    /** {@inheritDoc} */
77
//    @Override
78
//    public void update(CdmDataChangeMap changeEvents) {}
79
//}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SynonymRelationshipWizardPage.java
1
//// $Id$
2
///**
3
// * Copyright (C) 2014 EDIT
4
// * European Distributed Institute of Taxonomy
5
// * http://www.e-taxonomy.eu
6
// *
7
// * The contents of this file are subject to the Mozilla Public License Version 1.1
8
// * See LICENSE.TXT at the top of this package for the full license terms.
9
// */
10
//package eu.etaxonomy.taxeditor.ui.section.name;
11
//
12
//import org.eclipse.jface.util.IPropertyChangeListener;
13
//import org.eclipse.jface.util.PropertyChangeEvent;
14
//import org.eclipse.swt.SWT;
15
//import org.eclipse.swt.widgets.Composite;
16
//
17
//import eu.etaxonomy.cdm.model.common.TermType;
18
//import eu.etaxonomy.cdm.model.taxon.Synonym;
19
//import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
20
//import eu.etaxonomy.cdm.model.taxon.Taxon;
21
//import eu.etaxonomy.taxeditor.ui.AbstractEntityCollectionElementWizardPage;
22
//import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
23
//import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
24
//import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
25
//
26
///**
27
// * @author pplitzner
28
// * @date 27.01.2014
29
// *
30
// */
31
//public class SynonymRelationshipWizardPage extends AbstractEntityCollectionElementWizardPage implements IPropertyChangeListener {
32
//
33
//
34
//    private EntitySelectionElement<Taxon> selection_relatedTo;
35
//
36
//    private TermComboElement<SynonymRelationshipType> combo_relationshipType;
37
//
38
//    private CheckboxElement checkboxProParte;
39
//
40
//    private boolean isProParte;
41
//
42
//    private CheckboxElement checkboxPartial;
43
//
44
//    private boolean isPartial;
45
//
46
//    private final Synonym entity;
47
//
48
//    private SynonymRelationshipType type;
49
//
50
//    private Taxon taxon;
51
//
52
//
53
//    /**
54
//     * <p>
55
//     * Constructor for NameRelationshipWizardPage.
56
//     * </p>
57
//     *
58
//     * @param callingSection
59
//     *            a
60
//     *            {@link eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection}
61
//     *            object.
62
//     */
63
//    protected SynonymRelationshipWizardPage(
64
//            SynonymRelationshipDetailSection callingSection) {
65
//        super("SynonymRelationshipWizardPage");
66
//        setTitle("New Synonym Relationship");
67
//        setDescription(callingSection.getEntity().getTitleCache());
68
//        this.entity = callingSection.getEntity();
69
//        this.formFactory = callingSection.getFormFactory();
70
//
71
//        formFactory.addPropertyChangeListener(this);
72
//    }
73
//
74
//    /*
75
//     * (non-Javadoc)
76
//     *
77
//     * @see
78
//     * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
79
//     * .Composite)
80
//     */
81
//    /** {@inheritDoc} */
82
//    @Override
83
//    public void createControl(Composite parent) {
84
//        super.createControl(parent);
85
//
86
//        combo_relationshipType = formFactory.createDefinedTermComboElement(TermType.SynonymRelationshipType,
87
//                rootElement, "Synonym Relationship Type", null, SWT.NULL);
88
//
89
//        selection_relatedTo = formFactory
90
//                .createSelectionElement(Taxon.class,
91
//                        ((SynonymRelationshipWizard) getWizard())
92
//                        .getConversationHolder(), rootElement,
93
//                        "Related to", null, EntitySelectionElement.ALL,
94
//                        SWT.NULL);
95
//
96
//        checkboxProParte = formFactory.createCheckbox(rootElement, "Pro Parte Synonym", null, SWT.NULL);
97
//
98
//        checkboxPartial = formFactory.createCheckbox(rootElement, "Partial Synonym", null, SWT.NULL);
99
//
100
//    }
101
//
102
//    /**
103
//     * <p>
104
//     * getNameRelationship
105
//     * </p>
106
//     *
107
//     * @return a {@link eu.etaxonomy.cdm.model.name.NameRelationship} object.
108
//     */
109
//    public SynonymRelationship getSynonymRelationship() {
110
//        SynonymRelationship synonymRelationship = taxon.addSynonym(entity, combo_relationshipType.getSelection());
111
//        synonymRelationship.setPartial(isPartial);
112
//        synonymRelationship.setProParte(isProParte);
113
//        return synonymRelationship;
114
//    }
115
//
116
//    /** {@inheritDoc} */
117
//    @Override
118
//    public void propertyChange(PropertyChangeEvent event) {
119
//        if (event == null) {
120
//            return;
121
//        }
122
//        Object eventSource = event.getSource();
123
//        if (eventSource == combo_relationshipType) {
124
//            type = combo_relationshipType.getSelection();
125
//        } else if (eventSource == selection_relatedTo) {
126
//            taxon = selection_relatedTo.getEntity();
127
//        } else if (eventSource == checkboxProParte) {
128
//            isProParte = checkboxProParte.getSelection();
129
//        } else if (eventSource == checkboxPartial) {
130
//            isPartial = checkboxPartial.getSelection();
131
//        }
132
//
133
//        boolean complete = type != null && taxon != null;
134
//        setPageComplete(complete);
135
//    }
136
//
137
//}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java
15 15
import org.eclipse.jface.util.PropertyChangeEvent;
16 16
import org.eclipse.swt.SWT;
17 17

  
18
import eu.etaxonomy.cdm.model.common.TermType;
18 19
import eu.etaxonomy.cdm.model.reference.Reference;
20
import eu.etaxonomy.cdm.model.taxon.Synonym;
21
import eu.etaxonomy.cdm.model.taxon.SynonymType;
19 22
import eu.etaxonomy.cdm.model.taxon.Taxon;
20 23
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
21 24
import eu.etaxonomy.cdm.persistence.hibernate.permission.Role;
22 25
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
23 26
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
24 27
import eu.etaxonomy.taxeditor.store.CdmStore;
28
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
25 29
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
26 30
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
27 31
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
......
30 34
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
31 35

  
32 36
/**
33
 * <p>
34
 * TaxonBaseDetailElement class.
35
 * </p>
36
 *
37 37
 * @author n.hoffmann
38 38
 * @created Feb 26, 2010
39 39
 * @version 1.0
......
52 52

  
53 53
	private CheckboxElement checkbox_published;
54 54

  
55
//	private SynonymRelationshipDetailSection sectionSynonymRelationship;
56

  
57
	/**
58
	 * <p>
59
	 * Constructor for TaxonBaseDetailElement.
60
	 * </p>
61
	 *
62
	 * @param cdmFormFactory
63
	 *        a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
64
	 * @param formElement
65
	 *        a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
66
	 * @param style
67
	 *            a int.
68
	 */
55
    private TermComboElement<SynonymType> combo_relationshipType;
56
    private CheckboxElement checkProParte;
57
    private CheckboxElement checkPartial;
58

  
69 59
	public TaxonBaseDetailElement(CdmFormFactory cdmFormFactory,
70 60
			ICdmFormElement formElement, int style) {
71 61
		super(cdmFormFactory, formElement);
......
113 103
					"Taxon is published", ((Taxon) entity).isPublish(), style);
114 104
		}
115 105

  
116
//#5974
117
//		if(entity instanceof Synonym){
118
//		    sectionSynonymRelationship = formFactory.createSynonymRelationshipDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
119
//		    sectionSynonymRelationship.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
120
//		    sectionSynonymRelationship.setEntity((Synonym) entity);
121
//		}
106
		if(entity instanceof Synonym){
107
		    combo_relationshipType = formFactory.createDefinedTermComboElement(TermType.SynonymType, formElement, "Synonym Type", ((Synonym) entity).getType(), style);
108
	        checkProParte = formFactory.createCheckbox(formElement, "Pro Parte Synonym", null, style);
109
	        checkPartial= formFactory.createCheckbox(formElement, "Partial Synonym", null, style);
110
		}
122 111
	}
123 112

  
124 113
    private void updateCheckboxPublish() {
......
164 153
			getEntity().setSec(selection_secundum.getSelection());
165 154
		} else if (eventSource == text_appendedPhrase) {
166 155
			getEntity().setAppendedPhrase(text_appendedPhrase.getText());
167
		}else if (eventSource == text_secundum_microreference) {
156
		} else if (eventSource == text_secundum_microreference) {
168 157
            getEntity().setSecMicroReference(text_secundum_microreference.getText());
169 158
		} else if (eventSource == checkbox_published) {
170 159
		    ((Taxon)getEntity()).setPublish(checkbox_published.getSelection());
171
		}
160
		} else if(eventSource == combo_relationshipType){
161
            ((Synonym) getEntity()).setType(combo_relationshipType.getSelection());
162
        } else if(eventSource == checkPartial){
163
            ((Synonym) getEntity()).setPartial(checkPartial.getSelection());
164
        } else if(eventSource == checkProParte){
165
            ((Synonym) getEntity()).setProParte(checkProParte.getSelection());
166
        }
172 167
	}
173 168
	@Override
174 169
	protected void handleToggleableCacheField() {

Also available in: Unified diff