use of org.eclipse.scout.rt.shared.services.lookup.ILookupRow in project scout.rt by eclipse.
the class TreeProposalChooser method execGetSingleMatch.
/**
* Override this method to change that behaviour of what is a single match. By default a single match is when there is
* a single enabled LEAF node in the tree
*/
@ConfigOperation
@Order(40)
@Override
protected ILookupRow<LOOKUP_KEY> execGetSingleMatch() {
final List<ILookupRow<LOOKUP_KEY>> foundLeafs = new ArrayList<>();
ITreeVisitor v = new ITreeVisitor() {
@Override
public boolean visit(ITreeNode node) {
if (node.isEnabled() && node.isLeaf()) {
@SuppressWarnings("unchecked") ILookupRow<LOOKUP_KEY> row = (ILookupRow<LOOKUP_KEY>) node.getCell().getValue();
if (row != null && row.isEnabled()) {
foundLeafs.add(row);
}
}
return foundLeafs.size() <= 2;
}
};
m_model.visitVisibleTree(v);
if (foundLeafs.size() == 1) {
return foundLeafs.get(0);
} else {
return null;
}
}
Aggregations