diff --git a/migration/i1.0z/oracle/201310040650_IDEMPIERE-1196.sql b/migration/i1.0z/oracle/201310040650_IDEMPIERE-1196.sql
new file mode 100644
index 0000000000..624d95bb84
--- /dev/null
+++ b/migration/i1.0z/oracle/201310040650_IDEMPIERE-1196.sql
@@ -0,0 +1,41 @@
+SET SQLBLANKLINES ON
+SET DEFINE OFF
+
+-- Oct 4, 2013 2:48:55 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_Element SET Help='URI for Dashboard Gadget. This can be absolute path to a zul file or an unique gadget id which is instantiated through OSGi factory services.', Name='Gadget URI', Description='URI for Dashboard Gadget', PrintName='Gadget URI',Updated=TO_DATE('2013-10-04 14:48:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=53710
+;
+
+-- Oct 4, 2013 2:48:56 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_Column SET ColumnName='ZulFilePath', Name='Gadget URI', Description='URI for Dashboard Gadget', Help='URI for Dashboard Gadget. This can be absolute path to a zul file or an unique gadget id which is instantiated through OSGi factory services.' WHERE AD_Element_ID=53710
+;
+
+-- Oct 4, 2013 2:48:56 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_Process_Para SET ColumnName='ZulFilePath', Name='Gadget URI', Description='URI for Dashboard Gadget', Help='URI for Dashboard Gadget. This can be absolute path to a zul file or an unique gadget id which is instantiated through OSGi factory services.', AD_Element_ID=53710 WHERE UPPER(ColumnName)='ZULFILEPATH' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
+;
+
+-- Oct 4, 2013 2:48:56 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_Process_Para SET ColumnName='ZulFilePath', Name='Gadget URI', Description='URI for Dashboard Gadget', Help='URI for Dashboard Gadget. This can be absolute path to a zul file or an unique gadget id which is instantiated through OSGi factory services.' WHERE AD_Element_ID=53710 AND IsCentrallyMaintained='Y'
+;
+
+-- Oct 4, 2013 2:48:56 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_InfoColumn SET ColumnName='ZulFilePath', Name='Gadget URI', Description='URI for Dashboard Gadget', Help='URI for Dashboard Gadget. This can be absolute path to a zul file or an unique gadget id which is instantiated through OSGi factory services.' WHERE AD_Element_ID=53710 AND IsCentrallyMaintained='Y'
+;
+
+-- Oct 4, 2013 2:48:56 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_Field SET Name='Gadget URI', Description='URI for Dashboard Gadget', Help='URI for Dashboard Gadget. This can be absolute path to a zul file or an unique gadget id which is instantiated through OSGi factory services.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=53710) AND IsCentrallyMaintained='Y'
+;
+
+-- Oct 4, 2013 2:48:56 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_PrintFormatItem SET PrintName='Gadget URI', Name='Gadget URI' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=53710)
+;
+
+SELECT register_migration_script('201310040650_IDEMPIERE-1196.sql') FROM dual
+;
+
diff --git a/migration/i1.0z/postgresql/201310040650_IDEMPIERE-1196.sql b/migration/i1.0z/postgresql/201310040650_IDEMPIERE-1196.sql
new file mode 100644
index 0000000000..22c020bdc6
--- /dev/null
+++ b/migration/i1.0z/postgresql/201310040650_IDEMPIERE-1196.sql
@@ -0,0 +1,38 @@
+-- Oct 4, 2013 2:48:55 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_Element SET Help='URI for Dashboard Gadget. This can be absolute path to a zul file or an unique gadget id which is instantiated through OSGi factory services.', Name='Gadget URI', Description='URI for Dashboard Gadget', PrintName='Gadget URI',Updated=TO_TIMESTAMP('2013-10-04 14:48:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=53710
+;
+
+-- Oct 4, 2013 2:48:56 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_Column SET ColumnName='ZulFilePath', Name='Gadget URI', Description='URI for Dashboard Gadget', Help='URI for Dashboard Gadget. This can be absolute path to a zul file or an unique gadget id which is instantiated through OSGi factory services.' WHERE AD_Element_ID=53710
+;
+
+-- Oct 4, 2013 2:48:56 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_Process_Para SET ColumnName='ZulFilePath', Name='Gadget URI', Description='URI for Dashboard Gadget', Help='URI for Dashboard Gadget. This can be absolute path to a zul file or an unique gadget id which is instantiated through OSGi factory services.', AD_Element_ID=53710 WHERE UPPER(ColumnName)='ZULFILEPATH' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
+;
+
+-- Oct 4, 2013 2:48:56 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_Process_Para SET ColumnName='ZulFilePath', Name='Gadget URI', Description='URI for Dashboard Gadget', Help='URI for Dashboard Gadget. This can be absolute path to a zul file or an unique gadget id which is instantiated through OSGi factory services.' WHERE AD_Element_ID=53710 AND IsCentrallyMaintained='Y'
+;
+
+-- Oct 4, 2013 2:48:56 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_InfoColumn SET ColumnName='ZulFilePath', Name='Gadget URI', Description='URI for Dashboard Gadget', Help='URI for Dashboard Gadget. This can be absolute path to a zul file or an unique gadget id which is instantiated through OSGi factory services.' WHERE AD_Element_ID=53710 AND IsCentrallyMaintained='Y'
+;
+
+-- Oct 4, 2013 2:48:56 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_Field SET Name='Gadget URI', Description='URI for Dashboard Gadget', Help='URI for Dashboard Gadget. This can be absolute path to a zul file or an unique gadget id which is instantiated through OSGi factory services.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=53710) AND IsCentrallyMaintained='Y'
+;
+
+-- Oct 4, 2013 2:48:56 PM MYT
+-- IDEMPIERE-1196 Create a service to manage Home Widgets.
+UPDATE AD_PrintFormatItem SET PrintName='Gadget URI', Name='Gadget URI' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=53710)
+;
+
+SELECT register_migration_script('201310040650_IDEMPIERE-1196.sql') FROM dual
+;
+
diff --git a/org.adempiere.ui.zk/META-INF/MANIFEST.MF b/org.adempiere.ui.zk/META-INF/MANIFEST.MF
index db3edefd22..c0fa3f75e2 100644
--- a/org.adempiere.ui.zk/META-INF/MANIFEST.MF
+++ b/org.adempiere.ui.zk/META-INF/MANIFEST.MF
@@ -85,4 +85,4 @@ Bundle-Activator: org.adempiere.webui.WebUIActivator
Eclipse-ExtensibleAPI: true
Eclipse-RegisterBuddy: org.zkoss.zk.library
Web-ContextPath: webui
-Service-Component: OSGI-INF/reportviewerprovider.xml, OSGI-INF/defaultinfofactory.xml, OSGI-INF/defaulteditorfactory.xml, OSGI-INF/jrviewerprovider.xml, OSGI-INF/resourcefinder.xml, OSGI-INF/defaultpaymentformfactory.xml, OSGI-INF/processfactory.xml, OSGI-INF/defaultprintshippinglabel.xml, OSGI-INF/defaultcreatefromfactory.xml, OSGI-INF/defaultformfactory.xml, OSGI-INF/feedbackservice.xml
+Service-Component: OSGI-INF/reportviewerprovider.xml, OSGI-INF/defaultinfofactory.xml, OSGI-INF/defaulteditorfactory.xml, OSGI-INF/jrviewerprovider.xml, OSGI-INF/resourcefinder.xml, OSGI-INF/defaultpaymentformfactory.xml, OSGI-INF/processfactory.xml, OSGI-INF/defaultprintshippinglabel.xml, OSGI-INF/defaultcreatefromfactory.xml, OSGI-INF/defaultformfactory.xml, OSGI-INF/feedbackservice.xml, OSGI-INF/zulgadgetfactory.xml
diff --git a/org.adempiere.ui.zk/OSGI-INF/zulgadgetfactory.xml b/org.adempiere.ui.zk/OSGI-INF/zulgadgetfactory.xml
new file mode 100644
index 0000000000..20636fbcbd
--- /dev/null
+++ b/org.adempiere.ui.zk/OSGI-INF/zulgadgetfactory.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java
index 31543d8d3e..4e7375ae7c 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java
@@ -26,6 +26,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.logging.Level;
+import org.adempiere.base.Service;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.apps.graph.WGraph;
@@ -33,6 +34,7 @@ import org.adempiere.webui.apps.graph.WPerformanceDetail;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.dashboard.DashboardPanel;
import org.adempiere.webui.dashboard.DashboardRunnable;
+import org.adempiere.webui.factory.IDashboardGadgetFactory;
import org.adempiere.webui.report.HTMLExtension;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ThemeManager;
@@ -66,6 +68,7 @@ import org.zkoss.zk.ui.event.MaximizeEvent;
import org.zkoss.zul.Anchorchildren;
import org.zkoss.zul.Anchorlayout;
import org.zkoss.zul.Caption;
+import org.zkoss.zul.Div;
import org.zkoss.zul.Html;
import org.zkoss.zul.Iframe;
import org.zkoss.zul.Include;
@@ -249,12 +252,14 @@ public class DashboardController implements EventListener {
if(AD_Window_ID > 0)
{
int AD_Menu_ID = dc.getAD_Menu_ID();
+ Div div = new Div();
ToolBarButton btn = new ToolBarButton(String.valueOf(AD_Menu_ID));
I_AD_Menu menu = dc.getAD_Menu();
btn.setLabel(menu.getName());
btn.setAttribute("AD_Menu_ID", AD_Menu_ID);
btn.addEventListener(Events.ON_CLICK, this);
- content.appendChild(btn);
+ div.appendChild(btn);
+ content.appendChild(div);
panelEmpty = false;
}
@@ -300,6 +305,7 @@ public class DashboardController implements EventListener {
if(PA_Goal_ID > 0)
{
//link to open performance detail
+ Div div = new Div();
Toolbarbutton link = new Toolbarbutton();
link.setImage(ThemeManager.getThemeResource("images/Zoom16.png"));
link.setAttribute("PA_Goal_ID", PA_Goal_ID);
@@ -310,7 +316,8 @@ public class DashboardController implements EventListener {
new WPerformanceDetail(goal);
}
});
- content.appendChild(link);
+ div.appendChild(link);
+ content.appendChild(div);
String goalDisplay = dc.getGoalDisplay();
MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null);
@@ -326,8 +333,16 @@ public class DashboardController implements EventListener {
if(url != null)
{
try {
- Component component = Executions.createComponents(url, content, null);
- if(component != null)
+
+ Component component = null;
+ List f = Service.locator().list(IDashboardGadgetFactory.class).getServices();
+ for (IDashboardGadgetFactory factory : f) {
+ component = factory.getGadget(url.toString(),content);
+ if(component != null)
+ break;
+ }
+
+ if(component != null)
{
if (component instanceof Include)
component = component.getFirstChild();
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/IDashboardGadgetFactory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/IDashboardGadgetFactory.java
new file mode 100644
index 0000000000..beeb06bc55
--- /dev/null
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/IDashboardGadgetFactory.java
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * Copyright (C) 2013 Antonio Cañaveral *
+ * Copyright (C) 2013 Trek Global *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms version 2 of the GNU General Public License as published *
+ * by the Free Software Foundation. This program is distributed in the hope *
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
+ * See the GNU General Public License for more details. *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
+ *****************************************************************************/
+package org.adempiere.webui.factory;
+
+import org.zkoss.zk.ui.Component;
+
+/**
+ * @author Antonio Cañaveral
+ * @author hengsin
+ *
+ */
+public interface IDashboardGadgetFactory {
+ /**
+ *
+ * @param uri
+ * @param parent
+ * @return Component instance of DashboardPanel or null
+ */
+ public Component getGadget(String uri, Component parent);
+}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/ZulDashboardGadgetFactory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/ZulDashboardGadgetFactory.java
new file mode 100644
index 0000000000..00a84b655d
--- /dev/null
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/ZulDashboardGadgetFactory.java
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * Copyright (C) 2013 Antonio Cañaveral *
+ * Copyright (C) 2013 Trek Global *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms version 2 of the GNU General Public License as published *
+ * by the Free Software Foundation. This program is distributed in the hope *
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
+ * See the GNU General Public License for more details. *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
+ *****************************************************************************/
+package org.adempiere.webui.factory;
+
+import java.net.URL;
+
+import org.adempiere.base.Core;
+import org.adempiere.base.IResourceFinder;
+import org.zkoss.zk.ui.Component;
+import org.zkoss.zk.ui.Executions;
+
+/**
+ *
+ * @author Antonio Cañaveral
+ * @author hengsin
+ *
+ */
+public class ZulDashboardGadgetFactory implements IDashboardGadgetFactory {
+ @Override
+ public Component getGadget(String uri, Component parent) {
+ 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 null;
+ }
+}
\ No newline at end of file