IDEMPIERE-943 Menu Lookup not showing dup names / Peer review
This commit is contained in:
parent
bc9148858c
commit
2a9162fec2
|
@ -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 */
|
/** comboItems All menu labels */
|
||||||
private String[] comboItems;
|
private String[] comboItems;
|
||||||
|
@ -45,7 +45,7 @@ public class AutoComplete extends Combobox
|
||||||
private String[] strDescription;
|
private String[] strDescription;
|
||||||
|
|
||||||
private String[] images;
|
private String[] images;
|
||||||
|
|
||||||
private String[] contents;
|
private String[] contents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,7 +85,7 @@ public class AutoComplete extends Combobox
|
||||||
{
|
{
|
||||||
contents = vals;
|
contents = vals;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setImages(String[] images)
|
public void setImages(String[] images)
|
||||||
{
|
{
|
||||||
this.images = images;
|
this.images = images;
|
||||||
|
@ -164,7 +164,7 @@ public class AutoComplete extends Combobox
|
||||||
|
|
||||||
comboitem.setLabel(comboItems[i]);
|
comboitem.setLabel(comboItems[i]);
|
||||||
comboitem.setDescription(strDescription[i]);
|
comboitem.setDescription(strDescription[i]);
|
||||||
|
|
||||||
if (images != null && i < images.length && images[i] != null && images[i].trim().length() > 0)
|
if (images != null && i < images.length && images[i] != null && images[i].trim().length() > 0)
|
||||||
{
|
{
|
||||||
comboitem.setImage(images[i]);
|
comboitem.setImage(images[i]);
|
||||||
|
|
|
@ -41,11 +41,11 @@ import org.zkoss.zul.Treeitem;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MenuTreeSearchPanel extends TreeSearchPanel {
|
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 newBtn;
|
||||||
protected Toolbarbutton openBtn;
|
protected Toolbarbutton openBtn;
|
||||||
protected boolean isNew = false;
|
protected boolean isNew = false;
|
||||||
|
@ -187,13 +187,13 @@ public class MenuTreeSearchPanel extends TreeSearchPanel {
|
||||||
imageList.add(mNode.getImagePath());
|
imageList.add(mNode.getImagePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
treeDescription = descriptionList.toArray(new String[0]);
|
treeDescription = descriptionList.toArray(new String[0]);
|
||||||
treeValues = valueList.toArray(new String[0]);
|
treeValues = valueList.toArray(new String[0]);
|
||||||
treeImages = imageList.toArray(new String[0]);
|
treeImages = imageList.toArray(new String[0]);
|
||||||
treeTypes = typeList.toArray(new String[0]);
|
treeTypes = typeList.toArray(new String[0]);
|
||||||
orderArrays();
|
orderArrays();
|
||||||
|
|
||||||
cmbSearch.setDescription(treeDescription);
|
cmbSearch.setDescription(treeDescription);
|
||||||
cmbSearch.setDict(treeValues);
|
cmbSearch.setDict(treeValues);
|
||||||
cmbSearch.setImages(treeImages);
|
cmbSearch.setImages(treeImages);
|
||||||
|
@ -221,33 +221,33 @@ public class MenuTreeSearchPanel extends TreeSearchPanel {
|
||||||
Events.postEvent(event);
|
Events.postEvent(event);
|
||||||
Events.echoEvent(ON_POST_FIRE_TREE_EVENT, this, null);
|
Events.echoEvent(ON_POST_FIRE_TREE_EVENT, this, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void orderArrays()
|
protected void orderArrays()
|
||||||
{
|
{
|
||||||
String aux;
|
String aux;
|
||||||
for (int i = 1; i < treeValues.length; i++)
|
for (int i = 1; i < treeValues.length; i++)
|
||||||
{
|
{
|
||||||
for(int j = 0;j < treeValues.length-i;j++)
|
for (int j = 0; j < treeValues.length-i; j++)
|
||||||
{
|
{
|
||||||
if(treeValues[j].compareTo(treeValues[j+1]) > 0)
|
if (treeValues[j].compareTo(treeValues[j+1]) > 0)
|
||||||
{
|
{
|
||||||
aux = treeValues[j];
|
aux = treeValues[j];
|
||||||
treeValues[j] = treeValues[j+1];
|
treeValues[j] = treeValues[j+1];
|
||||||
treeValues[j+1]=aux;
|
treeValues[j+1]=aux;
|
||||||
|
|
||||||
aux = treeDescription[j];
|
aux = treeDescription[j];
|
||||||
treeDescription[j] = treeDescription[j+1];
|
treeDescription[j] = treeDescription[j+1];
|
||||||
treeDescription[j+1]=aux;
|
treeDescription[j+1]=aux;
|
||||||
|
|
||||||
aux = treeTypes[j];
|
aux = treeTypes[j];
|
||||||
treeTypes[j] = treeTypes[j+1];
|
treeTypes[j] = treeTypes[j+1];
|
||||||
treeTypes[j+1]=aux;
|
treeTypes[j+1]=aux;
|
||||||
|
|
||||||
aux = treeImages[j];
|
aux = treeImages[j];
|
||||||
treeImages[j] = treeImages[j+1];
|
treeImages[j] = treeImages[j+1];
|
||||||
treeImages[j+1]=aux;
|
treeImages[j+1]=aux;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,13 +63,14 @@ import org.zkoss.zul.impl.LabelImageElement;
|
||||||
*/
|
*/
|
||||||
public class TreeSearchPanel extends Panel implements EventListener<Event>, TreeDataListener, IdSpace
|
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 TreeMap<String, Object> treeNodeItemMap = new TreeMap<String, Object>();
|
||||||
protected String[] treeValues;
|
protected String[] treeValues;
|
||||||
protected String[] treeTypes;
|
protected String[] treeTypes;
|
||||||
|
@ -178,7 +179,7 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
|
||||||
protected void addTreeItem(Treeitem treeItem)
|
protected void addTreeItem(Treeitem treeItem)
|
||||||
{
|
{
|
||||||
StringBuilder key = new StringBuilder(getLabel(treeItem)).append(".").append(treeItem.getAttribute("menu.type"));
|
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) {
|
protected void addTreeItem(DefaultTreeNode<?> node) {
|
||||||
|
@ -356,7 +357,7 @@ public class TreeSearchPanel extends Panel implements EventListener<Event>, Tree
|
||||||
if (comp.getUuid().equals(uuid))
|
if (comp.getUuid().equals(uuid))
|
||||||
{
|
{
|
||||||
Comboitem item = (Comboitem) comp;
|
Comboitem item = (Comboitem) comp;
|
||||||
String value = item.getLabel();
|
String value = item.getLabel();
|
||||||
String type = item.getContent();
|
String type = item.getContent();
|
||||||
selectTreeitem(value+"."+type);
|
selectTreeitem(value+"."+type);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue