IDEMPIERE-4791 Pass PA_DashboardContent information to IDashboardGadgetFactory (#691)

This commit is contained in:
Carlos Ruiz 2021-05-20 10:41:35 +02:00 committed by GitHub
parent ca556b52ba
commit a89a84f528
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 5 deletions

View File

@ -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;
}

View File

@ -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)

View File

@ -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)
}
}