From f489fc76e2ab0691a0827cf1a6a0dda63c1c58e2 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 31 Oct 2012 09:37:27 -0500 Subject: [PATCH] IDEMPIERE-392 Redesign payment button - reuse SystemIDs --- .../src/org/adempiere/util/ModelClassGenerator.java | 5 +++-- .../src/org/compiere/model/MPaymentLookup.java | 6 +++--- .../src/org/compiere/model/SystemIDs.java | 7 ++++--- .../src/org/compiere/grid/ed/VButton.java | 10 +++++++--- .../src/org/adempiere/webui/editor/WButtonEditor.java | 10 +++++++--- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/org.adempiere.base/src/org/adempiere/util/ModelClassGenerator.java b/org.adempiere.base/src/org/adempiere/util/ModelClassGenerator.java index a5e0a29e5b..60ce8359fa 100644 --- a/org.adempiere.base/src/org/adempiere/util/ModelClassGenerator.java +++ b/org.adempiere.base/src/org/adempiere/util/ModelClassGenerator.java @@ -19,6 +19,8 @@ *****************************************************************************/ package org.adempiere.util; +import static org.compiere.model.SystemIDs.REFERENCE_PAYMENTRULE; + import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; @@ -35,7 +37,6 @@ import java.util.logging.Level; import org.adempiere.exceptions.DBException; import org.compiere.Adempiere; -import org.compiere.model.MPaymentLookup; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.DisplayType; @@ -429,7 +430,7 @@ public class ModelClassGenerator // Payment Validation if (displayType == DisplayType.Payment) { - String staticVar = addListValidation (sb, MPaymentLookup.PAYMENTRULE_AD_Reference_ID, columnName); + String staticVar = addListValidation (sb, REFERENCE_PAYMENTRULE, columnName); sb.insert(0, staticVar); } diff --git a/org.adempiere.base/src/org/compiere/model/MPaymentLookup.java b/org.adempiere.base/src/org/compiere/model/MPaymentLookup.java index e696a4aaca..1aad341ce0 100644 --- a/org.adempiere.base/src/org/compiere/model/MPaymentLookup.java +++ b/org.adempiere.base/src/org/compiere/model/MPaymentLookup.java @@ -13,6 +13,8 @@ *****************************************************************************/ package org.compiere.model; +import static org.compiere.model.SystemIDs.REFERENCE_PAYMENTRULE; + import java.io.Serializable; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -38,8 +40,6 @@ public class MPaymentLookup extends Lookup implements Serializable { * */ private static final long serialVersionUID = -6863672221350217533L; - - public static final int PAYMENTRULE_AD_Reference_ID = 195; /** Context */ private Properties m_ctx; @@ -136,7 +136,7 @@ public class MPaymentLookup extends Lookup implements Serializable { try { pstmt = DB.prepareStatement(sb.toString(), null); - pstmt.setInt(1, PAYMENTRULE_AD_Reference_ID); + pstmt.setInt(1, REFERENCE_PAYMENTRULE); if (!isBaseLanguage) pstmt.setString(2, ad_language); rs = pstmt.executeQuery(); diff --git a/org.adempiere.base/src/org/compiere/model/SystemIDs.java b/org.adempiere.base/src/org/compiere/model/SystemIDs.java index a225d2b4fd..e72eee1bc8 100644 --- a/org.adempiere.base/src/org/compiere/model/SystemIDs.java +++ b/org.adempiere.base/src/org/compiere/model/SystemIDs.java @@ -112,10 +112,11 @@ public class SystemIDs public final static int REFERENCE_DATATYPE_URL = 40; public final static int REFERENCE_DATATYPE_YES_NO = 20; - public static final int REFERENCE_AD_USER = 110; + public final static int REFERENCE_AD_USER = 110; public final static int REFERENCE_DOCUMENTACTION = 135; public final static int REFERENCE_PAYMENTRULE = 195; public final static int REFERENCE_POSTING_TYPE = 125; + public final static int REFERENCE_POSTED = 234; public final static int REFERENCE_YESNO = 319; public final static int REFERENCE_WIZARDSTATUS = 200003; @@ -134,7 +135,7 @@ public class SystemIDs public final static int USER_SYSTEM = 0; public final static int WINDOW_ACCOUNTCOMBINATION = 153; - public static final int WINDOW_CUSTOMERRETURN = 53097; + public final static int WINDOW_CUSTOMERRETURN = 53097; public final static int WINDOW_INVENTORYMOVE = 170; public final static int WINDOW_LOT = 257; public final static int WINDOW_MATERIALRECEIPT = 184; @@ -144,7 +145,7 @@ public class SystemIDs public final static int WINDOW_PRINTFORMAT = 240; public final static int WINDOW_PRODUCTION = 191; public final static int WINDOW_REQUESTS_ALL = 232; - public static final int WINDOW_RETURNTOVENDOR = 53098; + public final static int WINDOW_RETURNTOVENDOR = 53098; public final static int WINDOW_SHIPMENT_CUSTOMER = 169; public final static int WINDOW_WAREHOUSE_LOCATOR = 139; public final static int WINDOW_WINDOW_TAB_FIELD = 102; diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VButton.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VButton.java index 60eebae0ca..2d0698e655 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VButton.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VButton.java @@ -16,6 +16,10 @@ *****************************************************************************/ package org.compiere.grid.ed; +import static org.compiere.model.SystemIDs.REFERENCE_DOCUMENTACTION; +import static org.compiere.model.SystemIDs.REFERENCE_PAYMENTRULE; +import static org.compiere.model.SystemIDs.REFERENCE_POSTED; + import java.awt.Color; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; @@ -88,13 +92,13 @@ public final class VButton extends CButton // Special Buttons if (columnName.equals("PaymentRule")) { - readReference(195); + readReference(REFERENCE_PAYMENTRULE); this.setForeground(Color.blue); setIcon(Env.getImageIcon("Payment16.gif")); // 29*14 } else if (columnName.equals("DocAction")) { - readReference(135); + readReference(REFERENCE_DOCUMENTACTION); this.setForeground(Color.blue); setIcon(Env.getImageIcon("Process16.gif")); // 16*16 } @@ -109,7 +113,7 @@ public final class VButton extends CButton } else if (columnName.equals("Posted")) { - readReference(234); + readReference(REFERENCE_POSTED); this.setForeground(Color.magenta); setIcon(Env.getImageIcon("InfoAccount16.gif")); // 16*16 } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WButtonEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WButtonEditor.java index f618aa079a..0ea7fe495a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WButtonEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WButtonEditor.java @@ -17,6 +17,10 @@ package org.adempiere.webui.editor; +import static org.compiere.model.SystemIDs.REFERENCE_DOCUMENTACTION; +import static org.compiere.model.SystemIDs.REFERENCE_PAYMENTRULE; +import static org.compiere.model.SystemIDs.REFERENCE_POSTED; + import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -111,12 +115,12 @@ public class WButtonEditor extends WEditor implements IProcessButton String columnName = super.getColumnName(); if (columnName.equals("PaymentRule")) { - readReference(195); + readReference(REFERENCE_PAYMENTRULE); getComponent().setImage("/images/Payment16.png"); // 29*14 } else if (columnName.equals("DocAction")) { - readReference(135); + readReference(REFERENCE_DOCUMENTACTION); getComponent().setImage("/images/Process16.png"); // 16*16 } else if (columnName.equals("CreateFrom")) @@ -130,7 +134,7 @@ public class WButtonEditor extends WEditor implements IProcessButton } else if (columnName.equals("Posted")) { - readReference(234); + readReference(REFERENCE_POSTED); getComponent().setImage("/images/InfoAccount16.png"); // 16*16 }