1002811 dashboard improvements IDEMPIERE-1196
This commit is contained in:
parent
29339825b6
commit
6f0b259c97
|
@ -6,6 +6,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.compiere.util.CCache;
|
||||||
import org.jfree.chart.ChartFactory;
|
import org.jfree.chart.ChartFactory;
|
||||||
import org.jfree.chart.JFreeChart;
|
import org.jfree.chart.JFreeChart;
|
||||||
import org.jfree.chart.axis.CategoryAxis;
|
import org.jfree.chart.axis.CategoryAxis;
|
||||||
|
@ -24,16 +25,30 @@ import org.jfree.data.time.TimeSeriesCollection;
|
||||||
import org.jfree.data.xy.IntervalXYDataset;
|
import org.jfree.data.xy.IntervalXYDataset;
|
||||||
|
|
||||||
public class MChart extends X_AD_Chart {
|
public class MChart extends X_AD_Chart {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -8851465915516536910L;
|
private static final long serialVersionUID = 6001892625463139079L;
|
||||||
|
|
||||||
private int windowNo=0;
|
private int windowNo=0;
|
||||||
private Dataset dataset;
|
private Dataset dataset;
|
||||||
private HashMap<String,MQuery> queries;
|
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) {
|
public MChart(Properties ctx, int AD_Chart_ID, String trxName) {
|
||||||
super(ctx, AD_Chart_ID, trxName);
|
super(ctx, AD_Chart_ID, trxName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.compiere.util.CCache;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +20,22 @@ 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)
|
public static int getForSessionColumnCount(boolean isShowInDashboard, int AD_User_ID, int AD_Role_ID)
|
||||||
{
|
{
|
||||||
|
|
|
@ -336,11 +336,13 @@ public class DashboardController implements EventListener<Event> {
|
||||||
if(url != null)
|
if(url != null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
Map<String,Integer> map = new HashMap<String, Integer>();
|
||||||
|
map.put("DCID", dc.getPA_DashboardContent_ID());
|
||||||
|
|
||||||
Component component = null;
|
Component component = null;
|
||||||
List<IDashboardGadgetFactory> f = Service.locator().list(IDashboardGadgetFactory.class).getServices();
|
List<IDashboardGadgetFactory> f = Service.locator().list(IDashboardGadgetFactory.class).getServices();
|
||||||
for (IDashboardGadgetFactory factory : f) {
|
for (IDashboardGadgetFactory factory : f) {
|
||||||
component = factory.getGadget(url.toString(),content);
|
component = factory.getGadget(url.toString(),content,map);
|
||||||
if(component != null)
|
if(component != null)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.webui.factory;
|
package org.adempiere.webui.factory;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,5 +29,5 @@ public interface IDashboardGadgetFactory {
|
||||||
* @param parent
|
* @param parent
|
||||||
* @return Component instance of DashboardPanel or null
|
* @return Component instance of DashboardPanel or null
|
||||||
*/
|
*/
|
||||||
public Component getGadget(String uri, Component parent);
|
public Component getGadget(String uri, Component parent, Map<?, ?> args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
package org.adempiere.webui.factory;
|
package org.adempiere.webui.factory;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.adempiere.base.Core;
|
import org.adempiere.base.Core;
|
||||||
import org.adempiere.base.IResourceFinder;
|
import org.adempiere.base.IResourceFinder;
|
||||||
|
@ -28,12 +29,12 @@ import org.zkoss.zk.ui.Executions;
|
||||||
*/
|
*/
|
||||||
public class ZulDashboardGadgetFactory implements IDashboardGadgetFactory {
|
public class ZulDashboardGadgetFactory implements IDashboardGadgetFactory {
|
||||||
@Override
|
@Override
|
||||||
public Component getGadget(String uri, Component parent) {
|
public Component getGadget(String uri, Component parent, Map<?, ?> args) {
|
||||||
if (uri != null && uri.toLowerCase().endsWith(".zul")) {
|
if (uri != null && uri.toLowerCase().endsWith(".zul")) {
|
||||||
IResourceFinder rf = Core.getResourceFinder();
|
IResourceFinder rf = Core.getResourceFinder();
|
||||||
URL url = rf.getResource(uri);
|
URL url = rf.getResource(uri);
|
||||||
if(url!=null)
|
if(url!=null)
|
||||||
return Executions.createComponents(url.toString(), parent, null);
|
return Executions.createComponents(url.toString(), parent, args);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue