Project

General

Profile

1
package eu.dnetlib.repo.manager.client.getimpact;
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 4/4/16.
11
 */
12
public class GetImpactController extends TokenController {
13

    
14
    private GetImpactWidget getImpactWidget = new GetImpactWidget();
15
    private MetricsForDatasourceWidget metricsForDatasourceWidget = new MetricsForDatasourceWidget();
16
    private InstructionsForMetricsWidget instructionsForMetricsWidget = new InstructionsForMetricsWidget();
17

    
18
    private static GetImpactController instance = null;
19

    
20
    public static GetImpactController getInstance() {
21
        if (instance == null)
22
            instance = new GetImpactController();
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, getImpactWidget, parent, rest);
32
        else {
33
            if(rest.contains("/") && (rest.indexOf("/") < rest.length())) {
34
                redrawWidget(contentPanel, instructionsForMetricsWidget, parent, rest);
35
            } else {
36
                redrawWidget(contentPanel, metricsForDatasourceWidget, 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
        if (rest == null) {
46
            RepositoryManager.pageHeader.clear();
47
            RepositoryManager.pageHeader.add(new HTML("<div class=\"col-sm-9\"><h2>Metrics</h2><ol class=\"breadcrumb\">" +
48
                    "<li><a href=\"#dashboard\">Home</a></li><li class=\"active\"><strong>Metrics</strong></li></ol></div>"));
49
        }
50
    }
51

    
52
    @Override
53
    public String[] getMenuPath(String parent, String rest) {
54
        return new String[] {"getImpact"};
55
    }
56
}
(2-2/5)