/** Returns only the properties that have been marked as visible */ List<Property<T>> getVisibleProperties() { List<Property<T>> results = new ArrayList<Property<T>>(); for (Property<T> p : getProperties()) { if (p.isVisible()) results.add(p); } return results; }
/** * Returns only the properties that have been marked as visible * * @return */ List<Property<T>> getVisibleProperties() { List<Property<T>> results = new ArrayList<Property<T>>(); for (Property<T> p : getProperties()) { if (p.isVisible()) results.add(p); } return results; }
protected Property<T> getProperty(SortParam<?> sort) { if (sort == null || sort.getProperty() == null) return null; for (Property<T> property : getProperties()) { if (sort.getProperty().equals(property.getName())) { return property; } } return null; } /**
private List<T> filterByKeywords(List<T> items) { List<T> result = new ArrayList<T>(); final Matcher[] matchers = getMatchers(); List<Property<T>> properties = getProperties(); for (T item : items) { ITEM: // find any match of any pattern over any property for (Property<T> property : properties) { if (property.isSearchable()) { Object value = property.getPropertyValue(item); if (value != null) { // brute force check for keywords for (Matcher matcher : matchers) { matcher.reset(String.valueOf(value)); if (matcher.matches()) { result.add(item); break ITEM; } } } } } } return result; }
private List<T> filterByKeywords(List<T> items) { List<T> result = new ArrayList<T>(); final Matcher[] matchers = getMatchers(); List<Property<T>> properties = getProperties(); for (T item : items) { ITEM: // find any match of any pattern over any property for (Property<T> property : properties) { if(property.isSearchable()) { Object value = property.getPropertyValue(item); if (value != null) { // brute force check for keywords for (Matcher matcher : matchers) { matcher.reset(String.valueOf(value)); if (matcher.matches()) { result.add(item); break ITEM; } } } } } } return result; }
/** * Returns a comparator given the sort property. * * @param sort * @return */ protected Comparator<T> getComparator(SortParam sort) { if (sort == null || sort.getProperty() == null) return null; for (Property<T> property : getProperties()) { if (sort.getProperty().equals(property.getName())) { Comparator<T> comparator = property.getComparator(); if (comparator != null) { if (!sort.isAscending()) return new ReverseComparator<T>(comparator); else return comparator; } } } LOGGER.log(Level.WARNING, "Could not find any comparator " + "for sort property " + sort.getProperty()); return null; }