IDEMPIERE-4773 (#688)
* COF #10327 IDEMPIERE-4773 - add form factory base class backed by map and lambda functional object Remove unnecessary white space only changes and fix wrong component name Co-authored-by: muriloht <muriloht@devcoffee.com.br> Co-authored-by: matheus.marcelino <matheus.marcelino@devcoffee.com.br>
This commit is contained in:
parent
61f9a5cf82
commit
da96ecdc19
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.adempiere.webui.factory.MappedFormFactory">
|
||||
<property name="service.ranking" type="Integer" value="1"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.webui.factory.IFormFactory"/>
|
||||
<provide interface="org.adempiere.webui.factory.IMappedFormFactory"/>
|
||||
</service>
|
||||
<implementation class="org.adempiere.webui.factory.MappedFormFactory"/>
|
||||
</scr:component>
|
|
@ -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;
|
||||
|
@ -220,4 +221,26 @@ public class Extensions {
|
|||
public static final List<IChartRendererService> getChartRendererServices() {
|
||||
return Service.locator().list(IChartRendererService.class).getServices();
|
||||
}
|
||||
|
||||
private static IServiceReferenceHolder<IMappedFormFactory> 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<IMappedFormFactory> serviceReference = Service.locator().locate(IMappedFormFactory.class).getServiceReference();
|
||||
if (serviceReference != null) {
|
||||
formFactoryService = serviceReference.getService();
|
||||
s_mappedFormFactoryReference = serviceReference;
|
||||
}
|
||||
return formFactoryService;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<ADForm> {
|
||||
}
|
|
@ -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<ADForm> implements IFormFactory, IMappedFormFactory {
|
||||
|
||||
public MappedFormFactory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ADForm newFormInstance(String formName) {
|
||||
return newInstance(formName);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue