IDEMPIERE-392 Redesign payment button - revert previous change, use factory approach

This commit is contained in:
Elaine Tan 2012-11-08 18:21:38 +08:00
parent 614a431e0b
commit 816f897f06
49 changed files with 214 additions and 289 deletions

View File

@ -86,5 +86,5 @@ Import-Package: javax.net.ssl,
org.restlet.security, org.restlet.security,
org.restlet.service, org.restlet.service,
org.restlet.util 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 Bundle-ActivationPolicy: lazy

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.swing.payment.form.factory">
<implementation class="org.compiere.grid.DefaultPaymentFormFactory"/>
<service>
<provide interface="org.compiere.grid.IPaymentFormFactory"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.swing.payment.form.cash">
<implementation class="org.compiere.grid.VPaymentFormCash"/>
<property name="paymentRule" type="String" value="B"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.swing.payment.form.check">
<implementation class="org.compiere.grid.VPaymentFormCheck"/>
<property name="paymentRule" type="String" value="S"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.swing.payment.form.creditcard">
<implementation class="org.compiere.grid.VPaymentFormCreditCard"/>
<property name="paymentRule" type="String" value="K"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.swing.payment.form.directdebit">
<implementation class="org.compiere.grid.VPaymentFormDirectDebit"/>
<property name="paymentRule" type="String" value="D"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.swing.payment.form.directdeposit">
<implementation class="org.compiere.grid.VPaymentFormDirectDeposit"/>
<property name="paymentRule" type="String" value="T"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.swing.payment.form.mixedpos">
<implementation class="org.compiere.grid.VPaymentFormMixedPOS"/>
<property name="paymentRule" type="String" value="M"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.swing.payment.form.oncredit">
<implementation class="org.compiere.grid.VPaymentFormOnCredit"/>
<property name="paymentRule" type="String" value="P"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -6,12 +6,6 @@ bin.includes = META-INF/,\
miglayout-3.7.1-swing.jar,\ miglayout-3.7.1-swing.jar,\
jpedal.jar,\ jpedal.jar,\
OSGI-INF/,\ OSGI-INF/,\
OSGI-INF/paymentformcash.xml,\ OSGI-INF/defaultpaymentformfactory.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
source.client.jar = src/ source.client.jar = src/
output.client.jar = build/ output.client.jar = build/

View File

@ -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;
}
}

View File

