use of org.eclipse.nebula.widgets.nattable.search.strategy.GridSearchStrategy.GridRectangle in project nebula.widgets.nattable by eclipse.
the class CellDisplayValueSearchUtil method findCell.
/**
* Finds the first matching cell in a list of grid cell rectangles.
*
* @param layer
* @param configRegistry
* @param cellRectangles
* @param valueToMatch
* @param comparator
* @param caseSensitive
* @param wholeWord
* @param regex
* @param includeCollapsed
* TODO currently ignored
* @return
* @throws PatternSyntaxException
*/
static PositionCoordinate findCell(final ILayer layer, final IConfigRegistry configRegistry, final List<GridRectangle> cellRectangles, final Object valueToMatch, final Comparator<String> comparator, final boolean caseSensitive, final boolean wholeWord, final boolean regex, final boolean columnFirst, final boolean includeCollapsed) throws PatternSyntaxException {
String stringValue = caseSensitive ? valueToMatch.toString() : valueToMatch.toString().toLowerCase();
Pattern pattern = regex ? Pattern.compile(stringValue) : null;
for (GridRectangle cellRectangle : cellRectangles) {
int direction = cellRectangle.firstDim.size() > 0 || cellRectangle.secondDim.size() > 0 ? 1 : -1;
for (int i = cellRectangle.firstDim.start; Math.abs(cellRectangle.firstDim.end - i) > 0; i += direction) {
PositionCoordinate result = findCell(layer, configRegistry, i, cellRectangle.secondDim.start, cellRectangle.secondDim.end, direction, pattern, stringValue, comparator, caseSensitive, wholeWord, regex, columnFirst, includeCollapsed);
if (result != null) {
return result;
}
}
}
return null;
}
Aggregations