diff --git a/src/main/java/us/mytheria/bloblib/entities/BlobEditor.java b/src/main/java/us/mytheria/bloblib/entities/BlobEditor.java index a90f2e65..2fa8c187 100644 --- a/src/main/java/us/mytheria/bloblib/entities/BlobEditor.java +++ b/src/main/java/us/mytheria/bloblib/entities/BlobEditor.java @@ -64,7 +64,19 @@ public void loadPage(int page, boolean refill) { } public void loadCustomPage(int page, boolean refill, Function function) { - super.loadCustomPage(page, refill, list, function); + if (page < 1) { + return; + } + if (getTotalPages() < page) { + return; + } + if (refill) + refillButton("White-Background"); + clearValues(); + List> values = this.customPage(page, getItemsPerPage(), function); + for (int i = 0; i < values.size(); i++) { + setValue(i, values.get(i)); + } } @Override @@ -88,6 +100,22 @@ public List> page(int page, int itemsPerPage) { return values; } + public List> customPage(int page, int itemsPerPage, Function function) { + int start = (page - 1) * itemsPerPage; + int end = start + (itemsPerPage); + ArrayList> values = new ArrayList<>(); + for (int i = start; i < end; i++) { + T get; + try { + get = getList().get(i); + values.add(new VariableValue<>(function.apply(get), get)); + } catch (IndexOutOfBoundsException e) { + break; + } + } + return values; + } + public void remove(T t) { list.remove(t); }