@ -56,12 +56,8 @@ public class VPaymentFormCash extends PaymentFormCash implements ActionListener
private CLabel bAmountLabel = new CLabel(); private CLabel bAmountLabel = new CLabel();
private VNumber bAmountField = new VNumber(); private VNumber bAmountField = new VNumber();
public VPaymentFormCash() { public VPaymentFormCash(int windowNo, GridTab mTab) {
super(); super(windowNo, mTab);
}
public void init(int windowNo, GridTab mTab) {
super.init(windowNo, mTab);
bDateField = new VDate("DateAcct", false, false, true, DisplayType.Date, "DateAcct"); bDateField = new VDate("DateAcct", false, false, true, DisplayType.Date, "DateAcct");
dialog = new VPaymentFormDialog(this, windowNo); dialog = new VPaymentFormDialog(this, windowNo);
init(); init();

View File

@ -64,12 +64,8 @@ public class VPaymentFormCheck extends PaymentFormCheck implements ActionListene
private CButton sOnline = new CButton(); private CButton sOnline = new CButton();
private CLabel sStatus = new CLabel(); private CLabel sStatus = new CLabel();
public VPaymentFormCheck() { public VPaymentFormCheck(int windowNo, GridTab mTab) {
super(); super(windowNo, mTab);
}
public void init(int windowNo, GridTab mTab) {
super.init(windowNo, mTab);
dialog = new VPaymentFormDialog(this, windowNo); dialog = new VPaymentFormDialog(this, windowNo);
init(); init();
} }

View File

@ -63,12 +63,8 @@ public class VPaymentFormCreditCard extends PaymentFormCreditCard implements Act
private CLabel kStatus = new CLabel(); private CLabel kStatus = new CLabel();
public VPaymentFormCreditCard() { public VPaymentFormCreditCard(int windowNo, GridTab mTab) {
super(); super(windowNo, mTab);
}
public void init(int windowNo, GridTab mTab) {
super.init(windowNo, mTab);
dialog = new VPaymentFormDialog(this, windowNo); dialog = new VPaymentFormDialog(this, windowNo);
init(); init();
} }

View File

@ -50,12 +50,8 @@ public abstract class VPaymentFormDirect extends PaymentFormDirect implements Ac
private CLabel tRoutingText = new CLabel(); private CLabel tRoutingText = new CLabel();
private CLabel tNumberText = new CLabel(); private CLabel tNumberText = new CLabel();
public VPaymentFormDirect(boolean isDebit) { public VPaymentFormDirect(int windowNo, GridTab mTab, boolean isDebit) {
super(isDebit); super(windowNo, mTab, isDebit);
}
public void init(int windowNo, GridTab mTab) {
super.init(windowNo, mTab);
dialog = new VPaymentFormDialog(this, windowNo); dialog = new VPaymentFormDialog(this, windowNo);
init(); init();
} }

View File

@ -15,6 +15,7 @@ package org.compiere.grid;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
/** /**
* *
* @author Elaine * @author Elaine
@ -22,8 +23,8 @@ import org.compiere.model.GridTab;
*/ */
public class VPaymentFormDirectDebit extends VPaymentFormDirect { public class VPaymentFormDirectDebit extends VPaymentFormDirect {
public VPaymentFormDirectDebit() { public VPaymentFormDirectDebit(int windowNo, GridTab mTab) {
super(true); super(windowNo, mTab, true);
} }
} }

View File

@ -15,6 +15,7 @@ package org.compiere.grid;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
/** /**
* *
* @author Elaine * @author Elaine
@ -22,7 +23,7 @@ import org.compiere.model.GridTab;
*/ */
public class VPaymentFormDirectDeposit extends VPaymentFormDirect { public class VPaymentFormDirectDeposit extends VPaymentFormDirect {
public VPaymentFormDirectDeposit() { public VPaymentFormDirectDeposit(int windowNo, GridTab mTab) {
super(false); super(windowNo, mTab, false);
} }
} }

View File

@ -13,8 +13,9 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import java.util.List;
import org.adempiere.base.Service; import org.adempiere.base.Service;
import org.adempiere.base.ServiceQuery;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
/** /**
@ -24,18 +25,15 @@ import org.compiere.model.GridTab;
*/ */
public class VPaymentFormFactory { 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) public static IPaymentForm create(int windowNo, GridTab mTab, String paymentRule)
{ {
IPaymentForm form = getPaymentForm(windowNo, mTab, paymentRule); IPaymentForm paymentForm = null;
if (form != null) List<IPaymentFormFactory> factories = Service.locator().list(IPaymentFormFactory.class).getServices();
form.init(windowNo, mTab); for (IPaymentFormFactory factory : factories) {
return form; paymentForm = factory.create(windowNo, mTab, paymentRule);
if (paymentForm != null)
break;
}
return paymentForm;
} }
} }

View File

