Search in sources :

Example 21 with ILookupRow

use of org.eclipse.scout.rt.shared.services.lookup.ILookupRow in project scout.rt by eclipse.

the class TestingLookupService method getDataByText.

@Override
public List<ILookupRow<Long>> getDataByText(ILookupCall<Long> call) {
    List<ILookupRow<Long>> list = new ArrayList<ILookupRow<Long>>();
    Pattern p = createLowerCaseSearchPattern(call.getText());
    for (ILookupRow<Long> row : getRows()) {
        if (row.getText() != null && p.matcher(row.getText().toLowerCase()).matches()) {
            list.add(row);
        }
    }
    return list;
}
Also used : Pattern(java.util.regex.Pattern) ILookupRow(org.eclipse.scout.rt.shared.services.lookup.ILookupRow) ArrayList(java.util.ArrayList)

Example 22 with ILookupRow

use of org.eclipse.scout.rt.shared.services.lookup.ILookupRow in project scout.rt by eclipse.

the class TestingLookupService method getDataByAll.

@Override
public List<ILookupRow<Long>> getDataByAll(ILookupCall<Long> call) {
    List<ILookupRow<Long>> list = new ArrayList<ILookupRow<Long>>();
    Pattern p = createLowerCaseSearchPattern(call.getAll());
    for (ILookupRow<Long> row : getRows()) {
        if (row.getText() != null && p.matcher(row.getText().toLowerCase()).matches()) {
            list.add(row);
        }
    }
    return list;
}
Also used : Pattern(java.util.regex.Pattern) ILookupRow(org.eclipse.scout.rt.shared.services.lookup.ILookupRow) ArrayList(java.util.ArrayList)

Example 23 with ILookupRow

use of org.eclipse.scout.rt.shared.services.lookup.ILookupRow in project scout.rt by eclipse.

the class BatchLookupService method getBatchDataByKey.

@Override
public List<List<ILookupRow<?>>> getBatchDataByKey(BatchLookupCall batch) {
    List<ILookupCall<?>> calls = batch.getCallBatch();
    List<List<ILookupRow<?>>> result = new ArrayList<List<ILookupRow<?>>>();
    BatchLookupResultCache cache = new BatchLookupResultCache();
    for (ILookupCall<?> call : calls) {
        result.add(new ArrayList<ILookupRow<?>>(cache.getDataByKey(call)));
    }
    return result;
}
Also used : ILookupRow(org.eclipse.scout.rt.shared.services.lookup.ILookupRow) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) BatchLookupResultCache(org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache) ILookupCall(org.eclipse.scout.rt.shared.services.lookup.ILookupCall)

Example 24 with ILookupRow

use of org.eclipse.scout.rt.shared.services.lookup.ILookupRow in project scout.rt by eclipse.

the class BatchLookupService method getBatchDataByRec.

@Override
public List<List<ILookupRow<?>>> getBatchDataByRec(BatchLookupCall batch) {
    List<ILookupCall<?>> calls = batch.getCallBatch();
    List<List<ILookupRow<?>>> result = new ArrayList<List<ILookupRow<?>>>();
    BatchLookupResultCache cache = new BatchLookupResultCache();
    for (ILookupCall<?> call : calls) {
        result.add(new ArrayList<ILookupRow<?>>(cache.getDataByRec(call)));
    }
    return result;
}
Also used : ILookupRow(org.eclipse.scout.rt.shared.services.lookup.ILookupRow) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) BatchLookupResultCache(org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache) ILookupCall(org.eclipse.scout.rt.shared.services.lookup.ILookupCall)

Example 25 with ILookupRow

use of org.eclipse.scout.rt.shared.services.lookup.ILookupRow in project scout.rt by eclipse.

the class DataModelOperatorLookupCall method execCreateLookupRows.

@Override
protected List<ILookupRow<IDataModelAttributeOp>> execCreateLookupRows() {
    List<ILookupRow<IDataModelAttributeOp>> result = new ArrayList<ILookupRow<IDataModelAttributeOp>>();
    List<IDataModelAttributeOp> ops = null;
    if (m_attribute != null) {
        ops = m_attribute.getOperators();
    }
    if (ops != null) {
        for (IDataModelAttributeOp op : ops) {
            String text = op.getShortText();
            if (text != null && text.indexOf("{0}") >= 0) {
                text = text.replace("{0}", "n");
            }
            if (text != null && text.indexOf("{1}") >= 0) {
                text = text.replace("{1}", "m");
            }
            result.add(new LookupRow<IDataModelAttributeOp>(op, text));
        }
    }
    return result;
}
Also used : ILookupRow(org.eclipse.scout.rt.shared.services.lookup.ILookupRow) ArrayList(java.util.ArrayList) IDataModelAttributeOp(org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp)

Aggregations

ILookupRow (org.eclipse.scout.rt.shared.services.lookup.ILookupRow)36 ArrayList (java.util.ArrayList)29 List (java.util.List)24 ILookupCall (org.eclipse.scout.rt.shared.services.lookup.ILookupCall)19 BatchLookupResultCache (org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache)10 ILookupRowFetchedCallback (org.eclipse.scout.rt.shared.services.lookup.ILookupRowFetchedCallback)10 ClientRunContext (org.eclipse.scout.rt.client.context.ClientRunContext)9 ToStringBuilder (org.eclipse.scout.rt.platform.util.ToStringBuilder)8 Test (org.junit.Test)7 BatchLookupCall (org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall)6 ITree (org.eclipse.scout.rt.client.ui.basic.tree.ITree)5 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)4 ILookupRowProvider (org.eclipse.scout.rt.client.ui.form.fields.smartfield.ILookupRowProvider)4 EventListenerList (org.eclipse.scout.rt.platform.util.EventListenerList)4 LookupRow (org.eclipse.scout.rt.shared.services.lookup.LookupRow)4 HashMap (java.util.HashMap)3 ITreeNode (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)3 ITreeVisitor (org.eclipse.scout.rt.client.ui.basic.tree.ITreeVisitor)3 Pattern (java.util.regex.Pattern)2 IBatchLookupService (org.eclipse.scout.rt.shared.services.lookup.IBatchLookupService)2