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.BudgetInfo;
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(BudgetInfo budgetInfo) {
19

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

    
23
        contents += "<dl class=\"dl-horizontal\"><dt>Organisation</dt><dd>" + budgetInfo.getOrganisation().getName() + "</dd></dl>";
24
        contents += "<dl class=\"dl-horizontal\"><dt>Amount requested</dt><dd>" + budgetInfo.getAmountRequested() + " Euros</dd></dl>";
25
        contents += "<dl class=\"dl-horizontal\"><dt>Remaining</dt><dd>" + budgetInfo.getRemaining() + " Euros</dd></dl>";
26
        contents += "<dl class=\"dl-horizontal\"><dd>" + "<a href=\"" + GWT.getModuleBaseURL() + "budget?budgetId="
27
                + budgetInfo.getId() + "\" target=\"_blank\">Click here to see the terms of agreement</a>" + "</dd></dl>";
28

    
29
        budgetInfoElement.setHTML(contents);
30
    }
31

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