Project

General

Profile

1
package eu.dnetlib.client.fundingrequest.newrequest.publicationstep;
2

    
3
import com.github.gwtbootstrap.client.ui.Alert;
4
import com.github.gwtbootstrap.client.ui.constants.AlertType;
5
import com.google.gwt.core.client.GWT;
6
import com.google.gwt.user.client.ui.FlowPanel;
7
import com.google.gwt.user.client.ui.HTML;
8
import com.google.gwt.user.client.ui.IsWidget;
9
import com.google.gwt.user.client.ui.Widget;
10
import eu.dnetlib.client.GoldOAConstants;
11
import eu.dnetlib.goldoa.domain.Journal;
12

    
13
/**
14
 * Created by stefania on 3/18/15.
15
 */
16
public class JournalDisplayInfo implements IsWidget {
17

    
18
    private FlowPanel journalDisplayInfoPanel = new FlowPanel();
19

    
20
    private Alert errorLabel = new Alert();
21

    
22
    private HTML journalDisplayInfoElement = new HTML();
23
    private String contents;
24

    
25
    private GoldOAConstants goldOAConstants = GWT.create(GoldOAConstants.class);
26

    
27
    public JournalDisplayInfo(Journal journal) {
28

    
29
        if(journal==null) {
30

    
31
            errorLabel.setText(goldOAConstants.errorGettingJournalInfo());
32
            errorLabel.addStyleName("alertLabel");
33
            errorLabel.setType(AlertType.ERROR);
34
            errorLabel.setHeading("Error! ");
35
            errorLabel.setClose(false);
36

    
37
            journalDisplayInfoPanel.add(errorLabel);
38

    
39
        } else {
40

    
41
            contents = "<div class=\"displayInfoElement\">";
42

    
43
            contents += "<div class=\"displayInfoElementTitle\">" + journal.getTitle() + "</div>";
44

    
45
            if (journal.getAlternativeTitle() != null && !journal.getAlternativeTitle().trim().equals(""))
46
                contents += "<dl class=\"dl-horizontal\"><dt>ALTERNATIVE TITLE</dt><dd>" + journal.getAlternativeTitle() + "</dd></dl>";
47

    
48
            if (journal.getUrl() != null && !journal.getUrl().trim().equals(""))
49
                contents += "<dl class=\"dl-horizontal\"><dt>URL</dt><dd><a target=\"_blank\" href=\"" + journal.getUrl() + "\">" + journal.getUrl() + "</a></dd></dl>";
50

    
51
            if (journal.getPublisher() != null && journal.getPublisher().getName() !=null)
52
                contents += "<dl class=\"dl-horizontal\"><dt>PUBLISHER</dt><dd>" + journal.getPublisher().getName() + "</dd></dl>";
53

    
54
            if (journal.getLanguages() != null && !journal.getLanguages().trim().equals(""))
55
                contents += "<dl class=\"dl-horizontal\"><dt>LANGUAGES</dt><dd>" + journal.getLanguages() + "</dd></dl>";
56

    
57
            if (journal.getIssn() != null && !journal.getIssn().trim().equals(""))
58
                contents += "<dl class=\"dl-horizontal\"><dt>ISSN / EISSN</dt><dd>" + journal.getIssn() + "</dd></dl>";
59

    
60
            if (journal.getCountry() != null && !journal.getCountry().trim().equals(""))
61
                contents += "<dl class=\"dl-horizontal\"><dt>COUNTRY</dt><dd>" + journal.getCountry() + "</dd></dl>";
62

    
63
            if (journal.getSubjects() != null && !journal.getSubjects().trim().equals(""))
64
                contents += "<dl class=\"dl-horizontal\"><dt>SUBJECTS</dt><dd>" + journal.getSubjects() + "</dd></dl>";
65

    
66
            if (journal.getLicence() != null && !journal.getLicence().trim().equals(""))
67
                contents += "<dl class=\"dl-horizontal\"><dt>LICENCE</dt><dd>" + journal.getLicence() + "</dd></dl>";
68

    
69
            contents += "<dl class=\"dl-horizontal\"><dt>Listed APC fee</dt><dd>" + (Math.round(journal.getApc()*100) / 100.0) + " "
70
                    + journal.getCurrency().getName() + "</dd></dl>";
71

    
72
            contents += "<dl class=\"dl-horizontal\"><dt>Pilot Discount</dt><dd>" + (Math.round(journal.getDiscount()*100) / 100.0) + " %</dd></dl>";
73

    
74
            contents += "</div>";
75
            journalDisplayInfoElement.setHTML(contents);
76

    
77
            journalDisplayInfoPanel.add(journalDisplayInfoElement);
78
        }
79
    }
80

    
81
    @Override
82
    public Widget asWidget() {
83
        return journalDisplayInfoPanel;
84
    }
85
}
86

    
(1-1/5)