Search in sources :

Example 1 with LookupInfo

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());
                    }
                }
            }
        }
    }
}
Also used : LookupInfo(pl.x3E.adInterface.LookupInfo) ArrayList(java.util.ArrayList) GridField(org.compiere.model.GridField) Lookup(org.compiere.model.Lookup) MLookup(org.compiere.model.MLookup) LookupValues(pl.x3E.adInterface.LookupValues) KeyNamePair(org.compiere.util.KeyNamePair) ValueNamePair(org.compiere.util.ValueNamePair) LookupValue(pl.x3E.adInterface.LookupValue)

Aggregations

ArrayList (java.util.ArrayList)1 GridField (org.compiere.model.GridField)1 Lookup (org.compiere.model.Lookup)1 MLookup (org.compiere.model.MLookup)1 KeyNamePair (org.compiere.util.KeyNamePair)1 ValueNamePair (org.compiere.util.ValueNamePair)1 LookupInfo (pl.x3E.adInterface.LookupInfo)1 LookupValue (pl.x3E.adInterface.LookupValue)1 LookupValues (pl.x3E.adInterface.LookupValues)1