ref 18753: Add menu to Accounting Dashboard pages
https://support.d4science.org/issues/18753 Added TOC menu in reports
This commit is contained in:
parent
95b009ae60
commit
95f5670e9f
|
@ -5,6 +5,7 @@
|
||||||
<Change>Added Core Services support [ticket #18291]</Change>
|
<Change>Added Core Services support [ticket #18291]</Change>
|
||||||
<Change>Added Detached REs support [ticket #18815]</Change>
|
<Change>Added Detached REs support [ticket #18815]</Change>
|
||||||
<Change>Added the alphabetical sorting of tabs [ticket #18754]</Change>
|
<Change>Added the alphabetical sorting of tabs [ticket #18754]</Change>
|
||||||
|
<Change>Added TOC menu in reports [ticket #18753]</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets.user.accounting-dashboard.1-1-0"
|
<Changeset component="org.gcube.portlets.user.accounting-dashboard.1-1-0"
|
||||||
date="2019-10-01">
|
date="2019-10-01">
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package org.gcube.portlets.user.accountingdashboard.client.application;
|
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.controller.Controller;
|
||||||
import org.gcube.portlets.user.accountingdashboard.client.application.menu.MenuPresenter;
|
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.gwt.user.client.Window;
|
||||||
import com.google.inject.Inject;
|
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.NavigationEvent;
|
||||||
import com.gwtplatform.mvp.client.proxy.NavigationHandler;
|
import com.gwtplatform.mvp.client.proxy.NavigationHandler;
|
||||||
import com.gwtplatform.mvp.client.proxy.Proxy;
|
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
|
public class ApplicationPresenter
|
||||||
extends Presenter<ApplicationPresenter.PresenterView, ApplicationPresenter.ApplicationPresenterProxy>
|
extends Presenter<ApplicationPresenter.PresenterView, ApplicationPresenter.ApplicationPresenterProxy>
|
||||||
implements NavigationHandler {
|
implements NavigationHandler {
|
||||||
|
|
||||||
|
private static Logger logger = java.util.logging.Logger.getLogger("");
|
||||||
|
|
||||||
interface PresenterView extends View {
|
interface PresenterView extends View {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,10 +44,9 @@ public class ApplicationPresenter
|
||||||
private MenuPresenter menuPresenter;
|
private MenuPresenter menuPresenter;
|
||||||
private Controller controller;
|
private Controller controller;
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ApplicationPresenter(EventBus eventBus, PresenterView view, ApplicationPresenterProxy proxy, MenuPresenter menuPresenter,
|
ApplicationPresenter(EventBus eventBus, PresenterView view, ApplicationPresenterProxy proxy,
|
||||||
Controller controller) {
|
MenuPresenter menuPresenter, Controller controller) {
|
||||||
super(eventBus, view, proxy, RevealType.Root);
|
super(eventBus, view, proxy, RevealType.Root);
|
||||||
this.menuPresenter = menuPresenter;
|
this.menuPresenter = menuPresenter;
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
|
@ -63,16 +69,21 @@ public class ApplicationPresenter
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNavigation(NavigationEvent navigationEvent) {
|
public void onNavigation(NavigationEvent navigationEvent) {
|
||||||
Window.scrollTo(0, 0);
|
if (navigationEvent != null) {
|
||||||
// PlaceRequest placeRequest=navigationEvent.getRequest();
|
PlaceRequest placeRequest = navigationEvent.getRequest();
|
||||||
// placeManager.revealPlace(placeRequest);
|
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();
|
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.ReportData;
|
||||||
import org.gcube.portlets.user.accountingdashboard.shared.data.ReportElementData;
|
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.Tab;
|
||||||
import com.github.gwtbootstrap.client.ui.TabPanel;
|
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.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.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
@ -96,6 +100,31 @@ public class ReportAreaView extends ViewWithUiHandlers<ReportAreaPresenter>
|
||||||
Tab tab = new Tab();
|
Tab tab = new Tab();
|
||||||
tab.setHeading(category);
|
tab.setHeading(category);
|
||||||
HTMLPanel tabContent = new HTMLPanel("");
|
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.getName());
|
||||||
|
navLink.setIcon(IconType.BAR_CHART);
|
||||||
|
navLink.addStyleName(resources.uiDataCss().uiDataReportTocNavLink());
|
||||||
|
toc.add(navLink);
|
||||||
|
}
|
||||||
|
tabContent.add(toc);
|
||||||
|
}
|
||||||
|
|
||||||
for (Chart chart : categories.get(category)) {
|
for (Chart chart : categories.get(category)) {
|
||||||
tabContent.add(chart);
|
tabContent.add(chart);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,14 @@ public class Chart extends HTMLPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReportElementData getReportElementData() {
|
||||||
|
return reportElementData;
|
||||||
|
}
|
||||||
|
|
||||||
public void forceLayout() {
|
public void forceLayout() {
|
||||||
redrawChart();
|
redrawChart();
|
||||||
}
|
}
|
||||||
|
@ -182,8 +190,8 @@ public class Chart extends HTMLPanel {
|
||||||
datasetRow += "," + recordData.getY();
|
datasetRow += "," + recordData.getY();
|
||||||
}
|
}
|
||||||
|
|
||||||
var csvData=heading+"\n"+datasetRow + "\n";
|
var csvData = heading + "\n" + datasetRow + "\n";
|
||||||
var csvDataEncoded=encodeURI(csvData);
|
var csvDataEncoded = encodeURI(csvData);
|
||||||
csvContent += csvDataEncoded;
|
csvContent += csvDataEncoded;
|
||||||
} else {
|
} else {
|
||||||
var datasetRow = seriesData.getLabel();
|
var datasetRow = seriesData.getLabel();
|
||||||
|
@ -191,8 +199,8 @@ public class Chart extends HTMLPanel {
|
||||||
var recordData = dataRow[j];
|
var recordData = dataRow[j];
|
||||||
datasetRow += "," + recordData.getY();
|
datasetRow += "," + recordData.getY();
|
||||||
}
|
}
|
||||||
var csvData=datasetRow + "\n";
|
var csvData = datasetRow + "\n";
|
||||||
var csvDataEncoded=encodeURI(csvData);
|
var csvDataEncoded = encodeURI(csvData);
|
||||||
csvContent += csvDataEncoded;
|
csvContent += csvDataEncoded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,10 @@ public interface AppResources extends ClientBundle {
|
||||||
|
|
||||||
String uiDataReportTabPanel();
|
String uiDataReportTabPanel();
|
||||||
|
|
||||||
|
String uiDataReportToc();
|
||||||
|
|
||||||
|
String uiDataReportTocNavLink();
|
||||||
|
|
||||||
String uiDataChartWrapper();
|
String uiDataChartWrapper();
|
||||||
|
|
||||||
String uiDataChartCanvas();
|
String uiDataChartCanvas();
|
||||||
|
|
|
@ -67,6 +67,22 @@
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TOC WellNavList */
|
||||||
|
.uiDataReportToc {
|
||||||
|
padding: 8px 0px;
|
||||||
|
max-width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TOC NavLink */
|
||||||
|
.uiDataReportTocNavLink {
|
||||||
|
color: rgb(59, 89, 152);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TOC NavLink href */
|
||||||
|
.uiDataReportTocNavLink a {
|
||||||
|
color: rgb(59, 89, 152);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Chart */
|
/* Chart */
|
||||||
.uiDataChartWrapper {
|
.uiDataChartWrapper {
|
||||||
|
|
Loading…
Reference in New Issue