Project

General

Profile

« Previous | Next » 

Revision 35735

Finished the chronology widget

View differences:

ChronologyWidget.java
2 2

  
3 3
import com.google.gwt.i18n.client.DateTimeFormat;
4 4
import com.google.gwt.user.client.ui.*;
5
import eu.dnetlib.goldoa.domain.Affiliation;
6
import eu.dnetlib.goldoa.domain.Person;
7
import eu.dnetlib.goldoa.domain.Project;
5
import eu.dnetlib.goldoa.domain.*;
8 6
import eu.dnetlib.shared.FundingWizardState;
9 7

  
10 8
/**
......
44 42

  
45 43
    public void loadContent(FundingWizardState fundingWizardState) {
46 44

  
47
        if(fundingWizardState.getResearcher()!=null) {
45
        if(fundingWizardState.getResearcher()!=null)
46
            loadResearcherInfo(fundingWizardState.getResearcher());
48 47

  
49
            Person researcher = fundingWizardState.getResearcher();
48
        if(fundingWizardState.getProject()!=null)
49
            loadProjectInfo(fundingWizardState.getProject());
50 50

  
51
            HTML researcherInfo = new HTML();
52
            String researcherInfoContents = "";
51
        if(fundingWizardState.getPublication()!=null)
52
            loadPublicationInfo(fundingWizardState.getPublication());
53 53

  
54
            researcherInfoContents = "<div>";
54
        if(fundingWizardState.getRequest()!=null) {
55 55

  
56
            researcherInfoContents += "<dl><dt class=\"chronologySubTitle\">RESEARCHER</dt></dl>";
56
            if(fundingWizardState.getRequest().getFundingRequested()!=0
57
                    && fundingWizardState.getRequest().getProjectParticipation()!=0) {
57 58

  
58
            researcherInfoContents += "<dl><dt>Name</dt><dd>" + researcher.getName()  + " ";
59
            if(researcher.getInitials()!=null && !researcher.getInitials().trim().equals(""))
60
                researcherInfoContents += researcher.getInitials() + ". ";
61
            researcherInfoContents += researcher.getLastname() + "</dd></dl>";
62
            researcherInfoContents += "<dl><dt>Email</dt><dd>" + researcher.getEmail() + "</dd></dl>";
59
                if(fundingWizardState.getPublication()!=null && fundingWizardState.getPublication().getJournal()!=null) {
60
                    loadAccountingInfo(fundingWizardState.getRequest(), fundingWizardState.getPublication().getJournal().getApc(),
61
                            fundingWizardState.getPublication().getJournal().getDiscount());
62
                }
63 63

  
64
            if(researcher.getTelephone()!=null && !researcher.getTelephone().trim().equals(""))
65
                researcherInfoContents += "<dl><dt>Telephone</dt><dd>" + researcher.getTelephone() + "</dd></dl>";
64
                if(fundingWizardState.getPublication()!=null && fundingWizardState.getPublication().getPublisher()!=null) {
65
                    loadAccountingInfo(fundingWizardState.getRequest(), fundingWizardState.getPublication().getPublisher().getAPC(),
66
                            fundingWizardState.getPublication().getPublisher().getDiscount());
67
                }
68
            }
66 69

  
67
            if(researcher.getOrcidId()!=null && !researcher.getOrcidId().trim().equals(""))
68
                researcherInfoContents += "<dl><dt>ORCID</dt><dd>" + researcher.getOrcidId() + "</dd></dl>";
70
        }
71
    }
69 72

  
70
            if(!researcher.getAffiliations().isEmpty()) {
73
    private void loadResearcherInfo(Person researcher) {
71 74

  
72
                researcherInfoContents += "<dl><dt>Affiliation(s)</dt>";
75
        HTML researcherInfo = new HTML();
76
        String researcherInfoContents = "";
73 77

  
74
                for(Affiliation affiliation : researcher.getAffiliations()) {
75
                    researcherInfoContents += "<dd>" + affiliation.getOrganization().getName();
76
                    if(affiliation.getDepartment()!=null && !affiliation.getDepartment().equals(""))
77
                        researcherInfoContents += " - " + affiliation.getDepartment();
78
                    researcherInfoContents += "</dd>";
79
                }
80
                researcherInfoContents += "</dl>";
81
            }
78
        researcherInfoContents = "<div>";
82 79

  
83
            researcherInfoContents += "</div>";
84
            researcherInfo.setHTML(researcherInfoContents);
80
        researcherInfoContents += "<dl><dt class=\"chronologySubTitle\">RESEARCHER</dt></dl>";
85 81

  
86
            chronologyInfoPanel.add(researcherInfo);
82
        researcherInfoContents += "<dl><dt>Name</dt><dd>" + researcher.getName()  + " ";
83
        if(researcher.getInitials()!=null && !researcher.getInitials().trim().equals(""))
84
            researcherInfoContents += researcher.getInitials() + ". ";
85
        researcherInfoContents += researcher.getLastname() + "</dd></dl>";
86
        researcherInfoContents += "<dl><dt>Email</dt><dd>" + researcher.getEmail() + "</dd></dl>";
87

  
88
        if(researcher.getTelephone()!=null && !researcher.getTelephone().trim().equals(""))
89
            researcherInfoContents += "<dl><dt>Telephone</dt><dd>" + researcher.getTelephone() + "</dd></dl>";
90

  
91
        if(researcher.getOrcidId()!=null && !researcher.getOrcidId().trim().equals(""))
92
            researcherInfoContents += "<dl><dt>ORCID</dt><dd>" + researcher.getOrcidId() + "</dd></dl>";
93

  
94
        if(!researcher.getAffiliations().isEmpty()) {
95

  
96
            researcherInfoContents += "<dl><dt>Affiliation(s)</dt>";
97

  
98
            for(Affiliation affiliation : researcher.getAffiliations()) {
99
                researcherInfoContents += "<dd>" + affiliation.getOrganization().getName();
100
                if(affiliation.getDepartment()!=null && !affiliation.getDepartment().equals(""))
101
                    researcherInfoContents += " - " + affiliation.getDepartment();
102
                researcherInfoContents += "</dd>";
103
            }
104
            researcherInfoContents += "</dl>";
87 105
        }
88 106

  
89
        if(fundingWizardState.getProject()!=null) {
107
        researcherInfoContents += "</div>";
108
        researcherInfo.setHTML(researcherInfoContents);
90 109

  
91
            Project project = fundingWizardState.getProject();
110
        chronologyInfoPanel.add(researcherInfo);
111
    }
92 112

  
93
            HTML projectInfo = new HTML();
94
            String projectInfoContents = "";
113
    private void loadProjectInfo(Project project) {
95 114

  
96
            projectInfoContents = "<div>";
115
        HTML projectInfo = new HTML();
116
        String projectInfoContents = "";
97 117

  
98
            projectInfoContents += "<dl><dt class=\"chronologySubTitle\">PROJECT</dt></dl>";
118
        projectInfoContents = "<div>";
99 119

  
100
            if(project.getAcronym()!=null)
101
                projectInfoContents += "<dl><dt>Acronym</dt><dd>" + project.getAcronym() + "</dd></dl>";
120
        projectInfoContents += "<dl><dt class=\"chronologySubTitle\">PROJECT</dt></dl>";
102 121

  
103
            if (project.getTitle() != null)
104
                projectInfoContents += "<dl><dt>Title</dt><dd>" + project.getTitle() + "</dd></dl>";
122
        if(project.getAcronym()!=null)
123
            projectInfoContents += "<dl><dt>Acronym</dt><dd>" + project.getAcronym() + "</dd></dl>";
105 124

  
106
            if (project.getFunder() != null)
107
                projectInfoContents += "<dl><dt>Funder</dt><dd>" + project.getFunder() + "</dd></dl>";
125
        if (project.getTitle() != null)
126
            projectInfoContents += "<dl><dt>Title</dt><dd>" + project.getTitle() + "</dd></dl>";
108 127

  
109
            if (project.getFundingString() != null)
110
                projectInfoContents += "<dl><dt>Funding stream</dt><dd>" + project.getFundingString() + "</dd></dl>";
128
        if (project.getFunder() != null)
129
            projectInfoContents += "<dl><dt>Funder</dt><dd>" + project.getFunder() + "</dd></dl>";
111 130

  
112
            if (project.getScientificArea() != null)
113
                projectInfoContents += "<dl><dt>Scientific area</dt><dd>" + project.getScientificArea() + "</dd></dl>";
131
        if (project.getFundingString() != null)
132
            projectInfoContents += "<dl><dt>Funding stream</dt><dd>" + project.getFundingString() + "</dd></dl>";
114 133

  
115
            if (project.getCall() != null)
116
                projectInfoContents += "<dl><dt>Call</dt><dd>" + project.getCall() + "</dd></dl>";
134
        if (project.getScientificArea() != null)
135
            projectInfoContents += "<dl><dt>Scientific area</dt><dd>" + project.getScientificArea() + "</dd></dl>";
117 136

  
118
            if (project.getGrant() != null)
119
                projectInfoContents += "<dl><dt>Contract (GA) number</dt><dd>" + project.getGrant() + "</dd></dl>";
137
        if (project.getCall() != null)
138
            projectInfoContents += "<dl><dt>Call</dt><dd>" + project.getCall() + "</dd></dl>";
120 139

  
121
            if (project.getStartDate() != null)
122
                projectInfoContents += "<dl><dt>Start date</dt><dd>" + dtf.format(project.getStartDate()) + "</dd></dl>";
140
        if (project.getGrant() != null)
141
            projectInfoContents += "<dl><dt>Contract (GA) number</dt><dd>" + project.getGrant() + "</dd></dl>";
123 142

  
124
            if (project.getEndDate() != null)
125
                projectInfoContents += "<dl><dt>End date</dt><dd>" + dtf.format(project.getEndDate()) + "</dd></dl>";
143
        if (project.getStartDate() != null)
144
            projectInfoContents += "<dl><dt>Start date</dt><dd>" + dtf.format(project.getStartDate()) + "</dd></dl>";
126 145

  
127
            if (project.isSc39())
128
                projectInfoContents += "<dl><dt>Special clause 39</dt><dd>yes</dd></dl>";
129
            else
130
                projectInfoContents += "<dl><dt>Special clause 39</dt><dd>no</dd></dl>";
146
        if (project.getEndDate() != null)
147
            projectInfoContents += "<dl><dt>End date</dt><dd>" + dtf.format(project.getEndDate()) + "</dd></dl>";
131 148

  
132
            if (!project.getOrganizations().isEmpty()) {
133
                projectInfoContents += "<dl><dt>Organization(s)</dt><dd>";
134
                for (int i = 0; i < project.getOrganizations().size(); i++) {
135
                    if (i != 0)
136
                        projectInfoContents += ", ";
137
                    if(project.getOrganizations().get(i).getShortName()!=null && !project.getOrganizations().get(i).getShortName().trim().equals(""))
138
                        projectInfoContents += project.getOrganizations().get(i).getShortName();
139
                    else
140
                        projectInfoContents += project.getOrganizations().get(i).getName();
141
                }
142
                projectInfoContents += "</dd></dl>";
149
        if (project.isSc39())
150
            projectInfoContents += "<dl><dt>Special clause 39</dt><dd>yes</dd></dl>";
151
        else
152
            projectInfoContents += "<dl><dt>Special clause 39</dt><dd>no</dd></dl>";
153

  
154
        if (!project.getOrganizations().isEmpty()) {
155
            projectInfoContents += "<dl><dt>Organization(s)</dt><dd>";
156
            for (int i = 0; i < project.getOrganizations().size(); i++) {
157
                if (i != 0)
158
                    projectInfoContents += ", ";
159
                if(project.getOrganizations().get(i).getShortName()!=null && !project.getOrganizations().get(i).getShortName().trim().equals(""))
160
                    projectInfoContents += project.getOrganizations().get(i).getShortName();
161
                else
162
                    projectInfoContents += project.getOrganizations().get(i).getName();
143 163
            }
164
            projectInfoContents += "</dd></dl>";
165
        }
144 166

  
145
            if (project.getUrl() != null)
146
                projectInfoContents += "<dl><dt>More info</dt><dd>" + project.getUrl() + "</dd></dl>";
167
        if (project.getUrl() != null)
168
            projectInfoContents += "<dl><dt>More info</dt><dd>" + project.getUrl() + "</dd></dl>";
147 169

  
148
            projectInfoContents += "</div>";
149
            projectInfo.setHTML(projectInfoContents);
170
        projectInfoContents += "</div>";
171
        projectInfo.setHTML(projectInfoContents);
150 172

  
151
            chronologyInfoPanel.add(projectInfo);
173
        chronologyInfoPanel.add(projectInfo);
174
    }
175

  
176
    private void loadPublicationInfo(Publication publication) {
177

  
178
        HTML publicationInfo = new HTML();
179
        String publicationInfoContents = "";
180

  
181
        publicationInfoContents = "<div>";
182

  
183
        publicationInfoContents += "<dl><dt class=\"chronologySubTitle\">PUBLICATION</dt></dl>";
184

  
185

  
186
        if(publication.getTitle()!=null && !publication.getTitle().trim().equals(""))
187
            publicationInfoContents += "<dl><dt>Title</dt><dd>" + publication.getTitle() + "</dd></dl>";
188

  
189
        if(publication.getDoi()!=null && !publication.getDoi().trim().equals(""))
190
            publicationInfoContents += "<dl><dt>DOI</dt><dd>" + publication.getDoi() + "</dd></dl>";
191

  
192
        if(!publication.getAuthors().isEmpty()) {
193

  
194
            publicationInfoContents += "<dl><dt>Author(s)</dt>";
195

  
196
            for(Affiliation author : publication.getAuthors()) {
197
                publicationInfoContents += "<dd>" + author.getPerson().getName();
198
                if(author.getPerson().getInitials()!=null && !author.getPerson().getInitials().trim().equals(""))
199
                    publicationInfoContents += " " + author.getPerson().getInitials().trim();
200
                publicationInfoContents += author.getPerson().getLastname() + "</dd>";
201
            }
202
            publicationInfoContents += "</dl>";
152 203
        }
153 204

  
205
        if(publication.getPublicationDate()!=null)
206
            publicationInfoContents += "<dl><dt>Publication Date</dt><dd>" + dtf.format(publication.getPublicationDate()) + "</dd></dl>";
207

  
208
        if(publication.getType().equals(Publication.Type.ARTICLE))
209
            publicationInfoContents += "<dl><dt>Type</dt><dd>Article</dd></dl>";
210
        else
211
            publicationInfoContents += "<dl><dt>Type</dt><dd>Monograph</dd></dl>";
212

  
213
        if(publication.getLanguages()!=null && !publication.getLanguages().trim().equals(""))
214
            publicationInfoContents += "<dl><dt>Languages</dt><dd>" + publication.getLanguages() + "</dd></dl>";
215

  
216
        if(publication.getSubjects()!=null && !publication.getSubjects().trim().equals(""))
217
            publicationInfoContents += "<dl><dt>Subjects</dt><dd>" + publication.getSubjects() + "</dd></dl>";
218

  
219
        if(!publication.getIdentifiers().isEmpty()) {
220

  
221
            publicationInfoContents += "<dl><dt>Author(s)</dt>";
222

  
223
            for(PublicationIdentifier publicationIdentifier : publication.getIdentifiers()) {
224
                publicationInfoContents += "<dd>" +  publicationIdentifier.getType() + " - " + publicationIdentifier.getValue() + "</dd>";
225
            }
226
            publicationInfoContents += "</dl>";
227
        }
228

  
229
        publicationInfoContents += "</div>";
230
        publicationInfo.setHTML(publicationInfoContents);
231

  
232
        chronologyInfoPanel.add(publicationInfo);
233

  
234
        if(publication.getJournal()!=null)
235
            loadJournalInfo(publication.getJournal());
236

  
237
        if(publication.getPublisher()!=null)
238
            loadPublisherInfo(publication.getPublisher());
154 239
    }
240

  
241
    private void loadJournalInfo(Journal journal) {
242

  
243
        HTML journalInfo = new HTML();
244
        String journalInfoContents = "";
245

  
246
        journalInfoContents = "<div>";
247

  
248
        journalInfoContents += "<dl><dt class=\"chronologySubTitle\">JOURNAL</dt></dl>";
249

  
250
        if(journal.getTitle()!=null && !journal.getTitle().trim().equals(""))
251
            journalInfoContents += "<dl><dt>Title</dt><dd>" + journal.getTitle() + "</dd></dl>";
252

  
253
        if(journal.getAlternativeTitle()!=null && !journal.getAlternativeTitle().trim().equals(""))
254
            journalInfoContents += "<dl><dt>Alternative Title</dt><dd>" + journal.getAlternativeTitle() + "</dd></dl>";
255

  
256
        if(journal.getUrl()!=null && !journal.getUrl().trim().equals(""))
257
            journalInfoContents += "<dl><dt>URL</dt><dd>" + journal.getUrl() + "</dd></dl>";
258

  
259
        if(journal.getLanguages()!=null && !journal.getLanguages().trim().equals(""))
260
            journalInfoContents += "<dl><dt>Languages</dt><dd>" + journal.getLanguages() + "</dd></dl>";
261

  
262
        if(journal.getIssn()!=null && !journal.getIssn().trim().equals(""))
263
            journalInfoContents += "<dl><dt>ISSN / EISSN</dt><dd>" + journal.getIssn() + "</dd></dl>";
264

  
265
        if(journal.getCountry()!=null && !journal.getCountry().trim().equals(""))
266
            journalInfoContents += "<dl><dt>Country</dt><dd>" + journal.getCountry() + "</dd></dl>";
267

  
268
        if(journal.getSubjects()!=null && !journal.getSubjects().trim().equals(""))
269
            journalInfoContents += "<dl><dt>Subjects</dt><dd>" + journal.getSubjects() + "</dd></dl>";
270

  
271
        if(journal.getLicence()!=null && !journal.getLicence().trim().equals(""))
272
            journalInfoContents += "<dl><dt>Licence</dt><dd>" + journal.getLicence() + "</dd></dl>";
273

  
274
        journalInfoContents += "</div>";
275
        journalInfo.setHTML(journalInfoContents);
276

  
277
        chronologyInfoPanel.add(journalInfo);
278
    }
279

  
280
    private void loadPublisherInfo(Publisher publisher) {
281

  
282
        HTML publisherInfo = new HTML();
283
        String publisherInfoContents = "";
284

  
285
        publisherInfoContents = "<div>";
286

  
287
        publisherInfoContents += "<dl><dt class=\"chronologySubTitle\">PUBLISHER</dt></dl>";
288

  
289
        if(publisher.getName()!=null && !publisher.getName().trim().equals(""))
290
            publisherInfoContents += "<dl><dt>Publisher Name</dt><dd>" + publisher.getName() + "</dd></dl>";
291

  
292
        publisherInfoContents += "</div>";
293
        publisherInfo.setHTML(publisherInfoContents);
294

  
295
        chronologyInfoPanel.add(publisherInfo);
296
    }
297

  
298
    private void loadAccountingInfo(Request request, float apc, float discount) {
299

  
300
        HTML accountingInfo = new HTML();
301
        String accountingInfoContents = "";
302

  
303
        accountingInfoContents = "<div>";
304

  
305
        accountingInfoContents += "<dl><dt class=\"chronologySubTitle\">ACCOUNTING</dt></dl>";
306

  
307
        accountingInfoContents += "<dl><dt>APC</dt><dd>" + apc + "</dd></dl>";
308
        accountingInfoContents += "<dl><dt>Gold OA discount</dt><dd>" + discount + "%</dd></dl>";
309
        accountingInfoContents += "<dl><dt>Project participation</dt><dd>" + request.getProjectParticipation() + "</dd></dl>";
310
        accountingInfoContents += "<dl><dt>Funding requested</dt><dd>" + request.getFundingRequested() + "</dd></dl>";
311

  
312
        accountingInfoContents += "</div>";
313
        accountingInfo.setHTML(accountingInfoContents);
314

  
315
        chronologyInfoPanel.add(accountingInfo);
316
    }
155 317
}

Also available in: Unified diff