public void playAudio(String key) { ResourceModel r = resources.get(key); if (r != null && r.getDataType().equals(ResourceModel.AUDIOSTREAM)) { AudioStream as = r.getAudioStream(); AudioPlayer.player.start(as); r.setAudioStream(loadAudio(r.getFilePath())); } }
/** * 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; }
public Image getImage(String resourceName) { ResourceModel rm = resources.get(resourceName); if (rm == null) return null; return rm.getImage(); }
public BPageModel getPage(String pageName) { return pageModels.get(pageName); }
public BShapeModel getShape(String shapeName) { return shapeModels.get(shapeName); }
public AudioStream getAudioStream(String resourceName) { ResourceModel rm = resources.get(resourceName); if (rm == null) return null; return rm.getAudioStream(); }