diff --git a/org.adempiere.ui.swing/META-INF/MANIFEST.MF b/org.adempiere.ui.swing/META-INF/MANIFEST.MF
index e3572492ac..905630bf68 100644
--- a/org.adempiere.ui.swing/META-INF/MANIFEST.MF
+++ b/org.adempiere.ui.swing/META-INF/MANIFEST.MF
@@ -86,5 +86,5 @@ Import-Package: javax.net.ssl,
org.restlet.security,
org.restlet.service,
org.restlet.util
-Service-Component: OSGI-INF/paymentformcash.xml, OSGI-INF/paymentformcheck.xml, OSGI-INF/paymentformcreditcard.xml, OSGI-INF/paymentformdirectdebit.xml, OSGI-INF/paymentformdirectdeposit.xml, OSGI-INF/paymentformmixedpos.xml, OSGI-INF/paymentformoncredit.xml
+Service-Component: OSGI-INF/defaultpaymentformfactory.xml
Bundle-ActivationPolicy: lazy
diff --git a/org.adempiere.ui.swing/OSGI-INF/defaultpaymentformfactory.xml b/org.adempiere.ui.swing/OSGI-INF/defaultpaymentformfactory.xml
new file mode 100644
index 0000000000..6d0322ebdc
--- /dev/null
+++ b/org.adempiere.ui.swing/OSGI-INF/defaultpaymentformfactory.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/org.adempiere.ui.swing/OSGI-INF/paymentformcash.xml b/org.adempiere.ui.swing/OSGI-INF/paymentformcash.xml
deleted file mode 100644
index 99cadd28de..0000000000
--- a/org.adempiere.ui.swing/OSGI-INF/paymentformcash.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.swing/OSGI-INF/paymentformcheck.xml b/org.adempiere.ui.swing/OSGI-INF/paymentformcheck.xml
deleted file mode 100644
index dc17bda6d6..0000000000
--- a/org.adempiere.ui.swing/OSGI-INF/paymentformcheck.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.swing/OSGI-INF/paymentformcreditcard.xml b/org.adempiere.ui.swing/OSGI-INF/paymentformcreditcard.xml
deleted file mode 100644
index 7de1fc23e1..0000000000
--- a/org.adempiere.ui.swing/OSGI-INF/paymentformcreditcard.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.swing/OSGI-INF/paymentformdirectdebit.xml b/org.adempiere.ui.swing/OSGI-INF/paymentformdirectdebit.xml
deleted file mode 100644
index c9b56f531c..0000000000
--- a/org.adempiere.ui.swing/OSGI-INF/paymentformdirectdebit.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.swing/OSGI-INF/paymentformdirectdeposit.xml b/org.adempiere.ui.swing/OSGI-INF/paymentformdirectdeposit.xml
deleted file mode 100644
index cf0a13b76b..0000000000
--- a/org.adempiere.ui.swing/OSGI-INF/paymentformdirectdeposit.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.swing/OSGI-INF/paymentformmixedpos.xml b/org.adempiere.ui.swing/OSGI-INF/paymentformmixedpos.xml
deleted file mode 100644
index 535f6bff6b..0000000000
--- a/org.adempiere.ui.swing/OSGI-INF/paymentformmixedpos.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.swing/OSGI-INF/paymentformoncredit.xml b/org.adempiere.ui.swing/OSGI-INF/paymentformoncredit.xml
deleted file mode 100644
index 4541d936d6..0000000000
--- a/org.adempiere.ui.swing/OSGI-INF/paymentformoncredit.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.swing/build.properties b/org.adempiere.ui.swing/build.properties
index cfa512982f..4161e55a7a 100644
--- a/org.adempiere.ui.swing/build.properties
+++ b/org.adempiere.ui.swing/build.properties
@@ -6,12 +6,6 @@ bin.includes = META-INF/,\
miglayout-3.7.1-swing.jar,\
jpedal.jar,\
OSGI-INF/,\
- OSGI-INF/paymentformcash.xml,\
- OSGI-INF/paymentformcheck.xml,\
- OSGI-INF/paymentformcreditcard.xml,\
- OSGI-INF/paymentformdirectdebit.xml,\
- OSGI-INF/paymentformdirectdeposit.xml,\
- OSGI-INF/paymentformmixedpos.xml,\
- OSGI-INF/paymentformoncredit.xml
+ OSGI-INF/defaultpaymentformfactory.xml
source.client.jar = src/
output.client.jar = build/
diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/DefaultPaymentFormFactory.java b/org.adempiere.ui.swing/src/org/compiere/grid/DefaultPaymentFormFactory.java
new file mode 100644
index 0000000000..02b0283a5e
--- /dev/null
+++ b/org.adempiere.ui.swing/src/org/compiere/grid/DefaultPaymentFormFactory.java
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * Copyright (C) 2012 Elaine Tan *
+ * Copyright (C) 2012 Trek Global
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms version 2 of the GNU General Public License as published *
+ * by the Free Software Foundation. This program is distributed in the hope *
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
+ * See the GNU General Public License for more details. *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
+ *****************************************************************************/
+package org.compiere.grid;
+
+import org.compiere.model.GridTab;
+import org.compiere.model.MInvoice;
+
+/**
+ *
+ * @author Elaine
+ *
+ */
+public class DefaultPaymentFormFactory implements IPaymentFormFactory {
+
+ public IPaymentForm create(int windowNo, GridTab mTab, String paymentRule)
+ {
+ if (paymentRule.equals(MInvoice.PAYMENTRULE_Cash))
+ return new VPaymentFormCash(windowNo, mTab);
+ else if (paymentRule.equals(MInvoice.PAYMENTRULE_Check))
+ return new VPaymentFormCheck(windowNo, mTab);
+ else if (paymentRule.equals(MInvoice.PAYMENTRULE_CreditCard))
+ return new VPaymentFormCreditCard(windowNo, mTab);
+ else if (paymentRule.equals(MInvoice.PAYMENTRULE_DirectDebit))
+ return new VPaymentFormDirectDebit(windowNo, mTab);
+ else if (paymentRule.equals(MInvoice.PAYMENTRULE_DirectDeposit))
+ return new VPaymentFormDirectDeposit(windowNo, mTab);
+ else if (paymentRule.equals(MInvoice.PAYMENTRULE_MixedPOSPayment))
+ return new VPaymentFormMixedPOS(windowNo, mTab);
+ else if (paymentRule.equals(MInvoice.PAYMENTRULE_OnCredit))
+ return new VPaymentFormOnCredit(windowNo, mTab);
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormCash.java b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormCash.java
index 55e2b76f9f..642ad950a7 100644
--- a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormCash.java
+++ b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormCash.java
@@ -56,12 +56,8 @@ public class VPaymentFormCash extends PaymentFormCash implements ActionListener
private CLabel bAmountLabel = new CLabel();
private VNumber bAmountField = new VNumber();
- public VPaymentFormCash() {
- super();
- }
-
- public void init(int windowNo, GridTab mTab) {
- super.init(windowNo, mTab);
+ public VPaymentFormCash(int windowNo, GridTab mTab) {
+ super(windowNo, mTab);
bDateField = new VDate("DateAcct", false, false, true, DisplayType.Date, "DateAcct");
dialog = new VPaymentFormDialog(this, windowNo);
init();
diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormCheck.java b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormCheck.java
index 4cdef93906..642a0cc9ac 100644
--- a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormCheck.java
+++ b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormCheck.java
@@ -64,12 +64,8 @@ public class VPaymentFormCheck extends PaymentFormCheck implements ActionListene
private CButton sOnline = new CButton();
private CLabel sStatus = new CLabel();
- public VPaymentFormCheck() {
- super();
- }
-
- public void init(int windowNo, GridTab mTab) {
- super.init(windowNo, mTab);
+ public VPaymentFormCheck(int windowNo, GridTab mTab) {
+ super(windowNo, mTab);
dialog = new VPaymentFormDialog(this, windowNo);
init();
}
diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormCreditCard.java b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormCreditCard.java
index a54f056d1f..bd81c7a4e8 100644
--- a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormCreditCard.java
+++ b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormCreditCard.java
@@ -63,12 +63,8 @@ public class VPaymentFormCreditCard extends PaymentFormCreditCard implements Act
private CLabel kStatus = new CLabel();
- public VPaymentFormCreditCard() {
- super();
- }
-
- public void init(int windowNo, GridTab mTab) {
- super.init(windowNo, mTab);
+ public VPaymentFormCreditCard(int windowNo, GridTab mTab) {
+ super(windowNo, mTab);
dialog = new VPaymentFormDialog(this, windowNo);
init();
}
diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormDirect.java b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormDirect.java
index 031cf3ba8f..6689d3ab8d 100644
--- a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormDirect.java
+++ b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormDirect.java
@@ -50,12 +50,8 @@ public abstract class VPaymentFormDirect extends PaymentFormDirect implements Ac
private CLabel tRoutingText = new CLabel();
private CLabel tNumberText = new CLabel();
- public VPaymentFormDirect(boolean isDebit) {
- super(isDebit);
- }
-
- public void init(int windowNo, GridTab mTab) {
- super.init(windowNo, mTab);
+ public VPaymentFormDirect(int windowNo, GridTab mTab, boolean isDebit) {
+ super(windowNo, mTab, isDebit);
dialog = new VPaymentFormDialog(this, windowNo);
init();
}
diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormDirectDebit.java b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormDirectDebit.java
index 7582895e97..0b537ad20f 100644
--- a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormDirectDebit.java
+++ b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormDirectDebit.java
@@ -15,6 +15,7 @@ package org.compiere.grid;
import org.compiere.model.GridTab;
+
/**
*
* @author Elaine
@@ -22,8 +23,8 @@ import org.compiere.model.GridTab;
*/
public class VPaymentFormDirectDebit extends VPaymentFormDirect {
- public VPaymentFormDirectDebit() {
- super(true);
+ public VPaymentFormDirectDebit(int windowNo, GridTab mTab) {
+ super(windowNo, mTab, true);
}
}
diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormDirectDeposit.java b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormDirectDeposit.java
index e4703d7754..83d2e145e1 100644
--- a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormDirectDeposit.java
+++ b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormDirectDeposit.java
@@ -15,6 +15,7 @@ package org.compiere.grid;
import org.compiere.model.GridTab;
+
/**
*
* @author Elaine
@@ -22,7 +23,7 @@ import org.compiere.model.GridTab;
*/
public class VPaymentFormDirectDeposit extends VPaymentFormDirect {
- public VPaymentFormDirectDeposit() {
- super(false);
+ public VPaymentFormDirectDeposit(int windowNo, GridTab mTab) {
+ super(windowNo, mTab, false);
}
}
diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormFactory.java b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormFactory.java
index 0a8f076721..2c0be9a692 100644
--- a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormFactory.java
+++ b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormFactory.java
@@ -13,8 +13,9 @@
*****************************************************************************/
package org.compiere.grid;
+import java.util.List;
+
import org.adempiere.base.Service;
-import org.adempiere.base.ServiceQuery;
import org.compiere.model.GridTab;
/**
@@ -24,18 +25,15 @@ import org.compiere.model.GridTab;
*/
public class VPaymentFormFactory {
- public static IPaymentForm getPaymentForm(int windowNo, GridTab mTab, String paymentRule)
- {
- ServiceQuery query = new ServiceQuery();
- query.put("paymentRule", paymentRule);
- return Service.locator().locate(IPaymentForm.class, query).getService();
- }
-
public static IPaymentForm create(int windowNo, GridTab mTab, String paymentRule)
{
- IPaymentForm form = getPaymentForm(windowNo, mTab, paymentRule);
- if (form != null)
- form.init(windowNo, mTab);
- return form;
+ IPaymentForm paymentForm = null;
+ List factories = Service.locator().list(IPaymentFormFactory.class).getServices();
+ for (IPaymentFormFactory factory : factories) {
+ paymentForm = factory.create(windowNo, mTab, paymentRule);
+ if (paymentForm != null)
+ break;
+ }
+ return paymentForm;
}
}
diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormMixedPOS.java b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormMixedPOS.java
index 7d9c40932b..7ad7c2a286 100644
--- a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormMixedPOS.java
+++ b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormMixedPOS.java
@@ -23,12 +23,8 @@ import org.compiere.model.GridTab;
public class VPaymentFormMixedPOS extends PaymentFormMixedPOS {
private VPaymentFormDialog dialog;
- public VPaymentFormMixedPOS() {
- super();
- }
-
- public void init(int windowNo, GridTab mTab) {
- super.init(windowNo, mTab);
+ public VPaymentFormMixedPOS(int windowNo, GridTab mTab) {
+ super(windowNo, mTab);
dialog = new VPaymentFormDialog(this, windowNo);
}
diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormOnCredit.java b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormOnCredit.java
index 66a2fa63c5..ab622eac38 100644
--- a/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormOnCredit.java
+++ b/org.adempiere.ui.swing/src/org/compiere/grid/VPaymentFormOnCredit.java
@@ -37,12 +37,8 @@ public class VPaymentFormOnCredit extends PaymentFormOnCredit {
private CLabel pTermLabel = new CLabel();
private CComboBox pTermCombo = new CComboBox();
- public VPaymentFormOnCredit() {
- super();
- }
-
- public void init(int windowNo, GridTab mTab) {
- super.init(windowNo, mTab);
+ public VPaymentFormOnCredit(int windowNo, GridTab mTab) {
+ super(windowNo, mTab);
dialog = new VPaymentFormDialog(this, windowNo);
init();
}
diff --git a/org.adempiere.ui.zk/META-INF/MANIFEST.MF b/org.adempiere.ui.zk/META-INF/MANIFEST.MF
index 7f02208b05..c1aa808ed8 100644
--- a/org.adempiere.ui.zk/META-INF/MANIFEST.MF
+++ b/org.adempiere.ui.zk/META-INF/MANIFEST.MF
@@ -57,4 +57,4 @@ Bundle-Activator: org.adempiere.webui.WebUIActivator
Eclipse-ExtensibleAPI: true
Eclipse-RegisterBuddy: org.zkoss.zk.library
Web-ContextPath: webui
-Service-Component: OSGI-INF/reportviewerprovider.xml, OSGI-INF/defaultinfofactory.xml, OSGI-INF/defaulteditorfactory.xml, OSGI-INF/jrviewerprovider.xml, OSGI-INF/resourcefinder.xml, OSGI-INF/paymentformcash.xml, OSGI-INF/paymentformcheck.xml, OSGI-INF/paymentformcreditcard.xml, OSGI-INF/paymentformdirectdebit.xml, OSGI-INF/paymentformdirectdeposit.xml, OSGI-INF/paymentformmixedpos.xml, OSGI-INF/paymentformoncredit.xml
+Service-Component: OSGI-INF/reportviewerprovider.xml, OSGI-INF/defaultinfofactory.xml, OSGI-INF/defaulteditorfactory.xml, OSGI-INF/jrviewerprovider.xml, OSGI-INF/resourcefinder.xml, OSGI-INF/defaultpaymentformfactory.xml
diff --git a/org.adempiere.ui.zk/OSGI-INF/defaultpaymentformfactory.xml b/org.adempiere.ui.zk/OSGI-INF/defaultpaymentformfactory.xml
new file mode 100644
index 0000000000..46febc59c2
--- /dev/null
+++ b/org.adempiere.ui.zk/OSGI-INF/defaultpaymentformfactory.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/org.adempiere.ui.zk/OSGI-INF/paymentformcash.xml b/org.adempiere.ui.zk/OSGI-INF/paymentformcash.xml
deleted file mode 100644
index 8794742d12..0000000000
--- a/org.adempiere.ui.zk/OSGI-INF/paymentformcash.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.zk/OSGI-INF/paymentformcheck.xml b/org.adempiere.ui.zk/OSGI-INF/paymentformcheck.xml
deleted file mode 100644
index 41fee2dfd3..0000000000
--- a/org.adempiere.ui.zk/OSGI-INF/paymentformcheck.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.zk/OSGI-INF/paymentformcreditcard.xml b/org.adempiere.ui.zk/OSGI-INF/paymentformcreditcard.xml
deleted file mode 100644
index 32da363cb8..0000000000
--- a/org.adempiere.ui.zk/OSGI-INF/paymentformcreditcard.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.zk/OSGI-INF/paymentformdirectdebit.xml b/org.adempiere.ui.zk/OSGI-INF/paymentformdirectdebit.xml
deleted file mode 100644
index 1472755b41..0000000000
--- a/org.adempiere.ui.zk/OSGI-INF/paymentformdirectdebit.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.zk/OSGI-INF/paymentformdirectdeposit.xml b/org.adempiere.ui.zk/OSGI-INF/paymentformdirectdeposit.xml
deleted file mode 100644
index 0c6541711f..0000000000
--- a/org.adempiere.ui.zk/OSGI-INF/paymentformdirectdeposit.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.zk/OSGI-INF/paymentformmixedpos.xml b/org.adempiere.ui.zk/OSGI-INF/paymentformmixedpos.xml
deleted file mode 100644
index 74bcedf8e1..0000000000
--- a/org.adempiere.ui.zk/OSGI-INF/paymentformmixedpos.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.zk/OSGI-INF/paymentformoncredit.xml b/org.adempiere.ui.zk/OSGI-INF/paymentformoncredit.xml
deleted file mode 100644
index bc0466f507..0000000000
--- a/org.adempiere.ui.zk/OSGI-INF/paymentformoncredit.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/DefaultPaymentFormFactory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/DefaultPaymentFormFactory.java
new file mode 100644
index 0000000000..dc7a35f270
--- /dev/null
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/DefaultPaymentFormFactory.java
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * Copyright (C) 2012 Elaine Tan *
+ * Copyright (C) 2012 Trek Global
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms version 2 of the GNU General Public License as published *
+ * by the Free Software Foundation. This program is distributed in the hope *
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
+ * See the GNU General Public License for more details. *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
+ *****************************************************************************/
+package org.adempiere.webui.apps.form;
+
+import org.compiere.grid.IPaymentForm;
+import org.compiere.grid.IPaymentFormFactory;
+import org.compiere.model.GridTab;
+import org.compiere.model.MInvoice;
+
+/**
+ *
+ * @author Elaine
+ *
+ */
+public class DefaultPaymentFormFactory implements IPaymentFormFactory {
+
+ public IPaymentForm create(int windowNo, GridTab mTab, String paymentRule)
+ {
+ if (paymentRule.equals(MInvoice.PAYMENTRULE_Cash))
+ return new WPaymentFormCash(windowNo, mTab);
+ else if (paymentRule.equals(MInvoice.PAYMENTRULE_Check))
+ return new WPaymentFormCheck(windowNo, mTab);
+ else if (paymentRule.equals(MInvoice.PAYMENTRULE_CreditCard))
+ return new WPaymentFormCreditCard(windowNo, mTab);
+ else if (paymentRule.equals(MInvoice.PAYMENTRULE_DirectDebit))
+ return new WPaymentFormDirectDebit(windowNo, mTab);
+ else if (paymentRule.equals(MInvoice.PAYMENTRULE_DirectDeposit))
+ return new WPaymentFormDirectDeposit(windowNo, mTab);
+ else if (paymentRule.equals(MInvoice.PAYMENTRULE_MixedPOSPayment))
+ return new WPaymentFormMixedPOS(windowNo, mTab);
+ else if (paymentRule.equals(MInvoice.PAYMENTRULE_OnCredit))
+ return new WPaymentFormOnCredit(windowNo, mTab);
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaymentFormCash.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaymentFormCash.java
index d3c6288aec..8d6c116236 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaymentFormCash.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaymentFormCash.java
@@ -61,12 +61,8 @@ public class WPaymentFormCash extends PaymentFormCash implements EventListener factories = Service.locator().list(IPaymentFormFactory.class).getServices();
+ for (IPaymentFormFactory factory : factories) {
+ paymentForm = factory.create(windowNo, mTab, paymentRule);
+ if (paymentForm != null)
+ break;
+ }
+ return paymentForm;
}
}
\ No newline at end of file
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaymentFormMixedPOS.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaymentFormMixedPOS.java
index 0c89b69f6c..fafcd5d55a 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaymentFormMixedPOS.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaymentFormMixedPOS.java
@@ -25,12 +25,8 @@ public class WPaymentFormMixedPOS extends PaymentFormMixedPOS {
private WPaymentFormWindow window;
- public WPaymentFormMixedPOS() {
- super();
- }
-
- public void init(int windowNo, GridTab mTab) {
- super.init(windowNo, mTab);
+ public WPaymentFormMixedPOS(int windowNo, GridTab mTab) {
+ super(windowNo, mTab);
window = new WPaymentFormWindow(this, windowNo);
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaymentFormOnCredit.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaymentFormOnCredit.java
index c4072c6a86..eaa3b8ce4e 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaymentFormOnCredit.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaymentFormOnCredit.java
@@ -43,12 +43,8 @@ public class WPaymentFormOnCredit extends PaymentFormOnCredit {
private Label pTermLabel = new Label();
private Listbox pTermCombo = ListboxFactory.newDropdownListbox();
- public WPaymentFormOnCredit() {
- super();
- }
-
- public void init(int windowNo, GridTab mTab) {
- super.init(windowNo, mTab);
+ public WPaymentFormOnCredit(int windowNo, GridTab mTab) {
+ super(windowNo, mTab);
window = new WPaymentFormWindow(this, windowNo);
init();
}
diff --git a/org.adempiere.ui.zk/build.properties b/org.adempiere.ui.zk/build.properties
index 573da2e50e..1359ade0ba 100644
--- a/org.adempiere.ui.zk/build.properties
+++ b/org.adempiere.ui.zk/build.properties
@@ -28,13 +28,7 @@ bin.includes = META-INF/,\
OSGI-INF/defaulteditorfactory.xml,\
OSGI-INF/jrviewerprovider.xml,\
OSGI-INF/resourcefinder.xml,\
- OSGI-INF/paymentformcash.xml,\
- OSGI-INF/paymentformcheck.xml,\
- OSGI-INF/paymentformcreditcard.xml,\
- OSGI-INF/paymentformdirectdebit.xml,\
- OSGI-INF/paymentformdirectdeposit.xml,\
- OSGI-INF/paymentformmixedpos.xml,\
- OSGI-INF/paymentformoncredit.xml
+ OSGI-INF/defaultpaymentformfactory.xml
src.includes = WEB-INF/classes/,\
WEB-INF/tld/,\
WEB-INF/web.xml,\
diff --git a/org.adempiere.ui/src/org/compiere/grid/IPaymentForm.java b/org.adempiere.ui/src/org/compiere/grid/IPaymentForm.java
index 6a32a9260d..09bd591ff9 100644
--- a/org.adempiere.ui/src/org/compiere/grid/IPaymentForm.java
+++ b/org.adempiere.ui/src/org/compiere/grid/IPaymentForm.java
@@ -13,12 +13,10 @@
*****************************************************************************/
package org.compiere.grid;
-import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
+import org.compiere.model.PO;
public interface IPaymentForm {
-
- public void init(int WindowNo, GridTab mTab);
public boolean dynInit() throws Exception;
@@ -50,9 +48,7 @@ public interface IPaymentForm {
public Object getWindow();
- public Object getCustomizePanel();
-
- public void setCustomizeValues();
+ public void setCustomizeValues(PO po);
public void setBankAccountProcessor(MBankAccountProcessor bankAccountProcessor);
}
\ No newline at end of file
diff --git a/org.adempiere.ui/src/org/compiere/grid/IPaymentFormFactory.java b/org.adempiere.ui/src/org/compiere/grid/IPaymentFormFactory.java
new file mode 100644
index 0000000000..ca60a76679
--- /dev/null
+++ b/org.adempiere.ui/src/org/compiere/grid/IPaymentFormFactory.java
@@ -0,0 +1,27 @@
+/******************************************************************************
+ * Copyright (C) 2012 Elaine Tan *
+ * Copyright (C) 2012 Trek Global
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms version 2 of the GNU General Public License as published *
+ * by the Free Software Foundation. This program is distributed in the hope *
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
+ * See the GNU General Public License for more details. *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
+ *****************************************************************************/
+package org.compiere.grid;
+
+import org.compiere.model.GridTab;
+
+/**
+ *
+ * @author Elaine
+ *
+ */
+public interface IPaymentFormFactory {
+
+ public IPaymentForm create(int windowNo, GridTab mTab, String paymentRule);
+
+}
diff --git a/org.adempiere.ui/src/org/compiere/grid/PaymentForm.java b/org.adempiere.ui/src/org/compiere/grid/PaymentForm.java
index 1cd0022996..9ea587c08d 100644
--- a/org.adempiere.ui/src/org/compiere/grid/PaymentForm.java
+++ b/org.adempiere.ui/src/org/compiere/grid/PaymentForm.java
@@ -27,6 +27,7 @@ import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MPaymentProcessor;
import org.compiere.model.MSysConfig;
+import org.compiere.model.PO;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
@@ -77,10 +78,7 @@ public abstract class PaymentForm implements IPaymentForm {
public Hashtable s_Currencies = null;
- public PaymentForm() {
- }
-
- public void init(int WindowNo, GridTab mTab) {
+ public PaymentForm(int WindowNo, GridTab mTab) {
m_WindowNo = WindowNo;
m_isSOTrx = "Y".equals(Env.getContext(Env.getCtx(), WindowNo, "IsSOTrx"));
m_mTab = mTab;
@@ -295,13 +293,7 @@ public abstract class PaymentForm implements IPaymentForm {
}
@Override
- public Object getCustomizePanel()
- {
- return null;
- }
-
- @Override
- public void setCustomizeValues()
+ public void setCustomizeValues(PO po)
{
}
diff --git a/org.adempiere.ui/src/org/compiere/grid/PaymentFormCash.java b/org.adempiere.ui/src/org/compiere/grid/PaymentFormCash.java
index 5f4f177524..1bf4be7e0f 100644
--- a/org.adempiere.ui/src/org/compiere/grid/PaymentFormCash.java
+++ b/org.adempiere.ui/src/org/compiere/grid/PaymentFormCash.java
@@ -57,7 +57,8 @@ public abstract class PaymentFormCash extends PaymentForm {
/** Start CashBook */
public int m_C_CashBook_ID = 0;
- public PaymentFormCash() {
+ public PaymentFormCash(int windowNo, GridTab mTab) {
+ super(windowNo, mTab);
}
@Override
diff --git a/org.adempiere.ui/src/org/compiere/grid/PaymentFormCheck.java b/org.adempiere.ui/src/org/compiere/grid/PaymentFormCheck.java
index f0c82027de..18ac394fbc 100644
--- a/org.adempiere.ui/src/org/compiere/grid/PaymentFormCheck.java
+++ b/org.adempiere.ui/src/org/compiere/grid/PaymentFormCheck.java
@@ -48,7 +48,8 @@ public abstract class PaymentFormCheck extends PaymentForm {
/** Start Bank Account */
public int m_C_BankAccount_ID = 0;
- public PaymentFormCheck() {
+ public PaymentFormCheck(int windowNo, GridTab mTab) {
+ super(windowNo, mTab);
}
@Override
@@ -227,7 +228,7 @@ public abstract class PaymentFormCheck extends PaymentForm {
}
m_mPayment.setDateTrx(m_DateAcct);
m_mPayment.setDateAcct(m_DateAcct);
- setCustomizeValues();
+ setCustomizeValues(m_mPayment);
m_mPayment.saveEx();
// Save/Post
diff --git a/org.adempiere.ui/src/org/compiere/grid/PaymentFormCreditCard.java b/org.adempiere.ui/src/org/compiere/grid/PaymentFormCreditCard.java
index 79ff36ebeb..5a0ce2a947 100644
--- a/org.adempiere.ui/src/org/compiere/grid/PaymentFormCreditCard.java
+++ b/org.adempiere.ui/src/org/compiere/grid/PaymentFormCreditCard.java
@@ -45,7 +45,8 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
/** Start CreditCard */
public String m_CCType = "";
- public PaymentFormCreditCard() {
+ public PaymentFormCreditCard(int windowNo, GridTab mTab) {
+ super(windowNo, mTab);
}
@Override
@@ -286,7 +287,7 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
}
m_mPayment.setDateTrx(m_DateAcct);
m_mPayment.setDateAcct(m_DateAcct);
- setCustomizeValues();
+ setCustomizeValues(m_mPayment);
if (!m_mPayment.isOnline() && !m_mPayment.isApproved())
{
@@ -386,7 +387,7 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
mpt.setC_Order_ID(C_Order_ID);
mpt.setC_Invoice_ID(C_Invoice_ID);
mpt.setDateTrx(m_DateAcct);
- setCustomizeValues();
+ setCustomizeValues(mpt);
if (!mpt.save()) {
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
return false;
diff --git a/org.adempiere.ui/src/org/compiere/grid/PaymentFormDirect.java b/org.adempiere.ui/src/org/compiere/grid/PaymentFormDirect.java
index 04a8972433..be4ad70c9f 100644
--- a/org.adempiere.ui/src/org/compiere/grid/PaymentFormDirect.java
+++ b/org.adempiere.ui/src/org/compiere/grid/PaymentFormDirect.java
@@ -45,7 +45,8 @@ public abstract class PaymentFormDirect extends PaymentForm {
public MPayment m_mPayment = null;
public MPayment m_mPaymentOriginal = null;
- public PaymentFormDirect(boolean isDebit) {
+ public PaymentFormDirect(int windowNo, GridTab mTab, boolean isDebit) {
+ super(windowNo, mTab);
PAYMENTRULE = isDebit ? MInvoice.PAYMENTRULE_DirectDebit : MInvoice.PAYMENTRULE_DirectDeposit;
}
@@ -215,7 +216,7 @@ public abstract class PaymentFormDirect extends PaymentForm {
}
m_mPayment.setDateTrx(m_DateAcct);
m_mPayment.setDateAcct(m_DateAcct);
- setCustomizeValues();
+ setCustomizeValues(m_mPayment);
m_mPayment.saveEx();
// Save/Post
diff --git a/org.adempiere.ui/src/org/compiere/grid/PaymentFormMixedPOS.java b/org.adempiere.ui/src/org/compiere/grid/PaymentFormMixedPOS.java
index 8625fe3e3e..3a4c3db2fc 100644
--- a/org.adempiere.ui/src/org/compiere/grid/PaymentFormMixedPOS.java
+++ b/org.adempiere.ui/src/org/compiere/grid/PaymentFormMixedPOS.java
@@ -15,6 +15,7 @@ package org.compiere.grid;
import org.compiere.model.GridTab;
+
/**
*
* @author Elaine
@@ -22,6 +23,7 @@ import org.compiere.model.GridTab;
*/
public abstract class PaymentFormMixedPOS extends PaymentForm {
- public PaymentFormMixedPOS() {
+ public PaymentFormMixedPOS(int windowNo, GridTab mTab) {
+ super(windowNo, mTab);
}
}
diff --git a/org.adempiere.ui/src/org/compiere/grid/PaymentFormOnCredit.java b/org.adempiere.ui/src/org/compiere/grid/PaymentFormOnCredit.java
index 6e9f2d40ab..095638dad4 100644
--- a/org.adempiere.ui/src/org/compiere/grid/PaymentFormOnCredit.java
+++ b/org.adempiere.ui/src/org/compiere/grid/PaymentFormOnCredit.java
@@ -34,7 +34,8 @@ public abstract class PaymentFormOnCredit extends PaymentForm {
/** Start Payment Term */
public int m_C_PaymentTerm_ID = 0;
- public PaymentFormOnCredit() {
+ public PaymentFormOnCredit(int windowNo, GridTab mTab) {
+ super(windowNo, mTab);
}
@Override