org.jxls.command.AbstractCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jxls-jdk1.6 Show documentation
Show all versions of jxls-jdk1.6 Show documentation
Small library for Excel generation based on XLS templates
The newest version!
package org.jxls.command;
import org.jxls.area.Area;
import org.jxls.expression.ExpressionEvaluator;
import org.jxls.expression.JexlExpressionEvaluator;
import org.jxls.transform.TransformationConfig;
import org.jxls.transform.Transformer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
/**
* Implements basic command methods and is a convenient base class for other commands
* @author Leonid Vysochyn
* Date: 21.03.2009
*/
public abstract class AbstractCommand implements Command {
Logger logger = LoggerFactory.getLogger(AbstractCommand.class);
List areaList = new ArrayList();
String shiftMode;
public Command addArea(Area area) {
areaList.add(area);
return this;
}
public void reset() {
for (Area area : areaList) {
area.reset();
}
}
@Override
public void setShiftMode(String mode) {
if( mode != null ){
if( mode.equalsIgnoreCase(Command.INNER_SHIFT_MODE) || mode.equalsIgnoreCase(Command.ADJACENT_SHIFT_MODE)){
shiftMode = mode;
}else{
logger.error("Cannot set cell shift mode to " + mode + " for command: " + getName());
}
}
}
@Override
public String getShiftMode() {
return shiftMode;
}
public List getAreaList() {
return areaList;
}
protected Transformer getTransformer(){
if( areaList.isEmpty() ) return null;
return areaList.get(0).getTransformer();
}
protected TransformationConfig getTransformationConfig(){
return getTransformer().getTransformationConfig();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy