Project

General

Profile

« Previous | Next » 

Revision d82999cd

Added by Katja Luther over 2 years ago

ref #9900: fix consistent use of abbrev title for authors of nomenclatural reference

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewReferenceWizard.java
53 53
	public void addPages() {
54 54
		// TODO disabling external service wizard page for now
55 55
//		addPage(new ExternalReferenceServiceWizardPage(formFactory, getConversationHolder(), entity));
56
		referencePage = new ReferenceWizardPage(formFactory, getConversationHolder(), getEntity());
56
		referencePage = new ReferenceWizardPage(formFactory, getConversationHolder(), getEntity(), false);
57 57
		addPage(referencePage);
58 58
	}
59 59

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTeamWizard.java
11 11

  
12 12
import eu.etaxonomy.cdm.api.service.IAgentService;
13 13
import eu.etaxonomy.cdm.model.agent.Team;
14
import eu.etaxonomy.cdm.persistence.dto.MergeResult;
14 15
import eu.etaxonomy.taxeditor.store.CdmStore;
15 16
import eu.etaxonomy.taxeditor.ui.section.agent.TeamWizardPage;
16 17

  
......
49 50
	/** {@inheritDoc} */
50 51
	@Override
51 52
	protected void saveEntity() {
52
	    CdmStore.getService(IAgentService.class).merge(getEntity(), true);
53
	    MergeResult result = CdmStore.getService(IAgentService.class).merge(getEntity(), true);
53 54
	    
54 55
	}
55 56

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java
83 83
            this.cdmBaseToBeFiltered = new HashSet<>();
84 84
            objectsToBeFiltered.forEach(filter->this.cdmBaseToBeFiltered.add(filter.getUuid()));
85 85
        }
86
        Cursor cursor = shell.getCursor();
87
        shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
86
        Cursor cursor = null;
87
        if (shell != null){
88
        	cursor = shell.getCursor();
89
        	shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
90
        }
91
        
88 92
        init();
89
        shell.setCursor(cursor);
93
        if (shell != null){   
94
        	shell.setCursor(cursor);
95
        }
90 96
        setListLabelProvider(createListLabelProvider());
91 97

  
92 98
	}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java
57 57
import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailElement;
58 58
import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailElement;
59 59
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitFacadeGeneralDetailElement;
60
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;
60
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalSourceDetailElement;
61 61
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;
62 62
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailElement;
63 63
import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
......
93 93
			return (T) TaxonNodeSelectionDialog.select(shell,
94 94
			        null, null, (TaxonNode) currentSelection, ((TaxonNode) currentSelection).getClassification().getUuid());
95 95
		}
96
		if(clazz.equals(Reference.class) && parentElement != null && parentElement.getParentElement() instanceof NomenclaturalReferenceDetailElement){
96
		if(clazz.equals(Reference.class) && parentElement != null && parentElement.getParentElement() instanceof NomenclaturalSourceDetailElement){
97 97
			return (T) NomenclaturalReferenceSelectionDialog.select(shell,
98
			        (Reference) currentSelection, ((NomenclaturalReferenceDetailElement)parentElement.getParentElement()).getEntity().getCombinationAuthorship());
98
			        (Reference) currentSelection, ((NomenclaturalSourceDetailElement)parentElement.getParentElement()).getEntity().getCombinationAuthorship());
99 99
		}