@ -23,12 +23,8 @@ import org.compiere.model.GridTab;
public class VPaymentFormMixedPOS extends PaymentFormMixedPOS { public class VPaymentFormMixedPOS extends PaymentFormMixedPOS {
private VPaymentFormDialog dialog; private VPaymentFormDialog dialog;
public VPaymentFormMixedPOS() { public VPaymentFormMixedPOS(int windowNo, GridTab mTab) {
super(); super(windowNo, mTab);
}
public void init(int windowNo, GridTab mTab) {
super.init(windowNo, mTab);
dialog = new VPaymentFormDialog(this, windowNo); dialog = new VPaymentFormDialog(this, windowNo);
} }

View File

@ -37,12 +37,8 @@ public class VPaymentFormOnCredit extends PaymentFormOnCredit {
private CLabel pTermLabel = new CLabel(); private CLabel pTermLabel = new CLabel();
private CComboBox pTermCombo = new CComboBox(); private CComboBox pTermCombo = new CComboBox();
public VPaymentFormOnCredit() { public VPaymentFormOnCredit(int windowNo, GridTab mTab) {
super(); super(windowNo, mTab);
}
public void init(int windowNo, GridTab mTab) {
super.init(windowNo, mTab);
dialog = new VPaymentFormDialog(this, windowNo); dialog = new VPaymentFormDialog(this, windowNo);
init(); init();
} }

View File

@ -57,4 +57,4 @@ Bundle-Activator: org.adempiere.webui.WebUIActivator
Eclipse-ExtensibleAPI: true Eclipse-ExtensibleAPI: true
Eclipse-RegisterBuddy: org.zkoss.zk.library Eclipse-RegisterBuddy: org.zkoss.zk.library
Web-ContextPath: webui 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

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.zk.payment.form.factory">
<implementation class="org.adempiere.webui.apps.form.DefaultPaymentFormFactory"/>
<service>
<provide interface="org.compiere.grid.IPaymentFormFactory"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.zk.payment.form.cash">
<implementation class="org.adempiere.webui.apps.form.WPaymentFormCash"/>
<property name="paymentRule" type="String" value="B"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.zk.payment.form.check">
<implementation class="org.adempiere.webui.apps.form.WPaymentFormCheck"/>
<property name="paymentRule" type="String" value="S"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.zk.payment.form.creditcard">
<implementation class="org.adempiere.webui.apps.form.WPaymentFormCreditCard"/>
<property name="paymentRule" type="String" value="K"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.zk.payment.form.directdebit">
<implementation class="org.adempiere.webui.apps.form.WPaymentFormDirectDebit"/>
<property name="paymentRule" type="String" value="D"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.zk.payment.form.directdeposit">
<implementation class="org.adempiere.webui.apps.form.WPaymentFormDirectDeposit"/>
<property name="paymentRule" type="String" value="T"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.zk.payment.form.mixedpos">
<implementation class="org.adempiere.webui.apps.form.WPaymentFormMixedPOS"/>
<property name="paymentRule" type="String" value="M"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.zk.payment.form.oncredit">
<implementation class="org.adempiere.webui.apps.form.WPaymentFormOnCredit"/>
<property name="paymentRule" type="String" value="P"/>
<service>
<provide interface="org.compiere.grid.IPaymentForm"/>
</service>
</scr:component>

View File

@ -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;
}
}

View File

@ -61,12 +61,8 @@ public class WPaymentFormCash extends PaymentFormCash implements EventListener<E
private Label bAmountLabel = new Label(); private Label bAmountLabel = new Label();
private WNumberEditor bAmountField = new WNumberEditor(); private WNumberEditor bAmountField = new WNumberEditor();
public WPaymentFormCash() { public WPaymentFormCash(int windowNo, GridTab mTab) {
super(); super(windowNo, mTab);
}
public void init(int windowNo, GridTab mTab) {
super.init(windowNo, mTab);
bDateField = new WDateEditor("DateAcct", false, false, true, "DateAcct"); bDateField = new WDateEditor("DateAcct", false, false, true, "DateAcct");
window = new WPaymentFormWindow(this, windowNo); window = new WPaymentFormWindow(this, windowNo);
init(); init();

View File

@ -27,7 +27,6 @@ import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem; import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory; import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
@ -72,14 +71,9 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
private Label sCheckLabel = new Label(); private Label sCheckLabel = new Label();
private Button sOnline = new Button(); private Button sOnline = new Button();
private Label sStatus = new Label(); private Label sStatus = new Label();
private Panel customizePanel = new Panel();
public WPaymentFormCheck() { public WPaymentFormCheck(int windowNo, GridTab mTab) {
super(); super(windowNo, mTab);
}
public void init(int windowNo, GridTab mTab) {
super.init(windowNo, mTab);
window = new WPaymentFormWindow(this, windowNo); window = new WPaymentFormWindow(this, windowNo);
init(); init();
} }
@ -140,9 +134,6 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
row.appendChild(sCheckLabel.rightAlign()); row.appendChild(sCheckLabel.rightAlign());
row.appendChild(sCheckField); row.appendChild(sCheckField);
row = rows.newRow();
row.appendCellChild(customizePanel, 2);
row = rows.newRow(); row = rows.newRow();
row.appendChild(new Space()); row.appendChild(new Space());
row.appendChild(sOnline); row.appendChild(sOnline);
@ -321,9 +312,4 @@ public class WPaymentFormCheck extends PaymentFormCheck implements EventListener
public Object getWindow() { public Object getWindow() {
return window; return window;
} }
@Override
public Object getCustomizePanel() {
return customizePanel;
}
} }

View File

@ -26,7 +26,6 @@ import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem; import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory; import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
@ -68,14 +67,9 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
private Textbox kApprovalField = new Textbox(); private Textbox kApprovalField = new Textbox();
private Button kOnline = new Button(); private Button kOnline = new Button();
private Label kStatus = new Label(); private Label kStatus = new Label();
private Panel customizePanel = new Panel();
public WPaymentFormCreditCard() { public WPaymentFormCreditCard(int windowNo, GridTab mTab) {
super(); super(windowNo, mTab);
}
public void init(int windowNo, GridTab mTab) {
super.init(windowNo, mTab);
window = new WPaymentFormWindow(this, windowNo); window = new WPaymentFormWindow(this, windowNo);
init(); init();
} }
@ -132,9 +126,6 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
row.appendChild(kApprovalLabel.rightAlign()); row.appendChild(kApprovalLabel.rightAlign());
row.appendChild(kApprovalField); row.appendChild(kApprovalField);
row = rows.newRow();
row.appendCellChild(customizePanel, 2);
row = rows.newRow(); row = rows.newRow();
row.appendChild(new Space()); row.appendChild(new Space());
row.appendChild(kOnline); row.appendChild(kOnline);
@ -314,9 +305,4 @@ public class WPaymentFormCreditCard extends PaymentFormCreditCard implements Eve
public Object getWindow() { public Object getWindow() {
return window; return window;
} }
@Override
public Object getCustomizePanel() {
return customizePanel;
}
} }

