IDEMPIERE-4791 Pass PA_DashboardContent information to IDashboardGadgetFactory (#691)
This commit is contained in:
parent
ca556b52ba
commit
a89a84f528
|
@ -38,6 +38,7 @@ import org.compiere.grid.ICreateFromFactory;
|
|||
import org.compiere.grid.IPaymentForm;
|
||||
import org.compiere.grid.IPaymentFormFactory;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MDashboardContent;
|
||||
import org.compiere.util.CCache;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
|
||||
|
@ -190,11 +191,22 @@ public class Extensions {
|
|||
* @return Gadget component
|
||||
*/
|
||||
public static final Component getDashboardGadget(String url, Component parent) {
|
||||
return getDashboardGadget(url, parent, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url
|
||||
* @param parent
|
||||
* @param dc
|
||||
* @return Gadget component
|
||||
*/
|
||||
public static final Component getDashboardGadget(String url, Component parent, MDashboardContent dc) {
|
||||
IServiceReferenceHolder<IDashboardGadgetFactory> cache = s_dashboardGadgetFactoryCache.get(url);
|
||||
if (cache != null) {
|
||||
IDashboardGadgetFactory service = cache.getService();
|
||||
if (service != null) {
|
||||
Component component = service.getGadget(url,parent);
|
||||
Component component = service.getGadget(url,parent,dc);
|
||||
if(component != null)
|
||||
return component;
|
||||
}
|
||||
|
@ -205,7 +217,7 @@ public class Extensions {
|
|||
for (IServiceReferenceHolder<IDashboardGadgetFactory> factory : f) {
|
||||
IDashboardGadgetFactory service = factory.getService();
|
||||
if (service != null) {
|
||||
Component component = service.getGadget(url,parent);
|
||||
Component component = service.getGadget(url,parent,dc);
|
||||
if(component != null)
|
||||
return component;
|
||||
}
|
||||
|
|
|
@ -493,7 +493,7 @@ public class DashboardController implements EventListener<Event> {
|
|||
{
|
||||
try {
|
||||
|
||||
Component component = Extensions.getDashboardGadget(url, content);
|
||||
Component component = Extensions.getDashboardGadget(url, content, dc);
|
||||
if(component != null)
|
||||
{
|
||||
if (component instanceof Include)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.webui.factory;
|
||||
|
||||
import org.compiere.model.MDashboardContent;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
|
||||
/**
|
||||
|
@ -23,9 +24,20 @@ import org.zkoss.zk.ui.Component;
|
|||
public interface IDashboardGadgetFactory {
|
||||
/**
|
||||
*
|
||||
* @param uri
|
||||
* @param parent
|
||||
* @param String uri
|
||||
* @param Component parent
|
||||
* @return Component instance of DashboardPanel or null
|
||||
*/
|
||||
public Component getGadget(String uri, Component parent);
|
||||
|
||||
/**
|
||||
* @param String url
|
||||
* @param Component parent
|
||||
* @param MDashboardContent dc
|
||||
* @return Component instance of DashboardPanel or null
|
||||
*/
|
||||
default public Component getGadget(String url, Component parent, MDashboardContent dc) {
|
||||
return getGadget(url, parent); // ignore the third method by default (backward compatibility)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue