Search in sources :

Example 21 with Comboitem

use of org.zkoss.zul.Comboitem in project adempiere by adempiere.

the class AutoComplete method refresh.

/** 
	 * Refresh comboitem based on the specified value.
	*/
private void refresh(String val) {
    if (comboItems == null || val == null) {
        super.getChildren().clear();
        return;
    }
    String compare = val.toLowerCase().trim();
    Iterator<?> it = getItems().iterator();
    for (int i = 0; i < comboItems.length; i++) {
        boolean match = false;
        if (compare.length() < 3) {
            match = comboItems[i].toLowerCase().startsWith(compare);
        } else {
            match = comboItems[i].toLowerCase().contains(compare);
        }
        if (match) {
            Comboitem comboitem = null;
            if (it != null && it.hasNext()) {
                comboitem = ((Comboitem) it.next());
            } else {
                it = null;
                comboitem = new Comboitem();
                super.appendChild(comboitem);
            }
            comboitem.setLabel(comboItems[i]);
            comboitem.setDescription(strDescription[i]);
        }
    }
    while (it != null && it.hasNext()) {
        it.next();
        it.remove();
    }
}
Also used : Comboitem(org.zkoss.zul.Comboitem)

Aggregations

Comboitem (org.zkoss.zul.Comboitem)21 UserPreference (org.adempiere.webui.util.UserPreference)5 Iterator (java.util.Iterator)4 HttpClient (org.apache.commons.httpclient.HttpClient)4 GetMethod (org.apache.commons.httpclient.methods.GetMethod)4 KeyNamePair (org.compiere.util.KeyNamePair)4 JSONArray (org.json.simple.JSONArray)4 JSONObject (org.json.simple.JSONObject)4 JSONParser (org.json.simple.parser.JSONParser)4 ComboItem (org.adempiere.webui.component.ComboItem)3 MapLayer (au.org.emii.portal.menu.MapLayer)2 WrongValueException (org.zkoss.zk.ui.WrongValueException)2 FieldDTO (au.org.ala.spatial.dto.FieldDTO)1 LayerSelection (au.org.ala.spatial.util.LayerSelection)1 ValueChangeEvent (org.adempiere.exceptions.ValueChangeEvent)1 Combobox (org.adempiere.webui.component.Combobox)1 Label (org.adempiere.webui.component.Label)1 Textbox (org.adempiere.webui.component.Textbox)1 Language (org.compiere.util.Language)1 Event (org.zkoss.zk.ui.event.Event)1