Search in sources :

Example 6 with DisplayString

use of com.servoy.j2db.dataprocessing.CustomValueList.DisplayString in project servoy-client by Servoy.

the class LookupListModel method fillRelatedValueListValues.

/**
 * @param txt
 * @throws RemoteException
 * @throws Exception
 */
private void fillRelatedValueListValues(IRecordInternal parentState, String filter) throws ServoyException {
    if (parentState == null)
        return;
    String txt = filter;
    ValueList valueList = ((LookupValueList) lookup).getValueList();
    Relation[] relations = application.getFlattenedSolution().getRelationSequence(valueList.getRelationName());
    Pair<QuerySelect, BaseQueryTable> pair = RelatedValueList.createRelatedValuelistQuery(application, valueList, relations, parentState);
    if (pair == null) {
        return;
    }
    QuerySelect select = pair.getLeft();
    BaseQueryTable qTable = pair.getRight();
    generateWherePart(txt, valueList, select, qTable);
    try {
        FoundSetManager foundSetManager = ((FoundSetManager) application.getFoundSetManager());
        String transaction_id = foundSetManager.getTransactionID(table.getServerName());
        ArrayList<TableFilter> tableFilterParams = foundSetManager.getTableFilterParams(table.getServerName(), select);
        if (// apply name as filter on column valuelist_name in creationSQLParts
        nameFilter != null) {
            if (tableFilterParams == null) {
                tableFilterParams = new ArrayList<TableFilter>();
            }
            tableFilterParams.add(nameFilter);
        }
        SQLStatement trackingInfo = null;
        if (foundSetManager.getEditRecordList().hasAccess(table, IRepository.TRACKING_VIEWS)) {
            trackingInfo = new SQLStatement(ISQLActionTypes.SELECT_ACTION, table.getServerName(), qTable.getName(), null, null);
            trackingInfo.setTrackingData(select.getColumnNames(), new Object[][] {}, new Object[][] {}, application.getUserUID(), foundSetManager.getTrackingInfo(), application.getClientID());
        }
        IDataSet set = application.getDataServer().performQuery(application.getClientID(), table.getServerName(), transaction_id, select, null, tableFilterParams, true, 0, 100, IDataServer.VALUELIST_QUERY, trackingInfo);
        String[] displayFormat = (lookup instanceof LookupValueList) ? ((LookupValueList) lookup).getDisplayFormat() : null;
        for (int i = 0; i < set.getRowCount(); i++) {
            Object[] row = processRow(set.getRow(i));
            DisplayString display = CustomValueList.handleDisplayData(valueList, displayFormat, concatShowValues, showValues, row, application);
            if (display != null) {
                alDisplay.add(display);
                alReal.add(CustomValueList.handleRowData(valueList, concatReturnValues, returnValues, row, application));
            }
        }
        hadMoreRows = set.hadMoreRows();
    } catch (RemoteException e) {
        throw new RepositoryException(e);
    }
}
Also used : ValueList(com.servoy.j2db.persistence.ValueList) RepositoryException(com.servoy.j2db.persistence.RepositoryException) DisplayString(com.servoy.j2db.dataprocessing.CustomValueList.DisplayString) QuerySelect(com.servoy.j2db.query.QuerySelect) Relation(com.servoy.j2db.persistence.Relation) BaseQueryTable(com.servoy.base.query.BaseQueryTable) DisplayString(com.servoy.j2db.dataprocessing.CustomValueList.DisplayString) RemoteException(java.rmi.RemoteException)

Aggregations

DisplayString (com.servoy.j2db.dataprocessing.CustomValueList.DisplayString)6 QuerySelect (com.servoy.j2db.query.QuerySelect)3 BaseQueryTable (com.servoy.base.query.BaseQueryTable)2 Relation (com.servoy.j2db.persistence.Relation)2 RepositoryException (com.servoy.j2db.persistence.RepositoryException)2 ValueList (com.servoy.j2db.persistence.ValueList)2 RemoteException (java.rmi.RemoteException)2 CompareCondition (com.servoy.j2db.query.CompareCondition)1 IQuerySort (com.servoy.j2db.query.IQuerySort)1 OrCondition (com.servoy.j2db.query.OrCondition)1 Font (java.awt.Font)1 Insets (java.awt.Insets)1 Component (org.apache.wicket.Component)1 Response (org.apache.wicket.Response)1 HeaderContributor (org.apache.wicket.behavior.HeaderContributor)1 AutoCompleteBehavior (org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteBehavior)1 AutoCompleteSettings (org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings)1 IAutoCompleteRenderer (org.apache.wicket.extensions.ajax.markup.html.autocomplete.IAutoCompleteRenderer)1 IHeaderContributor (org.apache.wicket.markup.html.IHeaderContributor)1 IHeaderResponse (org.apache.wicket.markup.html.IHeaderResponse)1