Project

General

Profile

« Previous | Next » 

Revision 4faee5bc

Added by Katja Luther over 2 years ago

ref #9894: add field primary collector and handle as described in ticket

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/CollectorSelectionElement.java
1 1
package eu.etaxonomy.taxeditor.ui.selection;
2 2

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

  
3 5
import eu.etaxonomy.cdm.model.agent.AgentBase;
6
import eu.etaxonomy.cdm.model.agent.Person;
7
import eu.etaxonomy.cdm.model.agent.Team;
4 8
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
5 9
import eu.etaxonomy.cdm.model.common.CdmBase;
6 10
import eu.etaxonomy.cdm.model.reference.Reference;
11
import eu.etaxonomy.taxeditor.store.StoreUtil;
12
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
7 13
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
8 14
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
9 15

  
10 16
public class CollectorSelectionElement extends EntitySelectionElement<AgentBase> {
17
	
18
	Team collectorTeam;
11 19
	/**
12 20
     * @param formFactory
13 21
     * @param conversation
......
24 32
        parentElement, AgentBase.class,
25 33
        labelString, entity, mode, style);
26 34
    }
35
    public CollectorSelectionElement(CdmFormFactory formFactory,// ConversationHolder conversation,
36
            ICdmFormElement parentElement, String labelString, AgentBase entity, Person primaryCollector, int mode, int style) {
37
    	super(formFactory, //conversation,
38
        parentElement, AgentBase.class,
39
        labelString, primaryCollector, mode, style);
40
    	if (entity instanceof Team){
41
    		collectorTeam = (Team)entity;
42
    	}
43
    }
27 44

  
28 45
    @Override
29 46
    protected String getTitle() {
......
36 53
		}
37 54
		return "";
38 55
	}
56
	public Team getCollectorTeam() {
57
		return collectorTeam;
58
	}
59
	public void setCollectorTeam(Team collectorTeam) {
60
		this.collectorTeam = collectorTeam;
61
	}
62
	
63
	public void widgetSelected(SelectionEvent e) {
64
	    if (e.getSource().equals(button_selection) ){
65
	    	AgentBase selection = null;
66
	    	if (this.collectorTeam != null){
67
	    		selection = SelectionDialogFactory.getSelectionFromDialog(AgentBase.class, getShell(),
68
		                collectorTeam, this);
69
	    	}else{	    	
70
	    		selection = SelectionDialogFactory.getSelectionFromDialog(AgentBase.class, getShell(),
71
	                getEntity(), getParentElement());
72
	    	}
73
            setSelectionInternal(selection);
74
            if(!getLayoutComposite().isDisposed()){
75
                StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
76
            }
77
	    }
78
	}
39 79
}

Also available in: Unified diff