2015-07-24 16:59:31 +02:00
|
|
|
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts;
|
|
|
|
|
2015-09-11 18:31:11 +02:00
|
|
|
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.storage.StorageChart;
|
2015-07-24 16:59:31 +02:00
|
|
|
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingStateData;
|
|
|
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
|
|
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerChartDrawException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Accounting Chart 4 Task
|
|
|
|
*
|
|
|
|
* @author "Giancarlo Panichi" email: <a
|
|
|
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public class AccountingChart4Task extends AccountingChartBuilder {
|
|
|
|
|
|
|
|
private AccountingStateData accountingStateData;
|
|
|
|
|
|
|
|
public AccountingChart4Task(AccountingStateData accountingStateData) {
|
|
|
|
this.accountingStateData = accountingStateData;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void buildChart() throws AccountingManagerChartDrawException {
|
2015-09-11 18:31:11 +02:00
|
|
|
AccountingChartPanel accountingChartPanel = null;
|
|
|
|
|
2015-07-24 16:59:31 +02:00
|
|
|
if (accountingStateData == null
|
|
|
|
|| accountingStateData.getAccountingType() == null
|
|
|
|
|| accountingStateData.getSeriesRequest() == null
|
|
|
|
|| accountingStateData.getSeriesResponse() == null) {
|
|
|
|
accountingChartSpec.setChart(accountingChartPanel);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-09-11 18:31:11 +02:00
|
|
|
if (!(accountingStateData.getSeriesResponse() instanceof SeriesStorage)) {
|
2015-07-24 16:59:31 +02:00
|
|
|
accountingChartSpec.setChart(accountingChartPanel);
|
|
|
|
return;
|
|
|
|
}
|
2015-09-11 18:31:11 +02:00
|
|
|
|
|
|
|
StorageChart container=new StorageChart(accountingStateData);
|
|
|
|
|
|
|
|
accountingChartPanel = new AccountingChartPanel(container);
|
2015-07-24 16:59:31 +02:00
|
|
|
|
|
|
|
accountingChartSpec.setChart(accountingChartPanel);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|