Search in sources :

Example 6 with LookupValue

use of pl.x3E.adInterface.LookupValue in project adempiere by adempiere.

the class ADLookup method fillLookupValues.

public static void fillLookupValues(LookupValues lvs, Lookup lookup, boolean isMandatory, boolean isReadOnly) {
    if (lookup.getSize() == 0)
        lookup.refresh();
    Object[] list = lookup.getData(isMandatory, true, !isReadOnly, false).toArray();
    for (int i = 0; i < list.length; i++) {
        boolean isNumber = list[0] instanceof KeyNamePair;
        LookupValue lv = lvs.addNewLv();
        if (isNumber) {
            KeyNamePair p = (KeyNamePair) list[i];
            lv.setKey(Integer.toString(p.getKey()));
            lv.setVal(p.getName());
        } else {
            ValueNamePair p = (ValueNamePair) list[i];
            lv.setKey(p.getValue());
            lv.setVal(p.getName());
        }
    }
}
Also used : KeyNamePair(org.compiere.util.KeyNamePair) ValueNamePair(org.compiere.util.ValueNamePair) LookupValue(pl.x3E.adInterface.LookupValue)

Aggregations

LookupValue (pl.x3E.adInterface.LookupValue)6 LookupValues (pl.x3E.adInterface.LookupValues)4 KeyNamePair (org.compiere.util.KeyNamePair)3 ValueNamePair (org.compiere.util.ValueNamePair)2 ArrayList (java.util.ArrayList)1 GridField (org.compiere.model.GridField)1 Lookup (org.compiere.model.Lookup)1 MCountry (org.compiere.model.MCountry)1 MLookup (org.compiere.model.MLookup)1 MRegion (org.compiere.model.MRegion)1 Language (org.compiere.util.Language)1 Login (org.compiere.util.Login)1 ADLoginRequest (pl.x3E.adInterface.ADLoginRequest)1 ADLoginResponse (pl.x3E.adInterface.ADLoginResponse)1 ADLoginResponseDocument (pl.x3E.adInterface.ADLoginResponseDocument)1 LookupInfo (pl.x3E.adInterface.LookupInfo)1