Project

General

Profile

1
package eu.dnetlib.client.accountingmonitor;
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.i18n.client.DateTimeFormat;
7
import com.google.gwt.user.client.ui.FlowPanel;
8
import com.google.gwt.user.client.ui.Label;
9
import com.google.gwt.user.client.ui.Widget;
10
import eu.dnetlib.client.*;
11

    
12
/**
13
 * Created by stefania on 4/27/15.
14
 */
15
public class AccountingMonitorBudgetsWidget implements MyWidget {
16

    
17
    private String token = "";
18

    
19
    private FlowPanel monitorBudgetsPagePanel = new FlowPanel();
20
    private Label monitorBudgetsTitleLabel = new Label();
21
    private Label monitorBudgetsInfoLabel = new Label();
22

    
23
    private Alert errorLabel = new Alert();
24
    private Alert warningLabel = new Alert();
25

    
26
    private FlowPanel budgetsForApprovalPanel = new FlowPanel();
27

    
28
    private DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy/MM/dd");
29
    private DataServiceAsync dataService = GWT.create(DataService.class);
30

    
31
    public AccountingMonitorBudgetsWidget() {
32

    
33
        monitorBudgetsPagePanel.addStyleName("content");
34

    
35
        monitorBudgetsTitleLabel.setText("Accounting Monitor Budgets");
36
        monitorBudgetsTitleLabel.addStyleName("contentTitleLabel");
37

    
38
        monitorBudgetsInfoLabel.setText("Under construction....");
39
        monitorBudgetsInfoLabel.addStyleName("contentInfoLabel");
40

    
41
        errorLabel.addStyleName("alertLabel");
42
        errorLabel.setType(AlertType.ERROR);
43
        errorLabel.setClose(false);
44
        errorLabel.setVisible(false);
45

    
46
        warningLabel.addStyleName("alertLabel");
47
        warningLabel.setType(AlertType.WARNING);
48
        warningLabel.setClose(false);
49
        warningLabel.setVisible(false);
50

    
51
        budgetsForApprovalPanel.addStyleName("budgetsListPanel");
52

    
53
        monitorBudgetsPagePanel.add(monitorBudgetsTitleLabel);
54
        monitorBudgetsPagePanel.add(monitorBudgetsInfoLabel);
55
        monitorBudgetsPagePanel.add(errorLabel);
56
        monitorBudgetsPagePanel.add(warningLabel);
57
        monitorBudgetsPagePanel.add(budgetsForApprovalPanel);
58
    }
59

    
60
    @Override
61
    public void clear() {
62

    
63
        errorLabel.setVisible(false);
64
        warningLabel.setVisible(false);
65
        budgetsForApprovalPanel.clear();
66
    }
67

    
68
    @Override
69
    public void reload() {
70

    
71
        MyWidgetHelper.hideSidebar();
72

    
73
        SidebarPanel helpPanel = new SidebarPanel("Help");
74
        MyWidgetHelper.loadHelp(helpPanel, token.split("\\.")[0]);
75

    
76
//        loadBudgets();
77
    }
78

    
79
    @Override
80
    public void setToken(String token) {
81
        this.token = token;
82
    }
83

    
84
    @Override
85
    public void afterAdditionToRootPanel() {
86

    
87
    }
88

    
89
    @Override
90
    public Widget asWidget() {
91
        return monitorBudgetsPagePanel;
92
    }
93
}
(1-1/5)