84 lines
2.5 KiB
Java
84 lines
2.5 KiB
Java
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts;
|
|
|
|
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.job.JobChartBasicPanel;
|
|
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingStateData;
|
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ChartDrawException;
|
|
|
|
import com.google.gwt.event.shared.EventBus;
|
|
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
|
|
|
/**
|
|
* Accounting Chart 4 Job
|
|
*
|
|
* @author "Giancarlo Panichi" email: <a
|
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
*
|
|
*/
|
|
public class AccountingChart4Job extends AccountingChartBuilder {
|
|
|
|
private AccountingStateData accountingStateData;
|
|
private EventBus eventBus;
|
|
|
|
public AccountingChart4Job(EventBus eventBus, AccountingStateData accountingStateData) {
|
|
this.eventBus=eventBus;
|
|
this.accountingStateData = accountingStateData;
|
|
}
|
|
|
|
@Override
|
|
public void buildChart() throws ChartDrawException {
|
|
AccountingChartPanel accountingChartPanel = null;
|
|
|
|
if (accountingStateData == null
|
|
|| accountingStateData.getAccountingType() == null
|
|
|| accountingStateData.getSeriesRequest() == null
|
|
|| accountingStateData.getSeriesResponse() == null) {
|
|
accountingChartSpec.setChart(accountingChartPanel);
|
|
return;
|
|
}
|
|
|
|
if (!(accountingStateData.getSeriesResponse() instanceof SeriesJob)) {
|
|
accountingChartSpec.setChart(accountingChartPanel);
|
|
return;
|
|
}
|
|
|
|
SimpleContainer container = createJobChartPanel();
|
|
|
|
accountingChartPanel = new AccountingChartPanel(container);
|
|
|
|
accountingChartSpec.setChart(accountingChartPanel);
|
|
|
|
}
|
|
|
|
private SimpleContainer createJobChartPanel()
|
|
throws ChartDrawException {
|
|
|
|
if (accountingStateData == null
|
|
|| accountingStateData.getSeriesRequest() == null
|
|
|| accountingStateData.getSeriesRequest()
|
|
.getAccountingFilterDefinition() == null
|
|
|| accountingStateData.getSeriesRequest()
|
|
.getAccountingFilterDefinition()
|
|
.getChartType() == null) {
|
|
return null;
|
|
}
|
|
|
|
switch (accountingStateData.getSeriesRequest()
|
|
.getAccountingFilterDefinition().getChartType()) {
|
|
|
|
case Top:
|
|
return null;
|
|
//return new JobChartTopPanel(accountingStateData);
|
|
//createJobChart(new JobChart4Top(accountingStateData));
|
|
case Basic:
|
|
return new JobChartBasicPanel(eventBus, accountingStateData);
|
|
//createJobChart(new JobChart4Basic(
|
|
//accountingStateData));
|
|
default:
|
|
|
|
return null;
|
|
}
|
|
|
|
}
|
|
}
|