1002811 dashboard improvements IDEMPIERE-1196

This commit is contained in:
Elaine Tan 2013-10-30 20:00:53 +08:00
parent 29339825b6
commit 6f0b259c97
5 changed files with 44 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Properties;
import org.compiere.util.CCache;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
@ -24,15 +25,29 @@ import org.jfree.data.time.TimeSeriesCollection;
import org.jfree.data.xy.IntervalXYDataset;
public class MChart extends X_AD_Chart {
/**
*
*/
private static final long serialVersionUID = -8851465915516536910L;
private static final long serialVersionUID = 6001892625463139079L;
private int windowNo=0;
private Dataset dataset;
private HashMap<String,MQuery> queries;
private static CCache<Integer,MChart> s_cache = new CCache<Integer,MChart>("AD_Chart", 30, 60);
public static MChart get (Properties ctx, int AD_Chart_ID)
{
Integer key = new Integer(AD_Chart_ID);
MChart retValue = (MChart)s_cache.get(key);
if (retValue == null)
{
retValue = new MChart (ctx, AD_Chart_ID, null);
s_cache.put(key, retValue);
}
return retValue;
} // get
public MChart(Properties ctx, int AD_Chart_ID, String trxName) {
super(ctx, AD_Chart_ID, trxName);

View File

@ -8,6 +8,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.compiere.util.CCache;
import org.compiere.util.Env;
/**
@ -15,11 +16,26 @@ import org.compiere.util.Env;
*
*/
public class MDashboardContent extends X_PA_DashboardContent
{
{
/**
*
*/
private static final long serialVersionUID = -1360395253302002667L;
private static final long serialVersionUID = -3565359682982006243L;
private static CCache<Integer,MDashboardContent> s_cache = new CCache<Integer,MDashboardContent>("PA_DashboardContent_ID", 30, 60);
public static MDashboardContent get (Properties ctx, int PA_DashboardContent_ID)
{
Integer key = new Integer(PA_DashboardContent_ID);
MDashboardContent retValue = (MDashboardContent)s_cache.get(key);
if (retValue == null)
{
retValue = new MDashboardContent (ctx, PA_DashboardContent_ID, null);
s_cache.put(key, retValue);
}
return retValue;
} // get
public static int getForSessionColumnCount(boolean isShowInDashboard, int AD_User_ID, int AD_Role_ID)
{

View File

@ -336,11 +336,13 @@ public class DashboardController implements EventListener<Event> {
if(url != null)
{
try {
Map<String,Integer> map = new HashMap<String, Integer>();
map.put("DCID", dc.getPA_DashboardContent_ID());
Component component = null;
List<IDashboardGadgetFactory> f = Service.locator().list(IDashboardGadgetFactory.class).getServices();
for (IDashboardGadgetFactory factory : f) {
component = factory.getGadget(url.toString(),content);
component = factory.getGadget(url.toString(),content,map);
if(component != null)
break;
}

View File

@ -13,6 +13,8 @@
*****************************************************************************/
package org.adempiere.webui.factory;
import java.util.Map;
import org.zkoss.zk.ui.Component;
/**
@ -27,5 +29,5 @@ public interface IDashboardGadgetFactory {
* @param parent
* @return Component instance of DashboardPanel or null
*/
public Component getGadget(String uri, Component parent);
public Component getGadget(String uri, Component parent, Map<?, ?> args);
}

View File

@ -14,6 +14,7 @@
package org.adempiere.webui.factory;
import java.net.URL;
import java.util.Map;
import org.adempiere.base.Core;
import org.adempiere.base.IResourceFinder;
@ -28,12 +29,12 @@ import org.zkoss.zk.ui.Executions;
*/
public class ZulDashboardGadgetFactory implements IDashboardGadgetFactory {
@Override
public Component getGadget(String uri, Component parent) {
public Component getGadget(String uri, Component parent, Map<?, ?> args) {
if (uri != null && uri.toLowerCase().endsWith(".zul")) {
IResourceFinder rf = Core.getResourceFinder();
URL url = rf.getResource(uri);
if(url!=null)
return Executions.createComponents(url.toString(), parent, null);
return Executions.createComponents(url.toString(), parent, args);
}
return null;
}