Project

General

Profile

Download (1.37 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 *
3
 */
4
package eu.etaxonomy.taxeditor.ui.selection;
5

    
6
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
7
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
8
import eu.etaxonomy.cdm.model.common.ICdmBase;
9
import eu.etaxonomy.cdm.model.reference.Reference;
10
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
11
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
12

    
13
public class EntitySelectionElementWithAbbreviatedTitle<T extends ICdmBase> extends EntitySelectionElement<T> {
14

    
15
	/**
16
     * @param formFactory
17
     * @param conversation
18
     * @param parentElement
19
     * @param clazz
20
     * @param labelString
21
     * @param entity
22
     * @param mode
23
     * @param style
24
     */
25
    public EntitySelectionElementWithAbbreviatedTitle(CdmFormFactory formFactory, ConversationHolder conversation,
26
            ICdmFormElement parentElement, Class<T> clazz, String labelString, T entity, int mode, int style) {
27
        super(formFactory, conversation, parentElement, clazz, labelString, entity, mode, style);
28
    }
29

    
30
    @Override
31
    protected String getTitle() {
32
		if (entity != null){
33
		    if(entity instanceof TeamOrPersonBase) {
34
		        return ((TeamOrPersonBase) entity).getNomenclaturalTitle();
35
		    } else if(entity instanceof Reference){
36
		        return ((Reference) entity).getAbbrevTitleCache();
37
		    } else{
38
		        return super.getTitle();
39
		    }
40
		}
41
		return "";
42
	}
43
}
(3-3/5)