Project

General

Profile

Revision 720b900a

ID720b900aab3c18563786722de892b19173ae7626
Parent e5445f14
Child cec14c01

Added by Katja Luther over 4 years ago

fix #5977: create a new teammember should allow only persons

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AgentSelectionDialog.java
46 46
	 *
47 47
	 */
48 48
	protected static final String TEAM = "Team";
49
	
50
	protected static boolean selectTeamMember;
49 51

  
50 52
	/**
51 53
	 * <p>select</p>
......
55 57
	 * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
56 58
	 * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
57 59
	 */
58
	public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity) {
60
	public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity, boolean selectTeamMember) {
59 61
		AgentSelectionDialog dialog = new AgentSelectionDialog(shell, conversation,
60
				"Choose Agent", false, AgentSelectionDialog.class.getCanonicalName(), entity);
62
				"Choose Agent", false, AgentSelectionDialog.class.getCanonicalName(), entity, selectTeamMember);
61 63
		return getSelectionFromDialog(dialog);
62 64
	}
63 65

  
......
71 73
	 * @param multi a boolean.
72 74
	 * @param settings a {@link java.lang.String} object.
73 75
	 */
74
	protected AgentSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, String settings, AgentBase agent) {
76
	protected AgentSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, String settings, AgentBase agent, boolean selectTeamMember) {
75 77
		super(shell, conversation, title, multi, settings, agent);
78
		this.selectTeamMember = selectTeamMember;
76 79
	}
77 80

  
78 81

  
......
122 125
	/** {@inheritDoc} */
123 126
	@Override
124 127
	protected String getNewWizardLinkText() {
128
		if (this.selectTeamMember){
129
			return String.format("Create a new <a>%1s</a>", PERSON);
130
		}
125 131
		return String.format("Create a new <a>%1s</a> or <a>%2s</a>", TEAM, PERSON);
126 132
	}
127 133

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java
41 41
     * @param agent
42 42
     */
43 43
    protected NomenclaturalAuthorSelectionDialog(Shell shell, ConversationHolder conversation, String title,
44
            boolean multi, String settings, AgentBase agent) {
45
        super(shell, conversation, title, multi, settings, agent);
44
            boolean multi, String settings, AgentBase agent, boolean teamMemberSelection) {
45
        super(shell, conversation, title, multi, settings, agent, teamMemberSelection);
46 46
        // TODO Auto-generated constructor stub
47 47
    }
48 48

  
......
80 80
     * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
81 81
     * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
82 82
     */
83
    public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity) {
83
    public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity, boolean teamMemberSelection) {
84 84
        NomenclaturalAuthorSelectionDialog dialog = new NomenclaturalAuthorSelectionDialog(shell, conversation,
85
                "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity);
85
                "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity, teamMemberSelection);
86 86
        return getSelectionFromDialog(dialog);
87 87
    }
88 88

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalPersonAuthorSelectionDialog.java
35 35
     * @param agent
36 36
     */
37 37
    protected NomenclaturalPersonAuthorSelectionDialog(Shell shell, ConversationHolder conversation, String title,
38
            boolean multi, String settings, AgentBase agent) {
39
        super(shell, conversation, title, multi, settings, agent);
38
            boolean multi, String settings, AgentBase agent, boolean teamMemberSelection) {
39
        super(shell, conversation, title, multi, settings, agent, teamMemberSelection);
40 40
        // TODO Auto-generated constructor stub
41 41
    }
42 42

  
......
49 49
     * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
50 50
     * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
51 51
     */
52
    public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity) {
52
    public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity, boolean teamMemberSelection) {
53 53
        NomenclaturalPersonAuthorSelectionDialog dialog = new NomenclaturalPersonAuthorSelectionDialog(shell, conversation,
54
                "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity);
54
                "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity,teamMemberSelection);
55 55
        return getSelectionFromDialog(dialog);
56 56
    }
57 57

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java
86 86
			return (T) TeamSelectionDialog.select(shell, conversation, (Team) currentSelection);
87 87
		}
88 88
		if(clazz.equals(TeamOrPersonBase.class) && parentElement instanceof AuthorshipDetailElement){
89
            return (T) NomenclaturalAuthorSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
89
            return (T) NomenclaturalAuthorSelectionDialog.select(shell, conversation, (AgentBase) currentSelection, false);
90 90
        }else if(clazz.equals(TeamOrPersonBase.class)){
91 91
		    //TODO: add TeamOrPersonBaseSelectionDialog (see ticket #4545)
92
		    return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
92
		    return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) currentSelection, false);
93 93
		}
94 94
		if(clazz.equals(Person.class) && parentElement instanceof TeamMemberElement){
95
		    return (T) NomenclaturalPersonAuthorSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
95
		    return (T) NomenclaturalPersonAuthorSelectionDialog.select(shell, conversation, (AgentBase) currentSelection, true);
96 96
        }
97 97
		if(clazz.equals(AgentBase.class)){
98
			return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
98
			return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) currentSelection, false);
99 99
		}
100 100
		if(clazz.equals(Feature.class)){
101 101
			return (T) FeatureSelectionDialog.select(shell, conversation, (Feature) currentSelection);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)