From a67d22109e02cf428464ea490c08f001cefe1cfc Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 10 Sep 2008 05:38:25 +0000 Subject: [PATCH] * Merge revisions 6398 from branches/adempiere341 --- .../org/adempiere/webui/editor/WSearchEditor.java | 10 ++++++++++ .../adempiere/webui/editor/WTableDirEditor.java | 2 ++ .../src/org/adempiere/webui/grid/WBPartner.java | 15 +++++---------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java b/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java index ba32675ca4..a3db1981e2 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java @@ -63,6 +63,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value private String columnName; private WEditorPopupMenu popupMenu; private Object value; + private InfoPanel infoPanel = null; private static CLogger log = CLogger.getCLogger(WSearchEditor.class); @@ -269,6 +270,11 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value } else if (WEditorPopupMenu.NEW_EVENT.equals(evt.getContextEvent())) { + if (infoPanel != null) + { + infoPanel.detach(); + infoPanel = null; + } actionBPartner(true); } } @@ -477,6 +483,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value ip.setClosable(true); ip.setAttribute("mode", "modal"); ip.addValueChangeListener(this); + infoPanel = ip; AEnv.showWindow(ip); } else if (col.equals("C_BPartner_ID")) @@ -498,6 +505,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value ip.setClosable(true); ip.setAttribute("mode", "modal"); ip.addValueChangeListener(this); + infoPanel = ip; AEnv.showWindow(ip); /* @@ -524,6 +532,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value ig.setClosable(true); ig.setAttribute("mode", "modal"); ig.addValueChangeListener(this); + infoPanel = ig; AEnv.showWindow(ig); cancelled = ig.isCancelled(); @@ -531,6 +540,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value } + infoPanel = null; // Result if (result != null) { diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java b/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java index 013c7ac960..7ea75f3b0f 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java @@ -168,6 +168,8 @@ ContextMenuListener, IZoomableEditor if (selItem != null) { retVal = selItem.getValue(); + if ((retVal instanceof Integer) && (Integer)retVal == -1) + retVal = null; } return retVal; } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/grid/WBPartner.java b/zkwebui/WEB-INF/src/org/adempiere/webui/grid/WBPartner.java index 9fa63945b8..e397e055a4 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/grid/WBPartner.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/grid/WBPartner.java @@ -43,6 +43,7 @@ import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.WrongValueException; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; @@ -379,19 +380,13 @@ public class WBPartner extends Window implements EventListener, ValueChangeListe // Check Mandatory fields if (fName.getText().equals("")) { - fName.setStyle(BackgroundColours.ERROR); - return false; + throw new WrongValueException(fName, Msg.translate(Env.getCtx(), "FillMandatory")); } - else - fName.setStyle(BackgroundColours.MANDATORY); if (fAddress.getC_Location_ID() == 0) { - //fAddress.setBackground(Color)(BackgroundColours.ERROR); - return false; + throw new WrongValueException(fAddress.getComponent(), Msg.translate(Env.getCtx(), "FillMandatory")); } - //else - //fAddress.setBackground(AdempierePLAF.getFieldBackground_Mandatory()); // ***** Business Partner ***** @@ -421,7 +416,7 @@ public class WBPartner extends Window implements EventListener, ValueChangeListe m_partner.setName2(fName2.getText()); ListItem listitem = fGreetingBP.getSelectedItem(); - KeyNamePair p = (KeyNamePair)listitem.getValue(); + KeyNamePair p = listitem != null ? (KeyNamePair)listitem.getValue() : null; if (p != null && p.getKey() > 0) m_partner.setC_Greeting_ID(p.getKey()); @@ -467,7 +462,7 @@ public class WBPartner extends Window implements EventListener, ValueChangeListe m_user.setTitle(fTitle.getText()); listitem = fGreetingC.getSelectedItem(); - p = (KeyNamePair)listitem.getValue(); + p = listitem != null ? (KeyNamePair)listitem.getValue() : null; if (p != null && p.getKey() > 0) m_user.setC_Greeting_ID(p.getKey());