IDEMPIERE-1749 Add window event validator for AD_Window / Integrate sample test case provided by hengsin

This commit is contained in:
Carlos Ruiz 2014-02-12 09:31:33 -05:00
parent 410c9a1131
commit 36b7d1a0c5
4 changed files with 34 additions and 1 deletions

View File

@ -10,8 +10,10 @@ Import-Package: org.adempiere.base,
org.adempiere.base.equinox,
org.adempiere.exceptions,
org.adempiere.plugin.utils,
org.adempiere.util,
org.adempiere.webui.action,
org.adempiere.webui.adwindow,
org.adempiere.webui.adwindow.validator,
org.adempiere.webui.apps,
org.adempiere.webui.component,
org.adempiere.webui.window,
@ -24,5 +26,6 @@ Import-Package: org.adempiere.base,
org.zkoss.zul,
org.zkoss.zul.event,
org.zkoss.zul.impl
Service-Component: OSGI-INF/export.xml
Service-Component: OSGI-INF/export.xml,
OSGI-INF/paymentwindowvalidator.xml
Export-Package: action.images

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.window.payment.validator.PaymentWindowValidator">
<implementation class="org.adempiere.window.payment.validator.PaymentWindowValidator"/>
<service>
<provide interface="org.adempiere.webui.adwindow.validator.WindowValidator"/>
</service>
<property name="AD_Window_UU" type="String" value="ba895dc4-73df-4cf6-bc29-6dde6e011487"/>
</scr:component>

View File

@ -2,5 +2,6 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/export.xml,\
OSGI-INF/paymentwindowvalidator.xml,\
OSGI-INF/
source.. = src/

View File

@ -0,0 +1,21 @@
package org.adempiere.window.payment.validator;
import org.adempiere.util.Callback;
import org.adempiere.webui.adwindow.validator.WindowValidator;
import org.adempiere.webui.adwindow.validator.WindowValidatorEvent;
import org.adempiere.webui.adwindow.validator.WindowValidatorEventType;
import org.adempiere.webui.window.FDialog;
public class PaymentWindowValidator implements WindowValidator {
@Override
public void onWindowEvent(WindowValidatorEvent event,
Callback<Boolean> callback) {
if (event.getName().equals(WindowValidatorEventType.BEFORE_PRINT.getName())) {
FDialog.ask(event.getWindow().getADWindowContent().getWindowNo(),
event.getWindow().getComponent(), "Print ?", callback);
} else {
callback.onCallback(Boolean.TRUE);
}
}
}