String id, IModel<LayerInfo> value, Property<LayerInfo> property) { final LayerInfo layer = (LayerInfo) value.getObject(); final String text = property.getPropertyValue(layer).toString();
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; }
String id, IModel<LayerInfo> value, Property<LayerInfo> property) { final LayerInfo layer = (LayerInfo) value.getObject(); String text = property.getPropertyValue(layer).toString(); if (property == layerProvider.defaultStyle) { IModel<Boolean> model =
@Override protected Component getComponentForProperty( final String id, @SuppressWarnings("rawtypes") IModel<LogEvent> itemModel, Property<LogEvent> property) { LogEvent item = (LogEvent) itemModel.getObject(); if (property == LogEventProvider.SEVERITY) { Severity severity = item.getSeverity(); PackageResourceReference iconRef = SEVERITY_ICONS.get(severity); return new Icon(id, iconRef); } if (property == LogEventProvider.REPOSITORY) { return repositoryLink(id, item); } if (property == LogEventProvider.TIMESTAMP) { return new Label(id, DateUtil.serializeDateTime(item.getTimestamp())); } if (property == LogEventProvider.MESSAGE) { return messageLink(id, item); } return new Label(id, String.valueOf(property.getPropertyValue(item))); }
public int compare(T o1, T o2) { Comparable p1 = (Comparable) property.getPropertyValue(o1); Comparable p2 = (Comparable) property.getPropertyValue(o2); // what if any property is null? We assume null < (not null) if (p1 == null) return p2 != null ? -1 : 0; else if (p2 == null) return 1; return p1.compareTo(p2); }
@SuppressWarnings("unchecked") public int compare(T o1, T o2) { Comparable<Object> p1 = (Comparable<Object>) property.getPropertyValue(o1); Comparable<Object> p2 = (Comparable<Object>) property.getPropertyValue(o2); // what if any property is null? We assume null < (not null) if (p1 == null) return p2 != null ? -1 : 0; else if (p2 == null) return 1; return p1.compareTo(p2); } }