1
|
package eu.dnetlib.client;
|
2
|
|
3
|
import com.github.gwtbootstrap.client.ui.base.IconAnchor;
|
4
|
import com.google.gwt.dom.client.Document;
|
5
|
import com.google.gwt.dom.client.Style;
|
6
|
import com.google.gwt.event.dom.client.ClickEvent;
|
7
|
import com.google.gwt.event.dom.client.ClickHandler;
|
8
|
import com.google.gwt.user.client.History;
|
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 RequestsWidget implements MyWidget {
|
18
|
|
19
|
private FlowPanel requestsPagePanel = new FlowPanel();
|
20
|
private Label requestsTitleLabel = new Label();
|
21
|
private Label requestsInfoLabel = new Label();
|
22
|
|
23
|
private IconAnchor newFundingRequest = new IconAnchor();
|
24
|
private IconAnchor existingFundingRequests = new IconAnchor();
|
25
|
private IconAnchor newBudgetRequest = new IconAnchor();
|
26
|
|
27
|
public RequestsWidget() {
|
28
|
|
29
|
requestsPagePanel.addStyleName("content");
|
30
|
|
31
|
requestsTitleLabel.setText("Requests");
|
32
|
requestsTitleLabel.addStyleName("contentTitleLabel");
|
33
|
|
34
|
requestsInfoLabel.setText("Make new funding and budget requests and view existing ones");
|
35
|
requestsInfoLabel.addStyleName("contentInfoLabel");
|
36
|
|
37
|
newFundingRequest.setText("New funding request");
|
38
|
newFundingRequest.setHref("#newFundingRequest");
|
39
|
newFundingRequest.addStyleName("emphasis");
|
40
|
newFundingRequest.addClickHandler(new ClickHandler() {
|
41
|
@Override
|
42
|
public void onClick(ClickEvent clickEvent) {
|
43
|
History.newItem("newFundingRequest");
|
44
|
}
|
45
|
});
|
46
|
|
47
|
existingFundingRequests.setText("Existing funding requests");
|
48
|
existingFundingRequests.setHref("#existingFundingRequests");
|
49
|
existingFundingRequests.addStyleName("emphasis");
|
50
|
existingFundingRequests.addClickHandler(new ClickHandler() {
|
51
|
@Override
|
52
|
public void onClick(ClickEvent clickEvent) {
|
53
|
History.newItem("existingFundingRequests");
|
54
|
}
|
55
|
});
|
56
|
|
57
|
newBudgetRequest.setText("New budget request");
|
58
|
newBudgetRequest.setHref("#newBudgetRequest");
|
59
|
newBudgetRequest.addStyleName("emphasis");
|
60
|
newBudgetRequest.addClickHandler(new ClickHandler() {
|
61
|
@Override
|
62
|
public void onClick(ClickEvent clickEvent) {
|
63
|
History.newItem("newBudgetRequest");
|
64
|
}
|
65
|
});
|
66
|
|
67
|
requestsPagePanel.add(requestsTitleLabel);
|
68
|
requestsPagePanel.add(requestsInfoLabel);
|
69
|
requestsPagePanel.add(newFundingRequest);
|
70
|
requestsPagePanel.add(existingFundingRequests);
|
71
|
requestsPagePanel.add(newBudgetRequest);
|
72
|
}
|
73
|
|
74
|
@Override
|
75
|
public void clear() {
|
76
|
|
77
|
}
|
78
|
|
79
|
@Override
|
80
|
public void reload() {
|
81
|
|
82
|
Document.get().getElementById("content").removeClassName("uk-width-medium-1-1");
|
83
|
Document.get().getElementById("content").addClassName("uk-width-medium-3-4");
|
84
|
Document.get().getElementById("sidebar").getStyle().setDisplay(Style.Display.BLOCK);
|
85
|
|
86
|
SidebarPanel sidebarPanel = new SidebarPanel("Help");
|
87
|
RootPanel.get("sidebar").add(sidebarPanel.asWidget());
|
88
|
}
|
89
|
|
90
|
@Override
|
91
|
public void setToken(String token) {
|
92
|
|
93
|
}
|
94
|
|
95
|
@Override
|
96
|
public Widget asWidget() {
|
97
|
return requestsPagePanel;
|
98
|
}
|
99
|
}
|
100
|
|