package com.yanzuoguang.util.printer.vo; import com.alibaba.fastjson.annotation.JSONField; import com.yanzuoguang.util.vo.BaseVo; import java.util.ArrayList; import java.util.List; /** * 本实体用于C#,所以需要属性首字母大写,不能将其转换为字段 * * @author 颜佐光 */ public class PrinterPagerData extends BaseVo { /** * 纸张宽度 */ @JSONField(name = "PageWidth") private double pageWidth; /** * 纸张高度 */ @JSONField(name = "PageHeight") private double pageHeight; /** * 左边边距 */ @JSONField(name = "MarginLeft") private double marginLeft; /** * 上边边距 */ @JSONField(name = "MarginTop") private double marginTop; /** * 右边边距 */ @JSONField(name = "MarginRight") private double marginRight; /** * 下边边距 */ @JSONField(name = "MarginBottom") private double marginBottom; /** * 打印角度 */ @JSONField(name = "PrintAngle") private float printAngle; /** * 所有页面需要打印得属性 */ @JSONField(name = "Items") private List<PrinterPagerItemData> items; /** * 构造函数 */ public PrinterPagerData() { this.pageWidth = 180; this.pageHeight = 100; this.marginLeft = 0; this.marginTop = 0; this.marginRight = 0; this.marginBottom = 0; this.printAngle = 0; this.items = new ArrayList<>(); } /** * 清除位置 */ public void clearPosition() { this.items.clear(); } /** * 复制当前配置到新对象 * * @param to 复制到得对象 */ public void copyTo(PrinterPagerData to) { to.pageWidth = this.pageWidth; to.pageHeight = this.pageHeight; to.marginLeft = this.marginLeft; to.marginTop = this.marginTop; to.marginRight = this.marginRight; to.marginBottom = this.marginBottom; to.printAngle = this.printAngle; to.items.clear(); for (PrinterPagerItemData item : this.items) { PrinterPagerItemData item_to = new PrinterPagerItemData(); item.copyTo(item_to); to.items.add(item_to); } } public double getPageWidth() { return pageWidth; } public void setPageWidth(double pageWidth) { this.pageWidth = pageWidth; } public double getPageHeight() { return pageHeight; } public void setPageHeight(double pageHeight) { this.pageHeight = pageHeight; } public double getMarginLeft() { return marginLeft; } public void setMarginLeft(double marginLeft) { this.marginLeft = marginLeft; } public double getMarginTop() { return marginTop; } public void setMarginTop(double marginTop) { this.marginTop = marginTop; } public double getMarginRight() { return marginRight; } public void setMarginRight(double marginRight) { this.marginRight = marginRight; } public double getMarginBottom() { return marginBottom; } public void setMarginBottom(double marginBottom) { this.marginBottom = marginBottom; } public float getPrintAngle() { return printAngle; } public void setPrintAngle(float printAngle) { this.printAngle = printAngle; } public List<PrinterPagerItemData> getItems() { return items; } public void setItems(List<PrinterPagerItemData> items) { this.items = items; } }