1
|
package eu.dnetlib.repo.manager.client.enrichcontent;
|
2
|
|
3
|
import com.google.gwt.user.client.ui.FlowPanel;
|
4
|
import com.google.gwt.user.client.ui.HTML;
|
5
|
import com.google.gwt.user.client.ui.RootPanel;
|
6
|
import eu.dnetlib.repo.manager.client.RepositoryManager;
|
7
|
import eu.dnetlib.repo.manager.client.TokenController;
|
8
|
|
9
|
/**
|
10
|
* Created by stefania on 3/16/17.
|
11
|
*/
|
12
|
public class BrowseEventsController extends TokenController {
|
13
|
|
14
|
private EnrichContentWidget enrichContentWidget = new EnrichContentWidget();
|
15
|
private SelectTopicWidget selectTopicWidget = new SelectTopicWidget();
|
16
|
private ShowEventsWidget showEventsWidget = new ShowEventsWidget();
|
17
|
|
18
|
private static BrowseEventsController instance = null;
|
19
|
|
20
|
public static BrowseEventsController getInstance() {
|
21
|
if (instance == null)
|
22
|
instance = new BrowseEventsController();
|
23
|
|
24
|
return instance;
|
25
|
}
|
26
|
|
27
|
@Override
|
28
|
public void showWidget(FlowPanel contentPanel, String parent, String rest) {
|
29
|
|
30
|
if (rest == null)
|
31
|
redrawWidget(contentPanel, enrichContentWidget, parent, rest);
|
32
|
else {
|
33
|
if(rest.contains("/") && (rest.indexOf("/") < rest.length())) {
|
34
|
redrawWidget(contentPanel, showEventsWidget, parent, rest);
|
35
|
} else {
|
36
|
redrawWidget(contentPanel, selectTopicWidget, parent, rest);
|
37
|
}
|
38
|
}
|
39
|
}
|
40
|
|
41
|
// @Override
|
42
|
// public void drawHeader(String rest) {
|
43
|
//
|
44
|
// RootPanel.get("pageHeader").addStyleName("row wrapper border-bottom white-bg page-heading");
|
45
|
//
|
46
|
// if (rest == null) {
|
47
|
// RepositoryManager.pageHeader.clear();
|
48
|
// RepositoryManager.pageHeader.add(new HTML("<div class=\"col-sm-9\"><h2>Enrich Your Content - Browse Events</h2>" +
|
49
|
// "<ol class=\"breadcrumb\"><li><a href=\"#dashboard\">Home</a></li><li class=\"active\">" +
|
50
|
// "<strong>Enrich Content - Browse Events</strong></li></ol></div>"));
|
51
|
// } else {
|
52
|
// if(rest.contains("/")) {
|
53
|
// String[] tokenSplit = rest.split("/", 2);
|
54
|
// String dataSource = tokenSplit[0];
|
55
|
// String topic = tokenSplit[1];
|
56
|
// RepositoryManager.pageHeader.clear();
|
57
|
// String header = "<div class=\"col-sm-9\"><h2>Events for " + topic + "</h2><ol class=\"breadcrumb\">" +
|
58
|
// "<li><a href=\"#dashboard\">Home</a></li><li><a href=\"#enrichContent/events\">Enrich Content - Browse Events</a></li>" +
|
59
|
// "<li><a href=\"#enrichContent/events/" + dataSource +"\">" + dataSource + "</a></li>" +
|
60
|
// "<li class=\"active\"><strong>" + topic + "</strong></li></ol></div>";
|
61
|
// RepositoryManager.pageHeader.add(new HTML(header));
|
62
|
// } else {
|
63
|
// RepositoryManager.pageHeader.clear();
|
64
|
// String header = "<div class=\"col-sm-9\"><h2>Topics for " + rest + "</h2><ol class=\"breadcrumb\">" +
|
65
|
// "<li><a href=\"#dashboard\">Home</a></li><li><a href=\"#enrichContent/events\">Enrich Content - Browse Events</a></li>" +
|
66
|
// "<li class=\"active\"><strong>" + rest + "</strong></li></ol></div>";
|
67
|
// RepositoryManager.pageHeader.add(new HTML(header));
|
68
|
// }
|
69
|
// }
|
70
|
// }
|
71
|
|
72
|
@Override
|
73
|
public String[] getMenuPath(String parent, String rest) {
|
74
|
return new String[] {"events"};
|
75
|
}
|
76
|
}
|