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());
}
}
}
Aggregations