Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import java.io.IOException;

public class CSVFileBuilder<T> extends FileBuilder<T> {
private FileWriter writer;
protected FileWriter writer;
private int rowNr;
private int colNr;

CSVFileBuilder(Grid<T> grid, ExporterOption option) {
protected CSVFileBuilder(Grid<T> grid, ExporterOption option) {
super(grid, option);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public class ExcelFileBuilder<T> extends FileBuilder<T> {
private int rowNr;
private int colNr;
private Row row;
private Cell cell;
protected Cell cell;
private CellStyle boldStyle;

ExcelFileBuilder(Grid<T> grid, ExporterOption option) {
protected ExcelFileBuilder(Grid<T> grid, ExporterOption option) {
super(grid, option);
}

Expand Down
11 changes: 8 additions & 3 deletions exporter-addon/src/main/java/org/vaadin/haijian/FileBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public abstract class FileBuilder<T> {
private boolean headerRowBuilt = false;
private ExporterOption option;

FileBuilder(Grid<T> grid, ExporterOption option) {
protected FileBuilder(Grid<T> grid, ExporterOption option) {
this.grid = grid;
columns = grid.getColumns().stream().filter(this::isExportable).collect(Collectors.toList());
if (columns.isEmpty()) {
Expand All @@ -44,7 +44,7 @@ private boolean isExportable(Grid.Column column) {
&& (propertySet == null || propertySet.getProperty(column.getId()).isPresent());
}

InputStream build() {
protected InputStream build() {
try {
initTempFile();
resetContent();
Expand Down Expand Up @@ -136,7 +136,11 @@ private void buildRow(T item) {
Optional<PropertyDefinition<T, ?>> propertyDefinition = propertySet.getProperty(column.getId());
if (propertyDefinition.isPresent()) {
onNewCell();
buildCell(propertyDefinition.get().getGetter().apply(item));
if(column.getValueProvider() != null) {
buildCell( column.getValueProvider().apply(item) );
} else {
buildCell(propertyDefinition.get().getGetter().apply(item));
}
} else {
throw new ExporterException("Column id: " + column.getId() + " is a property which cannot be found");
}
Expand Down Expand Up @@ -182,4 +186,5 @@ private Stream<T> getDataStream(Query newQuery) {
}
return stream;
}

}