IDEMPIERE-92 fix problem opening Accounting Dimensions window on zk

This commit is contained in:
Carlos Ruiz 2012-02-06 22:34:17 -05:00
parent d3d8114786
commit 2f95568b07
4 changed files with 38 additions and 14 deletions

View File

@ -46,12 +46,12 @@ public class AdempiereIdGenerator implements IdGenerator {
} }
matcher.appendTail(sb); matcher.appendTail(sb);
prefix = sb.toString(); prefix = sb.toString();
} if (prefix.startsWith("unq")) { // prefix already guaranteed unique
if (prefix.startsWith("unq")) { // prefix already guaranteed unique if (desktop.getComponentByUuidIfAny(prefix) == null) { // but don't trust and look to avoid dups
if (desktop.getComponentByUuidIfAny(prefix) == null) { // but don't trust and look to avoid dups return prefix;
return prefix; } else {
} else { prefix = "not" + prefix; // set notunq as the prefix to let dev know something is wrong
prefix = "not" + prefix; // set notunq as the prefix to let dev know something is wrong }
} }
} }

View File

@ -204,7 +204,7 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
layout.setParent(this); layout.setParent(this);
layout.setStyle("width: 100%; height: 100%; position: absolute;"); layout.setStyle("width: 100%; height: 100%; position: absolute;");
treePanel = new ADTreePanel(); treePanel = new ADTreePanel(windowNo, gridTab.getTabNo());
West west = new West(); West west = new West();
west.appendChild(treePanel); west.appendChild(treePanel);
west.setWidth("300px"); west.setWidth("300px");

View File

@ -34,20 +34,29 @@ import org.zkoss.zul.Tree;
*/ */
public class ADTreePanel extends Panel implements EventListener public class ADTreePanel extends Panel implements EventListener
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 5473705529310157142L; private static final long serialVersionUID = -3046550099597437942L;
private TreeSearchPanel pnlSearch; private TreeSearchPanel pnlSearch;
private Tree tree; private Tree tree;
private Checkbox chkExpand; // Elaine 2009/02/27 - expand tree private Checkbox chkExpand; // Elaine 2009/02/27 - expand tree
private int m_windowno = -1;
private int m_tabno = -1;
public ADTreePanel() public ADTreePanel()
{ {
init(); init();
} }
public ADTreePanel(int windowno, int tabno)
{
m_windowno = windowno;
m_tabno = tabno;
init();
}
/** /**
* @param AD_Tree_ID * @param AD_Tree_ID
* @param windowNo * @param windowNo
@ -71,7 +80,7 @@ public class ADTreePanel extends Panel implements EventListener
tree.setStyle("border: none"); 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 toolbar = new Toolbar();
toolbar.appendChild(pnlSearch); toolbar.appendChild(pnlSearch);

View File

@ -50,10 +50,10 @@ import org.zkoss.zul.event.TreeDataListener;
*/ */
public class TreeSearchPanel extends Panel implements EventListener, TreeDataListener public class TreeSearchPanel extends Panel implements EventListener, TreeDataListener
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -1788127438140771622L; private static final long serialVersionUID = 3478451169922775667L;
private TreeMap<String, Object> treeNodeItemMap = new TreeMap<String, Object>(); private TreeMap<String, Object> treeNodeItemMap = new TreeMap<String, Object>();
private String[] treeValues; private String[] treeValues;
private String[] treeDescription; private String[] treeDescription;
@ -64,6 +64,8 @@ public class TreeSearchPanel extends Panel implements EventListener, TreeDataLis
private Tree tree; private Tree tree;
private String eventToFire; private String eventToFire;
private int m_windowno = 0;
private int m_tabno = 0;
private static final String PREFIX_DOCUMENT_SEARCH = "/"; private static final String PREFIX_DOCUMENT_SEARCH = "/";
@ -87,6 +89,20 @@ public class TreeSearchPanel extends Panel implements EventListener, TreeDataLis
init(); 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() private void init()
{ {
Div div = new Div(); Div div = new Div();
@ -103,8 +119,7 @@ public class TreeSearchPanel extends Panel implements EventListener, TreeDataLis
cmbSearch = new AutoComplete(); cmbSearch = new AutoComplete();
cmbSearch.setAutodrop(true); cmbSearch.setAutodrop(true);
cmbSearch.setId("cmbSearch"); cmbSearch.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unqCmbSearch" + "_" + m_windowno + "_" + m_tabno);
cmbSearch.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, cmbSearch.getId());
cmbSearch.addEventListener(Events.ON_CHANGE, this); cmbSearch.addEventListener(Events.ON_CHANGE, this);
if (AEnv.isInternetExplorer()) if (AEnv.isInternetExplorer())