private void windowOpened0(final IInfoQueryCriteria parameter) { final I_AD_InfoColumn infoColumn = parameter.getAD_InfoColumn(); if (infoColumn == null) { return; // shall not happen... } final String defaultValue = infoColumn.getDefaultValue(); // search for first not null component for (int i = 0; i < parameter.getParameterCount(); i++) { final Component editor = getEditorComponentOrNull(parameter, i); if (editor == null) { continue; } // add general listeners on parameter components editor.addKeyListener( new KeyAdapter() { @Override public void keyReleased(final KeyEvent e) { if (KeyEvent.VK_ENTER == e.getKeyCode()) { // each field shall execute query on enter executeQuery(); } } }); // we are focusing on field which as "SearchText" as default value if (defaultValue == null || defaultValue.indexOf(ATTR_SearchText) < 0) { return; } editor.requestFocus(); final String text = parameter.getText(); if (!Check.isEmpty(text, true)) { executeQueryOnInit(); } } }
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); } } } }