import {Unit, UnitType} from "../../drawing/Unit"; import {ReportItem} from "../ReportItem"; import {ReportItemBase} from "../ReportItemBase"; import {properties, layout} from "../decorates"; import {BandLayout} from "../layout/BandLayout"; import {BandProperty} from "../properties/define"; import {SplitTypeEnum} from "../../jasper/type/Enums"; import {ReportItemContainer} from "../ReportItemContainer"; import {JRPropertiesHolder} from "../../jasper/JRPropertiesHolder"; import {JRBand} from "../../jasper/JRBand"; import {JRPropertiesMap} from "../../jasper/JRPropertiesMap"; @layout(new BandLayout()) @properties(BandProperty) export abstract class ReportBandBase extends ReportItemContainer implements JRBand { constructor() { super(); this.height = Unit.cm(5); } isParentDesigner ():boolean { return true; } // get width():Unit { // return this.report.bandWidth; // } // // set width(value:Unit) { // this.report.bandWidth = value; // } get leftPadding(): Unit{ return this.report.leftMargin; } get topPadding(): Unit{ return this.report.topMargin; } get height():Unit { return this.getPropertyValue(BandProperty.height); } set height(value:Unit) { this.setPropertyValue(BandProperty.height, value); } get width():Unit { return this.report.bandWidth; } set width(value:Unit) { console.log('set band width'); this.report.bandWidth = value; } canContain(item:ReportItemBase):boolean { return (item instanceof ReportItem); } canAcceptItem(item:ReportItemBase): any { return { result: true, msg: '' }; } /** * 这个方法目的是提供给 JRXmlLoader 调用 * @param element */ addElement(element:ReportItem) { this.items.push(element); } // ---------- JRPropertiesHolder implements block begin hasProperties():boolean { return null; } getPropertiesMap():JRPropertiesMap { return null; } getParentProperties():JRPropertiesHolder { return null; } //------------------ JRBand implements block begin getHeight():number { return this.height.pixels; } getSplitTypeValue():SplitTypeEnum { return this.getPropertyValue(BandProperty.splitType); } setSplitTypeValue(splitType:SplitTypeEnum):void { this.setPropertyValue(BandProperty.splitType, splitType); } //------------------ JRBand implements block end getUUID(): string { return this.objectId; } }