View File

@ -25,7 +25,6 @@ import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem; import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.ListboxFactory; import org.adempiere.webui.component.ListboxFactory;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
@ -59,14 +58,9 @@ public abstract class WPaymentFormDirect extends PaymentFormDirect implements Ev
private Label tStatus = new Label(); private Label tStatus = new Label();
private Label tRoutingText = new Label(); private Label tRoutingText = new Label();
private Label tNumberText = new Label(); private Label tNumberText = new Label();
private Panel customizePanel = new Panel();
public WPaymentFormDirect(boolean isDebit) { public WPaymentFormDirect(int windowNo, GridTab mTab, boolean isDebit) {
super(isDebit); super(windowNo, mTab, isDebit);
}
public void init(int windowNo, GridTab mTab) {
super.init(windowNo, mTab);
window = new WPaymentFormWindow(this, windowNo); window = new WPaymentFormWindow(this, windowNo);
init(); init();
} }
@ -108,9 +102,6 @@ public abstract class WPaymentFormDirect extends PaymentFormDirect implements Ev
row.appendChild(tNumberText.rightAlign()); row.appendChild(tNumberText.rightAlign());
row.appendChild(tNumberField); row.appendChild(tNumberField);
row = rows.newRow();
row.appendCellChild(customizePanel, 2);
row = rows.newRow(); row = rows.newRow();
row.appendChild(new Space()); row.appendChild(new Space());
row.appendChild(tOnline); row.appendChild(tOnline);
@ -191,9 +182,4 @@ public abstract class WPaymentFormDirect extends PaymentFormDirect implements Ev
public Object getWindow() { public Object getWindow() {
return window; return window;
} }
@Override
public Object getCustomizePanel() {
return customizePanel;
}
} }

View File

@ -15,6 +15,7 @@ package org.adempiere.webui.apps.form;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
/** /**
* *
* @author Elaine * @author Elaine
@ -22,7 +23,7 @@ import org.compiere.model.GridTab;
*/ */
public class WPaymentFormDirectDebit extends WPaymentFormDirect { public class WPaymentFormDirectDebit extends WPaymentFormDirect {
public WPaymentFormDirectDebit() { public WPaymentFormDirectDebit(int windowNo, GridTab mTab) {
super(true); super(windowNo, mTab, true);
} }
} }

View File

@ -15,6 +15,7 @@ package org.adempiere.webui.apps.form;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
/** /**
* *
* @author Elaine * @author Elaine
@ -22,7 +23,7 @@ import org.compiere.model.GridTab;
*/ */
public class WPaymentFormDirectDeposit extends WPaymentFormDirect { public class WPaymentFormDirectDeposit extends WPaymentFormDirect {
public WPaymentFormDirectDeposit() { public WPaymentFormDirectDeposit(int windowNo, GridTab mTab) {
super(false); super(windowNo, mTab, false);
} }
} }

View File

