Project

General

Profile

1
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
import eu.dnetlib.goldoa.domain.Budget;
9

    
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
    public BudgetInfoElement(Budget budget) {
19

    
20

    
21
        String contents = "Budget request made at " + dtf.format(budget.getDate()) + " <span class=\"status\">STATUS: "
22
                + budget.getStatus() + "</span>";
23

    
24
        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
        contents += "<dl class=\"dl-horizontal\"><dd>" + "<a href=\"" + GWT.getModuleBaseURL() + "budget?budgetId="
28
                + budget.getId() + "\" target=\"_blank\">Click here to see the terms of agreement</a>" + "</dd></dl>";
29

    
30
        budgetInfoElement.setHTML(contents);
31
    }
32

    
33
    @Override
34
    public Widget asWidget() {
35
        return budgetInfoElement;
36
    }
37
}
(2-2/22)