/** * Remove the named Fields from the ordering. Returns the ordering for convenience. * * @param fieldsToRemove a collection of fields * @return */ protected CustomColumnOrdering removeFields(Collection<Field> fieldsToRemove) { List<ReportColumn> cols = ReportColumn.fromFields(fieldsToRemove); this.ordering.removeAll(cols); this.orderedLabels.removeAll(ReportColumn.getLabels(cols)); this.fieldOrdering.removeAll(fieldsToRemove); this.fields.removeAll(fieldsToRemove); return this; }
/** * Convenience method to create a custom field ordering from a list of Fields. * * @param fieldOrdering an ordered list of Fields */ public static CustomColumnOrdering create(final List<Field> fieldOrdering) { final List<ReportColumn> ordering = ReportColumn.fromFields(fieldOrdering); return new CustomColumnOrdering(ordering, fieldOrdering); }