Project

General

Profile

1 36110 stefania.m
package eu.dnetlib.client;
2
3
import com.google.gwt.core.client.GWT;
4
import com.google.gwt.i18n.client.DateTimeFormat;
5
import com.google.gwt.user.client.ui.HTML;
6
import com.google.gwt.user.client.ui.IsWidget;
7
import com.google.gwt.user.client.ui.Widget;
8 45767 panagiotis
import eu.dnetlib.goldoa.domain.Budget;
9 36110 stefania.m
10
/**
11
 * Created by stefania on 4/6/15.
12
 */
13
public class BudgetInfoElement implements IsWidget {
14
15
    private HTML budgetInfoElement = new HTML();
16
    private DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy/MM/dd");
17
18 45767 panagiotis
    public BudgetInfoElement(Budget budget) {
19 36110 stefania.m
20 46351 panagiotis
21 45767 panagiotis
        String contents = "Budget request made at " + dtf.format(budget.getDate()) + " <span class=\"status\">STATUS: "
22
                + budget.getStatus() + "</span>";
23 36110 stefania.m
24 45767 panagiotis
        contents += "<dl class=\"dl-horizontal\"><dt>Organisation</dt><dd>" + budget.getOrganization().getName() + "</dd></dl>";
25
        contents += "<dl class=\"dl-horizontal\"><dt>Amount requested</dt><dd>" + budget.getAmountRequested() + " Euros</dd></dl>";
26
        contents += "<dl class=\"dl-horizontal\"><dt>Remaining</dt><dd>" + budget.getRemaining() + " Euros</dd></dl>";
27 36110 stefania.m
        contents += "<dl class=\"dl-horizontal\"><dd>" + "<a href=\"" + GWT.getModuleBaseURL() + "budget?budgetId="
28 45767 panagiotis
                + budget.getId() + "\" target=\"_blank\">Click here to see the terms of agreement</a>" + "</dd></dl>";
29 36110 stefania.m
30
        budgetInfoElement.setHTML(contents);
31
    }
32
33
    @Override
34
    public Widget asWidget() {
35
        return budgetInfoElement;
36
    }
37
}