From b294c2db0fe9cc63258b3f5c6cd2c302f3b1c61e Mon Sep 17 00:00:00 2001 From: Sven Meier Date: Mon, 14 Dec 2020 21:29:20 +0100 Subject: [PATCH] fix NewPage for #702 upgrade jquery-selectors, disable csp, fixed unfinite loop in PeopleDataProvider --- .../wicketstuff/datatables/demo/DemoApplication.java | 2 ++ .../datatables/demo/PeopleDataProvider.java | 10 ++++++---- datatables-parent/datatables/pom.xml | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/datatables-parent/datatables-examples/src/main/java/org/wicketstuff/datatables/demo/DemoApplication.java b/datatables-parent/datatables-examples/src/main/java/org/wicketstuff/datatables/demo/DemoApplication.java index 38a74e7230..bda1ec40b0 100755 --- a/datatables-parent/datatables-examples/src/main/java/org/wicketstuff/datatables/demo/DemoApplication.java +++ b/datatables-parent/datatables-examples/src/main/java/org/wicketstuff/datatables/demo/DemoApplication.java @@ -47,6 +47,8 @@ protected void init() { getMarkupSettings().setStripWicketTags(true); configureResourceGuard(); + + getCspSettings().blocking().disabled(); } private void configureResourceGuard() { diff --git a/datatables-parent/datatables-examples/src/main/java/org/wicketstuff/datatables/demo/PeopleDataProvider.java b/datatables-parent/datatables-examples/src/main/java/org/wicketstuff/datatables/demo/PeopleDataProvider.java index b883c14b78..f049ff55d8 100644 --- a/datatables-parent/datatables-examples/src/main/java/org/wicketstuff/datatables/demo/PeopleDataProvider.java +++ b/datatables-parent/datatables-examples/src/main/java/org/wicketstuff/datatables/demo/PeopleDataProvider.java @@ -28,15 +28,17 @@ public Iterator iterator(long first, long count) { List people = new ArrayList<>(); Random random = new Random(123); - for (int i = 0; i < count;) { + for (int i = 0; i < FIRST_NAMES.length * LAST_NAMES.length; i++) { int randomFirst = random.nextInt(FIRST_NAMES.length); int randomLast = random.nextInt(LAST_NAMES.length); int randomAge = random.nextInt(99); final String firstName = FIRST_NAMES[randomFirst]; final String lastName = LAST_NAMES[randomLast]; - if (searchFilter != null && (firstName.toLowerCase().contains(searchFilter) || lastName.toLowerCase().contains(searchFilter) )) { + if (searchFilter == null || (firstName.toLowerCase().contains(searchFilter) || lastName.toLowerCase().contains(searchFilter) )) { people.add(new Person(firstName, lastName, randomAge, first + i)); - i++; + } + if (people.size() >= count) { + break; } } return people.iterator(); @@ -44,7 +46,7 @@ public Iterator iterator(long first, long count) { @Override public long size() { - return FIRST_NAMES.length; + return FIRST_NAMES.length * LAST_NAMES.length; } @Override diff --git a/datatables-parent/datatables/pom.xml b/datatables-parent/datatables/pom.xml index 81648b921b..da22fe2d8e 100755 --- a/datatables-parent/datatables/pom.xml +++ b/datatables-parent/datatables/pom.xml @@ -42,7 +42,7 @@ de.agilecoders.wicket jquery-selectors - 3.0.0-M4 + 3.0.2