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.Affiliation;
|
8
|
import eu.dnetlib.goldoa.domain.Publication;
|
9
|
import eu.dnetlib.goldoa.domain.PublicationIdentifier;
|
10
|
|
11
|
/**
|
12
|
* Created by stefania on 3/30/15.
|
13
|
*/
|
14
|
public class PublicationInlineInfo implements IsWidget {
|
15
|
|
16
|
private HTML publicationInlineInfo = new HTML();
|
17
|
private String publicationInfoContents = "";
|
18
|
|
19
|
private DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy/MM/dd");
|
20
|
|
21
|
public PublicationInlineInfo(Publication publication) {
|
22
|
|
23
|
publicationInfoContents = "<div class=\"displayInlineInfo\">";
|
24
|
|
25
|
publicationInfoContents += "<dl><dt class=\"chronologySubTitle\">PUBLICATION</dt></dl>";
|
26
|
|
27
|
if(publication.getType().equals(Publication.Type.ARTICLE))
|
28
|
publicationInfoContents += "<dd>Type: Article</dd>";
|
29
|
else if(publication.getType().equals(Publication.Type.MONOGRAPH))
|
30
|
publicationInfoContents += "<dd>Type: Book</dd>";
|
31
|
else if(publication.getType().equals(Publication.Type.CONFERENCE_PROCS))
|
32
|
publicationInfoContents += "<dd>Type: Conference Procs</dd>";
|
33
|
else
|
34
|
publicationInfoContents += "<dd>Type: Book chapter</dd>";
|
35
|
|
36
|
if(publication.getDoi()!=null && !publication.getDoi().trim().equals(""))
|
37
|
publicationInfoContents += "<dd>DOI: " + publication.getDoi() + "</dd>";
|
38
|
else
|
39
|
publicationInfoContents += "<dd>DOI: <mark>not available</mark></dd>";
|
40
|
|
41
|
if(publication.getTitle()!=null && !publication.getTitle().trim().equals("")) {
|
42
|
if(publication.getType().equals(Publication.Type.BOOK_CHAPTER))
|
43
|
publicationInfoContents += "<dd>Book Chapter Title: " + publication.getTitle() + "</dd>";
|
44
|
else
|
45
|
publicationInfoContents += "<dd>Title: " + publication.getTitle() + "</dd>";
|
46
|
}
|
47
|
|
48
|
if(publication.getType().equals(Publication.Type.CONFERENCE_PROCS)
|
49
|
&& publication.getEventDetails()!=null && !publication.getEventDetails().trim().isEmpty())
|
50
|
publicationInfoContents += "<dd>Event Details: " + publication.getEventDetails() + "</dd>";
|
51
|
|
52
|
if(publication.getType().equals(Publication.Type.BOOK_CHAPTER)) {
|
53
|
if(publication.getAlternativeTitle()!=null && !publication.getAlternativeTitle().trim().equals(""))
|
54
|
publicationInfoContents += "<dd>Book Title: " + publication.getAlternativeTitle() + "</dd>";
|
55
|
if(publication.getAlternativeDoi()!=null && !publication.getAlternativeDoi().trim().equals(""))
|
56
|
publicationInfoContents += "<dd>Book DOI: " + publication.getAlternativeDoi() + "</dd>";
|
57
|
}
|
58
|
|
59
|
if(!publication.getAuthors().isEmpty()) {
|
60
|
|
61
|
publicationInfoContents += "<dd>Authors: ";
|
62
|
for(int i=0; i<publication.getAuthors().size(); i++) {
|
63
|
if(i!=0)
|
64
|
publicationInfoContents += ", ";
|
65
|
publicationInfoContents += publication.getAuthors().get(i).getPerson().getName();
|
66
|
if(publication.getAuthors().get(i).getPerson().getInitials()!=null && !publication.getAuthors().get(i).getPerson().getInitials().trim().equals(""))
|
67
|
publicationInfoContents += " " + publication.getAuthors().get(i).getPerson().getInitials().trim() + ".";
|
68
|
publicationInfoContents += " " + publication.getAuthors().get(i).getPerson().getLastname();
|
69
|
}
|
70
|
publicationInfoContents += "</dd>";
|
71
|
}
|
72
|
|
73
|
if(publication.getAcceptanceDate()!=null) {
|
74
|
if(publication.getType().equals(Publication.Type.ARTICLE))
|
75
|
publicationInfoContents += "<dd>Acceptance Date: " + dtf.format(publication.getAcceptanceDate()) + "</dd>";
|
76
|
else
|
77
|
publicationInfoContents += "<dd>Estimated Acceptance Date: " + dtf.format(publication.getAcceptanceDate()) + "</dd>";
|
78
|
}
|
79
|
|
80
|
if(publication.getPublicationDate()!=null)
|
81
|
publicationInfoContents += "<dd>Publication Date: " + dtf.format(publication.getPublicationDate()) + "</dd>";
|
82
|
|
83
|
if(publication.getLanguages()!=null && !publication.getLanguages().trim().equals(""))
|
84
|
publicationInfoContents += "<dd>Languages: " + publication.getLanguages() + "</dd>";
|
85
|
|
86
|
if(publication.getSubjects()!=null && !publication.getSubjects().trim().equals(""))
|
87
|
publicationInfoContents += "<dd>Subjects: " + publication.getSubjects() + "</dd>";
|
88
|
|
89
|
if(!publication.getIdentifiers().isEmpty()) {
|
90
|
|
91
|
publicationInfoContents += "<dd>Identifiers: ";
|
92
|
for(int i=0; i<publication.getIdentifiers().size(); i++) {
|
93
|
if(i!=0)
|
94
|
publicationInfoContents += ", ";
|
95
|
publicationInfoContents += publication.getIdentifiers().get(i).getType() + " - " + publication.getIdentifiers().get(i).getValue();
|
96
|
}
|
97
|
publicationInfoContents += "</dd>";
|
98
|
}
|
99
|
|
100
|
|
101
|
publicationInfoContents += "<dl><dt class=\"chronologySubTitle\">REPOSITORY</dt></dl>";
|
102
|
if(publication.getRepository()!=null && !publication.getRepository().equals(""))
|
103
|
publicationInfoContents += "<dd>" + publication.getRepository() + "</dd>";
|
104
|
else
|
105
|
publicationInfoContents += "<dd><mark>unknown</mark></dd>";
|
106
|
|
107
|
|
108
|
publicationInfoContents += "</div>";
|
109
|
publicationInlineInfo.setHTML(publicationInfoContents);
|
110
|
}
|
111
|
|
112
|
@Override
|
113
|
public Widget asWidget() {
|
114
|
return publicationInlineInfo;
|
115
|
}
|
116
|
|
117
|
public void addStyleName(String styleName) {
|
118
|
publicationInlineInfo.addStyleName(styleName);
|
119
|
}
|
120
|
}
|