import {JRBaseFactory} from "./JRBaseFactory"; import {Group} from "../../items/band/Group"; import {FooterPositionEnum} from "../../configs/enums"; import {SchemaConstants} from "../SchemaConstants"; export class JRGroupFactory extends JRBaseFactory { createObject(atts:{}):any { const group = new Group(); group.name = atts[SchemaConstants.ATTRIBUTE_name]; const isStartNewColumn = atts[SchemaConstants.ATTRIBUTE_isStartNewColumn]; if (isStartNewColumn) { group.setStartNewColumn(isStartNewColumn === 'true' ? true : false); } const isStartNewPage = atts[SchemaConstants.ATTRIBUTE_isStartNewPage]; if (isStartNewColumn) { group.setStartNewPage(isStartNewPage === 'true' ? true : false); } const isResetPageNumber = atts[SchemaConstants.ATTRIBUTE_isResetPageNumber]; if (isResetPageNumber) { group.setResetPageNumber(isResetPageNumber === 'true' ? true : false); } const isReprintHeaderOnEachPage = atts[SchemaConstants.ATTRIBUTE_isReprintHeaderOnEachPage]; if (isReprintHeaderOnEachPage) { group.setReprintHeaderOnEachPage(isReprintHeaderOnEachPage === 'true' ? true : false); } const minHeightToStartNewPage = atts[SchemaConstants.ATTRIBUTE_minHeightToStartNewPage]; if (minHeightToStartNewPage) { group.setMinHeightToStartNewPage(parseInt(minHeightToStartNewPage)); } const footerPosition = atts[SchemaConstants.ATTRIBUTE_footerPosition]; if (footerPosition) { group.setFooterPosition((FooterPositionEnum[footerPosition])); } const keepTogether = atts[SchemaConstants.ATTRIBUTE_keepTogether]; if (keepTogether) { group.setKeepTogether(keepTogether === 'true' ? true : false); } return group; } }