use of org.eclipse.scout.rt.shared.services.lookup.ILookupRowFetchedCallback in project scout.rt by eclipse.
the class AbstractContentAssistField method newByKeyLookupRowProvider.
// ==== Lookup row fetching strategies ==== //
/**
* Creates a {@link ILookupRowProvider} to fetch a row by key.
*
* @see LookupCall#getDataByKey()
* @see LookupCall#getDataByAllInBackground(ILookupRowFetchedCallback)
*/
protected ILookupRowProvider<LOOKUP_KEY> newByKeyLookupRowProvider(final LOOKUP_KEY key) {
return new ILookupRowProvider<LOOKUP_KEY>() {
@Override
public void beforeProvide(ILookupCall<LOOKUP_KEY> lookupCall) {
prepareKeyLookup(lookupCall, key);
}
@Override
public void afterProvide(ILookupCall<LOOKUP_KEY> lookupCall, List<ILookupRow<LOOKUP_KEY>> result) {
interceptFilterLookupResult(lookupCall, result);
interceptFilterKeyLookupResult(lookupCall, result);
cleanupResultList(result);
}
@Override
public void provideSync(ILookupCall<LOOKUP_KEY> lookupCall, ILookupRowFetchedCallback<LOOKUP_KEY> callback) {
callback.onSuccess(provide(lookupCall));
}
@Override
public IFuture<Void> provideAsync(ILookupCall<LOOKUP_KEY> lookupCall, ILookupRowFetchedCallback<LOOKUP_KEY> callback, ClientRunContext clientRunContext) {
return lookupCall.getDataByKeyInBackground(clientRunContext, callback);
}
@SuppressWarnings("unchecked")
@Override
public List<ILookupRow<LOOKUP_KEY>> provide(ILookupCall<LOOKUP_KEY> lookupCall) {
return (List<ILookupRow<LOOKUP_KEY>>) lookupCall.getDataByKey();
}
@Override
public String toString() {
ToStringBuilder sb = new ToStringBuilder(this).attr("Key Lookup").attr("key", key);
return sb.toString();
}
};
}
use of org.eclipse.scout.rt.shared.services.lookup.ILookupRowFetchedCallback in project scout.rt by eclipse.
the class AbstractContentAssistField method newByAllLookupRowProvider.
/**
* Creates a {@link ILookupRowProvider} to fetch all rows.
*
* @see LookupCall#getDataByAll()
* @see LookupCall#getDataByAllInBackground(ILookupRowFetchedCallback)
*/
protected ILookupRowProvider<LOOKUP_KEY> newByAllLookupRowProvider(final String browseHint, final TriState activeState) {
return new ILookupRowProvider<LOOKUP_KEY>() {
@Override
public void beforeProvide(ILookupCall<LOOKUP_KEY> lookupCall) {
prepareBrowseLookup(lookupCall, browseHint, activeState);
}
@Override
public void afterProvide(ILookupCall<LOOKUP_KEY> lookupCall, List<ILookupRow<LOOKUP_KEY>> result) {
interceptFilterLookupResult(lookupCall, result);
interceptFilterBrowseLookupResult(lookupCall, result);
cleanupResultList(result);
}
@Override
public void provideSync(ILookupCall<LOOKUP_KEY> lookupCall, ILookupRowFetchedCallback<LOOKUP_KEY> callback) {
callback.onSuccess(provide(lookupCall));
}
@Override
public IFuture<Void> provideAsync(ILookupCall<LOOKUP_KEY> lookupCall, ILookupRowFetchedCallback<LOOKUP_KEY> callback, ClientRunContext clientRunContext) {
return lookupCall.getDataByAllInBackground(clientRunContext, callback);
}
@SuppressWarnings("unchecked")
@Override
public List<ILookupRow<LOOKUP_KEY>> provide(ILookupCall<LOOKUP_KEY> lookupCall) {
return (List<ILookupRow<LOOKUP_KEY>>) lookupCall.getDataByAll();
}
@Override
public String toString() {
ToStringBuilder sb = new ToStringBuilder(this).attr("All Lookup").attr("browseHint", browseHint).attr("activeState", activeState);
return sb.toString();
}
};
}
use of org.eclipse.scout.rt.shared.services.lookup.ILookupRowFetchedCallback in project scout.rt by eclipse.
the class AbstractSmartField2 method newByKeyLookupRowProvider.
// ==== Lookup row fetching strategies ==== //
/**
* Creates a {@link ILookupRowProvider} to fetch a row by key.
*
* @see LookupCall#getDataByKey()
* @see LookupCall#getDataByAllInBackground(ILookupRowFetchedCallback)
*/
protected ILookupRowProvider<VALUE> newByKeyLookupRowProvider(final VALUE key) {
return new ILookupRowProvider<VALUE>() {
@Override
public void beforeProvide(ILookupCall<VALUE> lookupCall) {
prepareKeyLookup(lookupCall, key);
}
@Override
public void afterProvide(ILookupCall<VALUE> lookupCall, List<ILookupRow<VALUE>> result) {
interceptFilterLookupResult(lookupCall, result);
interceptFilterKeyLookupResult(lookupCall, result);
cleanupResultList(result);
}
@Override
public void provideSync(ILookupCall<VALUE> lookupCall, ILookupRowFetchedCallback<VALUE> callback) {
callback.onSuccess(provide(lookupCall));
}
@Override
public IFuture<Void> provideAsync(ILookupCall<VALUE> lookupCall, ILookupRowFetchedCallback<VALUE> callback, ClientRunContext clientRunContext) {
return lookupCall.getDataByKeyInBackground(clientRunContext, callback);
}
@SuppressWarnings("unchecked")
@Override
public List<ILookupRow<VALUE>> provide(ILookupCall<VALUE> lookupCall) {
return (List<ILookupRow<VALUE>>) lookupCall.getDataByKey();
}
@Override
public String toString() {
ToStringBuilder sb = new ToStringBuilder(this).attr("Key Lookup").attr("key", key);
return sb.toString();
}
};
}
use of org.eclipse.scout.rt.shared.services.lookup.ILookupRowFetchedCallback in project scout.rt by eclipse.
the class AbstractSmartField2 method newByTextLookupRowProvider.
/**
* Creates a {@link ILookupRowProvider} to fetch rows matching the given text.
*
* @see LookupCall#getDataByText()
* @see LookupCall#getDataByTextInBackground(ILookupRowFetchedCallback)
*/
protected ILookupRowProvider<VALUE> newByTextLookupRowProvider(final String text) {
return new ILookupRowProvider<VALUE>() {
@Override
public void beforeProvide(ILookupCall<VALUE> lookupCall) {
prepareTextLookup(lookupCall, text);
}
@Override
public void afterProvide(ILookupCall<VALUE> call, List<ILookupRow<VALUE>> result) {
interceptFilterLookupResult(call, result);
interceptFilterTextLookupResult(call, result);
cleanupResultList(result);
}
@Override
public void provideSync(ILookupCall<VALUE> lookupCall, ILookupRowFetchedCallback<VALUE> callback) {
callback.onSuccess(provide(lookupCall));
}
@Override
public IFuture<Void> provideAsync(ILookupCall<VALUE> lookupCall, ILookupRowFetchedCallback<VALUE> callback, ClientRunContext clientRunContext) {
return lookupCall.getDataByTextInBackground(clientRunContext, callback);
}
@SuppressWarnings("unchecked")
@Override
public List<ILookupRow<VALUE>> provide(ILookupCall<VALUE> lookupCall) {
return (List<ILookupRow<VALUE>>) lookupCall.getDataByText();
}
@Override
public String toString() {
ToStringBuilder sb = new ToStringBuilder(this).attr("Text Lookup").attr("text", text);
return sb.toString();
}
};
}
use of org.eclipse.scout.rt.shared.services.lookup.ILookupRowFetchedCallback in project scout.rt by eclipse.
the class AbstractSmartField2 method newByAllLookupRowProvider.
/**
* Creates a {@link ILookupRowProvider} to fetch all rows.
*
* @see LookupCall#getDataByAll()
* @see LookupCall#getDataByAllInBackground(ILookupRowFetchedCallback)
*/
protected ILookupRowProvider<VALUE> newByAllLookupRowProvider(final String browseHint, final TriState activeState) {
return new ILookupRowProvider<VALUE>() {
@Override
public void beforeProvide(ILookupCall<VALUE> lookupCall) {
prepareBrowseLookup(lookupCall, browseHint, activeState);
}
@Override
public void afterProvide(ILookupCall<VALUE> lookupCall, List<ILookupRow<VALUE>> result) {
interceptFilterLookupResult(lookupCall, result);
interceptFilterBrowseLookupResult(lookupCall, result);
cleanupResultList(result);
}
@Override
public void provideSync(ILookupCall<VALUE> lookupCall, ILookupRowFetchedCallback<VALUE> callback) {
callback.onSuccess(provide(lookupCall));
}
@Override
public IFuture<Void> provideAsync(ILookupCall<VALUE> lookupCall, ILookupRowFetchedCallback<VALUE> callback, ClientRunContext clientRunContext) {
return lookupCall.getDataByAllInBackground(clientRunContext, callback);
}
@SuppressWarnings("unchecked")
@Override
public List<ILookupRow<VALUE>> provide(ILookupCall<VALUE> lookupCall) {
return (List<ILookupRow<VALUE>>) lookupCall.getDataByAll();
}
@Override
public String toString() {
ToStringBuilder sb = new ToStringBuilder(this).attr("All Lookup").attr("browseHint", browseHint).attr("activeState", activeState);
return sb.toString();
}
};
}
Aggregations