import {JRBaseFactory} from "./JRBaseFactory"; import {ReportItem} from "../../items/ReportItem"; import {StretchTypeEnum, ModeEnum} from "../../configs/enums"; import {SchemaConstants} from "../SchemaConstants"; export class JRElementFactory extends JRBaseFactory { createObject(atts:{}):any { const element:ReportItem = this.getDigester().peek(); const uuid = atts[SchemaConstants.ATTRIBUTE_uuid]; if (uuid) { element.objectId = uuid; } const stretchType = atts[SchemaConstants.ATTRIBUTE_stretchType]; if (stretchType) { element.setStretchType((StretchTypeEnum[stretchType])); } const isPrintRepeatedValues = atts[SchemaConstants.ATTRIBUTE_isPrintRepeatedValues]; if (isPrintRepeatedValues) { element.setPrintRepeatedValues(isPrintRepeatedValues === 'true'); } const mode = atts[SchemaConstants.ATTRIBUTE_mode]; if (mode) { element.setMode((ModeEnum[mode])); } const x = atts[SchemaConstants.ATTRIBUTE_x]; if (x) { element.setX(parseInt(x)); } const y = atts[SchemaConstants.ATTRIBUTE_y]; if (y) { element.setY(parseInt(y)); } const width = atts[SchemaConstants.ATTRIBUTE_width]; if (width) { element.setWidth(parseInt(width)); } const height = atts[SchemaConstants.ATTRIBUTE_height]; if (height) { element.setHeight(parseInt(height)); } const forecolor = atts[SchemaConstants.ATTRIBUTE_forecolor]; if (forecolor) { element.setForecolor(forecolor); } const backcolor = atts[SchemaConstants.ATTRIBUTE_backcolor]; if (backcolor) { element.setBackcolor(backcolor); } } }