Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #409 . #410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion ureport2-core/src/main/java/com/bstek/ureport/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static Connection getBuildinConnection(String name){

public static List<Cell> fetchTargetCells(Cell cell,Context context,String cellName){
while(!context.isCellPocessed(cellName)){
context.getReportBuilder().buildCell(context, null);
context.getReportBuilder().buildCellExactly(context, cellName);
}
List<Cell> leftCells=fetchCellsByLeftParent(context,cell, cellName);
List<Cell> topCells=fetchCellsByTopParent(context,cell, cellName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ public List<Cell> nextUnprocessedCells(){
}
return targetCellsList;
}

public List<Cell> getUnprocessedCells(String cellName){
return unprocessedCellsMap.remove(cellName);
}

public Object evalExpr(String expression){
return new ElCompute().doCompute(expression);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,21 @@ public void buildCell(Context context,List<Cell> cells){
}
}
}


public void buildCellExactly(Context context, String cellName) {
List<Cell> cells = context.getUnprocessedCells(cellName);
Cell cell = cells.get(0);
Cell leftParent = cell.getLeftParentCell();
Cell topParent = cell.getTopParentCell();
if (leftParent != null && !leftParent.isProcessed()) {
buildCellExactly(context, leftParent.getName());
}
if (topParent != null && !topParent.isProcessed()) {
buildCellExactly(context, topParent.getName());
}
buildCell(context, cells);
}

private Map<String,Dataset> buildDatasets(ReportDefinition reportDefinition,Map<String,Object> parameters,ApplicationContext applicationContext){
Map<String,Dataset> datasetMap=new HashMap<String,Dataset>();
List<DatasourceDefinition> datasources=reportDefinition.getDatasources();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public CellObjectExpression(String property) {
@Override
protected ExpressionData<?> compute(Cell cell, Cell currentCell,Context context) {
while(!context.isCellPocessed(cell.getName())){
context.getReportBuilder().buildCell(context, null);
context.getReportBuilder().buildCellExactly(context, cell.getName());
}
if(StringUtils.isNotBlank(property)){
Object obj=Utils.getProperty(cell, property);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class CellValueExpression extends BaseExpression{
@Override
protected ExpressionData<?> compute(Cell cell, Cell currentCell,Context context) {
while(!context.isCellPocessed(cell.getName())){
context.getReportBuilder().buildCell(context, null);
context.getReportBuilder().buildCellExactly(context, cell.getName());
}
return new ObjectExpressionData(cell.getData());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public boolean supportPaging(){
@Override
protected ExpressionData<?> compute(Cell cell,Cell currentCell, Context context) {
while(!context.isCellPocessed(cellName)){
context.getReportBuilder().buildCell(context, null);
context.getReportBuilder().buildCellExactly(context, cellName);
}
List<Cell> leftCellList = buildLeftCells(cell, context);
List<Cell> topCellList=buildTopCells(cell, context);
Expand Down Expand Up @@ -121,7 +121,7 @@ private List<Cell> buildLeftCells(Cell cell, Context context) {
for(CellCoordinate coordinate:leftCoordinates){
String name=coordinate.getCellName();
while(!context.isCellPocessed(name)){
context.getReportBuilder().buildCell(context, null);
context.getReportBuilder().buildCellExactly(context, name);
}
if(targetLeftCell==null){
if(coordinate.getCoordinateType().equals(CoordinateType.relative)){
Expand Down Expand Up @@ -207,7 +207,7 @@ private List<Cell> buildTopCells(Cell cell, Context context) {
for(CellCoordinate coordinate:topCoordinates){
String name=coordinate.getCellName();
while(!context.isCellPocessed(name)){
context.getReportBuilder().buildCell(context, null);
context.getReportBuilder().buildCellExactly(context, name);
}
if(cellList==null){
if(coordinate.getCoordinateType().equals(CoordinateType.relative)){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public boolean supportPaging(){
@Override
protected ExpressionData<?> compute(Cell cell, Cell currentCell,Context context) {
while(!context.isCellPocessed(cellName)){
context.getReportBuilder().buildCell(context, null);
context.getReportBuilder().buildCellExactly(context, cellName);
}
List<Cell> cells=context.getReport().getCellsMap().get(cellName);
List<Object> list=new ArrayList<Object>();
Expand Down