|
|
@ -3,6 +3,8 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package com.fr.design.mainframe.form; |
|
|
|
package com.fr.design.mainframe.form; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.DynamicUnitList; |
|
|
|
|
|
|
|
import com.fr.base.GraphHelper; |
|
|
|
import com.fr.base.TRL; |
|
|
|
import com.fr.base.TRL; |
|
|
|
import com.fr.base.vcs.DesignerMode; |
|
|
|
import com.fr.base.vcs.DesignerMode; |
|
|
|
import com.fr.design.DesignState; |
|
|
|
import com.fr.design.DesignState; |
|
|
@ -33,11 +35,14 @@ import com.fr.form.FormElementCaseProvider; |
|
|
|
import com.fr.form.fit.common.LightTool; |
|
|
|
import com.fr.form.fit.common.LightTool; |
|
|
|
import com.fr.form.main.Form; |
|
|
|
import com.fr.form.main.Form; |
|
|
|
import com.fr.grid.Grid; |
|
|
|
import com.fr.grid.Grid; |
|
|
|
|
|
|
|
import com.fr.grid.GridUtils; |
|
|
|
import com.fr.grid.selection.CellSelection; |
|
|
|
import com.fr.grid.selection.CellSelection; |
|
|
|
import com.fr.grid.selection.FloatSelection; |
|
|
|
import com.fr.grid.selection.FloatSelection; |
|
|
|
import com.fr.grid.selection.Selection; |
|
|
|
import com.fr.grid.selection.Selection; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
|
|
|
import com.fr.report.ReportHelper; |
|
|
|
import com.fr.report.cell.CellElement; |
|
|
|
import com.fr.report.cell.CellElement; |
|
|
|
|
|
|
|
import com.fr.report.elementcase.ElementCase; |
|
|
|
import com.fr.report.elementcase.TemplateElementCase; |
|
|
|
import com.fr.report.elementcase.TemplateElementCase; |
|
|
|
import com.fr.report.worksheet.FormElementCase; |
|
|
|
import com.fr.report.worksheet.FormElementCase; |
|
|
|
import com.fr.report.worksheet.WorkSheet; |
|
|
|
import com.fr.report.worksheet.WorkSheet; |
|
|
@ -132,16 +137,23 @@ public class FormElementCaseDesigner |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取当前ElementCase的缩略图 |
|
|
|
* 获取当前ElementCase的缩略图, 缩略图中包含所有有内容的单元格 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param size 缩略图的大小 |
|
|
|
* @param size 缩略图的大小 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public BufferedImage getElementCaseImage(Dimension size) { |
|
|
|
public BufferedImage getElementCaseImage(Dimension size) { |
|
|
|
|
|
|
|
Grid grid = this.elementCasePane != null ? this.elementCasePane.getGrid() : null; |
|
|
|
|
|
|
|
if (grid == null) { |
|
|
|
|
|
|
|
return new BufferedImage(0, 0, BufferedImage.TYPE_INT_RGB); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resetGrid(grid); |
|
|
|
|
|
|
|
|
|
|
|
BufferedImage image = null; |
|
|
|
BufferedImage image = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
int width = size.width; |
|
|
|
int width = Math.max(grid.getWidth(), size.width); |
|
|
|
int height = size.height; |
|
|
|
int height = Math.max(grid.getHeight(), size.width); |
|
|
|
|
|
|
|
|
|
|
|
// 使用TYPE_INT_RGB和new Color(255, 255, 255, 1)设置有透明背景buffer image,
|
|
|
|
// 使用TYPE_INT_RGB和new Color(255, 255, 255, 1)设置有透明背景buffer image,
|
|
|
|
// 使得创建出来的透明像素是(255, 255, 255, 1),而不是(0, 0, 0, 0)
|
|
|
|
// 使得创建出来的透明像素是(255, 255, 255, 1),而不是(0, 0, 0, 0)
|
|
|
@ -157,11 +169,8 @@ public class FormElementCaseDesigner |
|
|
|
// 使得创建出来的透明像素是(255, 255, 255, 1),而不是(0, 0, 0, 0)
|
|
|
|
// 使得创建出来的透明像素是(255, 255, 255, 1),而不是(0, 0, 0, 0)
|
|
|
|
// 这样不支持透明通道缩略图的旧设计器打开新设计器创建的模版时,就不会创建出拥有黑色背景的缩略图
|
|
|
|
// 这样不支持透明通道缩略图的旧设计器打开新设计器创建的模版时,就不会创建出拥有黑色背景的缩略图
|
|
|
|
g2d.setColor(new Color(255, 255, 255, 1)); |
|
|
|
g2d.setColor(new Color(255, 255, 255, 1)); |
|
|
|
g2d.fillRect(0, 0, (int) size.getWidth(), (int) size.getHeight()); |
|
|
|
g2d.fillRect(0, 0, width, height); |
|
|
|
|
|
|
|
|
|
|
|
Grid grid = this.elementCasePane != null ? this.elementCasePane.getGrid() : null; |
|
|
|
|
|
|
|
if (grid != null) { |
|
|
|
|
|
|
|
resetGrid(grid); |
|
|
|
|
|
|
|
boolean oldTranslucent = grid.isTranslucent(); |
|
|
|
boolean oldTranslucent = grid.isTranslucent(); |
|
|
|
boolean oldShowExtraGridLine = grid.isShowExtraGridLine(); |
|
|
|
boolean oldShowExtraGridLine = grid.isShowExtraGridLine(); |
|
|
|
// 截缩图图时grid需支持半透明,不能用默认白色填充画布,否则会遮挡组件样式背景
|
|
|
|
// 截缩图图时grid需支持半透明,不能用默认白色填充画布,否则会遮挡组件样式背景
|
|
|
@ -170,7 +179,6 @@ public class FormElementCaseDesigner |
|
|
|
grid.paint(g2d); |
|
|
|
grid.paint(g2d); |
|
|
|
grid.setTranslucent(oldTranslucent); |
|
|
|
grid.setTranslucent(oldTranslucent); |
|
|
|
grid.setShowExtraGridLine(oldShowExtraGridLine); |
|
|
|
grid.setShowExtraGridLine(oldShowExtraGridLine); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
@ -180,12 +188,33 @@ public class FormElementCaseDesigner |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void resetGrid(Grid grid) { |
|
|
|
private void resetGrid(Grid grid) { |
|
|
|
grid.setResolution(Constants.DEFAULT_WEBWRITE_AND_SCREEN_RESOLUTION); |
|
|
|
|
|
|
|
grid.updateUI(); |
|
|
|
|
|
|
|
grid.setAdsorbHeight(0); |
|
|
|
grid.setAdsorbHeight(0); |
|
|
|
grid.setAdsorbWidth(0); |
|
|
|
grid.setAdsorbWidth(0); |
|
|
|
|
|
|
|
|
|
|
|
grid.setVerticalValue(0); |
|
|
|
grid.setVerticalValue(0); |
|
|
|
grid.setHorizontalValue(0); |
|
|
|
grid.setHorizontalValue(0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FormElementCasePaneDelegate reportPane = getEditingElementCasePane(); |
|
|
|
|
|
|
|
ColumnRow lastColumnRow = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int lastColumn = lastColumnRow.getColumn(); |
|
|
|
|
|
|
|
int lastRow = lastColumnRow.getRow(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
grid.setVerticalExtent(lastRow); |
|
|
|
|
|
|
|
grid.setHorizontalExtent(lastColumn); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ElementCase report = reportPane.getEditingElementCase(); |
|
|
|
|
|
|
|
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report); |
|
|
|
|
|
|
|
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int resolution = grid.getResolution(); |
|
|
|
|
|
|
|
int width = columnWidthList.getRangeValueFromZero(lastColumn).toPixI(resolution); |
|
|
|
|
|
|
|
int height = rowHeightList.getRangeValueFromZero(lastRow).toPixI(resolution); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int gridLineWidth = GraphHelper.getLineStyleSize(Constants.LINE_THIN); |
|
|
|
|
|
|
|
grid.setSize(width + gridLineWidth, height + gridLineWidth); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
grid.updateUI(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|