Extension Point FormPanel

Some fixes on 2pack integration

https://sourceforge.net/tracker/?func=detail&aid=2700937&group_id=176962&atid=879334
This commit is contained in:
joergviola 2010-03-17 19:48:19 +00:00
parent 0798948086
commit e92f647b61
13 changed files with 215 additions and 10 deletions

View File

@ -4,5 +4,6 @@
<extension-point id="org.adempiere.base.IResourceFinder" name="ResourceFinder" schema="schema/ResourceFinder.exsd"/>
<extension-point id="org.adempiere.base.IColumnCallout" name="Callout" schema="schema/org.adempiere.base.Callout.exsd"/>
<extension-point id="org.adempiere.base.IDictionaryService" name="DictionaryService" schema="schema/org.adempiere.base.IDictionaryService.exsd"/>
<extension-point id="org.compiere.apps.form.FormPanel" name="FormPanel" schema="schema/org.compiere.apps.form.FormPanel.exsd"/>
</plugin>

View File

@ -0,0 +1,102 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.adempiere.base" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.adempiere.base" id="org.compiere.apps.form.FormPanel" name="FormPanel"/>
</appinfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<choice>
<element ref="client"/>
</choice>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="client">
<complexType>
<attribute name="class" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.compiere.apps.form.FormPanel"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@ -11,6 +11,8 @@ import java.util.List;
*/
public class Core {
public static final String OSGI_PREFIX = "osgi://";
public static IResourceFinder getResourceFinder() {
return new IResourceFinder() {
@ -34,5 +36,9 @@ public class Core {
return Service.list(IColumnCallout.class, query);
}
public static boolean isExtension(String className) {
return className.startsWith(OSGI_PREFIX);
}
}

View File

@ -1,12 +1,35 @@
package org.adempiere.client;
import org.compiere.util.CLogger;
import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
public class Activator extends Plugin {
private static final String ADMEPIERE_PREFIX = "org.adempiere";
private static CLogger log = CLogger.getCLogger(Activator.class);
@Override
public void start(BundleContext context) throws Exception {
System.out.println("Starting client");
log.info("Starting client");
org.compiere.AdempiereClient.main(new String[]{});
activateAll(context.getBundles());
}
private void activateAll(Bundle[] bundles) {
for (Bundle bundle : bundles) {
if (shouldStart(bundle))
try {
bundle.start();
log.info("Started "+bundle.getSymbolicName());
} catch (BundleException e) {
log.warning("Could not start "+bundle.getSymbolicName());
}
}
}
private boolean shouldStart(Bundle bundle) {
return bundle.getSymbolicName().startsWith(ADMEPIERE_PREFIX);
}
}

View File

@ -0,0 +1,18 @@
package org.adempiere.client;
import org.adempiere.base.Core;
import org.adempiere.base.Service;
import org.adempiere.base.ServiceQuery;
import org.compiere.apps.form.FormPanel;
public class Client {
public static FormPanel getFormPanel(String className) {
if (Core.isExtension(className))
className = className.substring(Core.OSGI_PREFIX.length());
ServiceQuery query = new ServiceQuery();
query.put("class", className);
return Service.locate(FormPanel.class, query );
}
}

View File

@ -32,6 +32,8 @@ import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.KeyStroke;
import org.adempiere.base.Core;
import org.adempiere.client.Client;
import org.compiere.apps.AEnv;
import org.compiere.apps.AGlassPane;
import org.compiere.apps.AMenu;
@ -303,7 +305,10 @@ public class FormFrame extends CFrame
try
{
// Create instance w/o parameters
m_panel = (FormPanel)Class.forName(className).newInstance();
if (Core.isExtension(className))
m_panel = Client.getFormPanel(className);
else
m_panel = (FormPanel)Class.forName(className).newInstance();
}
catch (Exception e)
{

View File

@ -16,13 +16,15 @@
*****************************************************************************/
package org.compiere.apps.form;
import org.adempiere.base.IService;
/**
* Form Panel Interface.
* for communicating between FormFrame and JPanel
* @author Jorg Janke
* @version $Id: FormPanel.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $
*/
public interface FormPanel
public interface FormPanel extends IService
{
/**
* Initialize Panel

View File

@ -8,3 +8,6 @@ Import-Package: org.adempiere.base,
org.adempiere.pipo,
org.compiere,
org.compiere.util
Export-Package: org.adempiere.pipo.srv
Require-Bundle: org.adempiere.base;bundle-version="0.0.0",
org.adempiere.tools;bundle-version="0.0.0"

View File

@ -4,7 +4,7 @@
<extension
point="org.adempiere.base.IDictionaryService">
<client
class="org.adempiere.pipo.PipoDictionaryService">
class="org.adempiere.pipo.srv.PipoDictionaryService">
</client>
</extension>

View File

@ -1,4 +1,4 @@
package org.adempiere.pipo;
package org.adempiere.pipo.srv;
import java.io.File;
import java.io.InputStream;
@ -9,6 +9,8 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.adempiere.base.IDictionaryService;
import org.adempiere.pipo.PackIn;
import org.adempiere.pipo.PackInHandler;
import org.compiere.Adempiere;
import org.compiere.util.DB;
import org.compiere.util.Trx;

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="lib/xercesImpl.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jstl.jar"/>
<classpathentry exported="true" kind="lib" path="lib/Verisign.jar"/>
<classpathentry exported="true" kind="lib" path="lib/standard.jar"/>

View File

@ -50,9 +50,11 @@ Bundle-ClassPath: tools.jar,
lib/ojdbc14.jar,
lib/postgresql.jar,
lib/wizard.jar,
lib/xercesImpl.jar,
lib/xjavadoc-1.1.jar,
lib/xml-apis.jar
lib/xml-apis.jar,
lib/cron4j-2.2.1.jar,
lib/payflow.jar,
lib/xercesImpl.jar
Export-Package: Lib,
Lib.email,
Lib.encodings,
@ -707,6 +709,7 @@ Export-Package: Lib,
org.apache.ecs.storage,
org.apache.ecs.xhtml;uses:="org.apache.ecs",
org.apache.ecs.xml;uses:="org.apache.ecs",
org.apache.html.dom,
org.apache.log4j;uses:="org.apache.log4j.or,org.apache.log4j.spi,org.apache.log4j.helpers",
org.apache.log4j.chainsaw;
uses:="javax.swing.event,
@ -863,6 +866,42 @@ Export-Package: Lib,
org.apache.taglibs.standard.tag.rt.xml;uses:="org.xml.sax,org.apache.taglibs.standard.tag.common.xml,javax.xml.transform",
org.apache.taglibs.standard.tei;uses:="javax.servlet.jsp.tagext",
org.apache.taglibs.standard.tlv;uses:="org.xml.sax,javax.servlet.jsp.tagext,org.xml.sax.helpers",
org.apache.wml,
org.apache.wml.dom,
org.apache.xerces.dom,
org.apache.xerces.dom.events,
org.apache.xerces.dom3.as,
org.apache.xerces.impl,
org.apache.xerces.impl.dtd,
org.apache.xerces.impl.dtd.models,
org.apache.xerces.impl.dv,
org.apache.xerces.impl.dv.dtd,
org.apache.xerces.impl.dv.util,
org.apache.xerces.impl.dv.xs,
org.apache.xerces.impl.io,
org.apache.xerces.impl.msg,
org.apache.xerces.impl.validation,
org.apache.xerces.impl.xpath,
org.apache.xerces.impl.xpath.regex,
org.apache.xerces.impl.xs,
org.apache.xerces.impl.xs.identity,
org.apache.xerces.impl.xs.models,
org.apache.xerces.impl.xs.opti,
org.apache.xerces.impl.xs.traversers,
org.apache.xerces.impl.xs.util,
org.apache.xerces.jaxp,
org.apache.xerces.jaxp.datatype,
org.apache.xerces.jaxp.validation,
org.apache.xerces.parsers,
org.apache.xerces.util,
org.apache.xerces.xinclude,
org.apache.xerces.xni,
org.apache.xerces.xni.grammars,
org.apache.xerces.xni.parser,
org.apache.xerces.xpointer,
org.apache.xerces.xs,
org.apache.xerces.xs.datatypes,
org.apache.xml.serialize,
org.codehaus.groovy,
org.codehaus.groovy.ant;
uses:="groovyjarjarasm.asm.tree,
@ -1431,4 +1470,5 @@ Export-Package: Lib,
org.apache.tools.ant.taskdefs,
org.apache.tools.ant.types,
org.python.core,
jline"
jline",
org.w3c.dom.html

View File

@ -47,6 +47,8 @@ bin.includes = META-INF/,\
lib/ojdbc14.jar,\
lib/postgresql.jar,\
lib/wizard.jar,\
lib/xercesImpl.jar,\
lib/xjavadoc-1.1.jar,\
lib/xml-apis.jar
lib/xml-apis.jar,\
lib/cron4j-2.2.1.jar,\
lib/payflow.jar,\
lib/xercesImpl.jar