Project

General

Profile

1
package eu.dnetlib.client.fundingrequest.stepinfo;
2

    
3
import com.google.gwt.user.client.ui.HTML;
4
import com.google.gwt.user.client.ui.IsWidget;
5
import com.google.gwt.user.client.ui.Widget;
6
import eu.dnetlib.goldoa.domain.Affiliation;
7
import eu.dnetlib.goldoa.domain.User;
8

    
9
/**
10
 * Created by stefania on 3/27/15.
11
 */
12
public class ResearcherSummaryInfo implements IsWidget {
13

    
14
    private HTML researcherInfo = new HTML();
15
    private String researcherInfoContents = "";
16

    
17
    public ResearcherSummaryInfo(User researcher) {
18

    
19
        researcherInfoContents = "<div>";
20

    
21
        researcherInfoContents += "<dl><dt class=\"chronologySubTitle\">RESEARCHER</dt></dl>";
22

    
23
        researcherInfoContents += "<dl><dt>Name</dt><dd>" + researcher.getFirstname()  + " ";
24
        if(researcher.getInitials()!=null && !researcher.getInitials().trim().equals(""))
25
            researcherInfoContents += researcher.getInitials() + ". ";
26
        researcherInfoContents += researcher.getLastname() + "</dd></dl>";
27
        researcherInfoContents += "<dl><dt>Email</dt><dd>" + researcher.getEmail() + "</dd></dl>";
28

    
29
        if(!researcher.getAffiliations().isEmpty()) {
30

    
31
            researcherInfoContents += "<dl><dt>Affiliation(s)</dt>";
32

    
33
            for(Affiliation affiliation : researcher.getAffiliations()) {
34
                researcherInfoContents += "<dd>" + affiliation.getOrganization().getName();
35
                if(affiliation.getDepartment()!=null && !affiliation.getDepartment().equals(""))
36
                    researcherInfoContents += " - " + affiliation.getDepartment();
37
                researcherInfoContents += "</dd>";
38
            }
39
            researcherInfoContents += "</dl>";
40
        }
41

    
42
        researcherInfoContents += "</div>";
43
        researcherInfo.setHTML(researcherInfoContents);
44
    }
45

    
46
    @Override
47
    public Widget asWidget() {
48
        return researcherInfo;
49
    }
50

    
51
    public void addStyleName(String styleName) {
52
        researcherInfo.addStyleName(styleName);
53
    }
54
}
(32-32/32)