Skip to content

Commit

Permalink
issue 242: creater->creator
Browse files Browse the repository at this point in the history
  • Loading branch information
SoltauFintel committed Mar 5, 2024
1 parent a5ba95a commit ed4541d
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public JxlsPoiTemplateFillerBuilder() {
withTransformerFactory(new PoiTransformerFactory());
withCommand(ImageCommand.COMMAND_NAME, ImageCommand.class);
withCommand(MergeCellsCommand.COMMAND_NAME, MergeCellsCommand.class);
withSheetCreater(new PoiSheetCreater());
withSheetCreator(new PoiSheetCreator());
}

public static JxlsPoiTemplateFillerBuilder newInstance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jxls.builder.SheetCreater;
import org.jxls.builder.SheetCreator;

public class PoiSheetCreater implements SheetCreater {
public class PoiSheetCreator implements SheetCreator {
private boolean cloneSheet = true;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFTable;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jxls.builder.SheetCreater;
import org.jxls.builder.SheetCreator;
import org.jxls.common.AreaRef;
import org.jxls.common.CellData;
import org.jxls.common.CellRef;
Expand All @@ -47,7 +47,7 @@ public class PoiTransformer extends AbstractTransformer {
private InputStream inputStream;
private final boolean isSXSSF;
private JxlsLogger logger = new PoiExceptionLogger();
private SheetCreater sheetCreater;
private SheetCreator sheetCreator;

/**
* @param workbook source workbook to transform
Expand Down Expand Up @@ -129,10 +129,10 @@ protected Sheet getSheet(CellRef srcCellRef, CellRef targetCellRef) {
String targetSheetName = targetCellRef.getSheetName();
Sheet sheet = workbook.getSheet(targetSheetName);
if (sheet == null) {
if (sheetCreater == null) {
if (sheetCreator == null) {
throw new JxlsException("Can not create sheet!");
}
sheet = (Sheet) sheetCreater.createSheet(workbook, srcCellRef.getSheetName(), targetSheetName);
sheet = (Sheet) sheetCreator.createSheet(workbook, srcCellRef.getSheetName(), targetSheetName);
}
return sheet;
}
Expand Down Expand Up @@ -481,7 +481,7 @@ public void adjustTableSize(CellRef ref, Size size) {
}

@Override
public void setSheetCreater(SheetCreater sheetCreater) {
this.sheetCreater = sheetCreater;
public void setSheetCreator(SheetCreator sheetCreator) {
this.sheetCreator = sheetCreator;
}
}
10 changes: 5 additions & 5 deletions jxls-site/docs/builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,13 @@ One use case could be performing POI operations, e.g. for grouping.
If you want to change the way how running variables are accessed, call `withRunVarAccess((name, data) -> your code)`.
The PublicContext.getRunVar() method is especially used to save loop variables. However, it is often the case that there is no entry for the key at all. If the map implementation reacts allergically to non-existent keys, you can change the behavior with withRunVarAccess().

## Sheet creater
## Sheet creator

Since version 3.0 we use a new SheetCreater interface for creating sheets in multisheet scenarios.
The implementation PoiSheetCreater uses the method `XSSFWorkbook.cloneSheet()` which makes a deep copy of the origin sheet.
Using `((PoiSheetCreater) getSheetCreater()).setCloneSheet(false)` you can deactivate this new behavior
Since version 3.0 we use a new SheetCreator interface for creating sheets in multisheet scenarios.
The implementation PoiSheetCreator uses the method `XSSFWorkbook.cloneSheet()` which makes a deep copy of the origin sheet.
Using `((PoiSheetCreator) getSheetCreator()).setCloneSheet(false)` you can deactivate this new behavior
and use createSheet() instead. But the page setup is also copied. Since version 3.0 more properties are copied.
Use `withSheetCreater(new ...)` for setting your own SheetCreater implementation.
Use `withSheetCreator(new ...)` for setting your own SheetCreator implementation.


## Template
Expand Down
2 changes: 1 addition & 1 deletion jxls-site/docs/migration-to-v3-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ You can stay with 2.14.0 *for a while*. If there are important bug fixes, we wil
- ASC_ignoreCase, DESC_ignoreCase options new for jx:each/orderBy and jx:each/groupOrder
- Activate streaming for a sheet using `sheetStreaming="true"` in a note (see JxlsStreaming.AUTO_DETECT)
- new builder options e.g. pre write actions
- multisheet: cloneSheet() introduced (could be a breaking change), see builder method withSheetCreater()
- multisheet: cloneSheet() introduced (could be a breaking change), see builder method withSheetCreator()

## What have to be changed in your code?

Expand Down
10 changes: 5 additions & 5 deletions jxls/src/main/java/org/jxls/builder/JxlsOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public class JxlsOptions {
private final List<NeedsPublicContext> needsContextList;
private final List<PreWriteAction> preWriteActions;
private final RunVarAccess runVarAccess;
private final SheetCreater sheetCreater;
private final SheetCreator sheetCreator;

public JxlsOptions(ExpressionEvaluatorFactory expressionEvaluatorFactory, String expressionNotationBegin,
String expressionNotationEnd, JxlsLogger logger, FormulaProcessor formulaProcessor, boolean updateCellDataArea,
boolean ignoreColumnProps, boolean ignoreRowProps, boolean recalculateFormulasBeforeSaving,
boolean recalculateFormulasOnOpening, KeepTemplateSheet keepTemplateSheet, AreaBuilder areaBuilder,
Map<String, Class<? extends Command>> commands, boolean clearTemplateCells,
JxlsTransformerFactory transformerFactory, JxlsStreaming streaming, List<NeedsPublicContext> needsContextList,
List<PreWriteAction> preWriteActions, RunVarAccess runVarAccess, SheetCreater sheetCreater) {
List<PreWriteAction> preWriteActions, RunVarAccess runVarAccess, SheetCreator sheetCreator) {
this.expressionEvaluatorFactory = expressionEvaluatorFactory;
this.expressionNotationBegin = expressionNotationBegin;
this.expressionNotationEnd = expressionNotationEnd;
Expand All @@ -63,7 +63,7 @@ public JxlsOptions(ExpressionEvaluatorFactory expressionEvaluatorFactory, String
this.needsContextList = needsContextList;
this.preWriteActions = preWriteActions;
this.runVarAccess = runVarAccess;
this.sheetCreater = sheetCreater;
this.sheetCreator = sheetCreator;
}

public ExpressionEvaluatorFactory getExpressionEvaluatorFactory() {
Expand Down Expand Up @@ -142,7 +142,7 @@ public RunVarAccess getRunVarAccess() {
return runVarAccess;
}

public SheetCreater getSheetCreater() {
return sheetCreater;
public SheetCreator getSheetCreator() {
return sheetCreator;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected void createTransformer(OutputStream outputStream) {
protected void configureTransformer() {
transformer.setIgnoreColumnProps(options.isIgnoreColumnProps());
transformer.setIgnoreRowProps(options.isIgnoreRowProps());
transformer.setSheetCreater(options.getSheetCreater());
transformer.setSheetCreator(options.getSheetCreator());
}

private void installCommands() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class JxlsTemplateFillerBuilder<SELF extends JxlsTemplateFillerBuilder<SE
protected final List<NeedsPublicContext> needsContextList = new ArrayList<>();
protected final List<PreWriteAction> preWriteActions = new ArrayList<>();
protected RunVarAccess runVarAccess;
private SheetCreater sheetCreater;
private SheetCreator sheetCreator;

/**
* @return new builder instance
Expand Down Expand Up @@ -122,7 +122,7 @@ public JxlsOptions getOptions() {
logger, formulaProcessor, updateCellDataArea, ignoreColumnProps, ignoreRowProps,
recalculateFormulasBeforeSaving, recalculateFormulasOnOpening, keepTemplateSheet,
areaBuilder, commands, clearTemplateCells, transformerFactory, streaming, needsContextList,
preWriteActions, runVarAccess, sheetCreater);
preWriteActions, runVarAccess, sheetCreator);
}

/**
Expand Down Expand Up @@ -364,13 +364,13 @@ public SELF withRunVarAccess(RunVarAccess runVarAccess) {
return (SELF) this;
}

public SELF withSheetCreater(SheetCreater sheetCreater) {
this.sheetCreater = sheetCreater;
public SELF withSheetCreator(SheetCreator sheetCreator) {
this.sheetCreator = sheetCreator;
return (SELF) this;
}

public SheetCreater getSheetCreater() {
return sheetCreater;
public SheetCreator getSheetCreator() {
return sheetCreator;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.jxls.builder;

public interface SheetCreater {
public interface SheetCreator {

/**
* Creates a new sheet as a copy of the given source sheet.
Expand Down
4 changes: 2 additions & 2 deletions jxls/src/main/java/org/jxls/transform/Transformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.List;
import java.util.Set;

import org.jxls.builder.SheetCreater;
import org.jxls.builder.SheetCreator;
import org.jxls.common.AreaRef;
import org.jxls.common.CellData;
import org.jxls.common.CellRef;
Expand Down Expand Up @@ -134,5 +134,5 @@ public interface Transformer {

void setIgnoreRowProps(boolean ignoreRowProps);

void setSheetCreater(SheetCreater sheetCreater);
void setSheetCreator(SheetCreator sheetCreator);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.List;
import java.util.Set;

import org.jxls.builder.SheetCreater;
import org.jxls.builder.SheetCreator;
import org.jxls.common.AreaRef;
import org.jxls.common.CellData;
import org.jxls.common.CellRef;
Expand Down Expand Up @@ -161,7 +161,7 @@ public void setIgnoreRowProps(boolean ignoreRowProps) {
}

@Override
public void setSheetCreater(SheetCreater sheetCreater) {
transformer.setSheetCreater(sheetCreater);
public void setSheetCreator(SheetCreator sheetCreator) {
transformer.setSheetCreator(sheetCreator);
}
}

0 comments on commit ed4541d

Please sign in to comment.