To limit a selection to a subset of objects, filter the list of selection candidates in the selection controller model:
public class FilteredSelectControllerModel extends TLspSelectControllerModel {
private final ILcdFilter<TLspDomainObjectContext> fFilter;
public FilteredSelectControllerModel(ILcdFilter<TLspDomainObjectContext> aFilter) {
super();
fFilter = aFilter;
}
@Override
public List<TLspDomainObjectContext> selectionCandidates(ALspSelectInput aInput,
Set<TLspPaintRepresentation> aRepresentations,
boolean aMultiple,
ILspView aView) {
List<TLspDomainObjectContext> originalCandidates = super.selectionCandidates(aInput, aRepresentations, aMultiple, aView);
//Use the filter passed in the constructor to filter the selection candidates
return originalCandidates.stream()
.filter(fFilter)
.collect(Collectors.toList());
}
}
You must install the controller model on the
TLspSelectController
by passing it in the constructor, or by calling the setControllerModel
method.