From a13f6e28ec560a32451557f1c5e40b7dbb692fee Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 29 Jan 2024 01:02:43 +0900 Subject: [PATCH] WIP --- .../common/LacertaApplyTagDialog.java | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/component/common/src/main/java/one/nem/lacerta/component/common/LacertaApplyTagDialog.java b/component/common/src/main/java/one/nem/lacerta/component/common/LacertaApplyTagDialog.java index 40ad1a24..7047837b 100644 --- a/component/common/src/main/java/one/nem/lacerta/component/common/LacertaApplyTagDialog.java +++ b/component/common/src/main/java/one/nem/lacerta/component/common/LacertaApplyTagDialog.java @@ -141,39 +141,44 @@ public class LacertaApplyTagDialog extends DialogFragment { private CompletableFuture> getDocumentTagArrayList(String documentId) { return CompletableFuture.supplyAsync(() -> { ArrayList documentTagArrayList = new ArrayList<>(); - setRegisteredTagList().thenAccept(Void -> { - setAppliedTagList(documentId).join(); - for (int i = 0; i < this.registeredTags.size(); i++) { - boolean isChecked = false; - for (int j = 0; j < this.appliedTags.size(); j++) { - if (this.registeredTags.get(i).getId().equals(this.appliedTags.get(j).getId())) { - isChecked = true; - break; - } + + setRegisteredTagList().join(); + setAppliedTagList(documentId).join(); + + logger.debug("getDocumentTagArrayList", "this.registeredTags.size(): " + this.registeredTags.size()); + logger.debug("getDocumentTagArrayList", "this.appliedTags.size(): " + this.appliedTags.size()); + + for (int i = 0; i < this.registeredTags.size(); i++) { + boolean isChecked = false; + for (int j = 0; j < this.appliedTags.size(); j++) { + if (this.registeredTags.get(i).getId().equals(this.appliedTags.get(j).getId())) { + isChecked = true; + break; } - documentTagArrayList.add(new DocumentTagApplyTagDialogExtendedModel( - new DocumentTag(this.registeredTags.get(i).getId(), this.registeredTags.get(i).getName(), this.registeredTags.get(i).getColor()), isChecked)); } - }); + documentTagArrayList.add(new DocumentTagApplyTagDialogExtendedModel( + new DocumentTag(this.registeredTags.get(i).getId(), this.registeredTags.get(i).getName(), this.registeredTags.get(i).getColor()), isChecked)); + } + return documentTagArrayList; }); } - private CompletableFuture setAppliedTagList(String documentId) { + private CompletableFuture> setAppliedTagList(String documentId) { return CompletableFuture.supplyAsync(() -> { lacertaLibrary.getAppliedTagList(documentId).thenAccept(documentTags -> { this.appliedTags = documentTags; }); - return null; + return this.appliedTags; }); } - private CompletableFuture setRegisteredTagList() { + private CompletableFuture> setRegisteredTagList() { return CompletableFuture.supplyAsync(() -> { lacertaLibrary.getTagList().thenAccept(documentTags -> { this.registeredTags = documentTags; }); - return null; + return this.registeredTags; }); }