From 5832e19b79767c4910bc529e44630437dfdf3692 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 23 Nov 2010 18:34:00 +0800 Subject: [PATCH] Minor info product window search enhancement. --- .../org/adempiere/webui/panel/InfoPanel.java | 4 +-- .../webui/panel/InfoProductPanel.java | 28 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java index 741e2ff5fa..d3c2a86550 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java @@ -356,7 +356,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM protected WListbox contentPanel = new WListbox(); protected Paging paging; protected int pageNo; - private int m_count; + protected int m_count; private int cacheStart; private int cacheEnd; private boolean m_useDatabasePaging = false; @@ -656,7 +656,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM * Test Row Count * @return true if display */ - private boolean testCount() + protected boolean testCount() { long start = System.currentTimeMillis(); String dynWhere = getSQLWhere(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java index cba98e0308..c7c870ad01 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java @@ -95,7 +95,7 @@ import org.zkoss.zkex.zul.South; public class InfoProductPanel extends InfoPanel implements EventListener { /** - * + * */ private static final long serialVersionUID = 6804975825156657866L; private Label lblValue = new Label(); @@ -194,7 +194,7 @@ public class InfoProductPanel extends InfoPanel implements EventListener // initComponents(); init(); - initInfo (value, M_Warehouse_ID, M_PriceList_ID); + initInfo (M_Warehouse_ID, M_PriceList_ID); m_C_BPartner_ID = Env.getContextAsInt(Env.getCtx(), windowNo, "C_BPartner_ID"); int no = contentPanel.getRowCount(); @@ -203,6 +203,14 @@ public class InfoProductPanel extends InfoPanel implements EventListener // AutoQuery if (value != null && value.length() > 0) { + // Set Value or Name + fieldValue.setText(value); + testCount(); + if (m_count <= 0) { + fieldValue.setText(""); + fieldName.setValue(value); + } + executeQuery(); renderItems(); } @@ -326,13 +334,13 @@ public class InfoProductPanel extends InfoPanel implements EventListener row.appendChild(pickProductCategory); row.appendChild(lblAS.rightAlign()); row.appendChild(pickAS); - + row = new Row(); rows.appendChild(row); row.appendChild(statusBar); row.setSpans("6"); statusBar.setEastVisibility(false); - + // Product Attribute Instance m_PAttributeButton = confirmPanel.createButton(ConfirmPanel.A_PATTRIBUTE); confirmPanel.addComponentsLeft(m_PAttributeButton); @@ -609,20 +617,14 @@ public class InfoProductPanel extends InfoPanel implements EventListener /** * Dynamic Init * - * @param value value * @param M_Warehouse_ID warehouse * @param M_PriceList_ID price list */ - private void initInfo (String value, int M_Warehouse_ID, int M_PriceList_ID) + private void initInfo (int M_Warehouse_ID, int M_PriceList_ID) { // Pick init fillPicks(M_PriceList_ID); int M_PriceList_Version_ID = findPLV (M_PriceList_ID); - // Set Value or Name - if (value.startsWith("@") && value.endsWith("@")) - fieldName.setText(value.substring(1,value.length()-1)); - else - fieldValue.setText(value); // Set Warehouse if (M_Warehouse_ID == 0) M_Warehouse_ID = Env.getContextAsInt(Env.getCtx(), "#M_Warehouse_ID"); @@ -1450,7 +1452,7 @@ public class InfoProductPanel extends InfoPanel implements EventListener return M_Product_Category_ID; } // - + public int getM_AttributeSet_ID() { int M_AttributeSet_ID = 0; @@ -1461,5 +1463,5 @@ public class InfoProductPanel extends InfoPanel implements EventListener return M_AttributeSet_ID; } - + } // InfoProduct