1) http://kenai.com/jira/browse/HENGSIN-6, RUN_setup.sh failure
Use the static method getLogger instead of using a static logger variable. The logger is created as needed inside the getLogger method. 2)http://kenai.com/jira/browse/HENGSIN-3, properties file wrongly created Patch accepted. 3) http://kenai.com/jira/browse/HENGSIN-4, Cannot connect to http://localhost:8080/admin/adempiereMonitor Always set default level for root logger in CLogMgt initialization. 4) http://kenai.com/jira/browse/HENGSIN-5, Build fails by default requiring directory lib/plugins Modify utils_dev/build.xml to ensure the existence of the lib/plugins folder. 5) Module refactoring * Remove client bundle dependency from the zkwebui bundle. Common UI code of the 2 bundle is moved into the new uibase bundle. * Remove client bundle dependency from server side bundle. The swing specific jasper report code is moved into the new JasperReportsClient bundle. * Move most swing code that is still in the base bundle into the client bundle. Many swing client specific code in Env.java (base bundle) is move into the AEnv.java (client bundle). * Default handlers for 2Pack is moved into the new pipoHandlers bundle. All loading of 2pack handler is now done using the equinox extension mechanism. 6) Extension point * Added process, form and modelvalidator extension point base on the existing work done by Jorg Viola in the osgi1 branch. 7) The pipo bundle is move from plugins/pipo to /pipo ( relative to the workspace ) due to ant4eclipse have problem building the bundle using the previous layout. 8) New workflow editor and rendering implementation using netbeans visual library. The implementation is shared the by swing and zk client.
|
@ -9,7 +9,6 @@ Export-Package: org.compiere.interfaces,
|
|||
org.compiere.utils
|
||||
Require-Bundle: org.adempiere.base;bundle-version="1.0.0",
|
||||
org.adempiere.JasperReportsTools;bundle-version="1.0.0",
|
||||
org.adempiere.client;bundle-version="1.0.0",
|
||||
com.springsource.javax.ejb;bundle-version="3.0.0",
|
||||
org.adempiere.tools;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<target name="clean" description="delete class directory">
|
||||
<delete>
|
||||
<fileset dir="../lib">
|
||||
<include name="org.adempiere.JasperReports*.jar"/>
|
||||
<include name="org.adempiere.JasperReports_*.jar"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
|
|
@ -102,7 +102,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
|
|||
private static CLogger log = CLogger.getCLogger(ReportStarter.class);
|
||||
private static File REPORT_HOME = null;
|
||||
|
||||
private static JRViewerProvider viewerProvider = new SwingJRViewerProvider();
|
||||
private static JRViewerProvider viewerProvider = null;
|
||||
private static JasperPrint jasperPrint;
|
||||
|
||||
static {
|
||||
|
@ -492,7 +492,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
|
|||
if (!processInfo.isBatch()) {
|
||||
|
||||
// Get printer job
|
||||
PrinterJob printerJob = org.compiere.print.CPrinter.getPrinterJob(printerName);
|
||||
PrinterJob printerJob = PrintUtil.getPrinterJob(printerName);
|
||||
// Set print request attributes
|
||||
|
||||
// Paper Attributes:
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>JasperReportsClient</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,8 @@
|
|||
#Thu Aug 19 17:50:42 MYT 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -0,0 +1,4 @@
|
|||
#Thu Aug 19 17:50:42 MYT 2010
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
|
@ -0,0 +1,12 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: JasperReportsClient
|
||||
Bundle-SymbolicName: org.adempiere.apps.JasperReportsClient
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: org.adempiere.base;bundle-version="1.0.0",
|
||||
org.adempiere.client;bundle-version="1.0.0",
|
||||
org.adempiere.JasperReports;bundle-version="1.0.0",
|
||||
org.adempiere.JasperReportsTools;bundle-version="1.0.0",
|
||||
org.adempiere.tools;bundle-version="1.0.0"
|
||||
Import-Package: org.osgi.framework
|
|
@ -0,0 +1,4 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!-- ============================================= -->
|
||||
<!-- PIPO -->
|
||||
<!-- ============================================= -->
|
||||
|
||||
<project name="pipo" default="plugin" basedir=".">
|
||||
|
||||
<description>
|
||||
This buildfile is used to build the client subproject within
|
||||
the Adempiere project.
|
||||
</description>
|
||||
|
||||
<import file="../utils_dev/properties.xml"/>
|
||||
|
||||
<target name="init" description="initialization target">
|
||||
<echo message="=========== Build JasperReportsClient"/>
|
||||
</target>
|
||||
|
||||
<target name="plugin" depends="init">
|
||||
<buildPlugin workspaceDirectory="${workspace}"
|
||||
projectName="JasperReportsClient"
|
||||
targetPlatformId="target.platform"
|
||||
destination="../lib"
|
||||
buildSourceJar="false" />
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete>
|
||||
<fileset dir="../lib/plugins">
|
||||
<include name="org.adempiere.apps.JasperReportsClient_*.jar"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.compiere.report;
|
||||
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class JasperReportsClientActivator implements BundleActivator {
|
||||
|
||||
/**
|
||||
* default constructor
|
||||
*/
|
||||
public JasperReportsClientActivator() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(BundleContext arg0) throws Exception {
|
||||
ReportStarter.setReportViewerProvider(new SwingJRViewerProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext arg0) throws Exception {
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
<target name="clean" description="delete class directory">
|
||||
<delete>
|
||||
<fileset dir="../lib">
|
||||
<include name="org.adempiere.JasperReportsTools*.jar"/>
|
||||
<include name="org.adempiere.JasperReportsTools_*.jar"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<target name="clean" description="delete class directory">
|
||||
<delete>
|
||||
<fileset dir="../lib/plugins">
|
||||
<include name="org.adempiere.JasperReports.webapp*.jar"/>
|
||||
<include name="org.adempiere.JasperReports.webapp_*.jar"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="/tools"/>
|
||||
<classpathentry kind="src" path="/JasperReportsTools"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<accessrules>
|
||||
<accessrule kind="accessible" pattern="sun/awt/*"/>
|
||||
<accessrule kind="accessible" pattern="com/sun/rowset/*"/>
|
||||
<accessrule kind="accessible" pattern="com/sun/image/codec/**"/>
|
||||
</accessrules>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="build"/>
|
||||
|
|
|
@ -15,7 +15,6 @@ Export-Package: com.akunagroup.uk.postcode,
|
|||
org.adempiere.pipo,
|
||||
org.adempiere.pipo.exception,
|
||||
org.adempiere.pipo.handler,
|
||||
org.adempiere.plaf,
|
||||
org.adempiere.print.export,
|
||||
org.adempiere.process,
|
||||
org.adempiere.process.rpl,
|
||||
|
@ -31,14 +30,12 @@ Export-Package: com.akunagroup.uk.postcode,
|
|||
org.compiere.impexp,
|
||||
org.compiere.interfaces,
|
||||
org.compiere.model,
|
||||
org.compiere.plaf,
|
||||
org.compiere.print,
|
||||
org.compiere.print.layout,
|
||||
org.compiere.process,
|
||||
org.compiere.report,
|
||||
org.compiere.report.core,
|
||||
org.compiere.sla,
|
||||
org.compiere.swing,
|
||||
org.compiere.tools,
|
||||
org.compiere.util,
|
||||
org.compiere.wf
|
||||
|
@ -48,5 +45,6 @@ Require-Bundle: org.adempiere.tools;bundle-version="1.0.0",
|
|||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Eclipse-ExtensibleAPI: true
|
||||
Import-Package: net.sf.cglib.proxy,
|
||||
org.eclipse.core.runtime;version="3.4.0"
|
||||
org.eclipse.core.runtime;version="3.4.0",
|
||||
org.osgi.framework
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<target name="clean">
|
||||
<delete>
|
||||
<fileset dir="../lib/plugins">
|
||||
<include name="*base*.jar"/>
|
||||
<include name="org.adempiere.base_*.jar"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<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"/>
|
||||
<extension-point id="org.adempiere.as.IApplicationServer" name="ApplicationServer" schema="schema/org.adempiere.as.IApplicationServer.exsd"/>
|
||||
<extension-point id="org.adempiere.base.Process" name="Process" schema="schema/org.adempiere.base.Process.exsd"/>
|
||||
<extension-point id="org.adempiere.base.ModelValidator" name="Model Validator" schema="schema/org.adempiere.base.ModelValidator.exsd"/>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="client"/>
|
||||
<element ref="finder"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
|
@ -47,7 +47,7 @@
|
|||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="client">
|
||||
<element name="finder">
|
||||
<complexType>
|
||||
<attribute name="class" type="string">
|
||||
<annotation>
|
||||
|
|
|
@ -21,7 +21,7 @@ Instead, you specify Table and Column in the extension declaration.
|
|||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="client" minOccurs="1" maxOccurs="unbounded"/>
|
||||
<element ref="callout" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
|
@ -50,7 +50,7 @@ Instead, you specify Table and Column in the extension declaration.
|
|||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="client">
|
||||
<element name="callout">
|
||||
<complexType>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
|
|
|
@ -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.adempiere.base.ModelValidator" name="Model Validator"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="listener"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string" use="required">
|
||||
<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="listener">
|
||||
<complexType>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.compiere.model.ModelValidator"/>
|
||||
</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>
|
|
@ -3,7 +3,7 @@
|
|||
<schema targetNamespace="org.adempiere.base" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.base" id="org.adempiere.as.IApplicationServer" name="ApplicationServer"/>
|
||||
<meta.schema plugin="org.adempiere.base" id="org.adempiere.base.Process" name="Process"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
|
@ -18,7 +18,7 @@
|
|||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="client"/>
|
||||
<element ref="process"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
|
@ -27,7 +27,7 @@
|
|||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<attribute name="id" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
|
@ -47,15 +47,15 @@
|
|||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="client">
|
||||
<element name="process">
|
||||
<complexType>
|
||||
<attribute name="class" type="string">
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.adempiere.as.IApplicationServer"/>
|
||||
<meta.attribute kind="java" basedOn=":org.compiere.process.ProcessCall"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
|
@ -3,6 +3,9 @@ package org.adempiere.base;
|
|||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import org.compiere.model.ModelValidator;
|
||||
import org.compiere.process.ProcessCall;
|
||||
|
||||
/**
|
||||
* This is a facade class for the Service Locator.
|
||||
* It provides simple access to all core services.
|
||||
|
@ -11,7 +14,7 @@ import java.util.List;
|
|||
*/
|
||||
public class Core {
|
||||
|
||||
public static final String OSGI_PREFIX = "osgi://";
|
||||
public static final String OSGI_PREFIX = "osgi:";
|
||||
|
||||
public static IResourceFinder getResourceFinder() {
|
||||
return new IResourceFinder() {
|
||||
|
@ -40,5 +43,22 @@ public class Core {
|
|||
return className.startsWith(OSGI_PREFIX);
|
||||
}
|
||||
|
||||
public static ProcessCall getProcess(String className) {
|
||||
if (isExtension(className))
|
||||
className = className.substring(Core.OSGI_PREFIX.length());
|
||||
|
||||
ServiceQuery query = new ServiceQuery();
|
||||
query.put("id", className);
|
||||
return Service.locate(ProcessCall.class, "org.adempiere.base.Process", query);
|
||||
}
|
||||
|
||||
public static ModelValidator getModelValidator(String className) {
|
||||
if (isExtension(className))
|
||||
className = className.substring(Core.OSGI_PREFIX.length());
|
||||
|
||||
ServiceQuery query = new ServiceQuery();
|
||||
query.put("id", className);
|
||||
return Service.locate(ModelValidator.class, "org.adempiere.base.ModelValidator", query);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.compiere.model.GridTab;
|
|||
/**
|
||||
* Column Callout Interface
|
||||
*/
|
||||
public interface IColumnCallout extends IService
|
||||
public interface IColumnCallout
|
||||
{
|
||||
/**
|
||||
* Start Callout.
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.base;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.File;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
* A dictionary service provides for easy handling of dynamic Adempiere
|
||||
|
@ -24,6 +26,6 @@ import java.io.InputStream;
|
|||
* @author Joerg Viola
|
||||
*
|
||||
*/
|
||||
public interface IDictionaryService extends IService {
|
||||
void merge(InputStream model) throws Exception;
|
||||
public interface IDictionaryService {
|
||||
void merge(BundleContext context, File packageFile) throws Exception;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.adempiere.base;
|
|||
|
||||
import java.net.URL;
|
||||
|
||||
public interface IResourceFinder extends IService {
|
||||
public interface IResourceFinder {
|
||||
|
||||
URL getResource(String name);
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package org.adempiere.base;
|
||||
|
||||
public interface IService {
|
||||
|
||||
}
|
|
@ -29,12 +29,12 @@ import java.util.List;
|
|||
*
|
||||
*/
|
||||
public interface IServiceLocator {
|
||||
<T extends IService> T locate(Class<T> type);
|
||||
<T extends IService> T locate(Class<T> type, String id);
|
||||
<T extends IService> T locate(Class<T> type, ServiceQuery query);
|
||||
<T extends IService> T locate(Class<T> type, String id, ServiceQuery query);
|
||||
<T extends IService> List<T> list(Class<T> type);
|
||||
<T extends IService> List<T> list(Class<T> type, String id);
|
||||
<T extends IService> List<T> list(Class<T> type, ServiceQuery query);
|
||||
<T extends IService> List<T> list(Class<T> type, String id, ServiceQuery query);
|
||||
<T> T locate(Class<T> type);
|
||||
<T> T locate(Class<T> type, String extensionPointId);
|
||||
<T> T locate(Class<T> type, ServiceQuery query);
|
||||
<T> T locate(Class<T> type, String extensionPointId, ServiceQuery query);
|
||||
<T> List<T> list(Class<T> type);
|
||||
<T> List<T> list(Class<T> type, String extensionPointId);
|
||||
<T> List<T> list(Class<T> type, ServiceQuery query);
|
||||
<T> List<T> list(Class<T> type, String extensionPointId, ServiceQuery query);
|
||||
}
|
||||
|
|
|
@ -57,35 +57,35 @@ public class Service {
|
|||
}
|
||||
}
|
||||
|
||||
public static <T extends IService> T locate(Class<T> type) {
|
||||
public static <T> T locate(Class<T> type) {
|
||||
return locate(type, type.getName());
|
||||
}
|
||||
|
||||
public static <T extends IService> T locate(Class<T> type, String id) {
|
||||
public static <T> T locate(Class<T> type, String id) {
|
||||
return locator().locate(type, id);
|
||||
}
|
||||
|
||||
public static <T extends IService> T locate(Class<T> type, ServiceQuery query) {
|
||||
public static <T> T locate(Class<T> type, ServiceQuery query) {
|
||||
return locate(type, type.getName(), query);
|
||||
}
|
||||
|
||||
public static <T extends IService> T locate(Class<T> type, String id, ServiceQuery query) {
|
||||
public static <T> T locate(Class<T> type, String id, ServiceQuery query) {
|
||||
return locator().locate(type, id, query);
|
||||
}
|
||||
|
||||
public static <T extends IService> List<T> list(Class<T> type) {
|
||||
public static <T> List<T> list(Class<T> type) {
|
||||
return list(type, type.getName());
|
||||
}
|
||||
|
||||
public static <T extends IService> List<T> list(Class<T> type, String id) {
|
||||
public static <T> List<T> list(Class<T> type, String id) {
|
||||
return locator().list(type, id);
|
||||
}
|
||||
|
||||
public static <T extends IService> List<T> list(Class<T> type, ServiceQuery query) {
|
||||
public static <T> List<T> list(Class<T> type, ServiceQuery query) {
|
||||
return locator().list(type, type.getName(), query);
|
||||
}
|
||||
|
||||
public static <T extends IService> List<T> list(Class<T> type, String id, ServiceQuery query) {
|
||||
public static <T> List<T> list(Class<T> type, String id, ServiceQuery query) {
|
||||
return locator().list(type, id, query);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.adempiere.base.equinox;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.adempiere.base.IService;
|
||||
import org.adempiere.base.IServiceLocator;
|
||||
import org.adempiere.base.ServiceQuery;
|
||||
|
||||
|
@ -33,44 +32,44 @@ import org.adempiere.base.ServiceQuery;
|
|||
*/
|
||||
public class EquinoxServiceLocator implements IServiceLocator {
|
||||
|
||||
public <T extends IService> List<T> list(Class<T> type) {
|
||||
public <T> List<T> list(Class<T> type) {
|
||||
return list(type, type.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IService> List<T> list(Class<T> type, String id) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, id);
|
||||
public <T> List<T> list(Class<T> type, String extensionPointId) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, extensionPointId);
|
||||
return list.asList();
|
||||
}
|
||||
|
||||
public <T extends IService> List<T> list(Class<T> type, ServiceQuery query) {
|
||||
public <T> List<T> list(Class<T> type, ServiceQuery query) {
|
||||
return list(type, type.getName(), query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IService> List<T> list(Class<T> type, String id,
|
||||
public <T> List<T> list(Class<T> type, String extensionPointId,
|
||||
ServiceQuery query) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, id, query);
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, extensionPointId, query);
|
||||
return list.asList();
|
||||
}
|
||||
|
||||
public <T extends IService> T locate(Class<T> type) {
|
||||
public <T> T locate(Class<T> type) {
|
||||
return locate(type, type.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IService> T locate(Class<T> type, String id) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, id);
|
||||
public <T> T locate(Class<T> type, String extensionPointId) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, extensionPointId);
|
||||
return list.first();
|
||||
}
|
||||
|
||||
public <T extends IService> T locate(Class<T> type, ServiceQuery query) {
|
||||
public <T> T locate(Class<T> type, ServiceQuery query) {
|
||||
return locate(type, type.getName(), query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IService> T locate(Class<T> type, String id, ServiceQuery query) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, type.getName(), query);
|
||||
public <T> T locate(Class<T> type, String extensionPointId, ServiceQuery query) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, extensionPointId, query);
|
||||
return list.first();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,16 +86,16 @@ public class ExtensionList<T> implements Iterable<T>{
|
|||
private IConfigurationElement[] elements;
|
||||
private HashMap<String, String> filters = new HashMap<String, String>();
|
||||
|
||||
public ExtensionList(Class<T> clazz, String id) {
|
||||
public ExtensionList(Class<T> clazz, String extensionPointId) {
|
||||
try {
|
||||
elements = Platform.getExtensionRegistry().getConfigurationElementsFor(id);
|
||||
elements = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointId);
|
||||
} catch (Exception ex) {
|
||||
System.out.println(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public ExtensionList(Class<T> type, String name, ServiceQuery query) {
|
||||
this(type, name);
|
||||
public ExtensionList(Class<T> type, String extensionPointId, ServiceQuery query) {
|
||||
this(type, extensionPointId);
|
||||
for (String key : query.keySet()) {
|
||||
addFilter(key, query.get(key));
|
||||
}
|
||||
|
@ -105,8 +105,8 @@ public class ExtensionList<T> implements Iterable<T>{
|
|||
return new ExtensionIterator<T>();
|
||||
}
|
||||
|
||||
public void addFilter(String name, String value) {
|
||||
filters.put(name, value);
|
||||
public void addFilter(String attribute, String value) {
|
||||
filters.put(attribute, value);
|
||||
}
|
||||
|
||||
public T first() {
|
||||
|
|
|
@ -195,11 +195,16 @@ public class ModelInterfaceGenerator
|
|||
.append(" /** TableName=").append(tableName).append(" */\n")
|
||||
.append(" public static final String Table_Name = \"").append(tableName).append("\";\n")
|
||||
|
||||
.append(" /** AD_Table_ID=").append(AD_Table_ID).append(" */\n")
|
||||
.append(" public static final int Table_ID = MTable.getTable_ID(Table_Name);\n")
|
||||
.append(" /** AD_Table_ID=").append(AD_Table_ID).append(" */\n");
|
||||
|
||||
//MTable.getTable_ID unnecessary for official ID
|
||||
if (AD_Table_ID <= MTable.MAX_OFFICIAL_ID)
|
||||
start.append(" public static final int Table_ID = ").append(AD_Table_ID).append(";\n");
|
||||
else
|
||||
start.append(" public static final int Table_ID = MTable.getTable_ID(Table_Name);\n");
|
||||
|
||||
//.append(" protected KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);\n")
|
||||
.append(" KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);\n") // INFO - Should this be here???
|
||||
start.append(" KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);\n") // INFO - Should this be here???
|
||||
|
||||
.append(" /** AccessLevel = ").append(accessLevelInfo).append("\n")
|
||||
.append(" */\n")
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.logging.Level;
|
|||
|
||||
import javax.script.ScriptEngine;
|
||||
|
||||
import org.adempiere.base.Core;
|
||||
import org.compiere.model.MProcess;
|
||||
import org.compiere.model.MRule;
|
||||
import org.compiere.process.ProcessCall;
|
||||
|
@ -119,39 +120,46 @@ public final class ProcessUtil {
|
|||
if (proc.getJasperReport() != null)
|
||||
className = JASPER_STARTER_CLASS;
|
||||
}
|
||||
//Get Class
|
||||
Class<?> processClass = null;
|
||||
//use context classloader if available
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
if (classLoader == null)
|
||||
classLoader = ProcessUtil.class.getClassLoader();
|
||||
try
|
||||
{
|
||||
processClass = classLoader.loadClass(className);
|
||||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
log.log(Level.WARNING, className, ex);
|
||||
pi.setSummary ("ClassNotFound", true);
|
||||
return false;
|
||||
}
|
||||
|
||||
//Get Process
|
||||
ProcessCall process = null;
|
||||
try
|
||||
{
|
||||
process = (ProcessCall)processClass.newInstance();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.log(Level.WARNING, "Instance for " + className, ex);
|
||||
pi.setSummary ("InstanceError", true);
|
||||
return false;
|
||||
if (Core.isExtension(className)) {
|
||||
process = Core.getProcess(className);
|
||||
}
|
||||
|
||||
if (processClass == null) {
|
||||
pi.setSummary("No Instance for " + pi.getClassName(), true);
|
||||
return false;
|
||||
if (process == null) {
|
||||
//Get Class
|
||||
Class<?> processClass = null;
|
||||
//use context classloader if available
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
if (classLoader == null)
|
||||
classLoader = ProcessUtil.class.getClassLoader();
|
||||
try
|
||||
{
|
||||
processClass = classLoader.loadClass(className);
|
||||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
log.log(Level.WARNING, className, ex);
|
||||
pi.setSummary ("ClassNotFound", true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (processClass == null) {
|
||||
pi.setSummary("No Instance for " + pi.getClassName(), true);
|
||||
return false;
|
||||
}
|
||||
|
||||
//Get Process
|
||||
try
|
||||
{
|
||||
process = (ProcessCall)processClass.newInstance();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.log(Level.WARNING, "Instance for " + className, ex);
|
||||
pi.setSummary ("InstanceError", true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
boolean success = false;
|
||||
|
|
|
@ -112,14 +112,9 @@ public class CConnection implements Serializable, Cloneable
|
|||
if (s_cc == null)
|
||||
{
|
||||
if (cc == null) cc = new CConnection(apps_host);
|
||||
CConnectionDialog ccd = new CConnectionDialog (cc);
|
||||
s_cc = ccd.getConnection ();
|
||||
if (!s_cc.isDatabaseOK() && !ccd.isCancel()) {
|
||||
s_cc.testDatabase(true);
|
||||
}
|
||||
// set also in ALogin and Ctrl
|
||||
Ini.setProperty (Ini.P_CONNECTION, s_cc.toStringLong ());
|
||||
Ini.saveProperties (Ini.isClient ());
|
||||
s_cc = cc;
|
||||
Ini.setProperty(Ini.P_CONNECTION, cc.toStringLong());
|
||||
Ini.saveProperties(Ini.isClient());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1395,34 +1390,4 @@ public class CConnection implements Serializable, Cloneable
|
|||
c.m_info = info;
|
||||
return c;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Testing
|
||||
* @param args ignored
|
||||
*/
|
||||
public static void main (String[] args)
|
||||
{
|
||||
boolean server = true;
|
||||
if (args.length == 0)
|
||||
System.out.println("CConnection <server|client>");
|
||||
else
|
||||
server = "server".equals(args[0]);
|
||||
System.out.println("CConnection - " + (server ? "server" : "client"));
|
||||
//
|
||||
if (server) {
|
||||
Adempiere.startup(false);
|
||||
} else {
|
||||
Adempiere.startup(true);
|
||||
}
|
||||
//
|
||||
System.out.println ("Connection = ");
|
||||
// CConnection[name=localhost{dev-dev1-adempiere},AppsHost=localhost,AppsPort=1099,type=Oracle,DBhost=dev,DBport=1521,DBname=dev1,BQ=false,FW=false,FWhost=,FWport=1630,UID=adempiere,PWD=adempiere]
|
||||
// System.out.println (Ini.getProperty (Ini.P_CONNECTION));
|
||||
|
||||
CConnection cc = CConnection.get ();
|
||||
// System.out.println (">> " + cc.toStringLong ());
|
||||
Connection con = cc.getConnection (false,
|
||||
Connection.TRANSACTION_READ_COMMITTED);
|
||||
new CConnectionDialog(cc);
|
||||
} // main
|
||||
} // CConnection
|
||||
|
|
|
@ -18,8 +18,6 @@ package org.compiere.model;
|
|||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.adempiere.base.IService;
|
||||
|
||||
/**
|
||||
* Callout Interface for Callout.
|
||||
* Used in MTab and ImpFormatRow
|
||||
|
|
|
@ -41,7 +41,6 @@ import org.apache.ecs.xhtml.table;
|
|||
import org.apache.ecs.xhtml.td;
|
||||
import org.apache.ecs.xhtml.th;
|
||||
import org.apache.ecs.xhtml.tr;
|
||||
import org.compiere.plaf.CompiereColor;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -267,14 +266,14 @@ public class GridWindow implements Serializable
|
|||
|
||||
/**
|
||||
* Get Color
|
||||
* @return AdempiereColor or null
|
||||
* @return MColor or null
|
||||
*/
|
||||
public CompiereColor getColor()
|
||||
public MColor getColor()
|
||||
{
|
||||
if (m_vo.AD_Color_ID == 0)
|
||||
return null;
|
||||
MColor mc = new MColor(m_vo.ctx, m_vo.AD_Color_ID, null);
|
||||
return mc.getAdempiereColor();
|
||||
return mc;
|
||||
} // getColor
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,13 +17,9 @@
|
|||
package org.compiere.model;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.plaf.CompiereColor;
|
||||
|
||||
/**
|
||||
* Color Persistent Object Model
|
||||
|
@ -95,62 +91,12 @@ public class MColor extends X_AD_Color
|
|||
return value.toString();
|
||||
} // saveNewSpecial
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Get AdempiereColor.
|
||||
* see org.compiere.grid.ed.VColor#getAdempiereColor
|
||||
* @return AdempiereColor
|
||||
*/
|
||||
public CompiereColor getAdempiereColor()
|
||||
{
|
||||
if (get_ID() == 0)
|
||||
return null;
|
||||
|
||||
// Color Type
|
||||
String ColorType = (String)getColorType();
|
||||
if (ColorType == null)
|
||||
{
|
||||
log.log(Level.SEVERE, "MColor.getAdempiereColor - No ColorType");
|
||||
return null;
|
||||
}
|
||||
CompiereColor cc = null;
|
||||
//
|
||||
if (ColorType.equals(CompiereColor.TYPE_FLAT))
|
||||
{
|
||||
cc = new CompiereColor(getColor(true), true);
|
||||
}
|
||||
else if (ColorType.equals(CompiereColor.TYPE_GRADIENT))
|
||||
{
|
||||
int RepeatDistance = getRepeatDistance();
|
||||
String StartPoint = getStartPoint();
|
||||
int startPoint = StartPoint == null ? 0 : Integer.parseInt(StartPoint);
|
||||
cc = new CompiereColor(getColor(true), getColor(false), startPoint, RepeatDistance);
|
||||
}
|
||||
else if (ColorType.equals(CompiereColor.TYPE_LINES))
|
||||
{
|
||||
int LineWidth = getLineWidth();
|
||||
int LineDistance = getLineDistance();
|
||||
cc = new CompiereColor(getColor(false), getColor(true), LineWidth, LineDistance);
|
||||
}
|
||||
else if (ColorType.equals(CompiereColor.TYPE_TEXTURE))
|
||||
{
|
||||
int AD_Image_ID = getAD_Image_ID();
|
||||
String url = getURL(AD_Image_ID);
|
||||
if (url == null)
|
||||
return null;
|
||||
BigDecimal ImageAlpha = getImageAlpha();
|
||||
float compositeAlpha = ImageAlpha == null ? 0.7f : ImageAlpha.floatValue();
|
||||
cc = new CompiereColor(url, getColor(true), compositeAlpha);
|
||||
}
|
||||
return cc;
|
||||
} // getAdempiereColor
|
||||
|
||||
/**
|
||||
* Get Color
|
||||
* @param primary true if primary false if secondary
|
||||
* @return Color
|
||||
*/
|
||||
private Color getColor (boolean primary)
|
||||
public Color getColor (boolean primary)
|
||||
{
|
||||
int red = primary ? getRed() : getRed_1();
|
||||
int green = primary ? getGreen() : getGreen_1();
|
||||
|
@ -164,7 +110,7 @@ public class MColor extends X_AD_Color
|
|||
* @param AD_Image_ID image
|
||||
* @return URL as String or null
|
||||
*/
|
||||
private String getURL (int AD_Image_ID)
|
||||
public String getURL (int AD_Image_ID)
|
||||
{
|
||||
if (AD_Image_ID == 0)
|
||||
return null;
|
||||
|
|
|
@ -694,7 +694,8 @@ public final class MLookup extends Lookup implements Serializable
|
|||
// Bug 1843862 - Lookups not working on Report Viewer window
|
||||
// globalqss - when called from Viewer window ignore error about unparsabe context variables
|
||||
// there is no context in report viewer windows
|
||||
if (Ini.isClient() == false || !Env.getWindow(m_info.WindowNo).getClass().getName().equals("org.compiere.print.Viewer")) {
|
||||
//TODO: need different approach that is not client dependent
|
||||
if (Ini.isClient() == false /*|| !Env.getWindow(m_info.WindowNo).getClass().getName().equals("org.compiere.print.Viewer")*/) {
|
||||
m_lookup.clear();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,8 @@ public class MTable extends X_AD_Table
|
|||
*/
|
||||
private static final long serialVersionUID = -2367316254623142732L;
|
||||
|
||||
public final static int MAX_OFFICIAL_ID = 999999;
|
||||
|
||||
/**
|
||||
* Get Table from Cache
|
||||
* @param ctx context
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.logging.Level;
|
|||
|
||||
import javax.script.ScriptEngine;
|
||||
|
||||
import org.adempiere.base.Core;
|
||||
import org.adempiere.model.ImportValidator;
|
||||
import org.adempiere.process.ImportProcess;
|
||||
import org.compiere.acct.Fact;
|
||||
|
@ -144,8 +145,16 @@ public class ModelValidationEngine
|
|||
try
|
||||
{
|
||||
//
|
||||
Class<?> clazz = Class.forName(className);
|
||||
ModelValidator validator = (ModelValidator)clazz.newInstance();
|
||||
ModelValidator validator = null;
|
||||
if (Core.isExtension(className))
|
||||
{
|
||||
validator = Core.getModelValidator(className);
|
||||
}
|
||||
if (validator == null)
|
||||
{
|
||||
Class<?> clazz = Class.forName(className);
|
||||
validator = (ModelValidator)clazz.newInstance();
|
||||
}
|
||||
initialize(validator, client);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package org.compiere.print;
|
||||
|
||||
public interface IReportEngineEventListener {
|
||||
|
||||
/**
|
||||
* @param event
|
||||
*/
|
||||
public void onPrintFormatChanged(ReportEngineEvent event);
|
||||
|
||||
/**
|
||||
* @param event
|
||||
*/
|
||||
public void onQueryChanged(ReportEngineEvent event);
|
||||
|
||||
/**
|
||||
* @param event
|
||||
*/
|
||||
public void onPageSetupChanged(ReportEngineEvent event);
|
||||
}
|
|
@ -43,6 +43,7 @@ import org.compiere.util.CLogMgt;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Ini;
|
||||
import org.compiere.util.Language;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
|
@ -77,6 +78,15 @@ public class PrintUtil
|
|||
return DocFlavor.SERVICE_FORMATTED.PAGEABLE;
|
||||
} // getDefaultFlavor
|
||||
|
||||
/**
|
||||
* Get Print Services for all flavor and pratt
|
||||
* @return print services
|
||||
*/
|
||||
public static PrintService[] getAllPrintServices()
|
||||
{
|
||||
return PrintServiceLookup.lookupPrintServices(null,null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Print Services for standard flavor and pratt
|
||||
* @return print services
|
||||
|
@ -96,6 +106,75 @@ public class PrintUtil
|
|||
} // getPrintServices
|
||||
|
||||
|
||||
/**
|
||||
* Return default PrinterJob
|
||||
* @return PrinterJob
|
||||
*/
|
||||
public static PrinterJob getPrinterJob()
|
||||
{
|
||||
return getPrinterJob(Ini.getProperty(Ini.P_PRINTER));
|
||||
} // getPrinterJob
|
||||
|
||||
/**
|
||||
* Return PrinterJob with selected printer name.
|
||||
* @param printerName if null, get default printer (Ini)
|
||||
* @return PrinterJob
|
||||
*/
|
||||
public static PrinterJob getPrinterJob (String printerName)
|
||||
{
|
||||
PrinterJob pj = null;
|
||||
PrintService ps = null;
|
||||
try
|
||||
{
|
||||
pj = PrinterJob.getPrinterJob();
|
||||
|
||||
// find printer service
|
||||
if (printerName == null || printerName.length() == 0)
|
||||
printerName = Ini.getProperty(Ini.P_PRINTER);
|
||||
if (printerName != null && printerName.length() != 0)
|
||||
{
|
||||
// System.out.println("CPrinter.getPrinterJob - searching " + printerName);
|
||||
PrintService[] services = getAllPrintServices();
|
||||
for (int i = 0; i < services.length; i++)
|
||||
{
|
||||
String serviceName = services[i].getName();
|
||||
if (printerName.equals(serviceName))
|
||||
{
|
||||
ps = services[i];
|
||||
// System.out.println("CPrinter.getPrinterJob - found " + printerName);
|
||||
break;
|
||||
}
|
||||
// System.out.println("CPrinter.getPrinterJob - not: " + serviceName);
|
||||
}
|
||||
} // find printer service
|
||||
|
||||
try
|
||||
{
|
||||
if (ps != null)
|
||||
pj.setPrintService(ps);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.warning("Could not set Print Service: " + e.toString());
|
||||
}
|
||||
//
|
||||
PrintService psUsed = pj.getPrintService();
|
||||
if (psUsed == null)
|
||||
log.warning("Print Service not Found");
|
||||
else
|
||||
{
|
||||
String serviceName = psUsed.getName();
|
||||
if (printerName != null && !printerName.equals(serviceName))
|
||||
log.warning("Not found: " + printerName + " - Used: " + serviceName);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.warning("Could not create for " + printerName + ": " + e.toString());
|
||||
}
|
||||
return pj;
|
||||
} // getPrinterJob
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
|
@ -115,7 +194,7 @@ public class PrintUtil
|
|||
if (jobName != null)
|
||||
name += jobName;
|
||||
//
|
||||
PrinterJob job = CPrinter.getPrinterJob(printerName);
|
||||
PrinterJob job = getPrinterJob(printerName);
|
||||
job.setJobName (name);
|
||||
job.setPageable (pageable);
|
||||
// Attributes
|
||||
|
@ -139,7 +218,7 @@ public class PrintUtil
|
|||
*/
|
||||
static public void print (Pageable pageable, PrintRequestAttributeSet prats)
|
||||
{
|
||||
PrinterJob job = CPrinter.getPrinterJob();
|
||||
PrinterJob job = getPrinterJob();
|
||||
job.setPageable(pageable);
|
||||
print (job, prats, true, false);
|
||||
} // print
|
||||
|
|
|
@ -31,6 +31,8 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
@ -156,8 +158,6 @@ public class ReportEngine implements PrintServiceAttributeListener
|
|||
private LayoutEngine m_layout = null;
|
||||
/** Printer */
|
||||
private String m_printerName = Ini.getProperty(Ini.P_PRINTER);
|
||||
/** View */
|
||||
private View m_view = null;
|
||||
/** Transaction Name */
|
||||
private String m_trxName = null;
|
||||
/** Where filter */
|
||||
|
@ -167,6 +167,18 @@ public class ReportEngine implements PrintServiceAttributeListener
|
|||
|
||||
private boolean m_summary = false;
|
||||
|
||||
private List<IReportEngineEventListener> eventListeners = new ArrayList<IReportEngineEventListener>();
|
||||
|
||||
public void addEventListener(IReportEngineEventListener listener)
|
||||
{
|
||||
eventListeners.add(listener);
|
||||
}
|
||||
|
||||
public boolean removeEventListener(IReportEngineEventListener listener)
|
||||
{
|
||||
return eventListeners.remove(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set PrintFormat.
|
||||
* If Layout was created, re-create layout
|
||||
|
@ -181,8 +193,12 @@ public class ReportEngine implements PrintServiceAttributeListener
|
|||
m_layout.setPrintFormat(pf, false);
|
||||
m_layout.setPrintData(m_printData, m_query, true); // format changes data
|
||||
}
|
||||
if (m_view != null)
|
||||
m_view.revalidate();
|
||||
|
||||
IReportEngineEventListener[] listeners = eventListeners.toArray(new IReportEngineEventListener[0]);
|
||||
for(IReportEngineEventListener listener : listeners)
|
||||
{
|
||||
listener.onPrintFormatChanged(new ReportEngineEvent(this));
|
||||
}
|
||||
} // setPrintFormat
|
||||
|
||||
/**
|
||||
|
@ -199,8 +215,12 @@ public class ReportEngine implements PrintServiceAttributeListener
|
|||
setPrintData();
|
||||
if (m_layout != null)
|
||||
m_layout.setPrintData(m_printData, m_query, true);
|
||||
if (m_view != null)
|
||||
m_view.revalidate();
|
||||
|
||||
IReportEngineEventListener[] listeners = eventListeners.toArray(new IReportEngineEventListener[0]);
|
||||
for(IReportEngineEventListener listener : listeners)
|
||||
{
|
||||
listener.onQueryChanged(new ReportEngineEvent(this));
|
||||
}
|
||||
} // setQuery
|
||||
|
||||
/**
|
||||
|
@ -329,20 +349,6 @@ public class ReportEngine implements PrintServiceAttributeListener
|
|||
} // getColumnCount
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Get View Panel
|
||||
* @return view panel
|
||||
*/
|
||||
public View getView()
|
||||
{
|
||||
if (m_layout == null)
|
||||
layout();
|
||||
if (m_view == null)
|
||||
m_view = new View (m_layout);
|
||||
return m_view;
|
||||
} // getView
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Print Report
|
||||
*/
|
||||
|
@ -434,8 +440,8 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
|||
private PrinterJob getPrinterJob (String printerName)
|
||||
{
|
||||
if (printerName != null && printerName.length() > 0)
|
||||
return CPrinter.getPrinterJob(printerName);
|
||||
return CPrinter.getPrinterJob(m_printerName);
|
||||
return PrintUtil.getPrinterJob(printerName);
|
||||
return PrintUtil.getPrinterJob(m_printerName);
|
||||
} // getPrinterJob
|
||||
|
||||
/**
|
||||
|
@ -447,8 +453,12 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
|||
if (m_layout == null)
|
||||
layout();
|
||||
m_layout.pageSetupDialog(getPrinterJob(m_printerName));
|
||||
if (m_view != null)
|
||||
m_view.revalidate();
|
||||
|
||||
IReportEngineEventListener[] listeners = eventListeners.toArray(new IReportEngineEventListener[0]);
|
||||
for(IReportEngineEventListener listener : listeners)
|
||||
{
|
||||
listener.onPageSetupChanged(new ReportEngineEvent(this));
|
||||
}
|
||||
} // pageSetupDialog
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package org.compiere.print;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
public class ReportEngineEvent extends EventObject {
|
||||
|
||||
/**
|
||||
* generated serial version Id
|
||||
*/
|
||||
private static final long serialVersionUID = 5414130140480852195L;
|
||||
|
||||
/**
|
||||
* @param source
|
||||
*/
|
||||
public ReportEngineEvent(ReportEngine source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return report engine
|
||||
*/
|
||||
public ReportEngine getReportEngine() {
|
||||
return (ReportEngine) getSource();
|
||||
}
|
||||
|
||||
}
|
|
@ -64,5 +64,4 @@ public interface ASyncProcess
|
|||
* @param pi ProcessInfo
|
||||
*/
|
||||
public void executeASync (ProcessInfo pi);
|
||||
|
||||
} // ASyncProcess
|
||||
|
|
|
@ -78,8 +78,8 @@ public class CLogMgt
|
|||
List<String>handlerNames = new ArrayList<String>();
|
||||
try
|
||||
{
|
||||
Logger rootLogger = Logger.getLogger(getRootLoggerName());
|
||||
rootLogger.setUseParentHandlers(false);
|
||||
Logger rootLogger = getRootLogger();
|
||||
|
||||
// System.out.println(rootLogger.getName() + " (" + rootLogger + ")");
|
||||
Handler[] handlers = rootLogger.getHandlers();
|
||||
for (int i = 0; i < handlers.length; i ++)
|
||||
|
@ -189,8 +189,7 @@ public class CLogMgt
|
|||
*/
|
||||
protected static Handler[] getHandlers()
|
||||
{
|
||||
Logger rootLogger = Logger.getLogger(getRootLoggerName());
|
||||
rootLogger.setUseParentHandlers(false);
|
||||
Logger rootLogger = getRootLogger();
|
||||
Handler[] handlers = rootLogger.getHandlers();
|
||||
return handlers;
|
||||
} // getHandlers
|
||||
|
@ -203,7 +202,7 @@ public class CLogMgt
|
|||
{
|
||||
if (handler == null)
|
||||
return;
|
||||
Logger rootLogger = Logger.getLogger(getRootLoggerName());
|
||||
Logger rootLogger = getRootLogger();
|
||||
rootLogger.addHandler(handler);
|
||||
//
|
||||
log.log(Level.CONFIG, "Handler=" + handler);
|
||||
|
@ -216,8 +215,7 @@ public class CLogMgt
|
|||
*/
|
||||
protected static void setFormatter (java.util.logging.Formatter formatter)
|
||||
{
|
||||
Logger rootLogger = Logger.getLogger(getRootLoggerName());
|
||||
rootLogger.setUseParentHandlers(false);
|
||||
Logger rootLogger = getRootLogger();
|
||||
Handler[] handlers = rootLogger.getHandlers();
|
||||
for (int i = 0; i < handlers.length; i++)
|
||||
{
|
||||
|
@ -232,8 +230,7 @@ public class CLogMgt
|
|||
*/
|
||||
protected static void setFilter (Filter filter)
|
||||
{
|
||||
Logger rootLogger = Logger.getLogger(getRootLoggerName());
|
||||
rootLogger.setUseParentHandlers(false);
|
||||
Logger rootLogger = getRootLogger();
|
||||
Handler[] handlers = rootLogger.getHandlers();
|
||||
for (int i = 0; i < handlers.length; i++)
|
||||
{
|
||||
|
@ -273,8 +270,7 @@ public class CLogMgt
|
|||
{
|
||||
if (level == null)
|
||||
return;
|
||||
Logger rootLogger = Logger.getLogger(getRootLoggerName());
|
||||
rootLogger.setUseParentHandlers(false);
|
||||
Logger rootLogger = getRootLogger();
|
||||
rootLogger.setLevel(level);
|
||||
Handler[] handlers = rootLogger.getHandlers();
|
||||
if (handlers == null || handlers.length == 0)
|
||||
|
@ -340,7 +336,7 @@ public class CLogMgt
|
|||
*/
|
||||
public static Level getLevel()
|
||||
{
|
||||
Logger rootLogger = Logger.getLogger(getRootLoggerName());
|
||||
Logger rootLogger = getRootLogger();
|
||||
return rootLogger.getLevel();
|
||||
} // getLevel
|
||||
|
||||
|
@ -350,7 +346,7 @@ public class CLogMgt
|
|||
*/
|
||||
public static int getLevelAsInt()
|
||||
{
|
||||
Logger rootLogger = Logger.getLogger(getRootLoggerName());
|
||||
Logger rootLogger = getRootLogger();
|
||||
return rootLogger.getLevel().intValue();
|
||||
} // getLevel
|
||||
|
||||
|
@ -417,8 +413,7 @@ public class CLogMgt
|
|||
*/
|
||||
public static void enable (boolean enableLogging)
|
||||
{
|
||||
Logger rootLogger = Logger.getLogger(getRootLoggerName());
|
||||
rootLogger.setUseParentHandlers(false);
|
||||
Logger rootLogger = getRootLogger();
|
||||
|
||||
if (enableLogging)
|
||||
setLevel(rootLogger.getLevel());
|
||||
|
@ -674,6 +669,21 @@ public class CLogMgt
|
|||
return "-no local host info -";
|
||||
} // getLocalHost
|
||||
|
||||
private static Logger getRootLogger()
|
||||
{
|
||||
Logger rootLogger = Logger.getLogger(getRootLoggerName());
|
||||
if (rootLogger.getUseParentHandlers())
|
||||
{
|
||||
rootLogger.setUseParentHandlers(false);
|
||||
}
|
||||
//set default level
|
||||
if (rootLogger.getLevel() == null)
|
||||
{
|
||||
rootLogger.setLevel(Level.WARNING);
|
||||
}
|
||||
|
||||
return rootLogger;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* CLogMgt
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.util;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
|
@ -33,29 +32,27 @@ import java.text.MessageFormat;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.RepaintManager;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.adempiere.base.Core;
|
||||
import org.adempiere.base.IResourceFinder;
|
||||
import org.adempiere.util.ServerContextProvider;
|
||||
import org.compiere.db.CConnection;
|
||||
import org.compiere.model.GridWindowVO;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MLookupCache;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MSession;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.swing.CFrame;
|
||||
|
||||
/**
|
||||
* System Environment and static variables.
|
||||
|
@ -72,6 +69,8 @@ public final class Env
|
|||
{
|
||||
private final static ContextProvider clientContextProvider = new DefaultContextProvider();
|
||||
|
||||
private static List<IEnvEventListener> eventListeners = new ArrayList<IEnvEventListener>();
|
||||
|
||||
/**
|
||||
* @param provider
|
||||
* @deprecated
|
||||
|
@ -80,6 +79,23 @@ public final class Env
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param listener
|
||||
*/
|
||||
public static void addEventListener(IEnvEventListener listener)
|
||||
{
|
||||
eventListeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param listener
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean removeEventListener(IEnvEventListener listener)
|
||||
{
|
||||
return eventListeners.remove(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit System
|
||||
* @param status System exit status (usually 0 for no error)
|
||||
|
@ -124,33 +140,10 @@ public final class Env
|
|||
*/
|
||||
public static void reset (boolean finalCall)
|
||||
{
|
||||
if (Ini.isClient())
|
||||
IEnvEventListener[] listeners = eventListeners.toArray(new IEnvEventListener[0]);
|
||||
for(IEnvEventListener listener : listeners)
|
||||
{
|
||||
closeWindows();
|
||||
|
||||
// Dismantle windows
|
||||
/**
|
||||
for (int i = 0; i < s_windows.size(); i++)
|
||||
{
|
||||
Container win = (Container)s_windows.get(i);
|
||||
if (win.getClass().getName().endsWith("AMenu")) // Null pointer
|
||||
;
|
||||
else if (win instanceof Window)
|
||||
((Window)win).dispose();
|
||||
else
|
||||
win.removeAll();
|
||||
}
|
||||
**/
|
||||
//bug [ 1574630 ]
|
||||
if (s_windows.size() > 0) {
|
||||
if (!finalCall) {
|
||||
Container c = s_windows.get(0);
|
||||
s_windows.clear();
|
||||
createWindowNo(c);
|
||||
} else {
|
||||
s_windows.clear();
|
||||
}
|
||||
}
|
||||
listener.onReset(finalCall);
|
||||
}
|
||||
|
||||
// Clear all Context
|
||||
|
@ -1179,8 +1172,11 @@ public final class Env
|
|||
MLookupCache.cacheReset(WindowNo);
|
||||
// MLocator.cacheReset(WindowNo);
|
||||
//
|
||||
if (Ini.isClient())
|
||||
removeWindow(WindowNo);
|
||||
IEnvEventListener[] listeners = eventListeners.toArray(new IEnvEventListener[0]);
|
||||
for(IEnvEventListener listener : listeners)
|
||||
{
|
||||
listener.onClearWindowContext(WindowNo);
|
||||
}
|
||||
} // clearWinContext
|
||||
|
||||
/**
|
||||
|
@ -1352,78 +1348,6 @@ public final class Env
|
|||
|
||||
/*************************************************************************/
|
||||
|
||||
// Array of active Windows
|
||||
private static ArrayList<Container> s_windows = new ArrayList<Container>(20);
|
||||
|
||||
/**
|
||||
* Add Container and return WindowNo.
|
||||
* The container is a APanel, AWindow or JFrame/JDialog
|
||||
* @param win window
|
||||
* @return WindowNo used for context
|
||||
*/
|
||||
public static int createWindowNo(Container win)
|
||||
{
|
||||
int retValue = s_windows.size();
|
||||
s_windows.add(win);
|
||||
return retValue;
|
||||
} // createWindowNo
|
||||
|
||||
/**
|
||||
* Search Window by comparing the Frames
|
||||
* @param container container
|
||||
* @return WindowNo of container or 0
|
||||
*/
|
||||
public static int getWindowNo (Container container)
|
||||
{
|
||||
if (container == null)
|
||||
return 0;
|
||||
JFrame winFrame = getFrame(container);
|
||||
if (winFrame == null)
|
||||
return 0;
|
||||
|
||||
// loop through windows
|
||||
for (int i = 0; i < s_windows.size(); i++)
|
||||
{
|
||||
Container cmp = (Container)s_windows.get(i);
|
||||
if (cmp != null)
|
||||
{
|
||||
JFrame cmpFrame = getFrame(cmp);
|
||||
if (winFrame.equals(cmpFrame))
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
} // getWindowNo
|
||||
|
||||
/**
|
||||
* Return the JFrame pointer of WindowNo - or null
|
||||
* @param WindowNo window
|
||||
* @return JFrame of WindowNo
|
||||
*/
|
||||
public static JFrame getWindow (int WindowNo)
|
||||
{
|
||||
JFrame retValue = null;
|
||||
try
|
||||
{
|
||||
retValue = getFrame ((Container)s_windows.get(WindowNo));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
getLogger().log(Level.SEVERE, e.toString());
|
||||
}
|
||||
return retValue;
|
||||
} // getWindow
|
||||
|
||||
/**
|
||||
* Remove window from active list
|
||||
* @param WindowNo window
|
||||
*/
|
||||
private static void removeWindow (int WindowNo)
|
||||
{
|
||||
if (WindowNo < s_windows.size())
|
||||
s_windows.set(WindowNo, null);
|
||||
} // removeWindow
|
||||
|
||||
/**
|
||||
* Clean up context for Window (i.e. delete it)
|
||||
* @param WindowNo window
|
||||
|
@ -1441,24 +1365,6 @@ public final class Env
|
|||
getCtx().clear();
|
||||
} // clearContext
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Get Frame of Window
|
||||
* @param container Container
|
||||
* @return JFrame of container or null
|
||||
*/
|
||||
public static JFrame getFrame (Container container)
|
||||
{
|
||||
Container element = container;
|
||||
while (element != null)
|
||||
{
|
||||
if (element instanceof JFrame)
|
||||
return (JFrame)element;
|
||||
element = element.getParent();
|
||||
}
|
||||
return null;
|
||||
} // getFrame
|
||||
|
||||
/**
|
||||
* Get Graphics of container or its parent.
|
||||
* The element may not have a Graphic if not displayed yet,
|
||||
|
@ -1596,92 +1502,6 @@ public final class Env
|
|||
return osName.indexOf ("windows") != -1;
|
||||
} // isWindows
|
||||
|
||||
|
||||
/** Array of hidden Windows */
|
||||
private static ArrayList<CFrame> s_hiddenWindows = new ArrayList<CFrame>();
|
||||
/** Closing Window Indicator */
|
||||
private static boolean s_closingWindows = false;
|
||||
|
||||
/**
|
||||
* Hide Window
|
||||
* @param window window
|
||||
* @return true if window is hidden, otherwise close it
|
||||
*/
|
||||
static public boolean hideWindow(CFrame window)
|
||||
{
|
||||
if (!Ini.isCacheWindow() || s_closingWindows)
|
||||
return false;
|
||||
for (int i = 0; i < s_hiddenWindows.size(); i++)
|
||||
{
|
||||
CFrame hidden = s_hiddenWindows.get(i);
|
||||
getLogger().info(i + ": " + hidden);
|
||||
if (hidden.getAD_Window_ID() == window.getAD_Window_ID())
|
||||
return false; // already there
|
||||
}
|
||||
if (window.getAD_Window_ID() != 0) // workbench
|
||||
{
|
||||
if (s_hiddenWindows.add(window))
|
||||
{
|
||||
window.setVisible(false);
|
||||
getLogger().info(window.toString());
|
||||
// window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_ICONIFIED));
|
||||
if (s_hiddenWindows.size() > 10) {
|
||||
CFrame toClose = s_hiddenWindows.remove(0); // sort of lru
|
||||
try {
|
||||
s_closingWindows = true;
|
||||
toClose.dispose();
|
||||
} finally {
|
||||
s_closingWindows = false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} // hideWindow
|
||||
|
||||
/**
|
||||
* Show Window
|
||||
* @param AD_Window_ID window
|
||||
* @return true if window re-displayed
|
||||
*/
|
||||
static public CFrame showWindow (int AD_Window_ID)
|
||||
{
|
||||
for (int i = 0; i < s_hiddenWindows.size(); i++)
|
||||
{
|
||||
CFrame hidden = s_hiddenWindows.get(i);
|
||||
if (hidden.getAD_Window_ID() == AD_Window_ID)
|
||||
{
|
||||
s_hiddenWindows.remove(i);
|
||||
getLogger().info(hidden.toString());
|
||||
hidden.setVisible(true);
|
||||
// De-iconify window - teo_sarca [ 1707221 ]
|
||||
int state = hidden.getExtendedState();
|
||||
if ((state & CFrame.ICONIFIED) > 0)
|
||||
hidden.setExtendedState(state & ~CFrame.ICONIFIED);
|
||||
//
|
||||
hidden.toFront();
|
||||
return hidden;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
} // showWindow
|
||||
|
||||
/**
|
||||
* Clode Windows.
|
||||
*/
|
||||
static void closeWindows ()
|
||||
{
|
||||
s_closingWindows = true;
|
||||
for (int i = 0; i < s_hiddenWindows.size(); i++)
|
||||
{
|
||||
CFrame hidden = s_hiddenWindows.get(i);
|
||||
hidden.dispose();
|
||||
}
|
||||
s_hiddenWindows.clear();
|
||||
s_closingWindows = false;
|
||||
} // closeWindows
|
||||
|
||||
/**
|
||||
* Sleep
|
||||
* @param sec seconds
|
||||
|
@ -1700,46 +1520,6 @@ public final class Env
|
|||
getLogger().info("End");
|
||||
} // sleep
|
||||
|
||||
/**
|
||||
* Update all windows after look and feel changes.
|
||||
* @since 2006-11-27
|
||||
*/
|
||||
public static Set<Window>updateUI()
|
||||
{
|
||||
Set<Window> updated = new HashSet<Window>();
|
||||
for (Container c : s_windows)
|
||||
{
|
||||
Window w = getFrame(c);
|
||||
if (w == null) continue;
|
||||
if (updated.contains(w)) continue;
|
||||
SwingUtilities.updateComponentTreeUI(w);
|
||||
w.validate();
|
||||
RepaintManager mgr = RepaintManager.currentManager(w);
|
||||
Component childs[] = w.getComponents();
|
||||
for (Component child : childs) {
|
||||
if (child instanceof JComponent)
|
||||
mgr.markCompletelyDirty((JComponent)child);
|
||||
}
|
||||
w.repaint();
|
||||
updated.add(w);
|
||||
}
|
||||
for (Window w : s_hiddenWindows)
|
||||
{
|
||||
if (updated.contains(w)) continue;
|
||||
SwingUtilities.updateComponentTreeUI(w);
|
||||
w.validate();
|
||||
RepaintManager mgr = RepaintManager.currentManager(w);
|
||||
Component childs[] = w.getComponents();
|
||||
for (Component child : childs) {
|
||||
if (child instanceof JComponent)
|
||||
mgr.markCompletelyDirty((JComponent)child);
|
||||
}
|
||||
w.repaint();
|
||||
updated.add(w);
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the context for calling remote server (for e.g, ejb),
|
||||
* only default and global variables are pass over.
|
||||
|
@ -1764,6 +1544,63 @@ public final class Env
|
|||
return p;
|
||||
}
|
||||
|
||||
/** Window Cache */
|
||||
private static CCache<Integer,GridWindowVO> s_windowsvo
|
||||
= new CCache<Integer,GridWindowVO>("AD_Window", 10);
|
||||
|
||||
/**
|
||||
* Get Window Model
|
||||
*
|
||||
* @param WindowNo Window No
|
||||
* @param AD_Window_ID window
|
||||
* @param AD_Menu_ID menu
|
||||
* @return Model Window Value Obkect
|
||||
*/
|
||||
public static GridWindowVO getMWindowVO (int WindowNo, int AD_Window_ID, int AD_Menu_ID)
|
||||
{
|
||||
getLogger().config("Window=" + WindowNo + ", AD_Window_ID=" + AD_Window_ID);
|
||||
GridWindowVO mWindowVO = null;
|
||||
if (AD_Window_ID != 0 && Ini.isCacheWindow()) // try cache
|
||||
{
|
||||
mWindowVO = s_windowsvo.get(AD_Window_ID);
|
||||
if (mWindowVO != null)
|
||||
{
|
||||
mWindowVO = mWindowVO.clone(WindowNo);
|
||||
getLogger().info("Cached=" + mWindowVO);
|
||||
}
|
||||
}
|
||||
|
||||
// Create Window Model on Client
|
||||
if (mWindowVO == null)
|
||||
{
|
||||
getLogger().config("create local");
|
||||
mWindowVO = GridWindowVO.create (Env.getCtx(), WindowNo, AD_Window_ID, AD_Menu_ID);
|
||||
if (mWindowVO != null)
|
||||
s_windowsvo.put(AD_Window_ID, mWindowVO);
|
||||
} // from Client
|
||||
if (mWindowVO == null)
|
||||
return null;
|
||||
|
||||
// Check (remote) context
|
||||
if (!mWindowVO.ctx.equals(Env.getCtx()))
|
||||
{
|
||||
// Remote Context is called by value, not reference
|
||||
// Add Window properties to context
|
||||
Enumeration<?> keyEnum = mWindowVO.ctx.keys();
|
||||
while (keyEnum.hasMoreElements())
|
||||
{
|
||||
String key = (String)keyEnum.nextElement();
|
||||
if (key.startsWith(WindowNo+"|"))
|
||||
{
|
||||
String value = mWindowVO.ctx.getProperty (key);
|
||||
Env.setContext(Env.getCtx(), key, value);
|
||||
}
|
||||
}
|
||||
// Sync Context
|
||||
mWindowVO.setCtx(Env.getCtx());
|
||||
}
|
||||
return mWindowVO;
|
||||
} // getWindow
|
||||
|
||||
/**************************************************************************
|
||||
* Static Variables
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package org.compiere.util;
|
||||
|
||||
public interface IEnvEventListener {
|
||||
|
||||
public void onClearWindowContext(int windowNo);
|
||||
|
||||
public void onReset(boolean finalCall);
|
||||
}
|
|
@ -34,7 +34,6 @@ import java.util.Collection;
|
|||
import java.util.Enumeration;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.jnlp.BasicService;
|
||||
import javax.jnlp.FileContents;
|
||||
|
@ -44,8 +43,6 @@ import javax.jnlp.UnavailableServiceException;
|
|||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import org.adempiere.plaf.AdempiereLookAndFeel;
|
||||
import org.adempiere.plaf.AdempiereThemeInnova;
|
||||
import org.compiere.model.ModelValidationEngine;
|
||||
|
||||
/**
|
||||
|
@ -101,10 +98,10 @@ public final class Ini implements Serializable
|
|||
/** Look & Feel */
|
||||
public static final String P_UI_LOOK = "UILookFeel";
|
||||
|
||||
private static final String DEFAULT_UI_LOOK = AdempiereLookAndFeel.NAME;
|
||||
private static final String DEFAULT_UI_LOOK = "Adempiere";
|
||||
/** UI Theme */
|
||||
|
||||
private static final String DEFAULT_UI_THEME = AdempiereThemeInnova.NAME;
|
||||
private static final String DEFAULT_UI_THEME = "Adempiere Theme";
|
||||
/** UI Theme */
|
||||
public static final String P_UI_THEME = "UITheme";
|
||||
|
||||
|
@ -233,8 +230,9 @@ public final class Ini implements Serializable
|
|||
|
||||
private static String s_propertyFileName = null;
|
||||
|
||||
/** Logger */
|
||||
private static Logger log = null;
|
||||
private static CLogger getLogger() {
|
||||
return CLogger.getCLogger(Ini.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Save INI parameters to disk
|
||||
|
@ -266,15 +264,15 @@ public final class Ini implements Serializable
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + e.toString());
|
||||
getLogger().log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + e.toString());
|
||||
return;
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
log.log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + t.toString());
|
||||
getLogger().log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + t.toString());
|
||||
return;
|
||||
}
|
||||
log.finer(fileName);
|
||||
getLogger().finer(fileName);
|
||||
}
|
||||
} // save
|
||||
|
||||
|
@ -284,7 +282,6 @@ public final class Ini implements Serializable
|
|||
*/
|
||||
public static void loadProperties (boolean reload)
|
||||
{
|
||||
log = Logger.getLogger(Ini.class.getName());
|
||||
if (reload || s_prop.size() == 0)
|
||||
{
|
||||
if (isWebStartClient())
|
||||
|
@ -309,7 +306,7 @@ public final class Ini implements Serializable
|
|||
ps = (PersistenceService)ServiceManager.lookup("javax.jnlp.PersistenceService");
|
||||
} catch (UnavailableServiceException e) {
|
||||
ps = null;
|
||||
log.log(Level.SEVERE, e.toString());
|
||||
getLogger().log(Level.SEVERE, e.toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -317,7 +314,7 @@ public final class Ini implements Serializable
|
|||
try {
|
||||
fc = ps.get(getCodeBase());
|
||||
} catch (MalformedURLException e) {
|
||||
log.log(Level.SEVERE, e.toString());
|
||||
getLogger().log(Level.SEVERE, e.toString());
|
||||
return false;
|
||||
} catch (FileNotFoundException e) {
|
||||
try {
|
||||
|
@ -328,7 +325,7 @@ public final class Ini implements Serializable
|
|||
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.log(Level.SEVERE, e.toString());
|
||||
getLogger().log(Level.SEVERE, e.toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -340,15 +337,12 @@ public final class Ini implements Serializable
|
|||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
log.log(Level.SEVERE, t.toString());
|
||||
getLogger().log(Level.SEVERE, t.toString());
|
||||
loadOK = false;
|
||||
}
|
||||
if (!loadOK || s_prop.getProperty(P_TODAY, "").equals(""))
|
||||
{
|
||||
firstTime = true;
|
||||
if (isShowLicenseDialog())
|
||||
if (!IniDialog.accept())
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
checkProperties();
|
||||
|
@ -370,7 +364,7 @@ public final class Ini implements Serializable
|
|||
ps = (PersistenceService)ServiceManager.lookup("javax.jnlp.PersistenceService");
|
||||
} catch (UnavailableServiceException e) {
|
||||
ps = null;
|
||||
log.log(Level.SEVERE, e.toString());
|
||||
getLogger().log(Level.SEVERE, e.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -383,7 +377,7 @@ public final class Ini implements Serializable
|
|||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
log.log(Level.SEVERE, "Cannot save Properties to " + getCodeBase() + " - " + t.toString());
|
||||
getLogger().log(Level.SEVERE, "Cannot save Properties to " + getCodeBase() + " - " + t.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -435,26 +429,23 @@ public final class Ini implements Serializable
|
|||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
log.warning(filename + " not found");
|
||||
getLogger().warning(filename + " not found");
|
||||
loadOK = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, filename + " - " + e.toString());
|
||||
getLogger().log(Level.SEVERE, filename + " - " + e.toString());
|
||||
loadOK = false;
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
log.log(Level.SEVERE, filename + " - " + t.toString());
|
||||
getLogger().log(Level.SEVERE, filename + " - " + t.toString());
|
||||
loadOK = false;
|
||||
}
|
||||
if (!loadOK || s_prop.getProperty(P_TODAY, "").equals(""))
|
||||
{
|
||||
log.config(filename);
|
||||
getLogger().config(filename);
|
||||
firstTime = true;
|
||||
if (isShowLicenseDialog())
|
||||
if (!IniDialog.accept())
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
checkProperties();
|
||||
|
@ -463,7 +454,7 @@ public final class Ini implements Serializable
|
|||
if (!loadOK || firstTime)
|
||||
saveProperties(true);
|
||||
s_loaded = true;
|
||||
log.info(filename + " #" + s_prop.size());
|
||||
getLogger().info(filename + " #" + s_prop.size());
|
||||
s_propertyFileName = filename;
|
||||
|
||||
return firstTime;
|
||||
|
@ -500,11 +491,11 @@ public final class Ini implements Serializable
|
|||
if (!file.delete())
|
||||
file.deleteOnExit();
|
||||
s_prop = new Properties();
|
||||
log.config (fileName);
|
||||
getLogger().config (fileName);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log (Level.WARNING, "Cannot delete Property file", e);
|
||||
getLogger().log (Level.WARNING, "Cannot delete Property file", e);
|
||||
}
|
||||
}
|
||||
} // deleteProperties
|
||||
|
@ -573,7 +564,7 @@ public final class Ini implements Serializable
|
|||
*/
|
||||
public static void setProperty (String key, String value)
|
||||
{
|
||||
// log.finer(key + "=" + value);
|
||||
// getLogger().finer(key + "=" + value);
|
||||
if (s_prop == null)
|
||||
s_prop = new Properties();
|
||||
if (key.equals(P_WARNING) || key.equals(P_WARNING_de))
|
||||
|
@ -629,7 +620,7 @@ public final class Ini implements Serializable
|
|||
return "";
|
||||
//
|
||||
String value = SecureEngine.decrypt(retStr);
|
||||
// log.finer(key + "=" + value);
|
||||
// getLogger().finer(key + "=" + value);
|
||||
if (value == null)
|
||||
return "";
|
||||
return value;
|
||||
|
@ -758,7 +749,7 @@ public final class Ini implements Serializable
|
|||
env = (String) context.lookup("java:comp/env/"+ADEMPIERE_HOME);
|
||||
} catch (NamingException e) {
|
||||
// teo_sarca: if you uncomment the line below you will get an NPE when generating models
|
||||
//log.fine( "Not found 'java:comp/env/"+ADEMPIERE_HOME+"' in Initial Context. " +e.getMessage());
|
||||
//getLogger().fine( "Not found 'java:comp/env/"+ADEMPIERE_HOME+"' in Initial Context. " +e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
package org.compiere.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.compiere.db.CConnectionDialog;
|
||||
|
||||
/**
|
||||
* Trace Information
|
||||
|
@ -30,7 +27,7 @@ import org.compiere.db.CConnectionDialog;
|
|||
public class Trace
|
||||
{
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger (CConnectionDialog.class);
|
||||
private static CLogger log = CLogger.getCLogger (Trace.class);
|
||||
|
||||
/**
|
||||
* Get Caller Array
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="/base"/>
|
||||
<classpathentry kind="src" path="/tools"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="build"/>
|
||||
</classpath>
|
||||
|
|
|
@ -7,6 +7,7 @@ Bundle-ClassPath: client.jar
|
|||
Export-Package: de.schaeffer.compiere.tools,
|
||||
org.adempiere.apps.graph,
|
||||
org.adempiere.osgi,
|
||||
org.adempiere.plaf,
|
||||
org.compiere,
|
||||
org.compiere.acct,
|
||||
org.compiere.apps,
|
||||
|
@ -19,11 +20,14 @@ Export-Package: de.schaeffer.compiere.tools,
|
|||
org.compiere.images,
|
||||
org.compiere.install,
|
||||
org.compiere.minigrid,
|
||||
org.compiere.plaf,
|
||||
org.compiere.pos,
|
||||
org.compiere.print,
|
||||
org.compiere.swing,
|
||||
org.eevolution.form
|
||||
Require-Bundle: org.adempiere.base;bundle-version="1.0.0",
|
||||
org.adempiere.tools;bundle-version="1.0.0"
|
||||
org.adempiere.tools;bundle-version="1.0.0",
|
||||
org.adempiere.ui.base;bundle-version="1.0.0"
|
||||
Eclipse-ExtensibleAPI: true
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Import-Package: org.eclipse.core.runtime;version="3.4.0",
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<target name="clean">
|
||||
<delete>
|
||||
<fileset dir="../lib/plugins">
|
||||
<include name="org.adempiere.client*.jar"/>
|
||||
<include name="org.adempiere.client_*.jar"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="org.adempiere.osgi.IMenuAction" name="MenuAction" schema="schema/org.adempiere.osgi.IMenuAction.exsd"/>
|
||||
<extension-point id="org.adempiere.apps.Form" name="Form" schema="schema/org.adempiere.apps.Form.exsd"/>
|
||||
<extension
|
||||
id="RF"
|
||||
name="RF"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.base" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<schema targetNamespace="org.adempiere.client" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.base" id="org.compiere.apps.form.FormPanel" name="FormPanel"/>
|
||||
<meta.schema plugin="org.adempiere.client" id="org.adempiere.apps.Form" name="Form"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
|
@ -18,7 +18,7 @@
|
|||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="client"/>
|
||||
<element ref="form"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
|
@ -27,7 +27,7 @@
|
|||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<attribute name="id" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
|||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="client">
|
||||
<element name="form">
|
||||
<complexType>
|
||||
<attribute name="class" type="string">
|
||||
<annotation>
|
|
@ -11,8 +11,8 @@ public class Client {
|
|||
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 );
|
||||
query.put("id", className);
|
||||
return Service.locate(FormPanel.class, "org.adempiere.apps.Form", query);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,9 +2,7 @@ package org.adempiere.osgi;
|
|||
|
||||
import javax.swing.JMenuBar;
|
||||
|
||||
import org.adempiere.base.IService;
|
||||
|
||||
public interface IMenuAction extends IService {
|
||||
public interface IMenuAction {
|
||||
|
||||
public void addAction(JMenuBar menuBar);
|
||||
|
||||
|
|
Before Width: | Height: | Size: 929 B After Width: | Height: | Size: 929 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 443 B After Width: | Height: | Size: 443 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 333 B After Width: | Height: | Size: 333 B |
Before Width: | Height: | Size: 561 B After Width: | Height: | Size: 561 B |
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 603 B |
Before Width: | Height: | Size: 528 B After Width: | Height: | Size: 528 B |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 635 B After Width: | Height: | Size: 635 B |
Before Width: | Height: | Size: 936 B After Width: | Height: | Size: 936 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 498 B After Width: | Height: | Size: 498 B |
Before Width: | Height: | Size: 433 B After Width: | Height: | Size: 433 B |
Before Width: | Height: | Size: 523 B After Width: | Height: | Size: 523 B |
Before Width: | Height: | Size: 652 B After Width: | Height: | Size: 652 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
@ -102,7 +102,7 @@ public class AcctViewer extends CFrame
|
|||
super (Msg.getMsg(Env.getCtx(), "AcctViewer"));
|
||||
log.info("AD_Table_ID=" + AD_Table_ID + ", Record_ID=" + Record_ID);
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
m_data = new AcctViewerData (Env.getCtx(), Env.createWindowNo(this),
|
||||
m_data = new AcctViewerData (Env.getCtx(), AEnv.createWindowNo(this),
|
||||
AD_Client_ID, AD_Table_ID);
|
||||
AEnv.addToWindowManager(this);
|
||||
//
|
||||
|
|
|
@ -70,7 +70,7 @@ public final class ADialog
|
|||
//
|
||||
Window parent = Env.getParent(c);
|
||||
if (parent == null)
|
||||
parent = Env.getWindow(WindowNo);
|
||||
parent = AEnv.getWindow(WindowNo);
|
||||
//
|
||||
if (showDialog && parent != null)
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ public final class ADialog
|
|||
//
|
||||
Window parent = Env.getParent(c);
|
||||
if (parent == null)
|
||||
parent = Env.getWindow(WindowNo);
|
||||
parent = AEnv.getWindow(WindowNo);
|
||||
//
|
||||
if (showDialog && parent != null)
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ public final class ADialog
|
|||
//
|
||||
Window parent = Env.getParent(c);
|
||||
if (parent == null)
|
||||
parent = Env.getWindow(WindowNo);
|
||||
parent = AEnv.getWindow(WindowNo);
|
||||
//
|
||||
if (showDialog && parent != null)
|
||||
{
|
||||
|
@ -219,7 +219,7 @@ public final class ADialog
|
|||
//
|
||||
Window parent = Env.getParent(c);
|
||||
if (parent == null)
|
||||
parent = Env.getWindow(WindowNo);
|
||||
parent = AEnv.getWindow(WindowNo);
|
||||
//
|
||||
if (showDialog && parent != null)
|
||||
{
|
||||
|
@ -235,7 +235,7 @@ public final class ADialog
|
|||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
else
|
||||
JOptionPane.showMessageDialog(Env.getWindow(WindowNo),
|
||||
JOptionPane.showMessageDialog(AEnv.getWindow(WindowNo),
|
||||
out.toString() + "\n", // message
|
||||
Env.getHeader(ctx, WindowNo), // title
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
|
@ -273,7 +273,7 @@ public final class ADialog
|
|||
//
|
||||
Window parent = Env.getParent(c);
|
||||
if (parent == null)
|
||||
parent = Env.getWindow(WindowNo);
|
||||
parent = AEnv.getWindow(WindowNo);
|
||||
|
||||
boolean retValue = false;
|
||||
if (showDialog && parent != null)
|
||||
|
@ -340,7 +340,7 @@ public final class ADialog
|
|||
//
|
||||
Window parent = Env.getParent(c);
|
||||
if (parent == null)
|
||||
parent = Env.getWindow(WindowNo);
|
||||
parent = AEnv.getWindow(WindowNo);
|
||||
//
|
||||
if (showDialog && parent != null)
|
||||
{
|
||||
|
|
|
@ -29,7 +29,8 @@ import java.awt.event.ActionListener;
|
|||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -47,7 +48,6 @@ import javax.swing.SwingUtilities;
|
|||
import org.compiere.db.CConnection;
|
||||
import org.compiere.grid.ed.Calculator;
|
||||
import org.compiere.interfaces.Server;
|
||||
import org.compiere.model.GridWindowVO;
|
||||
import org.compiere.model.MMenu;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRole;
|
||||
|
@ -55,7 +55,6 @@ import org.compiere.process.DocumentEngine;
|
|||
import org.compiere.swing.CButton;
|
||||
import org.compiere.swing.CFrame;
|
||||
import org.compiere.swing.CMenuItem;
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.CLogMgt;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
|
@ -77,6 +76,95 @@ import org.compiere.util.Splash;
|
|||
*/
|
||||
public final class AEnv
|
||||
{
|
||||
// Array of active Windows
|
||||
private static ArrayList<Container> s_windows = new ArrayList<Container>(20);
|
||||
|
||||
/** Array of hidden Windows */
|
||||
private static ArrayList<CFrame> s_hiddenWindows = new ArrayList<CFrame>();
|
||||
|
||||
/** Closing Window Indicator */
|
||||
private static boolean s_closingWindows = false;
|
||||
|
||||
/**
|
||||
* Hide Window
|
||||
* @param window window
|
||||
* @return true if window is hidden, otherwise close it
|
||||
*/
|
||||
static public boolean hideWindow(CFrame window)
|
||||
{
|
||||
if (!Ini.isCacheWindow() || s_closingWindows)
|
||||
return false;
|
||||
for (int i = 0; i < s_hiddenWindows.size(); i++)
|
||||
{
|
||||
CFrame hidden = s_hiddenWindows.get(i);
|
||||
log.info(i + ": " + hidden);
|
||||
if (hidden.getAD_Window_ID() == window.getAD_Window_ID())
|
||||
return false; // already there
|
||||
}
|
||||
if (window.getAD_Window_ID() != 0) // workbench
|
||||
{
|
||||
if (s_hiddenWindows.add(window))
|
||||
{
|
||||
window.setVisible(false);
|
||||
log.info(window.toString());
|
||||
// window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_ICONIFIED));
|
||||
if (s_hiddenWindows.size() > 10) {
|
||||
CFrame toClose = s_hiddenWindows.remove(0); // sort of lru
|
||||
try {
|
||||
s_closingWindows = true;
|
||||
toClose.dispose();
|
||||
} finally {
|
||||
s_closingWindows = false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} // hideWindow
|
||||
|
||||
/**
|
||||
* Show Window
|
||||
* @param AD_Window_ID window
|
||||
* @return true if window re-displayed
|
||||
*/
|
||||
static public CFrame showWindow (int AD_Window_ID)
|
||||
{
|
||||
for (int i = 0; i < s_hiddenWindows.size(); i++)
|
||||
{
|
||||
CFrame hidden = s_hiddenWindows.get(i);
|
||||
if (hidden.getAD_Window_ID() == AD_Window_ID)
|
||||
{
|
||||
s_hiddenWindows.remove(i);
|
||||
log.info(hidden.toString());
|
||||
hidden.setVisible(true);
|
||||
// De-iconify window - teo_sarca [ 1707221 ]
|
||||
int state = hidden.getExtendedState();
|
||||
if ((state & CFrame.ICONIFIED) > 0)
|
||||
hidden.setExtendedState(state & ~CFrame.ICONIFIED);
|
||||
//
|
||||
hidden.toFront();
|
||||
return hidden;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
} // showWindow
|
||||
|
||||
/**
|
||||
* Clode Windows.
|
||||
*/
|
||||
static void closeWindows ()
|
||||
{
|
||||
s_closingWindows = true;
|
||||
for (int i = 0; i < s_hiddenWindows.size(); i++)
|
||||
{
|
||||
CFrame hidden = s_hiddenWindows.get(i);
|
||||
hidden.dispose();
|
||||
}
|
||||
s_hiddenWindows.clear();
|
||||
s_closingWindows = false;
|
||||
} // closeWindows
|
||||
|
||||
/**
|
||||
* Show window: de-iconify and bring it to front
|
||||
* @author teo_sarca [ 1707221 ]
|
||||
|
@ -355,11 +443,11 @@ public final class AEnv
|
|||
// File Menu ------------------------
|
||||
if (actionCommand.equals("PrintScreen"))
|
||||
{
|
||||
PrintScreenPainter.printScreen (Env.getFrame(c));
|
||||
PrintScreenPainter.printScreen (getFrame(c));
|
||||
}
|
||||
else if (actionCommand.equals("ScreenShot"))
|
||||
{
|
||||
ScreenShot.createJPEG(Env.getFrame(c), null);
|
||||
ScreenShot.createJPEG(getFrame(c), null);
|
||||
}
|
||||
// else if (actionCommand.equals("Report"))
|
||||
// {
|
||||
|
@ -369,28 +457,28 @@ public final class AEnv
|
|||
{
|
||||
if (ADialog.ask(WindowNo, c, "ExitApplication?"))
|
||||
{
|
||||
AMenu aMenu = (AMenu)Env.getWindow(0);
|
||||
AMenu aMenu = (AMenu)getWindow(0);
|
||||
aMenu.dispose() ;
|
||||
}
|
||||
}
|
||||
else if (actionCommand.equals("Logout"))
|
||||
{
|
||||
AMenu aMenu = (AMenu)Env.getWindow(0);
|
||||
AMenu aMenu = (AMenu)getWindow(0);
|
||||
aMenu.logout();
|
||||
}
|
||||
|
||||
// View Menu ------------------------
|
||||
else if (actionCommand.equals("InfoProduct") && AEnv.canAccessInfo("PRODUCT"))
|
||||
{
|
||||
org.compiere.apps.search.Info.showProduct (Env.getFrame(c), WindowNo);
|
||||
org.compiere.apps.search.Info.showProduct (getFrame(c), WindowNo);
|
||||
}
|
||||
else if (actionCommand.equals("InfoBPartner") && AEnv.canAccessInfo("BPARTNER"))
|
||||
{
|
||||
org.compiere.apps.search.Info.showBPartner (Env.getFrame(c), WindowNo);
|
||||
org.compiere.apps.search.Info.showBPartner (getFrame(c), WindowNo);
|
||||
}
|
||||
else if (actionCommand.equals("InfoAsset") && AEnv.canAccessInfo("ASSET"))
|
||||
{
|
||||
org.compiere.apps.search.Info.showAsset (Env.getFrame(c), WindowNo);
|
||||
org.compiere.apps.search.Info.showAsset (getFrame(c), WindowNo);
|
||||
}
|
||||
else if (actionCommand.equals("InfoAccount") &&
|
||||
MRole.getDefault().isShowAcct() &&
|
||||
|
@ -400,12 +488,12 @@ public final class AEnv
|
|||
}
|
||||
else if (actionCommand.equals("InfoSchedule") && AEnv.canAccessInfo("SCHEDULE"))
|
||||
{
|
||||
new org.compiere.apps.search.InfoSchedule (Env.getFrame(c), null, false);
|
||||
new org.compiere.apps.search.InfoSchedule (getFrame(c), null, false);
|
||||
}
|
||||
//FR [ 1966328 ]
|
||||
else if (actionCommand.equals("InfoMRP") && AEnv.canAccessInfo("MRP"))
|
||||
{
|
||||
CFrame frame = (CFrame) Env.getFrame(c);
|
||||
CFrame frame = (CFrame) getFrame(c);
|
||||
int m_menu_id = MMenu.getMenu_ID("MRP Info");
|
||||
AMenu menu = AEnv.getAMenu(frame);
|
||||
AMenuStartItem form = new AMenuStartItem (m_menu_id, true, Msg.translate(Env.getCtx(), "MRP Info"), menu); // async load
|
||||
|
@ -413,7 +501,7 @@ public final class AEnv
|
|||
}
|
||||
else if (actionCommand.equals("InfoCRP") && AEnv.canAccessInfo("CRP"))
|
||||
{
|
||||
CFrame frame = (CFrame) Env.getFrame(c);
|
||||
CFrame frame = (CFrame) getFrame(c);
|
||||
int m_menu_id = MMenu.getMenu_ID("CRP Info");
|
||||
AMenu menu = AEnv.getAMenu(frame);
|
||||
AMenuStartItem form = new AMenuStartItem (m_menu_id, true, Msg.translate(Env.getCtx(), "CRP Info"), menu); // async load
|
||||
|
@ -421,27 +509,27 @@ public final class AEnv
|
|||
}
|
||||
else if (actionCommand.equals("InfoOrder") && AEnv.canAccessInfo("ORDER"))
|
||||
{
|
||||
org.compiere.apps.search.Info.showOrder (Env.getFrame(c), WindowNo, "");
|
||||
org.compiere.apps.search.Info.showOrder (getFrame(c), WindowNo, "");
|
||||
}
|
||||
else if (actionCommand.equals("InfoInvoice") && AEnv.canAccessInfo("INVOICE"))
|
||||
{
|
||||
org.compiere.apps.search.Info.showInvoice (Env.getFrame(c), WindowNo, "");
|
||||
org.compiere.apps.search.Info.showInvoice (getFrame(c), WindowNo, "");
|
||||
}
|
||||
else if (actionCommand.equals("InfoInOut") && AEnv.canAccessInfo("INOUT"))
|
||||
{
|
||||
org.compiere.apps.search.Info.showInOut (Env.getFrame(c), WindowNo, "");
|
||||
org.compiere.apps.search.Info.showInOut (getFrame(c), WindowNo, "");
|
||||
}
|
||||
else if (actionCommand.equals("InfoPayment") && AEnv.canAccessInfo("PAYMENT"))
|
||||
{
|
||||
org.compiere.apps.search.Info.showPayment (Env.getFrame(c), WindowNo, "");
|
||||
org.compiere.apps.search.Info.showPayment (getFrame(c), WindowNo, "");
|
||||
}
|
||||
else if (actionCommand.equals("InfoCashLine") && AEnv.canAccessInfo("CASHJOURNAL"))
|
||||
{
|
||||
org.compiere.apps.search.Info.showCashLine (Env.getFrame(c), WindowNo, "");
|
||||
org.compiere.apps.search.Info.showCashLine (getFrame(c), WindowNo, "");
|
||||
}
|
||||
else if (actionCommand.equals("InfoAssignment") && AEnv.canAccessInfo("RESOURCE"))
|
||||
{
|
||||
org.compiere.apps.search.Info.showAssignment (Env.getFrame(c), WindowNo, "");
|
||||
org.compiere.apps.search.Info.showAssignment (getFrame(c), WindowNo, "");
|
||||
}
|
||||
|
||||
|
||||
|
@ -452,32 +540,32 @@ public final class AEnv
|
|||
}
|
||||
else if (actionCommand.equals("Home"))
|
||||
{
|
||||
showWindow(Env.getWindow(0));
|
||||
showWindow(getWindow(0));
|
||||
}
|
||||
|
||||
// Tools Menu ------------------------
|
||||
else if (actionCommand.equals("Calculator"))
|
||||
{
|
||||
Calculator calc = new org.compiere.grid.ed.Calculator(Env.getFrame(c));
|
||||
Calculator calc = new org.compiere.grid.ed.Calculator(getFrame(c));
|
||||
calc.setDisposeOnEqual(false);
|
||||
AEnv.showCenterScreen (calc);
|
||||
}
|
||||
else if (actionCommand.equals("Calendar"))
|
||||
{
|
||||
AEnv.showCenterScreen (new org.compiere.grid.ed.Calendar(Env.getFrame(c)));
|
||||
AEnv.showCenterScreen (new org.compiere.grid.ed.Calendar(getFrame(c)));
|
||||
}
|
||||
else if (actionCommand.equals("Editor"))
|
||||
{
|
||||
AEnv.showCenterScreen (new org.compiere.grid.ed.Editor(Env.getFrame(c)));
|
||||
AEnv.showCenterScreen (new org.compiere.grid.ed.Editor(getFrame(c)));
|
||||
}
|
||||
else if (actionCommand.equals("Script"))
|
||||
{
|
||||
new BeanShellEditor(Env.getFrame(c));
|
||||
new BeanShellEditor(getFrame(c));
|
||||
}
|
||||
else if (actionCommand.equals("Preference"))
|
||||
{
|
||||
if (role.isShowPreference()) {
|
||||
AEnv.showCenterScreen(new Preference (Env.getFrame(c), WindowNo));
|
||||
AEnv.showCenterScreen(new Preference (getFrame(c), WindowNo));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,11 +576,11 @@ public final class AEnv
|
|||
}
|
||||
else if (actionCommand.equals("EMailSupport"))
|
||||
{
|
||||
ADialog.createSupportEMail(Env.getFrame(c), Env.getFrame(c).getTitle(), "\n\n");
|
||||
ADialog.createSupportEMail(getFrame(c), getFrame(c).getTitle(), "\n\n");
|
||||
}
|
||||
else if (actionCommand.equals("About"))
|
||||
{
|
||||
AEnv.showCenterScreen(new AboutBox(Env.getFrame(c)));
|
||||
AEnv.showCenterScreen(new AboutBox(getFrame(c)));
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
@ -658,7 +746,7 @@ public final class AEnv
|
|||
*/
|
||||
public static void addToWindowManager(CFrame frame)
|
||||
{
|
||||
JFrame top = Env.getWindow(0);
|
||||
JFrame top = getWindow(0);
|
||||
if (top instanceof AMenu)
|
||||
{
|
||||
((AMenu)top).getWindowManager().add(frame);
|
||||
|
@ -672,7 +760,7 @@ public final class AEnv
|
|||
*/
|
||||
public static AMenu getAMenu(CFrame frame)
|
||||
{
|
||||
JFrame top = Env.getWindow(0);
|
||||
JFrame top = getWindow(0);
|
||||
if (top instanceof AMenu)
|
||||
{
|
||||
return (AMenu)top;
|
||||
|
@ -826,64 +914,6 @@ public final class AEnv
|
|||
return CConnection.get().getServerVersion();
|
||||
} // getServerVersion
|
||||
|
||||
/** Window Cache */
|
||||
private static CCache<Integer,GridWindowVO> s_windows
|
||||
= new CCache<Integer,GridWindowVO>("AD_Window", 10);
|
||||
|
||||
/**
|
||||
* Get Window Model
|
||||
*
|
||||
* @param WindowNo Window No
|
||||
* @param AD_Window_ID window
|
||||
* @param AD_Menu_ID menu
|
||||
* @return Model Window Value Obkect
|
||||
*/
|
||||
public static GridWindowVO getMWindowVO (int WindowNo, int AD_Window_ID, int AD_Menu_ID)
|
||||
{
|
||||
log.config("Window=" + WindowNo + ", AD_Window_ID=" + AD_Window_ID);
|
||||
GridWindowVO mWindowVO = null;
|
||||
if (AD_Window_ID != 0 && Ini.isCacheWindow()) // try cache
|
||||
{
|
||||
mWindowVO = s_windows.get(AD_Window_ID);
|
||||
if (mWindowVO != null)
|
||||
{
|
||||
mWindowVO = mWindowVO.clone(WindowNo);
|
||||
log.info("Cached=" + mWindowVO);
|
||||
}
|
||||
}
|
||||
|
||||
// Create Window Model on Client
|
||||
if (mWindowVO == null)
|
||||
{
|
||||
log.config("create local");
|
||||
mWindowVO = GridWindowVO.create (Env.getCtx(), WindowNo, AD_Window_ID, AD_Menu_ID);
|
||||
if (mWindowVO != null)
|
||||
s_windows.put(AD_Window_ID, mWindowVO);
|
||||
} // from Client
|
||||
if (mWindowVO == null)
|
||||
return null;
|
||||
|
||||
// Check (remote) context
|
||||
if (!mWindowVO.ctx.equals(Env.getCtx()))
|
||||
{
|
||||
// Remote Context is called by value, not reference
|
||||
// Add Window properties to context
|
||||
Enumeration<?> keyEnum = mWindowVO.ctx.keys();
|
||||
while (keyEnum.hasMoreElements())
|
||||
{
|
||||
String key = (String)keyEnum.nextElement();
|
||||
if (key.startsWith(WindowNo+"|"))
|
||||
{
|
||||
String value = mWindowVO.ctx.getProperty (key);
|
||||
Env.setContext(Env.getCtx(), key, value);
|
||||
}
|
||||
}
|
||||
// Sync Context
|
||||
mWindowVO.setCtx(Env.getCtx());
|
||||
}
|
||||
return mWindowVO;
|
||||
} // getWindow
|
||||
|
||||
/**
|
||||
* Post Immediate
|
||||
* @param WindowNo window
|
||||
|
@ -940,8 +970,8 @@ public final class AEnv
|
|||
*/
|
||||
public static void updateUI()
|
||||
{
|
||||
Set<Window> updated = Env.updateUI();
|
||||
JFrame top = Env.getWindow(0);
|
||||
Set<Window> updated = updateUI0();
|
||||
JFrame top = getWindow(0);
|
||||
if (top instanceof AMenu)
|
||||
{
|
||||
CFrame[] frames = ((AMenu)top).getWindowManager().getWindows();
|
||||
|
@ -1009,4 +1039,158 @@ public final class AEnv
|
|||
return result;
|
||||
} // canAccessInfo
|
||||
|
||||
/**
|
||||
* Update all windows after look and feel changes.
|
||||
* @since 2006-11-27
|
||||
*/
|
||||
public static Set<Window>updateUI0()
|
||||
{
|
||||
Set<Window> updated = new HashSet<Window>();
|
||||
for (Container c : s_windows)
|
||||
{
|
||||
Window w = getFrame(c);
|
||||
if (w == null) continue;
|
||||
if (updated.contains(w)) continue;
|
||||
SwingUtilities.updateComponentTreeUI(w);
|
||||
w.validate();
|
||||
RepaintManager mgr = RepaintManager.currentManager(w);
|
||||
Component childs[] = w.getComponents();
|
||||
for (Component child : childs) {
|
||||
if (child instanceof JComponent)
|
||||
mgr.markCompletelyDirty((JComponent)child);
|
||||
}
|
||||
w.repaint();
|
||||
updated.add(w);
|
||||
}
|
||||
for (Window w : s_hiddenWindows)
|
||||
{
|
||||
if (updated.contains(w)) continue;
|
||||
SwingUtilities.updateComponentTreeUI(w);
|
||||
w.validate();
|
||||
RepaintManager mgr = RepaintManager.currentManager(w);
|
||||
Component childs[] = w.getComponents();
|
||||
for (Component child : childs) {
|
||||
if (child instanceof JComponent)
|
||||
mgr.markCompletelyDirty((JComponent)child);
|
||||
}
|
||||
w.repaint();
|
||||
updated.add(w);
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Container and return WindowNo.
|
||||
* The container is a APanel, AWindow or JFrame/JDialog
|
||||
* @param win window
|
||||
* @return WindowNo used for context
|
||||
*/
|
||||
public static int createWindowNo(Container win)
|
||||
{
|
||||
int retValue = s_windows.size();
|
||||
s_windows.add(win);
|
||||
return retValue;
|
||||
} // createWindowNo
|
||||
|
||||
/**
|
||||
* Search Window by comparing the Frames
|
||||
* @param container container
|
||||
* @return WindowNo of container or 0
|
||||
*/
|
||||
public static int getWindowNo (Container container)
|
||||
{
|
||||
if (container == null)
|
||||
return 0;
|
||||
JFrame winFrame = getFrame(container);
|
||||
if (winFrame == null)
|
||||
return 0;
|
||||
|
||||
// loop through windows
|
||||
for (int i = 0; i < s_windows.size(); i++)
|
||||
{
|
||||
Container cmp = (Container)s_windows.get(i);
|
||||
if (cmp != null)
|
||||
{
|
||||
JFrame cmpFrame = getFrame(cmp);
|
||||
if (winFrame.equals(cmpFrame))
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
} // getWindowNo
|
||||
|
||||
/**
|
||||
* Return the JFrame pointer of WindowNo - or null
|
||||
* @param WindowNo window
|
||||
* @return JFrame of WindowNo
|
||||
*/
|
||||
public static JFrame getWindow (int WindowNo)
|
||||
{
|
||||
JFrame retValue = null;
|
||||
try
|
||||
{
|
||||
retValue = getFrame ((Container)s_windows.get(WindowNo));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, e.toString());
|
||||
}
|
||||
return retValue;
|
||||
} // getWindow
|
||||
|
||||
/**
|
||||
* Remove window from active list
|
||||
* @param WindowNo window
|
||||
*/
|
||||
public static void removeWindow (int WindowNo)
|
||||
{
|
||||
if (WindowNo < s_windows.size())
|
||||
s_windows.set(WindowNo, null);
|
||||
} // removeWindow
|
||||
|
||||
/**************************************************************************
|
||||
* Get Frame of Window
|
||||
* @param container Container
|
||||
* @return JFrame of container or null
|
||||
*/
|
||||
public static JFrame getFrame (Container container)
|
||||
{
|
||||
Container element = container;
|
||||
while (element != null)
|
||||
{
|
||||
if (element instanceof JFrame)
|
||||
return (JFrame)element;
|
||||
element = element.getParent();
|
||||
}
|
||||
return null;
|
||||
} // getFrame
|
||||
|
||||
public static void reset(boolean finalCall)
|
||||
{
|
||||
closeWindows();
|
||||
|
||||
// Dismantle windows
|
||||
/**
|
||||
for (int i = 0; i < s_windows.size(); i++)
|
||||
{
|
||||
Container win = (Container)s_windows.get(i);
|
||||
if (win.getClass().getName().endsWith("AMenu")) // Null pointer
|
||||
;
|
||||
else if (win instanceof Window)
|
||||
((Window)win).dispose();
|
||||
else
|
||||
win.removeAll();
|
||||
}
|
||||
**/
|
||||
//bug [ 1574630 ]
|
||||
if (s_windows.size() > 0) {
|
||||
if (!finalCall) {
|
||||
Container c = s_windows.get(0);
|
||||
s_windows.clear();
|
||||
createWindowNo(c);
|
||||
} else {
|
||||
s_windows.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // AEnv
|
||||
|
|
|
@ -88,7 +88,7 @@ public final class ALogin extends CDialog
|
|||
super (parent, "Login", true); // Modal
|
||||
log.finer("");
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
m_WindowNo = Env.createWindowNo (null);
|
||||
m_WindowNo = AEnv.createWindowNo (null);
|
||||
res = ResourceBundle.getBundle(RESOURCE);
|
||||
//
|
||||
try
|
||||
|
|
|
@ -62,6 +62,8 @@ import org.compiere.model.MSysConfig;
|
|||
import org.compiere.model.MSystem;
|
||||
import org.compiere.model.MTreeNode;
|
||||
import org.compiere.model.MUser;
|
||||
import org.compiere.print.ReportCtl;
|
||||
import org.compiere.print.SwingViewerProvider;
|
||||
import org.compiere.swing.CButton;
|
||||
import org.compiere.swing.CFrame;
|
||||
import org.compiere.swing.CPanel;
|
||||
|
@ -70,6 +72,7 @@ import org.compiere.swing.CTabbedPane;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.IEnvEventListener;
|
||||
import org.compiere.util.Ini;
|
||||
import org.compiere.util.Language;
|
||||
import org.compiere.util.Msg;
|
||||
|
@ -89,7 +92,7 @@ import org.compiere.util.Splash;
|
|||
*
|
||||
*/
|
||||
public final class AMenu extends CFrame
|
||||
implements ActionListener, PropertyChangeListener, ChangeListener
|
||||
implements ActionListener, PropertyChangeListener, ChangeListener, IEnvEventListener
|
||||
{
|
||||
/**
|
||||
* generated serialVersionUID
|
||||
|
@ -109,7 +112,7 @@ public final class AMenu extends CFrame
|
|||
log.info("CodeBase=" + Adempiere.getCodeBase());
|
||||
Splash splash = Splash.getSplash();
|
||||
//
|
||||
m_WindowNo = Env.createWindowNo(this);
|
||||
m_WindowNo = AEnv.createWindowNo(this);
|
||||
// Login
|
||||
initSystem (splash); // login
|
||||
splash.setText(Msg.getMsg(m_ctx, "Loading"));
|
||||
|
@ -189,6 +192,10 @@ public final class AMenu extends CFrame
|
|||
infoUpdaterThread = new Thread(infoUpdater, "InfoUpdater");
|
||||
infoUpdaterThread.start();
|
||||
//
|
||||
Env.addEventListener(this);
|
||||
//
|
||||
ReportCtl.setReportViewerProvider(new SwingViewerProvider());
|
||||
//
|
||||
splash.dispose();
|
||||
splash = null;
|
||||
} // AMenu
|
||||
|
@ -810,4 +817,15 @@ public final class AMenu extends CFrame
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClearWindowContext(int windowNo) {
|
||||
AEnv.removeWindow(windowNo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReset(boolean finalCall) {
|
||||
AEnv.reset(finalCall);
|
||||
}
|
||||
|
||||
} // AMenu
|
||||
|
|
|
@ -226,7 +226,7 @@ public class AMenuStartItem extends Thread implements ActionListener
|
|||
*/
|
||||
private void startWindow(int AD_Workbench_ID, int AD_Window_ID)
|
||||
{
|
||||
AWindow frame = (AWindow)Env.showWindow(AD_Window_ID);
|
||||
AWindow frame = (AWindow)AEnv.showWindow(AD_Window_ID);
|
||||
if (frame != null) {
|
||||
m_menu.getWindowManager().add(frame);
|
||||
return;
|
||||
|
|
|
@ -462,7 +462,7 @@ public final class APanel extends CPanel
|
|||
}
|
||||
|
||||
//Window
|
||||
AMenu aMenu = (AMenu)Env.getWindow(0);
|
||||
AMenu aMenu = (AMenu)AEnv.getWindow(0);
|
||||
m_WindowMenu = new WindowMenu(aMenu.getWindowManager(), m_window);
|
||||
menuBar.add(m_WindowMenu);
|
||||
aShowAllWindow = addAction("ShowAllWindow", null, KeyStroke.getKeyStroke(KeyEvent.VK_W, KeyEvent.CTRL_MASK), false);
|
||||
|
@ -682,7 +682,7 @@ public final class APanel extends CPanel
|
|||
for (int wb = 0; wb < m_mWorkbench.getWindowCount(); wb++)
|
||||
{
|
||||
// Get/set WindowNo
|
||||
m_curWindowNo = Env.createWindowNo (this); // Timing: ca. 1.5 sec
|
||||
m_curWindowNo = AEnv.createWindowNo (this); // Timing: ca. 1.5 sec
|
||||
m_mWorkbench.setWindowNo(wb, m_curWindowNo);
|
||||
// Set AutoCommit for this Window
|
||||
Env.setAutoCommit(m_ctx, m_curWindowNo, Env.isAutoCommit(m_ctx));
|
||||
|
@ -717,7 +717,7 @@ public final class APanel extends CPanel
|
|||
{
|
||||
includedMap = new HashMap<Integer,GridController>(4);
|
||||
//
|
||||
GridWindowVO wVO = AEnv.getMWindowVO(m_curWindowNo, m_mWorkbench.getWindowID(wb), 0);
|
||||
GridWindowVO wVO = Env.getMWindowVO(m_curWindowNo, m_mWorkbench.getWindowID(wb), 0);
|
||||
if (wVO == null)
|
||||
{
|
||||
ADialog.error(0, null, "AccessTableNoView", "(No Window Model Info)");
|
||||
|
@ -795,7 +795,7 @@ public final class APanel extends CPanel
|
|||
else // normal tab
|
||||
{
|
||||
GridController gc = new GridController(); // Timing: ca. .1 sec
|
||||
CompiereColor cc = mWindow.getColor();
|
||||
CompiereColor cc = CompiereColor.getCompiereColor(mWindow.getColor());
|
||||
if (cc != null)
|
||||
gc.setBackgroundColor(cc); // set color on Window level
|
||||
gc.initGrid(gTab, false, m_curWindowNo, this, mWindow, (tab != 0)); // will set color on Tab level
|
||||
|
@ -1092,7 +1092,7 @@ public final class APanel extends CPanel
|
|||
if (require)
|
||||
{
|
||||
GridField[] findFields = mTab.getFields();
|
||||
Find find = new Find (Env.getFrame(this), m_curWindowNo, mTab.getName(),
|
||||
Find find = new Find (AEnv.getFrame(this), m_curWindowNo, mTab.getName(),
|
||||
mTab.getAD_Tab_ID(), mTab.getAD_Table_ID(), mTab.getTableName(),
|
||||
where.toString(), findFields, 10); // no query below 10
|
||||
query = find.getQuery();
|
||||
|
@ -1287,7 +1287,7 @@ public final class APanel extends CPanel
|
|||
{
|
||||
m_isLocked = busy;
|
||||
//
|
||||
JFrame frame = Env.getFrame(this);
|
||||
JFrame frame = AEnv.getFrame(this);
|
||||
if (frame == null) // during init
|
||||
return;
|
||||
if (frame instanceof AWindow)
|
||||
|
@ -1722,7 +1722,7 @@ public final class APanel extends CPanel
|
|||
else if (cmd.equals(aHome.getName())) {
|
||||
// show main menu - teo_sarca [ 1706409, 1707221 ]
|
||||
setBusy(false, false);
|
||||
AEnv.showWindow(Env.getWindow(0));
|
||||
AEnv.showWindow(AEnv.getWindow(0));
|
||||
return;
|
||||
}
|
||||
else if (cmd.equals(aFirst.getName()))
|
||||
|
@ -1821,7 +1821,7 @@ public final class APanel extends CPanel
|
|||
} // actionPerformed
|
||||
|
||||
private void cmd_logout() {
|
||||
JFrame top = Env.getWindow(0);
|
||||
JFrame top = AEnv.getWindow(0);
|
||||
if (top instanceof AMenu) {
|
||||
((AMenu)top).logout();
|
||||
}
|
||||
|
@ -2233,7 +2233,7 @@ public final class APanel extends CPanel
|
|||
pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx));
|
||||
pi.setPrintPreview(printPreview);
|
||||
|
||||
ProcessCtl.process(this, m_curWindowNo, pi, null); // calls lockUI, unlockUI
|
||||
ClientProcessCtrl.process(this, m_curWindowNo, pi, null); // calls lockUI, unlockUI
|
||||
statusBar.setStatusLine(pi.getSummary(), pi.isError());
|
||||
} // cmd_print
|
||||
|
||||
|
@ -2247,7 +2247,7 @@ public final class APanel extends CPanel
|
|||
cmd_save(false);
|
||||
// Gets Fields from AD_Field_v
|
||||
GridField[] findFields = GridField.createFields(m_ctx, m_curWindowNo, 0, m_curTab.getAD_Tab_ID());
|
||||
Find find = new Find (Env.getFrame(this), m_curWindowNo, m_curTab.getName(),
|
||||
Find find = new Find (AEnv.getFrame(this), m_curWindowNo, m_curTab.getName(),
|
||||
m_curTab.getAD_Tab_ID(), m_curTab.getAD_Table_ID(), m_curTab.getTableName(),
|
||||
m_curTab.getWhereExtended(), findFields, 1);
|
||||
MQuery query = find.getQuery();
|
||||
|
@ -2278,7 +2278,7 @@ public final class APanel extends CPanel
|
|||
}
|
||||
|
||||
// Attachment va =
|
||||
new Attachment (Env.getFrame(this), m_curWindowNo,
|
||||
new Attachment (AEnv.getFrame(this), m_curWindowNo,
|
||||
m_curTab.getAD_AttachmentID(), m_curTab.getAD_Table_ID(), record_ID, null);
|
||||
//
|
||||
m_curTab.loadAttachments(); // reload
|
||||
|
@ -2314,7 +2314,7 @@ public final class APanel extends CPanel
|
|||
String description = infoName + ": " + infoDisplay;
|
||||
//
|
||||
// AChat va =
|
||||
new AChat (Env.getFrame(this), m_curWindowNo,
|
||||
new AChat (AEnv.getFrame(this), m_curWindowNo,
|
||||
m_curTab.getCM_ChatID(), m_curTab.getAD_Table_ID(), record_ID,
|
||||
description, null);
|
||||
//
|
||||
|
@ -2336,7 +2336,7 @@ public final class APanel extends CPanel
|
|||
// Control Pressed
|
||||
if ((m_lastModifiers & InputEvent.CTRL_MASK) != 0)
|
||||
{
|
||||
new RecordAccessDialog(Env.getFrame(this), m_curTab.getAD_Table_ID(), record_ID);
|
||||
new RecordAccessDialog(AEnv.getFrame(this), m_curTab.getAD_Table_ID(), record_ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2359,7 +2359,7 @@ public final class APanel extends CPanel
|
|||
|
||||
Point pt = new Point (0, aHistory.getButton().getBounds().height);
|
||||
SwingUtilities.convertPointToScreen(pt, aHistory.getButton());
|
||||
VOnlyCurrentDays ocd = new VOnlyCurrentDays(Env.getFrame(this), pt);
|
||||
VOnlyCurrentDays ocd = new VOnlyCurrentDays(AEnv.getFrame(this), pt);
|
||||
if (!ocd.isCancel()) {
|
||||
m_onlyCurrentDays = ocd.getCurrentDays();
|
||||
if (m_onlyCurrentDays == 1) // Day
|
||||
|
@ -2393,7 +2393,7 @@ public final class APanel extends CPanel
|
|||
private void cmd_help()
|
||||
{
|
||||
log.info("");
|
||||
Help hlp = new Help (Env.getFrame(this), this.getTitle(), m_mWorkbench.getMWindow(getWindowIndex()));
|
||||
Help hlp = new Help (AEnv.getFrame(this), this.getTitle(), m_mWorkbench.getMWindow(getWindowIndex()));
|
||||
hlp.setVisible(true);
|
||||
} // cmd_help
|
||||
|
||||
|
@ -2409,7 +2409,7 @@ public final class APanel extends CPanel
|
|||
if (exit && ADialog.ask(m_curWindowNo, this, "ExitApplication?"))
|
||||
exitSystem = true;
|
||||
|
||||
Env.getFrame(this).dispose(); // calls this dispose
|
||||
AEnv.getFrame(this).dispose(); // calls this dispose
|
||||
|
||||
if (exitSystem)
|
||||
AEnv.exit(0);
|
||||
|
@ -2656,14 +2656,14 @@ public final class APanel extends CPanel
|
|||
return;
|
||||
}
|
||||
else {
|
||||
ProcessModalDialog dialog = new ProcessModalDialog(m_ctx, Env.getWindow(m_curWindowNo), Env.getHeader(m_ctx, m_curWindowNo),
|
||||
ProcessModalDialog dialog = new ProcessModalDialog(m_ctx, AEnv.getWindow(m_curWindowNo), Env.getHeader(m_ctx, m_curWindowNo),
|
||||
this, m_curWindowNo, vButton.getProcess_ID(), table_ID,
|
||||
record_ID, startWOasking);
|
||||
if (dialog.isValidDialog())
|
||||
{
|
||||
dialog.validate();
|
||||
dialog.pack();
|
||||
AEnv.showCenterWindow(Env.getWindow(m_curWindowNo), dialog);
|
||||
AEnv.showCenterWindow(AEnv.getWindow(m_curWindowNo), dialog);
|
||||
}
|
||||
}
|
||||
} // actionButton
|
||||
|
@ -2874,5 +2874,4 @@ public final class APanel extends CPanel
|
|||
public boolean isNested() {
|
||||
return isNested;
|
||||
}
|
||||
|
||||
} // APanel
|
||||
|
|
|
@ -180,7 +180,7 @@ public class AWindow extends CFrame
|
|||
*/
|
||||
public void dispose()
|
||||
{
|
||||
if (Env.hideWindow(this))
|
||||
if (AEnv.hideWindow(this))
|
||||
return;
|
||||
log.info(toString());
|
||||
if (m_APanel != null)
|
||||
|
|
|
@ -111,7 +111,7 @@ public class BeanShellEditor extends CDialog implements ActionListener
|
|||
m_owner = owner;
|
||||
m_WindowNo = WindowNo;
|
||||
if (m_WindowNo == 0)
|
||||
m_WindowNo = Env.createWindowNo(this);
|
||||
m_WindowNo = AEnv.createWindowNo(this);
|
||||
log.info("Window=" + m_WindowNo);
|
||||
try
|
||||
{
|
||||
|
|