コード例 #1
0
 /**
  * clones the datamodel doing a deep copy of the pages and shapes
  *
  * @return clone
  */
 public BDataModel clone() {
   BDataModel clone = new BDataModel();
   for (String page : this.pageModels.keySet()) {
     BPageModel pgclone = pageModels.get(page).clone();
     clone.addPage(pgclone);
     for (BShape shape : pgclone.getShapes()) {
       clone.addShape(shape.getModel());
     }
     pgclone.setData(clone);
   }
   for (String resource : this.resources.keySet()) {
     ResourceModel rmclone = resources.get(resource);
     clone.addResource(rmclone);
   }
   clone.setResourceNames(this.resourceNames);
   clone.setPageCounter(pageCounter);
   clone.setShapeCounter(shapeCounter);
   clone.documentDirectory = this.documentDirectory;
   return clone;
 }
コード例 #2
0
 public void addPage(BPageModel model) {
   if (model.getName() == null) model.setName(pageCounter.getPageName());
   pageModels.put(model.getName(), model);
   model.setData(this);
 }