100 100
		if(clazz.equals(Reference.class) && parentElement instanceof CommonNameSourceElement && PreferencesUtil.getFilterCommonNameReferences()){
101 101
            return (T) CommonNameReferenceSelectionDialog.select(shell,
......
115 115
		if(clazz.equals(Team.class)){
116 116
			return (T) TeamSelectionDialog.select(shell, (Team)currentSelection);
117 117
		}
118
		if(clazz.equals(TeamOrPersonBase.class) && parentElement instanceof AuthorshipDetailElement){
118
		if(clazz.equals(TeamOrPersonBase.class) && (parentElement instanceof AuthorshipDetailElement 
119
				|| (parentElement instanceof ReferenceDetailElement && ((ReferenceDetailElement)parentElement).isNomenclaturalReference()))){
119 120
            return (T) NomenclaturalAuthorSelectionDialog.select(shell,
120 121
                    (TeamOrPersonBase) currentSelection, false);
121 122
        }else if(clazz.equals(AgentBase.class) && (parentElement instanceof FieldUnitFacadeGeneralDetailElement || parentElement instanceof DerivedUnitGeneralDetailElement)){
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TeamOrPersonBaseSelectionDialog.java
39 39

  
40 40
    @Override
41 41
    protected void callService(String pattern) {
42
        model = (List)CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Team.class, limitOfInitialElements, pattern);
43
        model.addAll((List)CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Person.class,limitOfInitialElements, pattern));
42
    	model = (List)CdmStore.getService(IAgentService.class).getTeamOrPersonUuidAndTitleCache(null, limitOfInitialElements, pattern);
43
//        model = (List)CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Team.class, limitOfInitialElements, pattern);
44
//        model.addAll((List)CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Person.class,limitOfInitialElements, pattern));
44 45
    }
45 46

  
46 47
    @Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
156 156
import eu.etaxonomy.taxeditor.ui.section.EmptyElement;
157 157
import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailElement;
158 158
import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailSection;
159
import eu.etaxonomy.taxeditor.ui.section.agent.NomenclaturalTeamMemberElement;
159 160
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailElement;
160 161
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
161 162
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailElement;
......
338 339
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
339 340
import eu.etaxonomy.taxeditor.ui.section.reference.AdvancedNomenclaturalSourceElement;
340 341
import eu.etaxonomy.taxeditor.ui.section.reference.AdvancedSourceElement;
341
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;
342
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
342
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalSourceDetailElement;
343
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalSourceDetailSection;
343 344
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalSourceElement;
344 345
import eu.etaxonomy.taxeditor.ui.section.reference.OriginalSourceAdvancedSection;
345 346
import eu.etaxonomy.taxeditor.ui.section.reference.OriginalSourceElement;
......
1927 1928
        return section;
1928 1929
    }
1929 1930

  
1930
    public NomenclaturalReferenceDetailSection createNomenclaturalReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1931
        NomenclaturalReferenceDetailSection section = new NomenclaturalReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
1931
    public NomenclaturalSourceDetailSection createNomenclaturalReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
1932
        NomenclaturalSourceDetailSection section = new NomenclaturalSourceDetailSection(this, conversation, parentElement, selectionProvider, style);
1932 1933
        addAndAdaptSection(parentElement, section);
1933 1934
        return section;
1934 1935
    }
......
2475 2476
        addAndAdaptElement(parentElement, element);
2476 2477
        return element;
2477 2478
    }
2479
    public ReferenceDetailElement createNomenclaturalReferenceDetailElement(ICdmFormElement parentElement, int style){
2480
        ReferenceDetailElement element = new ReferenceDetailElement(this, parentElement, true, style);
2481
        addAndAdaptElement(parentElement, element);
2482
        return element;
2483
    }
