Merge pull request 'Feature/18753' (#2) from Feature/18753 into master
This commit is contained in:
commit
6fbc30f520
|
@ -5,6 +5,7 @@
|
|||
<Change>Added Core Services support [ticket #18291]</Change>
|
||||
<Change>Added Detached REs support [ticket #18815]</Change>
|
||||
<Change>Added the alphabetical sorting of tabs [ticket #18754]</Change>
|
||||
<Change>Added TOC menu in reports [ticket #18753]</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets.user.accounting-dashboard.1-1-0"
|
||||
date="2019-10-01">
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package org.gcube.portlets.user.accountingdashboard.client.application;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.gcube.portlets.user.accountingdashboard.client.application.controller.Controller;
|
||||
import org.gcube.portlets.user.accountingdashboard.client.application.menu.MenuPresenter;
|
||||
import org.gcube.portlets.user.accountingdashboard.client.place.NameTokens;
|
||||
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.inject.Inject;
|
||||
|
@ -15,6 +18,7 @@ import com.gwtplatform.mvp.client.presenter.slots.PermanentSlot;
|
|||
import com.gwtplatform.mvp.client.proxy.NavigationEvent;
|
||||
import com.gwtplatform.mvp.client.proxy.NavigationHandler;
|
||||
import com.gwtplatform.mvp.client.proxy.Proxy;
|
||||
import com.gwtplatform.mvp.shared.proxy.PlaceRequest;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -24,6 +28,9 @@ import com.gwtplatform.mvp.client.proxy.Proxy;
|
|||
public class ApplicationPresenter
|
||||
extends Presenter<ApplicationPresenter.PresenterView, ApplicationPresenter.ApplicationPresenterProxy>
|
||||
implements NavigationHandler {
|
||||
|
||||
private static Logger logger = java.util.logging.Logger.getLogger("");
|
||||
|
||||
interface PresenterView extends View {
|
||||
}
|
||||
|
||||
|
@ -36,11 +43,10 @@ public class ApplicationPresenter
|
|||
|
||||
private MenuPresenter menuPresenter;
|
||||
private Controller controller;
|
||||
|
||||
|
||||
@Inject
|
||||
ApplicationPresenter(EventBus eventBus, PresenterView view, ApplicationPresenterProxy proxy, MenuPresenter menuPresenter,
|
||||
Controller controller) {
|
||||
ApplicationPresenter(EventBus eventBus, PresenterView view, ApplicationPresenterProxy proxy,
|
||||
MenuPresenter menuPresenter, Controller controller) {
|
||||
super(eventBus, view, proxy, RevealType.Root);
|
||||
this.menuPresenter = menuPresenter;
|
||||
this.controller = controller;
|
||||
|
@ -63,16 +69,21 @@ public class ApplicationPresenter
|
|||
|
||||
@Override
|
||||
public void onNavigation(NavigationEvent navigationEvent) {
|
||||
Window.scrollTo(0, 0);
|
||||
// PlaceRequest placeRequest=navigationEvent.getRequest();
|
||||
// placeManager.revealPlace(placeRequest);
|
||||
|
||||
if (navigationEvent != null) {
|
||||
PlaceRequest placeRequest = navigationEvent.getRequest();
|
||||
logger.log(Level.FINE, "Navigation: " + placeRequest);
|
||||
// If the navigation is related to mainarea scrollbar is not reset
|
||||
if (placeRequest.getNameToken().compareTo(NameTokens.getMainArea()) != 0) {
|
||||
Window.scrollTo(0, 0);
|
||||
}
|
||||
// placeManager.revealPlace(placeRequest);
|
||||
} else {
|
||||
Window.scrollTo(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void callHello(){
|
||||
|
||||
private void callHello() {
|
||||
controller.callHello();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,9 +12,13 @@ import org.gcube.portlets.user.accountingdashboard.client.resources.AppResources
|
|||
import org.gcube.portlets.user.accountingdashboard.shared.data.ReportData;
|
||||
import org.gcube.portlets.user.accountingdashboard.shared.data.ReportElementData;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.NavHeader;
|
||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||
import com.github.gwtbootstrap.client.ui.Tab;
|
||||
import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||
import com.github.gwtbootstrap.client.ui.WellNavList;
|
||||
import com.github.gwtbootstrap.client.ui.base.IconAnchor;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
|
@ -96,6 +100,31 @@ public class ReportAreaView extends ViewWithUiHandlers<ReportAreaPresenter>
|
|||
Tab tab = new Tab();
|
||||
tab.setHeading(category);
|
||||
HTMLPanel tabContent = new HTMLPanel("");
|
||||
if(categories.get(category).size()>0){
|
||||
WellNavList toc=new WellNavList();
|
||||
toc.addStyleName(resources.uiDataCss().uiDataReportToc());
|
||||
NavHeader navHeader=new NavHeader();
|
||||
if(categories.get(category).size()>1){
|
||||
navHeader.setText("Available Graphs");
|
||||
}else {
|
||||
navHeader.setText("Available Graph");
|
||||
}
|
||||
toc.add(navHeader);
|
||||
for (Chart chart : categories.get(category)) {
|
||||
ReportElementData reData=chart.getReportElementData();
|
||||
StringBuilder navLinkText=new StringBuilder();
|
||||
navLinkText.append(reData.getLabel());
|
||||
//navLinkText.append("[");
|
||||
//navLinkText.append(reData.getCategory());
|
||||
//navLinkText.append("]");
|
||||
NavLink navLink=new NavLink(navLinkText.toString(),"#"+chart.getWrapperName());
|
||||
navLink.setIcon(IconType.BAR_CHART);
|
||||
navLink.addStyleName(resources.uiDataCss().uiDataReportTocNavLink());
|
||||
toc.add(navLink);
|
||||
}
|
||||
tabContent.add(toc);
|
||||
}
|
||||
|
||||
for (Chart chart : categories.get(category)) {
|
||||
tabContent.add(chart);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.google.gwt.user.client.ui.HTMLPanel;
|
|||
public class Chart extends HTMLPanel {
|
||||
|
||||
private String name;
|
||||
private String wrapperName;
|
||||
|
||||
private ReportElementData reportElementData;
|
||||
|
||||
|
@ -30,9 +31,11 @@ public class Chart extends HTMLPanel {
|
|||
+ "</ul>" + "</div>" + "<canvas id=" + name + " class='" + resources.uiDataCss().uiDataChartCanvas()
|
||||
+ "'></canvas>");
|
||||
this.name = name;
|
||||
this.wrapperName="wrapper_"+name;
|
||||
this.reportElementData = reportElementData;
|
||||
this.getElement().setId(wrapperName);
|
||||
this.addStyleName(resources.uiDataCss().uiDataChartWrapper());
|
||||
|
||||
|
||||
addAttachHandler(new AttachEvent.Handler() {
|
||||
|
||||
@Override
|
||||
|
@ -46,6 +49,18 @@ public class Chart extends HTMLPanel {
|
|||
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getWrapperName() {
|
||||
return wrapperName;
|
||||
}
|
||||
|
||||
public ReportElementData getReportElementData() {
|
||||
return reportElementData;
|
||||
}
|
||||
|
||||
public void forceLayout() {
|
||||
redrawChart();
|
||||
}
|
||||
|
@ -181,9 +196,9 @@ public class Chart extends HTMLPanel {
|
|||
heading += "," + recordData.getX();
|
||||
datasetRow += "," + recordData.getY();
|
||||
}
|
||||
|
||||
var csvData=heading+"\n"+datasetRow + "\n";
|
||||
var csvDataEncoded=encodeURI(csvData);
|
||||
|
||||
var csvData = heading + "\n" + datasetRow + "\n";
|
||||
var csvDataEncoded = encodeURI(csvData);
|
||||
csvContent += csvDataEncoded;
|
||||
} else {
|
||||
var datasetRow = seriesData.getLabel();
|
||||
|
@ -191,8 +206,8 @@ public class Chart extends HTMLPanel {
|
|||
var recordData = dataRow[j];
|
||||
datasetRow += "," + recordData.getY();
|
||||
}
|
||||
var csvData=datasetRow + "\n";
|
||||
var csvDataEncoded=encodeURI(csvData);
|
||||
var csvData = datasetRow + "\n";
|
||||
var csvDataEncoded = encodeURI(csvData);
|
||||
csvContent += csvDataEncoded;
|
||||
}
|
||||
}
|
||||
|
@ -320,8 +335,10 @@ public class Chart extends HTMLPanel {
|
|||
datasets : datasetsArray
|
||||
};
|
||||
|
||||
var label = [ reportElementData.getLabel(), ' [',
|
||||
reportElementData.getCategory(), ']' ].filter(Boolean).join("");
|
||||
//var label = [ reportElementData.getLabel(), ' [',
|
||||
// reportElementData.getCategory(), ']' ].filter(Boolean).join("");
|
||||
|
||||
var label = reportElementData.getLabel();
|
||||
|
||||
var scalesType = @org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report.chartjs.Chart::getScales(Lorg/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/chartjs/Chart;)(this);
|
||||
|
||||
|
|
|
@ -38,7 +38,11 @@ public interface AppResources extends ClientBundle {
|
|||
String uiDataReportPanel();
|
||||
|
||||
String uiDataReportTabPanel();
|
||||
|
||||
|
||||
String uiDataReportToc();
|
||||
|
||||
String uiDataReportTocNavLink();
|
||||
|
||||
String uiDataChartWrapper();
|
||||
|
||||
String uiDataChartCanvas();
|
||||
|
|
|
@ -67,10 +67,27 @@
|
|||
max-width: 800px;
|
||||
}
|
||||
|
||||
/* TOC WellNavList */
|
||||
.uiDataReportToc {
|
||||
padding: 8px 0px;
|
||||
max-width: 650px;
|
||||
}
|
||||
|
||||
/* TOC NavLink */
|
||||
.uiDataReportTocNavLink {
|
||||
color: rgb(59, 89, 152);
|
||||
}
|
||||
|
||||
/* TOC NavLink href */
|
||||
.uiDataReportTocNavLink a {
|
||||
color: rgb(59, 89, 152);
|
||||
}
|
||||
|
||||
|
||||
/* Chart */
|
||||
.uiDataChartWrapper {
|
||||
width: 800px;
|
||||
padding-top: 50px;
|
||||
/*border: solid 1px;*/
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue