Project

General

Profile

« Previous | Next » 

Revision 73649f56

Added by Katja Luther about 7 years ago

fix #3533: prefill nomenclatural reference selection dialog with nomenclatural title of combination author

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalReferenceSelectionDialog.java
11 11

  
12 12
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
13 13
import eu.etaxonomy.cdm.api.service.IReferenceService;
14
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
14 15
import eu.etaxonomy.cdm.model.reference.Reference;
15 16
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
16 17
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
......
20 21
public class NomenclaturalReferenceSelectionDialog extends
21 22
		ReferenceSelectionDialog {
22 23

  
24
    private TeamOrPersonBase author;
25
    private boolean firstCall = true;
26

  
23 27
	protected NomenclaturalReferenceSelectionDialog(Shell shell,
24 28
			ConversationHolder conversation, String title, boolean multi,
25
			Reference reference, boolean inReference) {
29
			Reference reference, boolean inReference, TeamOrPersonBase author) {
26 30
		super(shell, conversation, title, multi, reference);
27
		// TODO Auto-generated constructor stub
31
		this.author = author;
32
		firstCall = true;
33

  
28 34
	}
29 35

  
30 36
	/* (non-Javadoc)
......
37 43
        String pattern = null;
38 44
        if (control != null){
39 45
            pattern = ((Text)control).getText();
46

  
47
        }
48
        if (firstCall && author != null){
49
            pattern = author.getNomenclaturalTitle();
50
            if (control!= null){
51
                firstCall = false;
52
                ((Text)control).setText(pattern);
53
            }
54

  
40 55
        }
41 56

  
42 57
        if (pattern == null || pattern.equals("?")){
......
44 59
        }else{
45 60
            model = CdmStore.getService(IReferenceService.class).getUuidAndAbbrevTitleCache(limitOfInitialElements, pattern);
46 61
        }
62
        System.out.println("2");
47 63
	}
48 64

  
49 65
	/**
......
64 80
	 * @return a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
65 81
	 */
66 82

  
67
	public static Reference select(Shell shell, ConversationHolder conversation, Reference reference) {
83
	public static Reference select(Shell shell, ConversationHolder conversation, Reference reference, TeamOrPersonBase author) {
68 84
		NomenclaturalReferenceSelectionDialog dialog = new NomenclaturalReferenceSelectionDialog(shell, conversation,
69
				"Choose a reference", isInReference, reference, false);
85
				"Choose a reference", isInReference, reference, false, author);
70 86
		return getSelectionFromDialog(dialog);
71 87
	}
72 88

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ReferenceSelectionDialog.java
33 33

  
34 34
    protected static boolean isInReference = false;
35 35
    private Reference currentReference;
36

  
36 37
	/**
37 38
	 * <p>select</p>
38 39
	 *
......
75 76
	protected ReferenceSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, Reference reference) {
76 77
		super(shell, conversation, title, multi, ReferenceSelectionDialog.class.getCanonicalName(), null);
77 78
		this.currentReference = reference;
79

  
80

  
78 81
	}
79 82

  
80 83

  
......
93 96
        super(shell, conversation, title, multi, ReferenceSelectionDialog.class.getCanonicalName(), null);
94 97
        this.isInReference = isInReference;
95 98
        this.currentReference = reference;
99

  
96 100
    }
97 101

  
98 102

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java
79 79
			return (T) TaxonNodeSelectionDialog.select(shell, conversation, null, null, (TaxonNode) currentSelection, ((TaxonNode) currentSelection).getClassification());
80 80
		}
81 81
		if(clazz.equals(Reference.class) && parentElement instanceof NomenclaturalReferenceDetailElement){
82
			return (T) NomenclaturalReferenceSelectionDialog.select(shell, conversation, (Reference) currentSelection);
82
			return (T) NomenclaturalReferenceSelectionDialog.select(shell, conversation, (Reference) currentSelection, ((NomenclaturalReferenceDetailElement)parentElement).getEntity().getCombinationAuthorship());
83 83
		}
84 84
		if(clazz.equals(Reference.class)){
85 85
		    if (parentElement instanceof ReferenceDetailElement){
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
282 282
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
283 283
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;
284 284
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
285
import eu.etaxonomy.taxeditor.ui.section.reference.ReferencingObjectsMessagesSection;
285 286
import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationElement;
286 287
import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
287 288
import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseElement;
......
1681 1682
        return section;
1682 1683
    }
1683 1684

  
1685
    public ReferencingObjectsMessagesSection createReferencingObjectsMessagesSection(ConversationHolder conversation, ICdmFormElement parentElement, int style, Reference reference){
1686
        ReferencingObjectsMessagesSection section = new ReferencingObjectsMessagesSection(this, parentElement,style,reference);
1687
        addAndAdaptSection(parentElement, section);
1688
        return section;
1689
    }
1690

  
1684 1691
    public NonViralNameDetailSection createNonViralNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, boolean nameChoosable, int style){
1685 1692
        NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, nameChoosable, style);
1686 1693
        addAndAdaptSection(parentElement, section);

Also available in: Unified diff