Project

General

Profile

« Previous | Next » 

Revision 48932

View differences:

InstructionsForMetricsWidget.java
12 12
import eu.dnetlib.domain.data.Repository;
13 13
import eu.dnetlib.gwt.client.help.HelpService;
14 14
import eu.dnetlib.gwt.client.help.HelpServiceAsync;
15
import eu.dnetlib.repo.manager.client.AbstractRepositoryManagerWidget;
15 16
import eu.dnetlib.repo.manager.client.HelpCallback;
16 17
import eu.dnetlib.repo.manager.client.RepositoryManager;
17 18
import eu.dnetlib.repo.manager.client.RepositoryManagerWidget;
......
26 27
/**
27 28
 * Created by stefania on 12/19/16.
28 29
 */
29
public class InstructionsForMetricsWidget implements RepositoryManagerWidget {
30
public class InstructionsForMetricsWidget extends AbstractRepositoryManagerWidget implements RepositoryManagerWidget {
30 31

  
31 32
    private String parentToken = "";
32 33
    private String restToken = "";
33 34

  
34 35
    private String repositoryId = "";
35 36

  
36
    private FlowPanel instructionsForMetricsPanel = new FlowPanel();
37

  
38
    private FlowPanel instructionsForMetricsColPanel = new FlowPanel();
39
    private FlowPanel instructionsForMetricsInnerPanel = new FlowPanel();
40
    private FlowPanel instructionsForMetricsBox = new FlowPanel();
41 37
    private FlowPanel instructionsForMetricsBoxContent = new FlowPanel();
42 38

  
43 39
    private Alert errorAlert = new Alert();
44 40

  
45
    private FlowPanel helpPanel = new FlowPanel();
46

  
47 41
    private RepositoryServiceAsync repositoryService = GWT.create(RepositoryService.class);
48 42
    private static HelpServiceAsync helpService = GWT.create(HelpService.class);
49 43

  
50 44
    public InstructionsForMetricsWidget() {
51 45

  
52
        instructionsForMetricsPanel.addStyleName("row");
46
        super();
53 47

  
54
        instructionsForMetricsColPanel.addStyleName("col-lg-12");
55
        instructionsForMetricsColPanel.add(instructionsForMetricsInnerPanel);
48
        HTML title = new HTML("<h1 class=\"uk-article-title\">Metrics</h1>");
49
        title.addStyleName("uk-margin-medium-bottom");
50
        contentPanel.add(title);
56 51

  
57
        instructionsForMetricsInnerPanel.addStyleName("wrapper wrapper-content animated fadeInUp");
58
        instructionsForMetricsInnerPanel.add(instructionsForMetricsBox);
59

  
60
        instructionsForMetricsBox.addStyleName("ibox");
61
        instructionsForMetricsBox.add(instructionsForMetricsBoxContent);
62

  
63
        instructionsForMetricsBoxContent.addStyleName("ibox-content bigContent");
64

  
65 52
        errorAlert.setType(AlertType.DANGER);
66 53
        errorAlert.setDismissable(false);
67 54
        errorAlert.setVisible(false);
68 55
        instructionsForMetricsBoxContent.add(errorAlert);
69 56

  
70
        instructionsForMetricsPanel.add(instructionsForMetricsColPanel);
57
        contentPanel.add(instructionsForMetricsBoxContent);
71 58
    }
72 59

  
73 60
    @Override
......
75 62

  
76 63
        instructionsForMetricsBoxContent.clear();
77 64
        errorAlert.setVisible(false);
78
        instructionsForMetricsPanel.remove(helpPanel);
65
        gridPanel.remove(helpPanel);
79 66
    }
80 67

  
81 68
    @Override
82 69
    public void reload() {
83 70

  
84
        Document.get().getElementById("page-wrapper").removeClassName("sidebar-content");
71
        Document.get().getElementById("headerNoTransparent").removeClassName("tm-header-transparent");
85 72
        instructionsForMetricsBoxContent.add(errorAlert);
86 73

  
87
        helpService.getHelpById(parentToken + "_forDatasource_instructions", new HelpCallback(instructionsForMetricsColPanel, helpPanel, instructionsForMetricsPanel));
74
        helpService.getHelpById(parentToken + "_forDatasource_instructions", new HelpCallback(helpPanel, gridPanel));
88 75

  
89 76
        final HTML loadingWheel = new HTML("<div class=\"loader-big\" style=\"text-align: center; padding-top: 170px; " +
90 77
                "color: rgb(47, 64, 80); font-weight: bold;\">Retrieving repository information...</div>" +
......
122 109
                    @Override
123 110
                    public void onSuccess(String piwikScript) {
124 111

  
125
                        RepositoryManager.pageHeader.clear();
126
                        String logoURLSource = "";
127
                        if(repository.getLogoUrl()==null || repository.getLogoUrl().isEmpty())
128
                            logoURLSource = "img/yourLogoHere.jpg";
129
                        else
130
                            logoURLSource = repository.getLogoUrl();
112
//                        RepositoryManager.pageHeader.clear();
113
//                        String logoURLSource = "";
114
//                        if(repository.getLogoUrl()==null || repository.getLogoUrl().isEmpty())
115
//                            logoURLSource = "img/yourLogoHere.jpg";
116
//                        else
117
//                            logoURLSource = repository.getLogoUrl();
118
//
119
//                        RepositoryManager.pageHeader.add(new HTML("<div class=\"col-sm-9\"><h2><img src=\"" + logoURLSource + "\" alt=[Repo Logo]" +
120
//                                "width=\"35px\" height=\"35px\" style=\"margin-right: 15px; margin-top:-2px\">Enable metrics for " + repository.getOfficialName() + "</h2>" +
121
//                                "<ol class=\"breadcrumb\"><li><a href=\"#dashboard\">Home</a></li><li><a href=\"#" + parentToken +
122
//                                "\">Metrics</a></li><li><a href=\"#" + parentToken + "/" + repositoryId + "\">" + repository.getOfficialName() + "</a>" +
123
//                                "</li><li class=\"active\"><strong>Instructions</strong></li></ol></div><div class=\"col-sm-3\"></div>"));
131 124

  
132
                        RepositoryManager.pageHeader.add(new HTML("<div class=\"col-sm-9\"><h2><img src=\"" + logoURLSource + "\" alt=[Repo Logo]" +
133
                                "width=\"35px\" height=\"35px\" style=\"margin-right: 15px; margin-top:-2px\">Enable metrics for " + repository.getOfficialName() + "</h2>" +
134
                                "<ol class=\"breadcrumb\"><li><a href=\"#dashboard\">Home</a></li><li><a href=\"#" + parentToken +
135
                                "\">Metrics</a></li><li><a href=\"#" + parentToken + "/" + repositoryId + "\">" + repository.getOfficialName() + "</a>" +
136
                                "</li><li class=\"active\"><strong>Instructions</strong></li></ol></div><div class=\"col-sm-3\"></div>"));
137

  
138 125
                        instructionsForMetricsBoxContent.removeStyleName("loading-big");
139 126
                        instructionsForMetricsBoxContent.remove(loadingWheel);
140 127

  
......
180 167

  
181 168
    }
182 169

  
183
    @Override
184
    public Widget asWidget() {
185
        return instructionsForMetricsPanel;
186
    }
187

  
188 170
    private FlowPanel showInstructions(String piwikScript) {
189 171

  
190 172
        FlowPanel instructionsPanel = new FlowPanel();

Also available in: Unified diff