addNewPageBeforeIndex実装

This commit is contained in:
r-ca 2024-01-09 17:12:13 +09:00
parent e3a5dee36c
commit 0c59c85b28
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -143,12 +143,20 @@ public class DocumentProcessorImpl implements DocumentProcessor{
xmlMetaPageModel.setIndex(index + 1); xmlMetaPageModel.setIndex(index + 1);
xmlMetaModel.getPages().add(index, xmlMetaPageModel); xmlMetaModel.getPages().add(index, xmlMetaPageModel);
xmlMetaModel.setPages(reIndexPages(xmlMetaModel.getPages())); xmlMetaModel.setPages(reIndexPages(xmlMetaModel.getPages()));
} }
@Override @Override
public void addNewPageBeforeIndex(Bitmap bitmap, int index) { public void addNewPageBeforeIndex(Bitmap bitmap, int index) throws Exception {
logger.debug("addNewPageBeforeIndex", "called");
String filename = UUID.randomUUID().toString() + ".png"; // TODO-rca: 拡張子を動的にする
this.fileManager.getNewInstance().createDirectoryIfNotExist(DEFAULT_SAVE_DIR).resolve(DEFAULT_SAVE_DIR).saveBitmap(bitmap, filename);
XmlMetaPageModel xmlMetaPageModel = new XmlMetaPageModel();
xmlMetaPageModel.setFilename(filename);
xmlMetaPageModel.setIndex(index);
xmlMetaModel.getPages().add(index - 1, xmlMetaPageModel);
xmlMetaModel.setPages(reIndexPages(xmlMetaModel.getPages()));
} }
@Override @Override