2478 2484

  
2479
    public NomenclaturalReferenceDetailElement createNomenclaturalReferenceDetailElement(ICdmFormElement parentElement, int style){
2480
        NomenclaturalReferenceDetailElement element = new NomenclaturalReferenceDetailElement(this, parentElement, style);
2485
    public NomenclaturalSourceDetailElement createNomenclaturalSourceDetailElement(ICdmFormElement parentElement, int style){
2486
        NomenclaturalSourceDetailElement element = new NomenclaturalSourceDetailElement(this, parentElement, style);
2481 2487
        addAndAdaptElement(parentElement, element);
2482 2488
        return element;
2483 2489
    }
......
2982 2988
            if (parentElement instanceof TeamMemberSection){
2983 2989
                isNomenclatural = ((TeamMemberSection) parentElement).isNomenclaturalTeam();
2984 2990
            }
2985
            element = new TeamMemberElement(this, parentElement, (Person) entity, removeListener, style, isNomenclatural);
2991
            if (isNomenclatural){
2992
            	element = new NomenclaturalTeamMemberElement(this, parentElement, (Person) entity, removeListener, style);
2993
            }else{
2994
            	element = new TeamMemberElement(this, parentElement, (Person) entity, removeListener, style);
2995
            }
2986 2996
        } else if (entity instanceof Credit) {
2987 2997
            element = new CreditElement(this, parentElement, (Credit) entity, removeListener, style);
2988 2998
        } else if (entity instanceof Extension) {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/NomenclaturalTeamMemberElement.java
1
package eu.etaxonomy.taxeditor.ui.section.agent;
2

  
3
import org.eclipse.swt.events.SelectionListener;
4

  
5
import eu.etaxonomy.cdm.model.agent.Person;
6
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
7
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
8
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
9
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
10

  
11
public class NomenclaturalTeamMemberElement extends TeamMemberElement {
12

  
13
	public NomenclaturalTeamMemberElement(CdmFormFactory cdmFormFactory, AbstractFormSection section, Person entity,
14
			SelectionListener removeListener, int style) {
15
		super(cdmFormFactory, section, entity, removeListener, style);
16
		
17
	}
18

  
19
	@Override
20
	public void createControls(ICdmFormElement element, int style) {
21
		selection_person = formFactory
22
				.createSelectionElementWithAbbreviatedTitle(Person.class,getConversationHolder(),
23
				        this, "Person", null,
24
						EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE,
25
						style);
26
		if (entity != null){
27
			setEntity(entity);
28
		}
29
	}
30
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamMemberElement.java
25 25
 */
26 26
public class TeamMemberElement extends AbstractEntityCollectionElement<Person> {
27 27

  
28
	private EntitySelectionElement<Person> selection_person;
28
	protected EntitySelectionElement<Person> selection_person;
29 29

  
30 30
	public TeamMemberElement(CdmFormFactory cdmFormFactory,
31 31
			AbstractFormSection section, Person entity,
32
			SelectionListener removeListener, int style, boolean isNomenclatural) {
32
			SelectionListener removeListener, int style) {
33 33
		super(cdmFormFactory, section, entity, removeListener, null, style);
34 34
	}
35 35

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailElement.java
1
/**
2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * See LICENSE.TXT at the top of this package for the full license terms.
8
 */
9

  
10
package eu.etaxonomy.taxeditor.ui.section.reference;
11

  
12
import eu.etaxonomy.cdm.model.name.NomenclaturalSource;
13
import eu.etaxonomy.cdm.model.name.TaxonName;
14
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
15
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
16
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
17

  
18
/**
19
 * <p>
20
 * NomenclaturalReferenceDetailElement class.
21
 * </p>
22
 *
23
 * @author n.hoffmann
24
 * @created Mar 12, 2010
25
 */
26
public class NomenclaturalReferenceDetailElement extends
27
		AbstractCdmDetailElement<TaxonName> {
28

  
29
    private OriginalSourceElement sourceElement;
30

  
31
	/**
32
	 * <p>
33
	 * Constructor for NomenclaturalReferenceDetailElement.
34
	 * </p>
35
	 *
36
	 * @param cdmFormFactory
37
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
38
	 *            object.
39
	 * @param formElement
40
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
41
	 *            object.
42
	 * @param style
43
	 *            a int.
44
	 */
45
	public NomenclaturalReferenceDetailElement(CdmFormFactory cdmFormFactory,
46
			ICdmFormElement formElement, int style) {
47
		super(cdmFormFactory, formElement);
48
	}
49

  
50
	@Override
51
	protected void createControls(ICdmFormElement formElement,
52
			TaxonName entity, int style) {
53

  
54
	    sourceElement = formFactory.createNomenclaturalSourceElement(formElement, entity, "Reference");
55
	    if (entity.getNomenclaturalSource() == null){
56
            NomenclaturalSource source = NomenclaturalSource.NewNomenclaturalInstance(entity);
57
            entity.setNomenclaturalSource(source);
58
            sourceElement.setEntity(source);
59
        }else{
60
            sourceElement.setEntity(entity.getNomenclaturalSource());
61
        }
62
	    sourceElement.setPersistentBackground(formElement.getPersistentBackground());
63

  
64
	}
65

  
66
	@Override
67
	public void handleEvent(Object eventSource) {
68

  
69
	}
70

  
71

  
72
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailSection.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.ui.section.reference;
11

  
12
import org.eclipse.jface.viewers.ISelectionProvider;
13

  
14
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
16
import eu.etaxonomy.cdm.model.name.NomenclaturalSource;
17
import eu.etaxonomy.cdm.model.name.TaxonName;
18
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
19
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
22
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
23
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
24

  
25
/**
26
 * <p>NomenclaturalReferenceDetailSection class.</p>
27
 *
28
 * @author n.hoffmann
29
 * @created Mar 12, 2010
30
 */
31
public class NomenclaturalReferenceDetailSection extends
32
		AbstractCdmDetailSection<TaxonName>  implements ITaxonBaseDetailSection{
33

  
34
	private TaxonBase<?> taxonBase;
35

  
36
	/**
37
	 * <p>Constructor for NomenclaturalReferenceDetailSection.</p>
38
	 *
39
	 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
40
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
41
	 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
42
	 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
43
	 * @param style a int.
44
	 */
45
	public NomenclaturalReferenceDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
46
			ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
47
		super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
48
	}
49

  
50
	@Override
51
	public String getHeading() {
52
		return "Nomenclatural Source";
53
	}
54

  
55
	@Override
56
    public void setTaxonBase(TaxonBase entity) {
57
		this.taxonBase = entity;
58
		TaxonName name = HibernateProxyHelper.deproxy(entity.getName());
59
		setEntity(name);
60
	}
61

  
62
	@Override
63
	protected void setSectionTitle() {
64
		String title = "";
65
		if(getEntity() != null && getEntity().getNomenclaturalSource() != null){
66
			NomenclaturalSource reference = getEntity().getNomenclaturalSource();
67
			if (reference != null && reference.getCitation() != null){
68
			    String nomenclaturalCitation = reference.getCitation().getNomenclaturalCitation(reference.getCitationMicroReference());
69
			    title = ": " + nomenclaturalCitation;
70
			}
71

  
72
		}
73
		this.setText(getHeading() + title);
74
	}
75

  
76
	@Override
77
	public TaxonBase getTaxonBase() {
78
		return taxonBase;
79
	}
80

  
81
	@Override
82
	protected AbstractCdmDetailElement<TaxonName> createCdmDetailElement(
83
			AbstractCdmDetailSection<TaxonName> parentElement, int style) {
84
	    return formFactory.createNomenclaturalReferenceDetailElement(parentElement, style);
85
	}
86
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalSourceDetailElement.java
1
/**
2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * See LICENSE.TXT at the top of this package for the full license terms.
8
 */
9

  
10
package eu.etaxonomy.taxeditor.ui.section.reference;
11

  
12
import eu.etaxonomy.cdm.model.name.NomenclaturalSource;
13
import eu.etaxonomy.cdm.model.name.TaxonName;
14
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
15
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
16
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
17

  
18
/**
19
 * <p>
20
 * NomenclaturalReferenceDetailElement class.
21
 * </p>
22
 *
23
 * @author n.hoffmann
24
 * @created Mar 12, 2010
25
 */
26
public class NomenclaturalSourceDetailElement extends
27
		AbstractCdmDetailElement<TaxonName> {
28

  
29
    private OriginalSourceElement sourceElement;
30

  
31
	/**
32
	 * <p>
33
	 * Constructor for NomenclaturalReferenceDetailElement.
34
	 * </p>
35
	 *
36
	 * @param cdmFormFactory
37
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
38
	 *            object.
39
	 * @param formElement
40
	 *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
41
	 *            object.
42
	 * @param style
43
	 *            a int.
44
	 */
45
	public NomenclaturalSourceDetailElement(CdmFormFactory cdmFormFactory,
46
			ICdmFormElement formElement, int style) {
47
		super(cdmFormFactory, formElement);
48
	}
49

  
50
	@Override
51
	protected void createControls(ICdmFormElement formElement,
52
			TaxonName entity, int style) {
53

  
54
	    sourceElement = formFactory.createNomenclaturalSourceElement(formElement, entity, "Reference");
55
	    if (entity.getNomenclaturalSource() == null){
56
            NomenclaturalSource source = NomenclaturalSource.NewNomenclaturalInstance(entity);
57
            entity.setNomenclaturalSource(source);
58
            sourceElement.setEntity(source);
59
        }else{
60
            sourceElement.setEntity(entity.getNomenclaturalSource());
61
        }
62
	    sourceElement.setPersistentBackground(formElement.getPersistentBackground());
63

  
64
	}
65

  
66
	@Override
67
	public void handleEvent(Object eventSource) {
68

  
69
	}
70

  
71

  
72
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalSourceDetailSection.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.taxeditor.ui.section.reference;
11

  
12
import org.eclipse.jface.viewers.ISelectionProvider;
13

  
14
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
16
import eu.etaxonomy.cdm.model.name.NomenclaturalSource;
17
import eu.etaxonomy.cdm.model.name.TaxonName;
18
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
19
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
22
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
23
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
24

  
25
/**
26
 * <p>NomenclaturalReferenceDetailSection class.</p>
27
 *
28
 * @author n.hoffmann
29
 * @created Mar 12, 2010
30
 */
31
public class NomenclaturalSourceDetailSection extends
32
		AbstractCdmDetailSection<TaxonName>  implements ITaxonBaseDetailSection{
33

  
34
	private TaxonBase<?> taxonBase;
35

  
36
	/**
37
	 * <p>Constructor for NomenclaturalReferenceDetailSection.</p>
38
	 *
39
	 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
40
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
41
	 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
42
	 * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
43
	 * @param style a int.
44
	 */
45
	public NomenclaturalSourceDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
46
			ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
47
		super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
48
	}
49

  
50
	@Override
51
	public String getHeading() {
52
		return "Nomenclatural Source";
53
	}
54

  
55
	@Override
56
    public void setTaxonBase(TaxonBase entity) {
57
		this.taxonBase = entity;
58
		TaxonName name = HibernateProxyHelper.deproxy(entity.getName());
59
		setEntity(name);
60
	}
61

  
62
	@Override
63
	protected void setSectionTitle() {
64
		String title = "";
65
		if(getEntity() != null && getEntity().getNomenclaturalSource() != null){
66
			NomenclaturalSource reference = getEntity().getNomenclaturalSource();
67
			if (reference != null && reference.getCitation() != null){
68
			    String nomenclaturalCitation = reference.getCitation().getNomenclaturalCitation(reference.getCitationMicroReference());
69
			    title = ": " + nomenclaturalCitation;
70
			}
71

  
72
		}
73
		this.setText(getHeading() + title);
74
	}
75

  
76
	@Override
77
	public TaxonBase getTaxonBase() {
78
		return taxonBase;
79
	}
80

  
81
	@Override
82
	protected AbstractCdmDetailElement<TaxonName> createCdmDetailElement(
83
			AbstractCdmDetailSection<TaxonName> parentElement, int style) {
84
	    return formFactory.createNomenclaturalSourceDetailElement(parentElement, style);
85
	}
86
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalSourceElement.java
33 33
public class NomenclaturalSourceElement extends OriginalSourceElement<NomenclaturalSource> {
34 34

  
35 35
    private EntitySelectionElementWithAbbreviatedTitle<Reference> selection_NomRef;
36
    protected String label = "Source";
37
    protected CdmBase cdmEntity;
38

  
39 36
    protected EntitySelectionElement<TaxonName> select_nameUsedInSource;
40
    protected ExternalLinksSection externalLinks;
37
    
41 38

  
42 39
    public NomenclaturalSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement, CdmBase cdmEntity,
43 40
            String label) {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java
48 48
public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElement<Reference>
49 49
		implements IErrorIntolerableElement, IExceptionHandler {
50 50

  
51
    private ToggleableTextElement toggleableAbbrevCache;
51
	boolean isNomenclaturalReference = false;
52
	
53
    
54

  
55
	private ToggleableTextElement toggleableAbbrevCache;
52 56

  
53 57
	private TextWithLabelElement text_edition;
54 58
	private TextWithLabelElement text_editor;
......
97 101
			ICdmFormElement formElement, int style) {
98 102
		super(cdmFormFactory, formElement);
99 103
	}
104
	
105
	public ReferenceDetailElement(CdmFormFactory cdmFormFactory,
106
			ICdmFormElement formElement, boolean isNomenclaturalReference, int style) {
107
		this(cdmFormFactory, formElement, style);
108
		this.isNomenclaturalReference = isNomenclaturalReference;
109
		
110
	}
111
	public boolean isNomenclaturalReference() {
112
		return isNomenclaturalReference;
113
	}
114

  
115
	public void setNomenclaturalReference(boolean isNomenclaturalReference) {
116
		this.isNomenclaturalReference = isNomenclaturalReference;
117
	}
100 118

  
101 119
	@Override
102 120
	protected void createControls(ICdmFormElement formElement,
......
125 143
		ReferenceType referenceType = entity.getType();
126 144
		// author team
127 145
		if(referenceType != null && !referenceType.equals(ReferenceType.Journal) && !referenceType.equals(ReferenceType.PrintSeries) ) {
128
            selection_authorTeam = formFactory
129
            		.createSelectionElement(TeamOrPersonBase.class,
130
            		        formElement, "Author",
131
            				entity.getAuthorship(),
132
            				EntitySelectionElement.ALL, style);
146
			if (isNomenclaturalReference){
147
				selection_authorTeam = formFactory
148
	            		.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,getConversationHolder(),
149
	            		        formElement, "Author",
150
	            				entity.getAuthorship(),
151
	            				EntitySelectionElement.ALL, style);
152
			}else{
153
	            selection_authorTeam = formFactory
154
	            		.createSelectionElement(TeamOrPersonBase.class,
155
	            		        formElement, "Author",
156
	            				entity.getAuthorship(),
157
	            				EntitySelectionElement.ALL, style);
158
			}
133 159
        }
134 160

  
135 161
		if (referenceType != null) {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceWizardPage.java
27 27
 * @created Jun 1, 2010
28 28
 */
29 29
public class ReferenceWizardPage extends AbstractCdmEntityWizardPage<Reference> implements IExceptionHandler{
30
	private boolean isNomenclaturalReference = false;
30 31

  
31 32
	/**
32 33
	 * <p>Constructor for ReferenceBaseWizardPage.</p>
......
35 36
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
36 37
	 * @param entity a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
37 38
	 */
38
	public ReferenceWizardPage(CdmFormFactory formFactory, ConversationHolder conversation, Reference entity) {
39
	public ReferenceWizardPage(CdmFormFactory formFactory, ConversationHolder conversation, Reference entity, boolean isNomenclaturalReference) {
39 40
		super(formFactory, conversation, entity);
40 41
		setTitle("Reference");
42
		this.isNomenclaturalReference = isNomenclaturalReference;
41 43
	}
42 44

  
43 45
	@Override
......
47 49

  
48 50
	@Override
49 51
    public AbstractCdmDetailElement<Reference> createElement(ICdmFormElement rootElement){
50
		ReferenceDetailElement referenceElement = formFactory.createReferenceDetailElement(rootElement, SWT.NULL);
52
		ReferenceDetailElement referenceElement = formFactory.createNomenclaturalReferenceDetailElement(rootElement,  SWT.NULL);
51 53
		referenceElement.addExceptionHandler(this);
52 54
		referenceElement.setEntity(entity);
53 55
		referenceElement.setWarnForReferencingObjectsVisible(true);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EditFromSelectionWizard.java
97 97
			IService<CdmBase> service = CdmStore.getService(entity);
98 98
			rootElement = service.load(entity.getUuid());
99 99
		}
100
		if (rootElement.isInstanceOf(Reference.class)) {
100
		if (rootElement.isInstanceOf(Reference.class)&& selectionElement instanceof EntitySelectionElementWithAbbreviatedTitle<?>) {
101 101
			addPage(new ReferenceWizardPage(formFactory,
102 102
					selectionElement.getConversationHolder(),
103
					(HibernateProxyHelper.deproxy(rootElement, Reference.class))));
104
		} else if (rootElement.isInstanceOf(Team.class) && selectionElement instanceof EntitySelectionElementWithAbbreviatedTitle<?>) {
103
					HibernateProxyHelper.deproxy(rootElement, Reference.class), true));
104
		} else if (rootElement.isInstanceOf(Reference.class) ) {
105
			addPage(new ReferenceWizardPage(formFactory,
106
					selectionElement.getConversationHolder(), HibernateProxyHelper.deproxy(rootElement, Reference.class), false));
107
		} else if (rootElement.isInstanceOf(Team.class) && (selectionElement instanceof EntitySelectionElementWithAbbreviatedTitle<?> )) {
105 108
			addPage(new TeamWizardPage(formFactory,
106 109
					selectionElement.getConversationHolder(), HibernateProxyHelper.deproxy(rootElement, Team.class), true));
107 110
		} else if (rootElement.isInstanceOf(Team.class) && !(selectionElement instanceof EntitySelectionElementWithAbbreviatedTitle<?>)) {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
15 15

  
16 16
import javax.inject.Inject;
17 17

  
18
import org.apache.lucene.search.BulkScorer;
18 19
import org.eclipse.e4.core.di.annotations.Optional;
19 20
import org.eclipse.e4.ui.di.UIEventTopic;
20 21
import org.eclipse.jface.viewers.ISelection;
21 22
import org.eclipse.jface.viewers.IStructuredSelection;
22 23
import org.eclipse.jface.viewers.SelectionChangedEvent;
24
import org.eclipse.jface.viewers.StructuredSelection;
23 25
import org.eclipse.jface.viewers.TreeNode;
24 26
import org.eclipse.swt.SWT;
25 27
import org.springframework.security.core.GrantedAuthority;
......
30 32
import eu.etaxonomy.cdm.model.agent.Person;
31 33
import eu.etaxonomy.cdm.model.agent.Team;
32 34
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
35
import eu.etaxonomy.cdm.model.common.CdmBase;
33 36
import eu.etaxonomy.cdm.model.common.Marker;
34 37
import eu.etaxonomy.cdm.model.description.CategoricalData;
35 38
import eu.etaxonomy.cdm.model.description.Character;
......
52 55
import eu.etaxonomy.cdm.model.permission.Group;
53 56
import eu.etaxonomy.cdm.model.permission.User;
54 57
import eu.etaxonomy.cdm.model.reference.Reference;
58
import eu.etaxonomy.cdm.model.taxon.SecundumSource;
55 59
import eu.etaxonomy.cdm.model.taxon.Synonym;
56 60
import eu.etaxonomy.cdm.model.taxon.Taxon;
57 61
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
......
132 136
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
133 137
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
134 138
import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
135
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
139
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalSourceDetailSection;
136 140
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
141
import eu.etaxonomy.taxeditor.ui.section.reference.SecundumSourceSection;
137 142
import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
138 143
import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.DerivedUnitFacadeIdentifierSection;
139 144
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
......
209 214
            input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
210 215
        }
211 216
        super.setInput(input);
217
        
218
        
212 219
    }
213 220

  
214 221
    @Override
......
477 484
            requiredCrud = EnumSet.of(CRUD.UPDATE);
478 485
        }
479 486
        boolean hasPermission = CdmStore.currentAuthentiationHasPermission(StoreUtil.getCdmEntity(getInput()), requiredCrud);
487
        TaxonBase<?> taxonBase = (TaxonBase<?>)getInput();
480 488
        if (hasPermission){
481 489
            // check for subtree permissions as well.
482
            TaxonBase<?> taxonBase = (TaxonBase<?>)getInput();
490
            
483 491
            Taxon acceptedTaxon = null;
484 492
            if (taxonBase instanceof Taxon){
485 493
                acceptedTaxon = (Taxon)taxonBase;
......
525 533
                addPart(taxonBaseDetailSection);
526 534
            }
527 535
        }
536
        //TODO: test code for secundum source section
537
//        SecundumSourceSection sourceSection = formFactory.createSecundumDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SecundumSourceSection.class, getInput().getClass().getCanonicalName(), true));
538
//        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
539
//        addPart(sourceSection);
540
//        if (taxonBase.getSecSource() == null){
541
//            SecundumSource source = SecundumSource.NewSecundumInstance(taxonBase);
542
//            taxonBase.setSecSource(source);
543
//            sourceSection.setEntity(taxonBase);
544
//        }else{
545
//        	sourceSection.setEntity(taxonBase);
546
//        }
547
//
548
//        if (config != null && !config.isSecEnabled()){
549
//        	sourceSection.setEnabled(false);
550
//        }
528 551
        NonViralNameDetailSection nonViralNameSection = formFactory
529 552
                .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
530 553
                        StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
531 554
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
532 555
        nonViralNameSection.setEnabled(detailsEnabled);
533 556
        if (config == null || config.isNomenclaturalReferenceSectionActivated()){
534
            NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
535
                    StoreUtil.getSectionStyle(NomenclaturalReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true));
557
            NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
558
                    StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
536 559
            referenceDetailSection.setEnabled(detailsEnabled);
537 560
            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
538 561
            addPart(referenceDetailSection);
......
577 600

  
578 601
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
579 602

  
580
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
581
                StoreUtil.getSectionStyle(NomenclaturalReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true));
603
        NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
604
                StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
582 605
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
583 606

  
584 607
        NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
......
939 962

  
940 963
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
941 964

  
942
        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
943
                StoreUtil.getSectionStyle(NomenclaturalReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true));
965
        NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
966
                StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
944 967
        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
945 968
        addPart(referenceDetailSection);
946 969

  

Also available in: Unified diff