1
|
package eu.dnetlib.repo.manager.client;
|
2
|
|
3
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
4
|
import com.google.gwt.user.client.ui.FlowPanel;
|
5
|
import com.google.gwt.user.client.ui.HTML;
|
6
|
import eu.dnetlib.gwt.shared.Help;
|
7
|
|
8
|
/**
|
9
|
* Created by stefania on 3/9/16.
|
10
|
*/
|
11
|
public class HelpCallback implements AsyncCallback<Help> {
|
12
|
|
13
|
private FlowPanel helpPanel;
|
14
|
private FlowPanel parentPanel;
|
15
|
|
16
|
public HelpCallback(FlowPanel helpPanel, FlowPanel parentPanel) {
|
17
|
this.helpPanel = helpPanel;
|
18
|
this.parentPanel = parentPanel;
|
19
|
}
|
20
|
|
21
|
@Override
|
22
|
public void onFailure(Throwable caught) {
|
23
|
parentPanel.remove(helpPanel);
|
24
|
}
|
25
|
|
26
|
@Override
|
27
|
public void onSuccess(Help help) {
|
28
|
|
29
|
if (help != null && help.getText()!=null && !help.getText().trim().isEmpty()) {
|
30
|
String content = "<div class=\"uk-card uk-card-body uk-card-default sidemenu\">" + help.getText() + "</div>";
|
31
|
HTML html = new HTML();
|
32
|
html.setHTML(content);
|
33
|
|
34
|
helpPanel.clear();
|
35
|
helpPanel.add(html);
|
36
|
parentPanel.add(helpPanel);
|
37
|
|
38
|
} else {
|
39
|
parentPanel.remove(helpPanel);
|
40
|
}
|
41
|
}
|
42
|
|
43
|
public FlowPanel getHelpPanel() {
|
44
|
return helpPanel;
|
45
|
}
|
46
|
|
47
|
public void setHelpPanel(FlowPanel helpPanel) {
|
48
|
this.helpPanel = helpPanel;
|
49
|
}
|
50
|
|
51
|
public FlowPanel getParentPanel() {
|
52
|
return parentPanel;
|
53
|
}
|
54
|
|
55
|
public void setParentPanel(FlowPanel parentPanel) {
|
56
|
this.parentPanel = parentPanel;
|
57
|
}
|
58
|
}
|