From 2f95568b070fbdbce181b365c44d70de05405bbc Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 6 Feb 2012 22:34:17 -0500 Subject: [PATCH] IDEMPIERE-92 fix problem opening Accounting Dimensions window on zk --- .../adempiere/webui/AdempiereIdGenerator.java | 12 +++++----- .../org/adempiere/webui/panel/ADTabpanel.java | 2 +- .../adempiere/webui/panel/ADTreePanel.java | 15 +++++++++--- .../webui/panel/TreeSearchPanel.java | 23 +++++++++++++++---- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereIdGenerator.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereIdGenerator.java index 5b599cb1c5..2af4bc4987 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereIdGenerator.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereIdGenerator.java @@ -46,12 +46,12 @@ public class AdempiereIdGenerator implements IdGenerator { } matcher.appendTail(sb); prefix = sb.toString(); - } - if (prefix.startsWith("unq")) { // prefix already guaranteed unique - if (desktop.getComponentByUuidIfAny(prefix) == null) { // but don't trust and look to avoid dups - return prefix; - } else { - prefix = "not" + prefix; // set notunq as the prefix to let dev know something is wrong + if (prefix.startsWith("unq")) { // prefix already guaranteed unique + if (desktop.getComponentByUuidIfAny(prefix) == null) { // but don't trust and look to avoid dups + return prefix; + } else { + prefix = "not" + prefix; // set notunq as the prefix to let dev know something is wrong + } } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java index a564d60336..05f0f87e4b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java @@ -204,7 +204,7 @@ DataStatusListener, IADTabpanel, VetoableChangeListener layout.setParent(this); layout.setStyle("width: 100%; height: 100%; position: absolute;"); - treePanel = new ADTreePanel(); + treePanel = new ADTreePanel(windowNo, gridTab.getTabNo()); West west = new West(); west.appendChild(treePanel); west.setWidth("300px"); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTreePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTreePanel.java index 636fe6f4a2..4b5d5841e8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTreePanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTreePanel.java @@ -34,20 +34,29 @@ import org.zkoss.zul.Tree; */ public class ADTreePanel extends Panel implements EventListener { - /** + /** * */ - private static final long serialVersionUID = 5473705529310157142L; + private static final long serialVersionUID = -3046550099597437942L; private TreeSearchPanel pnlSearch; private Tree tree; private Checkbox chkExpand; // Elaine 2009/02/27 - expand tree + private int m_windowno = -1; + private int m_tabno = -1; public ADTreePanel() { init(); } + public ADTreePanel(int windowno, int tabno) + { + m_windowno = windowno; + m_tabno = tabno; + init(); + } + /** * @param AD_Tree_ID * @param windowNo @@ -71,7 +80,7 @@ public class ADTreePanel extends Panel implements EventListener tree.setStyle("border: none"); - pnlSearch = new TreeSearchPanel(tree, Events.ON_SELECT); + pnlSearch = new TreeSearchPanel(tree, Events.ON_SELECT, m_windowno, m_tabno); Toolbar toolbar = new Toolbar(); toolbar.appendChild(pnlSearch); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/TreeSearchPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/TreeSearchPanel.java index ca419c7982..55807c1c6c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/TreeSearchPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/TreeSearchPanel.java @@ -50,10 +50,10 @@ import org.zkoss.zul.event.TreeDataListener; */ public class TreeSearchPanel extends Panel implements EventListener, TreeDataListener { - /** + /** * */ - private static final long serialVersionUID = -1788127438140771622L; + private static final long serialVersionUID = 3478451169922775667L; private TreeMap treeNodeItemMap = new TreeMap(); private String[] treeValues; private String[] treeDescription; @@ -64,6 +64,8 @@ public class TreeSearchPanel extends Panel implements EventListener, TreeDataLis private Tree tree; private String eventToFire; + private int m_windowno = 0; + private int m_tabno = 0; private static final String PREFIX_DOCUMENT_SEARCH = "/"; @@ -87,6 +89,20 @@ public class TreeSearchPanel extends Panel implements EventListener, TreeDataLis init(); } + /** + * @param tree + * @param event + */ + public TreeSearchPanel(Tree tree, String event, int windowno, int tabno) + { + super(); + this.tree = tree; + this.eventToFire = event; + m_windowno = windowno; + m_tabno = tabno; + init(); + } + private void init() { Div div = new Div(); @@ -103,8 +119,7 @@ public class TreeSearchPanel extends Panel implements EventListener, TreeDataLis cmbSearch = new AutoComplete(); cmbSearch.setAutodrop(true); - cmbSearch.setId("cmbSearch"); - cmbSearch.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, cmbSearch.getId()); + cmbSearch.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unqCmbSearch" + "_" + m_windowno + "_" + m_tabno); cmbSearch.addEventListener(Events.ON_CHANGE, this); if (AEnv.isInternetExplorer())