IDEMPIERE-943 Menu Lookup not showing dup names / Peer review

This commit is contained in:
Carlos Ruiz 2013-05-28 20:42:32 -05:00
parent bc9148858c
commit 2a9162fec2
3 changed files with 40 additions and 39 deletions

View File

@ -36,7 +36,7 @@ public class AutoComplete extends Combobox
/**
*
*/
private static final long serialVersionUID = 2642639623099513816L;
private static final long serialVersionUID = -6440285742490532737L;
/** comboItems All menu labels */
private String[] comboItems;
@ -45,7 +45,7 @@ public class AutoComplete extends Combobox
private String[] strDescription;
private String[] images;
private String[] contents;
/**
@ -85,7 +85,7 @@ public class AutoComplete extends Combobox
{
contents = vals;
}
public void setImages(String[] images)
{
this.images = images;
@ -164,7 +164,7 @@ public class AutoComplete extends Combobox
comboitem.setLabel(comboItems[i]);
comboitem.setDescription(strDescription[i]);
if (images != null && i < images.length && images[i] != null && images[i].trim().length() > 0)
{
comboitem.setImage(images[i]);

View File

@ -41,11 +41,11 @@ import org.zkoss.zul.Treeitem;
*
*/
public class MenuTreeSearchPanel extends TreeSearchPanel {
/**
* generated serial id
*
*/
private static final long serialVersionUID = 8785295166415073971L;
private static final long serialVersionUID = 3127547233019932429L;
protected Toolbarbutton newBtn;
protected Toolbarbutton openBtn;
protected boolean isNew = false;
@ -187,13 +187,13 @@ public class MenuTreeSearchPanel extends TreeSearchPanel {
imageList.add(mNode.getImagePath());
}
}
treeDescription = descriptionList.toArray(new String[0]);
treeValues = valueList.toArray(new String[0]);
treeImages = imageList.toArray(new String[0]);
treeTypes = typeList.toArray(new String[0]);
orderArrays();
cmbSearch.setDescription(treeDescription);
cmbSearch.setDict(treeValues);
cmbSearch.setImages(treeImages);
@ -221,33 +221,33 @@ public class MenuTreeSearchPanel extends TreeSearchPanel {
Events.postEvent(event);
Events.echoEvent(ON_POST_FIRE_TREE_EVENT, this, null);
}
protected void orderArrays()
{
String aux;
for (int i = 1; i < treeValues.length; i++)
{
for(int j = 0;j < treeValues.length-i;j++)
{
if(treeValues[j].compareTo(treeValues[j+1]) > 0)
{
aux = treeValues[j];
treeValues[j] = treeValues[j+1];
treeValues[j+1]=aux;
aux = treeDescription[j];
treeDescription[j] = treeDescription[j+1];
treeDescription[j+1]=aux;
aux = treeTypes[j];
treeTypes[j] = treeTypes[j+1];
treeTypes[j+1]=aux;
aux = treeImages[j];
treeImages[j] = treeImages[j+1];
treeImages[j+1]=aux;
}
}
for (int i = 1; i < treeValues.length; i++)
{
for (int j = 0; j < treeValues.length-i; j++)
{
if (treeValues[j].compareTo(treeValues[j+1]) > 0)
{
aux = treeValues[j];
treeValues[j] = treeValues[j+1];
treeValues[j+1]=aux;
aux = treeDescription[j];
treeDescription[j] = treeDescription[j+1];
treeDescription[j+1]=aux;
aux = treeTypes[j];
treeTypes[j] = treeTypes[j+1];
treeTypes[j+1]=aux;
aux = treeImages[j];
treeImages[j] = treeImages[j+1];
treeImages[j+1]=aux;
}
}
}
}
}

View File

@ -63,13 +63,14 @@ import org.zkoss.zul.impl.LabelImageElement;
*/
public class TreeSearchPanel extends Panel implements EventListener<Event>, TreeDataListener, IdSpace
{
private static final String ON_COMBO_SELECT_ECHO_EVENT = "onComboSelectEcho";
private static final String ON_POST_SELECT_TREEITEM_EVENT = "onPostSelectTreeitem";
protected static final String ON_POST_FIRE_TREE_EVENT = "onPostFireTreeEvent";
/**
*
*/
private static final long serialVersionUID = 3478451169922775667L;
private static final long serialVersionUID = -1659100374345282774L;
private static final String ON_COMBO_SELECT_ECHO_EVENT = "onComboSelectEcho";
private static final String ON_POST_SELECT_TREEITEM_EVENT = "onPostSelectTreeitem";
protected static final String ON_POST_FIRE_TREE_EVENT = "onPostFireTreeEvent";
protected TreeMap<String, Object> treeNodeItemMap = new TreeMap<String, Object>();
protected String[] treeValues;
protected String[] treeTypes;
@ -178,7 +179,7 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
protected void addTreeItem(Treeitem treeItem)
{
StringBuilder key = new StringBuilder(getLabel(treeItem)).append(".").append(treeItem.getAttribute("menu.type"));
treeNodeItemMap.put(key.toString(), treeItem);
treeNodeItemMap.put(key.toString(), treeItem);
}
protected void addTreeItem(DefaultTreeNode<?> node) {
@ -356,7 +357,7 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
if (comp.getUuid().equals(uuid))
{
Comboitem item = (Comboitem) comp;
String value = item.getLabel();
String value = item.getLabel();
String type = item.getContent();
selectTreeitem(value+"."+type);
}