/** * Create a new spread that reflects the * * @param masterSpreadName * @return * @throws Exception */ public Spread addSpread(String masterSpreadName) throws Exception { Spread spread = newSpread(masterSpreadName); // Get the corresponding master spread, clone its data source, // and use that to load the spread. spread.setTransformationMatrix(this.spreads.size()); return spread; }
/** * @param masterSpreadName * @return * @throws Exception */ public Spread newSpread(String masterSpreadName) throws Exception { Spread newSpread = new Spread(); assignIdAndRegister(newSpread); newSpread.setParent(this); newSpread.setSpreadIndex(this.spreads.size()); this.spreads.add(newSpread); MasterSpread masterSpread = this.getMasterSpread(masterSpreadName); if (masterSpread == null) { logger.info("Master spread \"" + masterSpreadName + "\" not found. Master spreads: "); for (String key : this.masterSpreads.keySet()) { logger.info(" \"" + key + "\""); } throw new Exception("Failed to find master spread \"" + masterSpreadName + "\""); } newSpread.setTransformationMatrix(this.spreads.size()); // Note that masters apply to pages, not spreads. for (Page page : newSpread.getPages()) { page.setAppliedMaster(masterSpread); } this.addChild(newSpread); return newSpread; }