diff --git a/org.adempiere.ui.zk/OSGI-INF/org.adempiere.webui.factory.MappedFormFactory.xml b/org.adempiere.ui.zk/OSGI-INF/org.adempiere.webui.factory.MappedFormFactory.xml new file mode 100644 index 0000000000..647b968b22 --- /dev/null +++ b/org.adempiere.ui.zk/OSGI-INF/org.adempiere.webui.factory.MappedFormFactory.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/Extensions.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/Extensions.java index 8b6512d282..e6d0331ea6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/Extensions.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/Extensions.java @@ -31,6 +31,7 @@ import org.adempiere.webui.apps.IProcessParameterListener; import org.adempiere.webui.apps.graph.IChartRendererService; import org.adempiere.webui.factory.IDashboardGadgetFactory; import org.adempiere.webui.factory.IFormFactory; +import org.adempiere.webui.factory.IMappedFormFactory; import org.adempiere.webui.panel.ADForm; import org.compiere.grid.ICreateFrom; import org.compiere.grid.ICreateFromFactory; @@ -219,5 +220,27 @@ public class Extensions { */ public static final List getChartRendererServices() { return Service.locator().list(IChartRendererService.class).getServices(); - } + } + + private static IServiceReferenceHolder s_mappedFormFactoryReference = null; + + /** + * + * @return {@link IMappedFormFactory} + */ + public static IMappedFormFactory getMappedFormFactory(){ + IMappedFormFactory formFactoryService = null; + if (s_mappedFormFactoryReference != null) { + formFactoryService = s_mappedFormFactoryReference.getService(); + if (formFactoryService != null) + return formFactoryService; + } + IServiceReferenceHolder serviceReference = Service.locator().locate(IMappedFormFactory.class).getServiceReference(); + if (serviceReference != null) { + formFactoryService = serviceReference.getService(); + s_mappedFormFactoryReference = serviceReference; + } + return formFactoryService; + } + } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/IMappedFormFactory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/IMappedFormFactory.java new file mode 100644 index 0000000000..b7a4f508f8 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/IMappedFormFactory.java @@ -0,0 +1,36 @@ +/*********************************************************************** + * This file is part of iDempiere ERP Open Source * + * http://www.idempiere.org * + * * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * 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., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - matheus.marcelino * + **********************************************************************/ +package org.adempiere.webui.factory; + +import org.adempiere.base.IMappedByNameFactory; +import org.adempiere.webui.panel.ADForm; + +/** + * + * @author matheus.marcelino + * + */ +public interface IMappedFormFactory extends IMappedByNameFactory { +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/MappedFormFactory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/MappedFormFactory.java new file mode 100644 index 0000000000..141be68b11 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/MappedFormFactory.java @@ -0,0 +1,51 @@ +/*********************************************************************** + * This file is part of iDempiere ERP Open Source * + * http://www.idempiere.org * + * * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * 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., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - matheus.marcelino * + **********************************************************************/ + +package org.adempiere.webui.factory; + +/** + * + * @author matheus.marcelino + * + */ +import org.adempiere.base.MappedByNameFactory; +import org.adempiere.webui.panel.ADForm; +import org.osgi.service.component.annotations.Component; + +@Component(name = "org.adempiere.webui.factory.MappedFormFactory", +immediate = true, +service = {IFormFactory.class, IMappedFormFactory.class}, +property = {"service.ranking:Integer=1"}) +public class MappedFormFactory extends MappedByNameFactory implements IFormFactory, IMappedFormFactory { + + public MappedFormFactory() { + } + + @Override + public ADForm newFormInstance(String formName) { + return newInstance(formName); + } + +}