1 |
35691
|
stefania.m
|
package eu.dnetlib.client.fundingrequest.existingrequests;
|
2 |
|
|
|
3 |
|
|
import com.github.gwtbootstrap.client.ui.Button;
|
4 |
|
|
import com.google.gwt.event.dom.client.ClickEvent;
|
5 |
|
|
import com.google.gwt.event.dom.client.ClickHandler;
|
6 |
35700
|
stefania.m
|
import com.google.gwt.user.client.History;
|
7 |
35691
|
stefania.m
|
import com.google.gwt.user.client.ui.FlowPanel;
|
8 |
|
|
import com.google.gwt.user.client.ui.IsWidget;
|
9 |
|
|
import com.google.gwt.user.client.ui.Widget;
|
10 |
35751
|
stefania.m
|
import eu.dnetlib.client.fundingrequest.newrequest.EligibilityDisplayWidget;
|
11 |
|
|
import eu.dnetlib.client.fundingrequest.stepinfo.*;
|
12 |
|
|
import eu.dnetlib.goldoa.domain.Request;
|
13 |
35691
|
stefania.m
|
import eu.dnetlib.goldoa.domain.RequestInfo;
|
14 |
|
|
|
15 |
|
|
/**
|
16 |
|
|
* Created by stefania on 3/26/15.
|
17 |
|
|
*/
|
18 |
|
|
public class ExistingRequestElement implements IsWidget {
|
19 |
|
|
|
20 |
|
|
private FlowPanel requestInfoPanel = new FlowPanel();
|
21 |
|
|
|
22 |
35751
|
stefania.m
|
private FlowPanel requestSummaryPanel = new FlowPanel();
|
23 |
35839
|
stefania.m
|
private FlowPanel firstDivider = new FlowPanel();
|
24 |
|
|
private FlowPanel secondDivider = new FlowPanel();
|
25 |
35691
|
stefania.m
|
|
26 |
|
|
private FlowPanel actionButtons = new FlowPanel();
|
27 |
|
|
private Button goToFundingWizard = new Button("Go to Funding Wizard");
|
28 |
|
|
|
29 |
35700
|
stefania.m
|
public ExistingRequestElement(final RequestInfo requestInfo) {
|
30 |
35691
|
stefania.m
|
|
31 |
|
|
requestInfoPanel.addStyleName("requestInfoPanel");
|
32 |
|
|
|
33 |
35839
|
stefania.m
|
if(requestInfo.getResearcher()!=null) {
|
34 |
|
|
ResearcherInlineInfo researcherInlineInfo = new ResearcherInlineInfo(requestInfo.getResearcher());
|
35 |
|
|
requestSummaryPanel.add(researcherInlineInfo.asWidget());
|
36 |
|
|
}
|
37 |
35691
|
stefania.m
|
|
38 |
35839
|
stefania.m
|
if(requestInfo.getProject()!=null) {
|
39 |
|
|
ProjectInlineInfo projectInlineInfo = new ProjectInlineInfo(requestInfo.getProject());
|
40 |
|
|
requestSummaryPanel.add(projectInlineInfo.asWidget());
|
41 |
|
|
}
|
42 |
35751
|
stefania.m
|
|
43 |
35839
|
stefania.m
|
if(requestInfo.getPublication()!=null) {
|
44 |
|
|
PublicationInlineInfo publicationInlineInfo = new PublicationInlineInfo(requestInfo.getPublication());
|
45 |
|
|
requestSummaryPanel.add(publicationInlineInfo.asWidget());
|
46 |
|
|
}
|
47 |
35751
|
stefania.m
|
|
48 |
|
|
float apc = 0;
|
49 |
|
|
float discount = 0;
|
50 |
|
|
|
51 |
|
|
if(requestInfo.getPublication()!=null && requestInfo.getPublication().getJournal()!=null) {
|
52 |
35839
|
stefania.m
|
JournalInlineInfo journalInlineInfo = new JournalInlineInfo(requestInfo.getPublication().getJournal());
|
53 |
|
|
requestSummaryPanel.add(journalInlineInfo.asWidget());
|
54 |
35751
|
stefania.m
|
apc = requestInfo.getPublication().getJournal().getApc();
|
55 |
|
|
discount = requestInfo.getPublication().getJournal().getDiscount();
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
if(requestInfo.getPublication()!=null && requestInfo.getPublication().getPublisher()!=null) {
|
59 |
35839
|
stefania.m
|
PublisherInlineInfo publisherInlineInfo = new PublisherInlineInfo(requestInfo.getPublication().getPublisher());
|
60 |
|
|
requestSummaryPanel.add(publisherInlineInfo.asWidget());
|
61 |
35751
|
stefania.m
|
apc = requestInfo.getPublication().getPublisher().getAPC();
|
62 |
|
|
discount = requestInfo.getPublication().getJournal().getDiscount();
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
if(requestInfo.getProjectParticipation()!=null && requestInfo.getFundingRequested()!=null) {
|
66 |
35839
|
stefania.m
|
AccountingInlineInfo accountingInlineInfo = new AccountingInlineInfo(new Request(requestInfo), apc, discount);
|
67 |
|
|
requestSummaryPanel.add(accountingInlineInfo.asWidget());
|
68 |
35751
|
stefania.m
|
}
|
69 |
|
|
|
70 |
35691
|
stefania.m
|
actionButtons.addStyleName("requestInfoActionButtons");
|
71 |
|
|
|
72 |
|
|
goToFundingWizard.addStyleName("requestInfoActionButton");
|
73 |
|
|
goToFundingWizard.addClickHandler(new ClickHandler() {
|
74 |
|
|
@Override
|
75 |
|
|
public void onClick(ClickEvent event) {
|
76 |
35928
|
stefania.m
|
History.newItem("newFundingRequest." + requestInfo.getId());
|
77 |
35691
|
stefania.m
|
}
|
78 |
|
|
});
|
79 |
|
|
actionButtons.add(goToFundingWizard);
|
80 |
|
|
|
81 |
35839
|
stefania.m
|
firstDivider.addStyleName("uk-grid-divider");
|
82 |
|
|
secondDivider.addStyleName("uk-grid-divider");
|
83 |
35751
|
stefania.m
|
|
84 |
|
|
EligibilityDisplayWidget eligibilityDisplayWidget = new EligibilityDisplayWidget(requestInfo.getEligibility());
|
85 |
|
|
|
86 |
|
|
requestInfoPanel.add(eligibilityDisplayWidget.asWidget());
|
87 |
35839
|
stefania.m
|
requestInfoPanel.add(firstDivider);
|
88 |
35751
|
stefania.m
|
requestInfoPanel.add(requestSummaryPanel);
|
89 |
35839
|
stefania.m
|
|
90 |
|
|
if(requestInfo.getStatus().equals(Request.RequestStatus.INCOMPLETE)) {
|
91 |
|
|
requestInfoPanel.add(secondDivider);
|
92 |
|
|
requestInfoPanel.add(actionButtons);
|
93 |
|
|
}
|
94 |
35691
|
stefania.m
|
}
|
95 |
|
|
|
96 |
|
|
@Override
|
97 |
|
|
public Widget asWidget() {
|
98 |
|
|
return requestInfoPanel;
|
99 |
|
|
}
|
100 |
|
|
}
|