Project

General

Profile

1
package eu.dnetlib.client;
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.dom.client.Document;
7
import com.google.gwt.dom.client.Style;
8
import com.google.gwt.i18n.client.DateTimeFormat;
9
import com.google.gwt.user.client.ui.FlowPanel;
10
import com.google.gwt.user.client.ui.Label;
11
import com.google.gwt.user.client.ui.RootPanel;
12
import com.google.gwt.user.client.ui.Widget;
13

    
14
/**
15
 * Created by stefania on 4/2/15.
16
 */
17
public class MonitorBudgetsWidget implements MyWidget {
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 MonitorBudgetsWidget() {
32

    
33
        monitorBudgetsPagePanel.addStyleName("content");
34

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

    
38
        monitorBudgetsInfoLabel.setText("Monitor and change the status of budget requests that are pending approval");
39
        monitorBudgetsInfoLabel.addStyleName("contentInfoLabel");
40

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

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

    
53
        budgetsForApprovalPanel.addStyleName("requestsListPanel");
54

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

    
62
    @Override
63
    public void clear() {
64

    
65
        errorLabel.setVisible(false);
66
        warningLabel.setVisible(false);
67
        budgetsForApprovalPanel.clear();
68
    }
69

    
70
    @Override
71
    public void reload() {
72

    
73
        Document.get().getElementById("content").removeClassName("uk-width-medium-1-1");
74
        Document.get().getElementById("content").addClassName("uk-width-medium-3-4");
75
        Document.get().getElementById("sidebar").getStyle().setDisplay(Style.Display.BLOCK);
76

    
77
        SidebarPanel sidebarPanel = new SidebarPanel("Help");
78
        RootPanel.get("sidebar").add(sidebarPanel.asWidget());
79

    
80
        budgetsForApprovalPanel.add(new Label("Under Construction"));
81
    }
82

    
83
    @Override
84
    public void setToken(String token) {
85

    
86
    }
87

    
88
    @Override
89
    public Widget asWidget() {
90
        return monitorBudgetsPagePanel;
91
    }
92
}
(10-10/20)