Project

General

Profile

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

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

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

    
14
    private HTML projectInfo = new HTML();
15
    private String projectInfoContents = "";
16

    
17
    private DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy/MM/dd");
18

    
19
    public ProjectFullInfo(Project project) {
20

    
21
        projectInfoContents = "<div>";
22

    
23
        projectInfoContents += "<dl><dt class=\"chronologySubTitle\">PROJECT</dt></dl>";
24

    
25
        if(project.getAcronym()!=null)
26
            projectInfoContents += "<dl><dt>Acronym</dt><dd>" + project.getAcronym() + "</dd></dl>";
27

    
28
        if (project.getTitle() != null)
29
            projectInfoContents += "<dl><dt>Title</dt><dd>" + project.getTitle() + "</dd></dl>";
30

    
31
        if (project.getFunder() != null)
32
            projectInfoContents += "<dl><dt>Funder</dt><dd>" + project.getFunder() + "</dd></dl>";
33

    
34
        if (project.getFundingString() != null)
35
            projectInfoContents += "<dl><dt>Funding stream</dt><dd>" + project.getFundingString() + "</dd></dl>";
36

    
37
        if (project.getScientificArea() != null)
38
            projectInfoContents += "<dl><dt>Scientific area</dt><dd>" + project.getScientificArea() + "</dd></dl>";
39

    
40
        if (project.getCall() != null)
41
            projectInfoContents += "<dl><dt>Call</dt><dd>" + project.getCall() + "</dd></dl>";
42

    
43
        if (project.getGrant() != null)
44
            projectInfoContents += "<dl><dt>Contract (GA) number</dt><dd>" + project.getGrant() + "</dd></dl>";
45

    
46
        if (project.getStartDate() != null)
47
            projectInfoContents += "<dl><dt>Start date</dt><dd>" + dtf.format(project.getStartDate()) + "</dd></dl>";
48

    
49
        if (project.getEndDate() != null)
50
            projectInfoContents += "<dl><dt>End date</dt><dd>" + dtf.format(project.getEndDate()) + "</dd></dl>";
51

    
52
        if (project.isSc39())
53
            projectInfoContents += "<dl><dt>Special clause 39</dt><dd>yes</dd></dl>";
54
        else
55
            projectInfoContents += "<dl><dt>Special clause 39</dt><dd>no</dd></dl>";
56

    
57
        //TODO do we need to display all organizations?
58
//        if (!project.getOrganizations().isEmpty()) {
59
//            projectInfoContents += "<dl><dt>Organization(s)</dt><dd>";
60
//            for (int i = 0; i < project.getOrganizations().size(); i++) {
61
//                if (i != 0)
62
//                    projectInfoContents += ", ";
63
//                if(project.getOrganizations().get(i).getShortName()!=null && !project.getOrganizations().get(i).getShortName().trim().equals(""))
64
//                    projectInfoContents += project.getOrganizations().get(i).getShortName();
65
//                else
66
//                    projectInfoContents += project.getOrganizations().get(i).getName();
67
//            }
68
//            projectInfoContents += "</dd></dl>";
69
//        }
70

    
71
        if (project.getUrl() != null)
72
            projectInfoContents += "<dl><dt>More info</dt><dd>" + project.getUrl() + "</dd></dl>";
73

    
74
        projectInfoContents += "</div>";
75
        projectInfo.setHTML(projectInfoContents);
76
    }
77

    
78
    @Override
79
    public Widget asWidget() {
80
        return projectInfo;
81
    }
82

    
83
    public void addStyleName(String styleName) {
84
        projectInfo.addStyleName(styleName);
85
    }
86
}
(4-4/9)