@ -13,9 +13,11 @@
*****************************************************************************/ *****************************************************************************/
package org.adempiere.webui.apps.form; package org.adempiere.webui.apps.form;
import java.util.List;
import org.adempiere.base.Service; import org.adempiere.base.Service;
import org.adempiere.base.ServiceQuery;
import org.compiere.grid.IPaymentForm; import org.compiere.grid.IPaymentForm;
import org.compiere.grid.IPaymentFormFactory;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
/** /**
@ -25,18 +27,15 @@ import org.compiere.model.GridTab;
*/ */
public class WPaymentFormFactory { public class WPaymentFormFactory {
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) public static IPaymentForm create(int windowNo, GridTab mTab, String paymentRule)
{ {
IPaymentForm form = getPaymentForm(windowNo, mTab, paymentRule); IPaymentForm paymentForm = null;
if (form != null) List<IPaymentFormFactory> factories = Service.locator().list(IPaymentFormFactory.class).getServices();
form.init(windowNo, mTab); for (IPaymentFormFactory factory : factories) {
return form; paymentForm = factory.create(windowNo, mTab, paymentRule);
if (paymentForm != null)
break;
}
return paymentForm;
} }
} }

View File

@ -25,12 +25,8 @@ public class WPaymentFormMixedPOS extends PaymentFormMixedPOS {
private WPaymentFormWindow window; private WPaymentFormWindow window;
public WPaymentFormMixedPOS() { public WPaymentFormMixedPOS(int windowNo, GridTab mTab) {
super(); super(windowNo, mTab);
}
public void init(int windowNo, GridTab mTab) {
super.init(windowNo, mTab);
window = new WPaymentFormWindow(this, windowNo); window = new WPaymentFormWindow(this, windowNo);
} }

View File

@ -43,12 +43,8 @@ public class WPaymentFormOnCredit extends PaymentFormOnCredit {
private Label pTermLabel = new Label(); private Label pTermLabel = new Label();
private Listbox pTermCombo = ListboxFactory.newDropdownListbox(); private Listbox pTermCombo = ListboxFactory.newDropdownListbox();
public WPaymentFormOnCredit() { public WPaymentFormOnCredit(int windowNo, GridTab mTab) {
super(); super(windowNo, mTab);
}
public void init(int windowNo, GridTab mTab) {
super.init(windowNo, mTab);
window = new WPaymentFormWindow(this, windowNo); window = new WPaymentFormWindow(this, windowNo);
init(); init();
} }

View File

@ -28,13 +28,7 @@ bin.includes = META-INF/,\
OSGI-INF/defaulteditorfactory.xml,\ OSGI-INF/defaulteditorfactory.xml,\
OSGI-INF/jrviewerprovider.xml,\ OSGI-INF/jrviewerprovider.xml,\
OSGI-INF/resourcefinder.xml,\ OSGI-INF/resourcefinder.xml,\
OSGI-INF/paymentformcash.xml,\ OSGI-INF/defaultpaymentformfactory.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
src.includes = WEB-INF/classes/,\ src.includes = WEB-INF/classes/,\
WEB-INF/tld/,\ WEB-INF/tld/,\
WEB-INF/web.xml,\ WEB-INF/web.xml,\

View File

@ -13,12 +13,10 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.grid; package org.compiere.grid;
import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor; import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.PO;
public interface IPaymentForm { public interface IPaymentForm {
public void init(int WindowNo, GridTab mTab);
public boolean dynInit() throws Exception; public boolean dynInit() throws Exception;
@ -50,9 +48,7 @@ public interface IPaymentForm {
public Object getWindow(); public Object getWindow();
public Object getCustomizePanel(); public void setCustomizeValues(PO po);
public void setCustomizeValues();
public void setBankAccountProcessor(MBankAccountProcessor bankAccountProcessor); public void setBankAccountProcessor(MBankAccountProcessor bankAccountProcessor);
} }

View File

@ -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);
}

View File

@ -27,6 +27,7 @@ import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor; import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MPaymentProcessor; import org.compiere.model.MPaymentProcessor;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
import org.compiere.model.PO;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -77,10 +78,7 @@ public abstract class PaymentForm implements IPaymentForm {
public Hashtable<Integer,KeyNamePair> s_Currencies = null; public Hashtable<Integer,KeyNamePair> s_Currencies = null;
public PaymentForm() { public PaymentForm(int WindowNo, GridTab mTab) {
}
public void init(int WindowNo, GridTab mTab) {
m_WindowNo = WindowNo; m_WindowNo = WindowNo;
m_isSOTrx = "Y".equals(Env.getContext(Env.getCtx(), WindowNo, "IsSOTrx")); m_isSOTrx = "Y".equals(Env.getContext(Env.getCtx(), WindowNo, "IsSOTrx"));
m_mTab = mTab; m_mTab = mTab;
@ -295,13 +293,7 @@ public abstract class PaymentForm implements IPaymentForm {
} }
@Override @Override
public Object getCustomizePanel() public void setCustomizeValues(PO po)
{
return null;
}
@Override
public void setCustomizeValues()
{ {
} }

View File

@ -57,7 +57,8 @@ public abstract class PaymentFormCash extends PaymentForm {
/** Start CashBook */ /** Start CashBook */
public int m_C_CashBook_ID = 0; public int m_C_CashBook_ID = 0;
public PaymentFormCash() { public PaymentFormCash(int windowNo, GridTab mTab) {
super(windowNo, mTab);
} }
@Override @Override

View File

@ -48,7 +48,8 @@ public abstract class PaymentFormCheck extends PaymentForm {
/** Start Bank Account */ /** Start Bank Account */
public int m_C_BankAccount_ID = 0; public int m_C_BankAccount_ID = 0;
public PaymentFormCheck() { public PaymentFormCheck(int windowNo, GridTab mTab) {
super(windowNo, mTab);
} }
@Override @Override
@ -227,7 +228,7 @@ public abstract class PaymentFormCheck extends PaymentForm {
} }
m_mPayment.setDateTrx(m_DateAcct); m_mPayment.setDateTrx(m_DateAcct);
m_mPayment.setDateAcct(m_DateAcct); m_mPayment.setDateAcct(m_DateAcct);
setCustomizeValues(); setCustomizeValues(m_mPayment);
m_mPayment.saveEx(); m_mPayment.saveEx();
// Save/Post // Save/Post

View File

@ -45,7 +45,8 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
/** Start CreditCard */ /** Start CreditCard */
public String m_CCType = ""; public String m_CCType = "";
public PaymentFormCreditCard() { public PaymentFormCreditCard(int windowNo, GridTab mTab) {
super(windowNo, mTab);
} }
@Override @Override
@ -286,7 +287,7 @@ public abstract class PaymentFormCreditCard extends PaymentForm {
} }
m_mPayment.setDateTrx(m_DateAcct); m_mPayment.setDateTrx(m_DateAcct);
m_mPayment.setDateAcct(m_DateAcct); m_mPayment.setDateAcct(m_DateAcct);
setCustomizeValues(); setCustomizeValues(m_mPayment);
if (!m_mPayment.isOnline() && !m_mPayment.isApproved()) 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_Order_ID(C_Order_ID);
mpt.setC_Invoice_ID(C_Invoice_ID); mpt.setC_Invoice_ID(C_Invoice_ID);
mpt.setDateTrx(m_DateAcct); mpt.setDateTrx(m_DateAcct);
setCustomizeValues(); setCustomizeValues(mpt);
if (!mpt.save()) { if (!mpt.save()) {
processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated"); processMsg = Msg.getMsg(Env.getCtx(), "PaymentNotCreated");
return false; return false;

View File

@ -45,7 +45,8 @@ public abstract class PaymentFormDirect extends PaymentForm {
public MPayment m_mPayment = null; public MPayment m_mPayment = null;
public MPayment m_mPaymentOriginal = 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; 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.setDateTrx(m_DateAcct);
m_mPayment.setDateAcct(m_DateAcct); m_mPayment.setDateAcct(m_DateAcct);
setCustomizeValues(); setCustomizeValues(m_mPayment);
m_mPayment.saveEx(); m_mPayment.saveEx();
// Save/Post // Save/Post

View File

@ -15,6 +15,7 @@ package org.compiere.grid;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
/** /**
* *
* @author Elaine * @author Elaine
@ -22,6 +23,7 @@ import org.compiere.model.GridTab;
*/ */
public abstract class PaymentFormMixedPOS extends PaymentForm { public abstract class PaymentFormMixedPOS extends PaymentForm {
public PaymentFormMixedPOS() { public PaymentFormMixedPOS(int windowNo, GridTab mTab) {
super(windowNo, mTab);
} }
} }

View File

@ -34,7 +34,8 @@ public abstract class PaymentFormOnCredit extends PaymentForm {
/** Start Payment Term */ /** Start Payment Term */
public int m_C_PaymentTerm_ID = 0; public int m_C_PaymentTerm_ID = 0;
public PaymentFormOnCredit() { public PaymentFormOnCredit(int windowNo, GridTab mTab) {
super(windowNo, mTab);
} }
@Override @Override