use of pl.x3E.adInterface.LookupInfo in project adempiere by adempiere.
the class ADServiceImpl method fillField.
private void fillField(Field f, GridFieldVO fo) {
////(griddieldvo) adempiere specific
f.setADColumnID(fo.AD_Column_ID);
f.setADProcessID(fo.AD_Process_ID);
f.setADReferenceValueID(fo.AD_Reference_Value_ID);
f.setADWindowID(fo.AD_Window_ID);
f.setCallout(fo.Callout);
f.setColumnName(fo.ColumnName);
f.setDefaultValue(fo.DefaultValue);
f.setDefaultValue2(fo.DefaultValue2);
f.setDescription(fo.Description);
f.setDisplayLength(fo.DisplayLength);
f.setDisplayLogic(fo.DisplayLogic);
f.setDisplayType(fo.displayType);
f.setFieldGroup(fo.FieldGroup);
f.setFieldLength(fo.FieldLength);
f.setHeader(fo.Header);
f.setHelp(fo.Help);
f.setIsAlwaysUpdateable(fo.IsAlwaysUpdateable);
f.setIsDisplayed(fo.IsDisplayed);
f.setIsEncryptedColumn(fo.IsEncryptedColumn);
f.setIsEncryptedField(fo.IsEncryptedField);
f.setIsFieldOnly(fo.IsFieldOnly);
f.setIsHeading(fo.IsHeading);
f.setIsKey(fo.IsKey);
f.setIsMandatory(fo.IsMandatory);
f.setIsParent(fo.IsParent);
f.setIsProcess(fo.isProcess);
f.setIsRange(fo.IsRange);
f.setIsReadOnly(fo.IsReadOnly);
f.setIsSameLine(fo.IsSameLine);
f.setIsSelectionColumn(fo.IsSelectionColumn);
f.setIsUpdateable(fo.IsUpdateable);
if (DisplayType.isLookup(fo.displayType)) {
GridField ff = new GridField(fo);
ArrayList<String> deps = ff.getDependentOn();
Lookup lookup = ff.getLookup();
LookupInfo li = f.addNewLookupInfo();
if (fo.lookupInfo != null) {
li.setZoomWindow(fo.lookupInfo.ZoomWindow);
li.setZoomWindow(fo.lookupInfo.ZoomWindow);
}
//if (deps.size()==0)
if (lookup != null && (fo.ValidationCode == null || (fo.ValidationCode != null && fo.ValidationCode.length() == 0))) {
LookupValues lvs = f.addNewLookup();
//System.out.println( "lookup "+fo.ColumnName+" "+lookup.getSize() );
//if(lookup.size() == 0) - nie robic tego
// System.out.println("lookup refresh ["+fo.ColumnName+"]= "+lookup.refresh());
/*if(lookup.getSize() > 0)*/
// the last was false, 2007-05-11
ArrayList ar = lookup.getData(ff.isMandatory(false), true, !ff.isReadOnly(), true);
if (ar != null && ar.size() > 0) {
Object[] list = ar.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());
//System.out.println( "LV " + p.getKey() + " - "+ p.getName() );
} else {
ValueNamePair p = (ValueNamePair) list[i];
lv.setKey(p.getValue());
lv.setVal(p.getName());
//System.out.println( "LV " + p.getValue() + " - "+ p.getName());
}
}
}
}
}
}
Aggregations