private Info_Column createColumnInfo(final I_AD_InfoColumn field) { final Properties ctx = getCtx(); String columnName = field.getAD_Element().getColumnName(); String name = msgBL.translate(ctx, columnName); final int displayType = field.getAD_Reference_ID(); Class<?> colClass = DisplayType.getClass(displayType, true); String colSQL = Check.isEmpty(field.getDisplayField(), true) ? field.getSelectClause() : field.getDisplayField(); String idColSQL = null; if (DisplayType.isLookup(field.getAD_Reference_ID())) { colClass = KeyNamePair.class; idColSQL = field.getSelectClause(); final String displayColumnSQL = MLookupFactory.getLookupEmbed( ctx, colSQL, // BaseColumn null, // BaseTable field.getAD_Reference_ID(), field.getAD_Reference_Value_ID()); if (!Check.isEmpty(displayColumnSQL, true)) { colSQL = "(" + displayColumnSQL + ")"; } } if (DisplayType.List == field.getAD_Reference_ID()) { columnName = field.getName(); } if (columnName.endsWith("_ID") && DisplayType.ID == field.getAD_Reference_ID()) // should be only ID, 02883 { name = " "; colClass = IDColumn.class; } final Info_Column ic = new Info_Column(name, columnName, colClass); ic.setDisplayType(displayType); ic.setIDcolSQL(idColSQL); ic.setColSQL(colSQL); ic.setColumnName(columnName); // // Check/Load Column Controller final IInfoColumnController columnController = getInfoColumnControllerOrNull(field); if (columnController != null) { ic.setColumnController(columnController); columnController.customize(this, ic); } return ic; }
private void initParameters() { final List<I_AD_InfoColumn> paramInfoColumns = adInfoWindowDAO.retrieveQueryColumns(infoWindow); for (final I_AD_InfoColumn col : paramInfoColumns) { if (!Check.isEmpty(col.getParameterDisplayLogic(), true)) { final ILogicExpression expression = expressionFactory.compileOrDefault( col.getParameterDisplayLogic(), ILogicExpression.FALSE, ILogicExpression.class); // don't fail on missing parameter because we want to be compatible with old // org.compiere.util.Evaluator.evaluateLogic(Evaluatee, String) method final boolean ignoreUnparsable = true; if (!expression.evaluate(ctx, ignoreUnparsable)) { // this parameter will never-ever be displayed continue; } } if (col.isParameterNextLine() && !criteriasBySelectClause.isEmpty()) { addComponentToParameters(null, true); } // final String selectSql = col.getSelectClause(); final IInfoQueryCriteria criteria = getInfoQueryCriteria(col, true); // retrieve default if not found // Add criteria to map { String name = selectSql; final int i = 1; while (criteriasBySelectClause.containsKey(name)) { name = selectSql + "#" + i; } criteriasBySelectClause.put(name, criteria); } // // Add criteria to Displayed Parameters displayedParameters.add(criteria); // // Iterate criterias and add editor fields to Parameters panel for (int i = 0; i < criteria.getParameterCount(); i++) { final Component editor = (Component) criteria.getParameterComponent(i); if (editor instanceof VLookup) { final VLookup lookup = (VLookup) editor; lookup.enableLookupAutocomplete(); } // // Label final String labelText = criteria.getLabel(i); if (!Check.isEmpty(labelText)) { addComponentToParameters(labelText, false); } // // Parameter addComponentToParameters(editor, false); // // Parameter To final Component editor2 = (Component) criteria.getParameterToComponent(i); if (col.isRange() && editor2 != null) { addComponentToParameters(" - ", false); addComponentToParameters(editor2, false); } } } }