1 |
36467
|
stefania.m
|
package eu.dnetlib.client;
|
2 |
|
|
|
3 |
37259
|
stefania.m
|
import com.github.gwtbootstrap.client.ui.Modal;
|
4 |
|
|
import com.github.gwtbootstrap.client.ui.constants.BackdropType;
|
5 |
36467
|
stefania.m
|
import com.google.gwt.core.client.GWT;
|
6 |
36624
|
stefania.m
|
import com.google.gwt.dom.client.Document;
|
7 |
|
|
import com.google.gwt.dom.client.Style;
|
8 |
37259
|
stefania.m
|
import com.google.gwt.query.client.Function;
|
9 |
|
|
import com.google.gwt.user.client.Event;
|
10 |
36467
|
stefania.m
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
11 |
|
|
import com.google.gwt.user.client.ui.HTML;
|
12 |
36624
|
stefania.m
|
import com.google.gwt.user.client.ui.RootPanel;
|
13 |
36467
|
stefania.m
|
import eu.dnetlib.goldoa.domain.Help;
|
14 |
|
|
|
15 |
37259
|
stefania.m
|
import static com.google.gwt.query.client.GQuery.$;
|
16 |
|
|
|
17 |
36467
|
stefania.m
|
/**
|
18 |
|
|
* Created by stefania on 4/17/15.
|
19 |
|
|
*/
|
20 |
|
|
public abstract class MyWidgetHelper {
|
21 |
|
|
|
22 |
|
|
private static DataServiceAsync dataService = GWT.create(DataService.class);
|
23 |
|
|
|
24 |
|
|
public static void loadHelp(final SidebarPanel sidebarPanel, final String helpId) {
|
25 |
|
|
|
26 |
|
|
dataService.getHelpById(helpId, new AsyncCallback<Help>() {
|
27 |
|
|
|
28 |
|
|
@Override
|
29 |
|
|
public void onFailure(Throwable throwable) {
|
30 |
|
|
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
@Override
|
34 |
|
|
public void onSuccess(Help help) {
|
35 |
|
|
|
36 |
|
|
if(help!=null) {
|
37 |
|
|
|
38 |
|
|
HTML html = new HTML();
|
39 |
|
|
html.setHTML(help.getText());
|
40 |
|
|
|
41 |
|
|
sidebarPanel.clearContent();
|
42 |
|
|
sidebarPanel.addContent(html);
|
43 |
36624
|
stefania.m
|
|
44 |
|
|
MyWidgetHelper.showSidebar();
|
45 |
|
|
RootPanel.get("sidebar").add(sidebarPanel.asWidget());
|
46 |
37259
|
stefania.m
|
|
47 |
|
|
$(".contactUs").click(new Function() {
|
48 |
|
|
|
49 |
|
|
public boolean f(Event e) {
|
50 |
|
|
|
51 |
|
|
final Modal contactUsModal = new Modal();
|
52 |
|
|
|
53 |
|
|
contactUsModal.addStyleName("contactModal");
|
54 |
|
|
contactUsModal.setTitle("Contact Us");
|
55 |
|
|
contactUsModal.setAnimation(true);
|
56 |
|
|
contactUsModal.setBackdrop(BackdropType.STATIC);
|
57 |
37787
|
stefania.m
|
contactUsModal.setDynamicSafe(true);
|
58 |
37259
|
stefania.m
|
|
59 |
|
|
ContactForm contactForm = new ContactForm();
|
60 |
|
|
ContactForm.ContactSubmittedListener contactSubmittedListener = new ContactForm.ContactSubmittedListener() {
|
61 |
|
|
@Override
|
62 |
|
|
public void contactSubmitted() {
|
63 |
|
|
contactUsModal.hide();
|
64 |
|
|
}
|
65 |
|
|
};
|
66 |
|
|
contactForm.setContactSubmittedListener(contactSubmittedListener);
|
67 |
|
|
|
68 |
|
|
contactUsModal.add(contactForm.asWidget());
|
69 |
|
|
|
70 |
|
|
contactUsModal.show();
|
71 |
|
|
|
72 |
|
|
return true;
|
73 |
|
|
}
|
74 |
|
|
});
|
75 |
36467
|
stefania.m
|
}
|
76 |
|
|
}
|
77 |
|
|
});
|
78 |
|
|
}
|
79 |
36624
|
stefania.m
|
|
80 |
|
|
public static void showSidebar() {
|
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 |
|
|
|
87 |
|
|
public static void hideSidebar() {
|
88 |
|
|
|
89 |
|
|
Document.get().getElementById("content").removeClassName("uk-width-medium-3-4");
|
90 |
|
|
Document.get().getElementById("content").addClassName("uk-width-medium-1-1");
|
91 |
|
|
Document.get().getElementById("sidebar").getStyle().setDisplay(Style.Display.NONE);
|
92 |
|
|
}
|
93 |
36467
|
stefania.m
|
}
|